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

[Chore] 클라이언트 나의 스터디 페이지 및 자잘한 QA 사항 반영 #102

Merged
merged 8 commits into from
Sep 2, 2024
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { css } from "@styled-system/css";
import { Flex } from "@styled-system/jsx";
import { Text } from "@wow-class/ui";
import { parseISODate } from "@wow-class/utils";
import { padWithZero, parseISODate } from "@wow-class/utils";
import { routePath } from "constants/routePath";
import Link from "next/link";
import type { ComponentProps } from "react";
Expand All @@ -28,7 +28,7 @@ const AssignmentStatusBox = ({
}: AssignmentStatusBoxProps) => {
const { year, month, day, hours, minutes } = parseISODate(deadLine);

const attendanceDeadline = `${year}년 ${month}월 ${day}일 ${hours}:${minutes}까지`;
const attendanceDeadline = `${year}년 ${month}월 ${day}일 ${padWithZero(hours)}:${padWithZero(minutes)}까지`;
const {
label: assignmentSubmissionStatusLabel = "",
color: assignmentSubmissionStatusColor,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import type { DailyTaskDto } from "types/dtos/myStudy";
import type { DailyTaskType } from "types/entities/myStudy";

import { AssignmentStatusBox, AttendanceStatusBox } from ".";

const DailyTaskItem = ({
dailyTask,
index,
}: {
dailyTask: DailyTaskDto<DailyTaskType>;
index: number;
}) => {
const {
todoType,
week,
deadLine,
attendanceStatus,
assignmentTitle,
assignmentSubmissionStatus,
} = dailyTask;

return todoType === "ATTENDANCE" ? (
<AttendanceStatusBox
attendanceStatus={attendanceStatus || "NOT_ATTENDED"}
deadLine={deadLine}
key={index}
week={week}
/>
) : (
<AssignmentStatusBox
assignmentSubmissionStatus={assignmentSubmissionStatus || "SUCCESS"}
deadLine={deadLine}
key={index}
name={assignmentTitle || ""}
week={week}
/>
);
};

export default DailyTaskItem;
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { Flex } from "@styled-system/jsx";
import { Text } from "@wow-class/ui";
import { myStudyApi } from "apis/myStudyApi";
import type { DailyTaskDto } from "types/dtos/myStudy";
import type { DailyTaskType } from "types/entities/myStudy";

import { AttendanceStatusBox, DailyTaskCarousel } from ".";
import AssignmentStatusBox from "./AssignmentStatusBox";
import { DailyTaskCarousel, DailyTaskItem } from ".";

const DailyTasks = async () => {
const myOngoingStudyData = await myStudyApi.getMyOngoingStudyInfo();
Expand Down Expand Up @@ -36,38 +33,4 @@ const DailyTasks = async () => {
);
};

const DailyTaskItem = ({
dailyTask,
index,
}: {
dailyTask: DailyTaskDto<DailyTaskType>;
index: number;
}) => {
const {
todoType,
week,
deadLine,
attendanceStatus,
assignmentTitle,
assignmentSubmissionStatus,
} = dailyTask;

return todoType === "ATTENDANCE" ? (
<AttendanceStatusBox
attendanceStatus={attendanceStatus || "NOT_ATTENDED"}
deadLine={deadLine}
key={index}
week={week}
/>
) : (
<AssignmentStatusBox
assignmentSubmissionStatus={assignmentSubmissionStatus || "SUCCESS"}
deadLine={deadLine}
key={index}
name={assignmentTitle || ""}
week={week}
/>
);
};

export default DailyTasks;
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const EmptyStudy = () => {
alignItems="center"
direction="column"
gap="xl"
height="100%"
justifyContent="center"
minHeight="calc(100vh - 108px)"
>
<Image
alt="empty-study"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ const StudyCurriculum = async () => {
? "제출한 과제 확인"
: "과제 제출하기";
const isCurrentWeek = getIsCurrentWeek(startDate, endDate);
const buttonDisabled =
assignmentSubmissionStatus === "FAILURE" || !isCurrentWeek;

return (
<Table key={index}>
Expand Down Expand Up @@ -105,7 +107,7 @@ const StudyCurriculum = async () => {
<Button
aria-label="check-submitted-assignment"
asProp={Link}
disabled={assignmentSubmissionStatus === "FAILURE"}
disabled={buttonDisabled}
href={submissionLink || ""}
size="sm"
style={assignmentButtonStyle}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export { default as AssignmentStatusBox } from "./AssignmentStatusBox";
export { default as AttendanceStatusBox } from "./AttendanceStatusBox";
export { default as DailyTaskCarousel } from "./DailyTaskCarousel";
export { default as DailyTaskItem } from "./DailyTaskItem";
export { default as DailyTasks } from "./DailyTasks";
export { default as EmptyStudy } from "./EmptyStudy";
export { default as Header } from "./Header";
Expand Down
2 changes: 1 addition & 1 deletion apps/client/app/(afterLogin)/my-study/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ const Layout = ({
export default Layout;

const layoutContainerStyle = css({
height: "100%",
minHeight: "calc(100vh - 108px)",
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@
"clsx": "^2.1.1",
"wowds-icons": "^0.1.3",
"wowds-tokens": "^0.1.1",
"wowds-ui": "^0.1.14"
"wowds-ui": "^0.1.15"
}
}
12 changes: 6 additions & 6 deletions packages/utils/src/formatDate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ export const parseISODate = (dateString: string) => {
const date = new Date(dateString);

return {
year: date.getUTCFullYear(),
month: date.getUTCMonth() + 1,
day: date.getUTCDate(),
hours: date.getUTCHours(),
minutes: date.getUTCMinutes(),
seconds: date.getUTCSeconds(),
year: date.getFullYear(),
month: date.getMonth() + 1,
day: date.getDate(),
hours: date.getHours(),
minutes: date.getMinutes(),
seconds: date.getSeconds(),
};
};

Expand Down
15 changes: 10 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading