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 반영 #121

Merged
merged 4 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ import Tag from "wowds-ui/Tag";
interface AssignmentStatusBoxProps {
week: number;
name: string;
assignmentSubmissionStatus: Extract<
AssignmentSubmissionStatusType,
"SUCCESS" | "FAILURE"
>;
assignmentSubmissionStatus: AssignmentSubmissionStatusType;
deadLine: string;
}

Expand All @@ -30,9 +27,9 @@ const AssignmentStatusBox = ({

const attendanceDeadline = `${year}년 ${month}월 ${day}일 ${padWithZero(hours)}:${padWithZero(minutes)}까지`;
const {
label: assignmentSubmissionStatusLabel = "",
label: assignmentSubmissionStatusLabel,
color: assignmentSubmissionStatusColor,
} = assignmentSubmissionStatusMap[assignmentSubmissionStatus] || {};
} = assignmentSubmissionStatusMap[assignmentSubmissionStatus];

return (
<Box
Expand Down Expand Up @@ -68,7 +65,7 @@ const AssignmentStatusBox = ({
</Flex>
<Button
asProp={Link}
disabled={assignmentSubmissionStatus !== "SUCCESS"}
disabled={assignmentSubmissionStatus !== "NOT_SUBMITTED"}
href={routePath["my-assignment"]}
size="lg"
style={assignmentButtonStyle}
Expand All @@ -84,11 +81,12 @@ const AssignmentStatusBox = ({
export default AssignmentStatusBox;

const assignmentSubmissionStatusMap: Record<
Extract<AssignmentSubmissionStatusType, "SUCCESS" | "FAILURE">,
AssignmentSubmissionStatusType,
{ label: string; color: ComponentProps<typeof Tag>["color"] }
> = {
SUCCESS: { label: "제출 완료", color: "blue" },
FAILURE: { label: "제출 실패", color: "red" },
NOT_SUBMITTED: { label: "", color: "grey" },
};

const dailyTaskBoxStyle = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Table, Text } from "@wow-class/ui";
import { formatWeekPeriod } from "@wow-class/utils";
import { myStudyApi } from "apis/myStudyApi";
import { attendanceStatusMap } from "constants/attendanceStatusMap";
import { routePath } from "constants/routePath";
import Link from "next/link";
import type { ComponentProps } from "react";
import type { StudyDifficultyType } from "types/entities/myStudy";
Expand Down Expand Up @@ -53,24 +54,31 @@ const StudyCurriculum = async () => {
attendanceStatusMap[
curriculumStatus === "CANCELLED" ? "ATTENDED" : attendanceStatus
];

const assignmentButtonText =
assignmentSubmissionStatus === "SUCCESS"
? "제출한 과제 확인"
: "과제 제출하기";
const assignmentButtonHref =
submissionLink ?? routePath["my-assignment"] ?? "";

const isCurrentWeek = getIsCurrentWeek(startDate, endDate);

const buttonDisabled =
!isCurrentWeek ||
assignmentSubmissionStatus === "FAILURE" ||
assignmentStatus === "CANCELLED";

const noDescriptionTextColor = description ? "black" : "sub";

return (
<Table key={index}>
<Table.Left className={leftColStyle}>
<div className={weekContainerStyle}>
{isCurrentWeek && (
<div className={currentWeekIndicatorStyle} />
)}
<Text as="h5" typo="body1">
<Text as="h5" color={noDescriptionTextColor} typo="body1">
{week}주차
</Text>
</div>
Expand All @@ -79,7 +87,7 @@ const StudyCurriculum = async () => {
<Text as="h3" color="sub" typo="h3">
휴강 주차
</Text>
) : (
) : description ? (
<Flex
direction="column"
gap={4.5}
Expand All @@ -102,11 +110,20 @@ const StudyCurriculum = async () => {
{description}
</Text>
</Flex>
) : (
<Text as="h3" color="sub" typo="h3">
작성된 내용이 없어요
</Text>
)}
</div>
</Table.Left>
<Table.Right className={rightColStyle}>
<Text as="h5" className={weekPeriodTextStyle} typo="body1">
<Text
as="h5"
className={weekPeriodTextStyle}
color={noDescriptionTextColor}
typo="body1"
>
{formatWeekPeriod(startDate, endDate)}
</Text>
<div className={tagContainerStyle}>
Expand All @@ -123,7 +140,7 @@ const StudyCurriculum = async () => {
aria-label="check-submitted-assignment"
asProp={Link}
disabled={buttonDisabled}
href={submissionLink || ""}
href={assignmentButtonHref}
size="sm"
style={assignmentButtonStyle}
target="_blank"
Expand Down
Loading