Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] 스터디 기본 정보 조회하기 UI 생성 및 api 연결 #42

Merged
merged 70 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
1ae4c49
feat: layout
eugene028 Aug 12, 2024
3c8b5e3
chore: lock 패키지 변경 사항 반영
eugene028 Aug 12, 2024
96dcb69
chore: 중복된 Navbar 컴포넌트 삭제
ghdtjgus76 Aug 12, 2024
10a576b
feat: 개설 스터디 기본 잡기
eugene028 Aug 12, 2024
dcd3e0b
feat: 스터디 개설 페이지 레이아웃
eugene028 Aug 13, 2024
e135d97
chore:패키지 설치
eugene028 Aug 13, 2024
5d35442
fix: 찌그러짐 방지용 minWidth 추가
eugene028 Aug 13, 2024
a77f7e6
feat: 스터디 개설하기 뷰 생성
eugene028 Aug 13, 2024
dcbb5b3
fix: 개설된 스터디로 화면 옮기기
eugene028 Aug 13, 2024
cec09ee
feat: auth 체크용 middleWare 생성
eugene028 Aug 13, 2024
333e298
fix: utils fetcher 함수 export 경로 변경
eugene028 Aug 13, 2024
f122b3d
feat: 스터디 생성하기 페이지 생성
eugene028 Aug 13, 2024
d1b9aa6
fix: router handler 삭제
eugene028 Aug 13, 2024
ab0a88f
fix:로그인 로직 합치기
eugene028 Aug 13, 2024
38dcff3
refactor: api path 상수로 수정
eugene028 Aug 13, 2024
0ccf38f
feat: isAdmin 함수 추가
eugene028 Aug 13, 2024
96dead7
fix: 코드리뷰 반영
eugene028 Aug 13, 2024
beae0f1
fix: admin여부에 따라 스터디 생성 박스 보이지 않도록
eugene028 Aug 13, 2024
329670f
chore: dev 머지
eugene028 Aug 14, 2024
8bbc939
chore: 패키지 설치
eugene028 Aug 14, 2024
30d8e7c
fix: 빌드에러 고치기
eugene028 Aug 14, 2024
9e03318
fix: 고친 로그인 로직 머지
eugene028 Aug 14, 2024
e09a96d
fix: isadmin 판별 로직 미들웨어에서 진행
eugene028 Aug 14, 2024
8efc686
feat: 역할 논리 다시
eugene028 Aug 14, 2024
00020f8
fix: 폴더명 변경
eugene028 Aug 14, 2024
625326e
fix: createStudy 경로 변경
eugene028 Aug 14, 2024
387950c
feat:wow-icons 추가
eugene028 Aug 14, 2024
2c771c5
feat: 기존 브랜치 머지
eugene028 Aug 14, 2024
ca7e7f4
refactor: 컴포넌트 폴더위치 변경
eugene028 Aug 14, 2024
5622e3f
chore:react-hook-form 설치
eugene028 Aug 14, 2024
317d492
feat: 복잡한 UI 설계 react-hook-form
eugene028 Aug 14, 2024
0a4bc8a
feat: 스터디 수강 시작 날짜 지정
eugene028 Aug 14, 2024
5ca5232
chore: dev 머지
eugene028 Aug 16, 2024
dee4824
chore: timepicker 패키지 설치
eugene028 Aug 16, 2024
12c8c0e
feat: 스터디 신청 UI 완성
eugene028 Aug 16, 2024
21fea58
fix: 쓸데없는 콘솔로그 제거
eugene028 Aug 16, 2024
ac11d0a
feat: api 연결
eugene028 Aug 16, 2024
4022961
feat:api 호출 성공시 redirect
eugene028 Aug 16, 2024
2b97234
fix: 캐시 지워서 빌드에러 해결
eugene028 Aug 16, 2024
361cf66
chore: fetcher 테스트
eugene028 Aug 19, 2024
058b69f
chore: dev 브랜치에서 머지
eugene028 Aug 20, 2024
78b414e
chore: 패키지 설치
eugene028 Aug 20, 2024
7b41745
feat: 스터디 리스트 보기 뷰
eugene028 Aug 20, 2024
a7c4c78
fix: api 관련 코드리뷰 반영
eugene028 Aug 20, 2024
1cd3527
fix: 코드리뷰 반영
eugene028 Aug 20, 2024
2cb887e
fix: 메인에서 머지
eugene028 Aug 20, 2024
3c23f8f
fix: navbar 두개인것 고치기
eugene028 Aug 20, 2024
330a19b
feat: Header, 기본 레이아웃 세팅
eugene028 Aug 20, 2024
7b75b58
feat: Header 생성
eugene028 Aug 20, 2024
7ff93ad
feat: 출석 보기
eugene028 Aug 20, 2024
5cf6d7b
fix: 코드리뷰 반영
eugene028 Aug 20, 2024
1e9ac2a
fix: 코드리뷰 반영
eugene028 Aug 20, 2024
6e97e57
fix: 코드리뷰 반영
eugene028 Aug 20, 2024
3bfec83
chore: dev 머지
eugene028 Aug 20, 2024
4be1296
fix: api 추가 및 하드코딩 제거
eugene028 Aug 20, 2024
fa1ac2e
feat: 과제 목록 보기 api 연결
eugene028 Aug 20, 2024
28d73b6
chore: 스터디 리스트 작업 머지
eugene028 Aug 20, 2024
6a963d1
feat: 과제 목록 생성
eugene028 Aug 20, 2024
bfcf60f
feat: 스터디 커리큘럼 생성 기능 및 api 연결
eugene028 Aug 20, 2024
df812ba
chore: 다른 브랜치 작업영역 불러오기
eugene028 Aug 20, 2024
fac8392
feat: 스터디 기본 정보 대시보드
eugene028 Aug 20, 2024
a782db6
fix: 노션 링크 없을 때에 에러페이지 안뜨게끔 수정
eugene028 Aug 21, 2024
caf0c9a
chore: dev 브랜치 conflict 해결
eugene028 Aug 21, 2024
5358390
fix: padwithzero 추가
eugene028 Aug 21, 2024
f57718f
fix: 노션 null 처리 진행
eugene028 Aug 21, 2024
ea1e2f2
chore: dev브랜치에서 머지
eugene028 Aug 23, 2024
6194cdc
fix: 중복 요소 제거
eugene028 Aug 23, 2024
860a788
fix: 코드리뷰 반영 및 모든 mock 데이터 제거
eugene028 Aug 23, 2024
46f2a7e
fix: 필요없는 console 삭제
eugene028 Aug 23, 2024
26c487a
fix: 코드리뷰 반영
eugene028 Aug 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions apps/admin/apis/study/studyInfoApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { fetcher } from "@wow-class/utils";
import { mentorApiPath } from "constants/apiPath";
import { tags } from "constants/tags";
import type { AssignmentApiResponseDto } from "types/dtos/assignmentList";
import type { SessionApiResponseDto } from "types/dtos/sessionList";
import type { StudyBasicInfoApiResponseDto } from "types/dtos/studyBasicInfo";

