Skip to content

Commit bc48bab

Browse files
authored
fix: 과제 스터디의 경우 시간 - 보여주도록 수정 (#82)
1 parent 45bda4e commit bc48bab

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

apps/client/app/(afterLogin)/study-apply/_components/StudyItem.tsx

+19-6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import Link from "next/link";
88
import type { ComponentProps } from "react";
99
import type { StudyList } from "types/dtos/applyStudy";
1010
import type { StudyType } from "types/entities/common/study";
11+
import type { Time } from "types/entities/common/time";
1112
import Button from "wowds-ui/Button";
1213
import Tag from "wowds-ui/Tag";
1314
interface StudyItemProps {
@@ -24,18 +25,25 @@ const StudyItem = ({ study, appliedStudyId }: StudyItemProps) => {
2425
mentorName,
2526
studyType,
2627
dayOfWeek,
27-
startTime: { hour: startTimeHour, minute: startTimeMinute },
28-
endTime: { hour: endTimeHour, minute: endTimeMinute },
28+
startTime,
29+
endTime,
2930
openingDate: openingDateString,
3031
applicationEndDate: endDateString,
3132
totalWeek,
3233
} = study;
3334

3435
const openingDate = parseISODate(openingDateString);
3536
const endDate = parseISODate(endDateString);
36-
const studyTime = `${dayToKorean[dayOfWeek.toUpperCase()]} ${startTimeHour}:${padWithZero(startTimeMinute)} - ${
37-
endTimeHour
38-
}:${padWithZero(endTimeMinute)}`;
37+
38+
const formatTime = (startTime: Time, endTime: Time) => {
39+
const { hour: startTimeHour, minute: startTimeMinute } = startTime;
40+
const { hour: endTimeHour, minute: endTimeMinute } = endTime;
41+
42+
return `${dayToKorean[dayOfWeek.toUpperCase()]} ${startTimeHour}:${padWithZero(startTimeMinute)} - ${
43+
endTimeHour
44+
}:${padWithZero(endTimeMinute)}`;
45+
};
46+
const studyTime = startTime && endTime ? formatTime(startTime, endTime) : "-";
3947

4048
const isApplicable = appliedStudyId === null;
4149
const isCancelable = appliedStudyId === studyId;
@@ -56,7 +64,12 @@ const StudyItem = ({ study, appliedStudyId }: StudyItemProps) => {
5664
</Link>
5765
</Flex>
5866
<Text className={textCellStyle}>{mentorName}</Text>
59-
<Text className={textCellStyle}>{studyTime}</Text>
67+
<Text
68+
className={textCellStyle}
69+
style={{ width: "11rem", textAlign: "center" }}
70+
>
71+
{studyTime}
72+
</Text>
6073
<Text className={textCellStyle}>{totalWeek}주 코스</Text>
6174
<Flex direction="column" textAlign="center">
6275
<Text className={textCellStyle}>

apps/client/types/dtos/applyStudy.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ export interface StudyList {
99
introduction: string;
1010
mentorName: string;
1111
dayOfWeek: DayOfWeekType;
12-
startTime: Time;
13-
endTime: Time;
12+
startTime: Time | null;
13+
endTime: Time | null;
1414
totalWeek: number;
1515
openingDate: string;
1616
applicationEndDate: string;

0 commit comments

Comments
 (0)