Skip to content

Commit

Permalink
[Chore] 나의 스터디 페이지 QA 반영 (#121)
Browse files Browse the repository at this point in the history
* chore: 커리큘럼 과제 제출하기 리다이렉트 추가

* chore: 스터디 커리큘럼 상세 정보 없는 경우 처리

* fix: 과제 수행하지 않은 경우 오늘의 할 일 나의 과제 바로가기 버튼 활성화

* chore: 과제 상태 박스에서 제출 전 상태 고려하도록 수정
  • Loading branch information
ghdtjgus76 authored Sep 4, 2024
1 parent cf57028 commit dc84741
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
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

0 comments on commit dc84741

Please sign in to comment.