export const studyInfoApi = {
getStudyBasicInfo: async (studyId: number) => {
const response = await fetcher.get<StudyBasicInfoApiResponseDto>(
`/common/studies/${studyId}`,
{
next: { tags: [tags.studyBasicInfo] },
cache: "force-cache",
}
);
return response.data;
},
getAssignmentList: async (studyId: number) => {
const response = await fetcher.get<AssignmentApiResponseDto[]>(
`${mentorApiPath.assignments}?studyId=${studyId}`,
{
next: { tags: [tags.assignments] },
cache: "force-cache",
}
);
return response.data;
},
cancelAssignment: async (studyDetailId: number) => {
const response = await fetcher.patch(
`/mentor/study-details/${studyDetailId}/assignments/cancel`,
{}
);

return { success: response.ok };
},
getSessionList: async (studyId: number) => {
const response = await fetcher.get<SessionApiResponseDto[]>(
`${mentorApiPath.sessions}?study=${studyId}`,
{
next: { tags: [tags.sessions] },
cache: "force-cache",
}
);
return response.data;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Space, Text } from "@wow-class/ui";
import { studyInfoApi } from "apis/study/studyInfoApi";

import AssignmentListItem from "./AssignmentListItem";

const AssignmentList = async ({ studyId }: { studyId: string }) => {
const assignmentList = await studyInfoApi.getAssignmentList(
parseInt(studyId, 10)
);

return (
<section aria-label="assignment-list">
<Text typo="h2">주차별 과제</Text>
<Space height={24} />
{assignmentList?.map((assignment, index) => {
return (
<AssignmentListItem
assignment={assignment}
key={`studyDetailId-${index}`}
/>
);
})}
</section>
);
};

export default AssignmentList;
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
"use client";
import { cva } from "@styled-system/css";
import { Flex } from "@styled-system/jsx";
import { Table, Text } from "@wow-class/ui";
import { padWithZero, parseISODate } from "@wow-class/utils";
import { studyInfoApi } from "apis/study/studyInfoApi";
import { tags } from "constants/tags";
import Link from "next/link";
import type { AssignmentApiResponseDto } from "types/dtos/assignmentList";
import getIsCurrentWeek from "utils/getIsCurrentWeek";
import { revalidateTagByName } from "utils/revalidateTagByName";
import Button from "wowds-ui/Button";

const AssignmentListItem = ({
assignment,
}: {
assignment: AssignmentApiResponseDto;
}) => {
const {
studyDetailId,
title,
deadline,
week,
descriptionLink,
assignmentStatus,
} = assignment;
const thisWeekAssignment = getIsCurrentWeek(deadline);
const { year, month, day, hours, minutes } = parseISODate(deadline);

const studyDeadline = `종료 : ${year}년 ${month}월 ${day}일 ${padWithZero(hours)}:${padWithZero(minutes)}`;

const handleCancelAssignment = async (studyDetailId: number) => {
const { success } = await studyInfoApi.cancelAssignment(studyDetailId);
if (success) {
window.alert("휴강 처리에 성공했어요.");
revalidateTagByName(tags.assignments);
} else {
window.alert("휴강 처리에 실패했어요.");
}
};
return (
<Table>
<Table.Left style={TableLeftStyle}>
<Flex alignItems="center" gap="xxs">
<div
className={ThisWeekBarStyle({
type: thisWeekAssignment ? "thisWeek" : "notThisWeek",
})}
/>
<Text typo="body1">{week}주차</Text>
</Flex>
<Flex direction="column" gap="xxs">
<Text typo="h3">{title || "-"}</Text>
<Text color="sub" typo="body2">
{deadline ? studyDeadline : "-"}
</Text>
</Flex>
</Table.Left>
<Table.Right>
<>
{assignmentStatus === "OPEN" ? (
<Button
asProp={Link}
href={descriptionLink || ""}
size="sm"
variant="outline"
>
과제 내용보기
</Button>
) : (
<Flex gap="sm">
<Button
color="sub"
size="sm"
variant="sub"
onClick={() => handleCancelAssignment(studyDetailId)}
>
과제 휴강처리
</Button>
<Button
size="sm"
variant="solid"
onClick={() => {
console.log("TODO: 과제 개설 페이지 연결");
}}
>
과제 개설하기
</Button>
</Flex>
)}
</>
</Table.Right>
</Table>
);
};
export default AssignmentListItem;

const ThisWeekBarStyle = cva({
base: {
width: "4px",
height: "18px",
},
variants: {
type: {
thisWeek: {
backgroundColor: "primary",
},
notThisWeek: {
backgroundColor: "transparent",
},
},
},
});

const TableLeftStyle = {
display: "flex",
alignItems: "center",
gap: "47px",
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { css } from "@styled-system/css";
import { Flex } from "@styled-system/jsx";
import { Space, Text } from "@wow-class/ui";
import Box from "wowds-ui/Box";
import Tag from "wowds-ui/Tag";

const CheckAttendanceNumber = () => {
return (
<section>
<Text typo="h2">주차별 출결 번호</Text>
<Space height={24} />
<div className={AttendanceContainerStyle}>
<Box
style={AttendanceBoxStyle}
text={
<Flex direction="column" gap="lg">
<Flex direction="column" gap="xs">
<Flex alignItems="center" gap="xs">
<Text typo="h2">4주차 출결 번호</Text>
<Tag color="blue" variant="solid2">
진행중
</Tag>
</Flex>
<Text color="sub" typo="body1">
2024년 5월 23일 00:00 - 23:59까지
</Text>
</Flex>
<Text color="primary" style={AttendanceNumberStyle}>
2143
</Text>
</Flex>
}
/>
<Box
style={AttendanceBoxStyle}
text={
<Flex direction="column" gap="lg">
<Flex direction="column" gap="xs">
<Flex alignItems="center" gap="xs">
<Text typo="h2">5주차 출결 번호</Text>
<Tag color="grey" variant="solid2">
진행전
</Tag>
</Flex>
<Text color="sub" typo="body1">
2024년 5월 23일 00:00 - 23:59까지
</Text>
</Flex>
<Text color="outline" style={AttendanceNumberStyle}>
4176
</Text>
</Flex>
}
/>
</div>
</section>
);
};

export default CheckAttendanceNumber;

const AttendanceContainerStyle = css({
display: "flex",
direction: "row",
alignItems: "center",
gap: "md",
});

const AttendanceBoxStyle = {
maxWidth: "282px",
};

const AttendanceNumberStyle = {
fontSize: "40px",
fontWeight: 700,
};
Loading
Loading