Skip to content

Commit

Permalink
fix: 스터디 시간 없을 경우 예외처리
Browse files Browse the repository at this point in the history
  • Loading branch information
eugene028 committed Aug 28, 2024
1 parent d3908b7 commit f9bfe68
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions apps/admin/app/studies/[studyId]/_components/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,29 @@ const Header = ({
mentorName,
studyType,
dayOfWeek,
startTime: { hour: startHour, minute: startMinute },
endTime: { hour: endHour, minute: endMinute },
startTime,
endTime,
totalWeek,
period: { startDate, endDate },
introduction,
notionLink,
} = studyInfo;

const studySchedule = () => {
if (startTime && endDate) {
const { hour: startHour, minute: startMinute } = startTime;
const { hour: endHour, minute: endMinute } = endTime;
return `${dayToKorean[dayOfWeek]} ${startHour}:${padWithZero(startMinute)}-
${endHour}:${padWithZero(endMinute)}`;
} else {
null;
}
};

const { month: startMonth, day: startDay } = parseISODate(startDate);
const { month: endMonth, day: endDay } = parseISODate(endDate);
const studySemester = `${academicYear}-${semester === "FIRST" ? 1 : 2}`;
const studySchedule = `${dayToKorean[dayOfWeek]} ${startHour}:${padWithZero(startMinute)}-
${endHour}:${padWithZero(endMinute)}`;

const studyPeriod = `${padWithZero(startMonth)}.${padWithZero(startDay)}-
${padWithZero(endMonth)}.${padWithZero(endDay)}`;

Expand Down Expand Up @@ -124,10 +134,14 @@ const Header = ({
스터디 일정
</Text>
<Flex gap="xs">
<Text as="h5" color="sub">
{studySchedule}
</Text>
<ItemSeparator />
{startTime && (
<Flex gap="xs">
<Text as="h5" color="sub">
{studySchedule()}
</Text>
<ItemSeparator />
</Flex>
)}
<Text as="h5" color="sub">
{totalWeek}주 코스
</Text>
Expand Down

0 comments on commit f9bfe68

Please sign in to comment.