Skip to content

Commit

Permalink
feat: 출석일이 아니라면, 출석 버튼 비활성화
Browse files Browse the repository at this point in the history
  • Loading branch information
abiriadev committed Jul 4, 2024
1 parent 83f7912 commit a8f62f2
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/Pages/StudyDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { match, P } from 'ts-pattern';
import { Sidebar } from './Sidebar';
import { useAttendStudyMutation } from '@/Hooks/study/useAttendStudyMutation';
import { isToday } from 'date-fns';
import { getDayById } from '@/utils/date';
import { getDayById, isTodayAttendanceDay } from '@/utils/date';

const isValidUrl = (url: string) => {
try {
Expand Down Expand Up @@ -76,13 +76,18 @@ export const StudyDetailPage = () => {
<PlatformSection>
<PlatformTitle>
<TopBarSectionTitle>진행 플랫폼</TopBarSectionTitle>
{didIAttendToday ? (
<Button disabled>출석 완료</Button>
) : (
<Button scheme="secondary" onClick={async () => attendStudyMutate()}>
출석 체크
</Button>
)}
{study.status !== 'COMPLETED' &&
(isTodayAttendanceDay(study.attendanceDay) ? (
didIAttendToday ? (
<Button disabled>출석 완료</Button>
) : (
<Button scheme="secondary" onClick={async () => attendStudyMutate()}>
출석 체크
</Button>
)
) : (
<Button disabled>출석 없음</Button>
))}
{isAttendanceModalOpen && isAttendStudyMutationSuccess && (
<Modal
title="해당 스터디 출석이 체크되었습니다!"
Expand Down

0 comments on commit a8f62f2

Please sign in to comment.