diff --git a/src/components/summary/study-info-summary.tsx b/src/components/summary/study-info-summary.tsx index 32038c08..711509cd 100644 --- a/src/components/summary/study-info-summary.tsx +++ b/src/components/summary/study-info-summary.tsx @@ -9,6 +9,7 @@ import Button from '@/components/ui/button'; import { GroupStudyFullResponse } from '@/features/study/group/api/group-study-types'; import ApplyGroupStudyModal from '@/features/study/group/ui/apply-group-study-modal'; import { useGetGroupStudyMyStatus } from '@/hooks/queries/group-study-member-api'; +import { useToastStore } from '@/stores/use-toast-store'; import { useUserStore } from '@/stores/useUserStore'; import { EXPERIENCE_LEVEL_LABELS, @@ -28,6 +29,7 @@ export default function SummaryStudyInfo({ data }: Props) { const queryClient = useQueryClient(); const [isExpanded, setIsExpanded] = useState(false); const memberId = useUserStore((state) => state.memberId); + const showToast = useToastStore((state) => state.showToast); const { basicInfo, detailInfo, interviewPost } = data; const { @@ -119,8 +121,12 @@ export default function SummaryStudyInfo({ data }: Props) { const visibleItems = isExpanded ? infoItems : infoItems.slice(0, 4); const handleCopyURL = async () => { - await navigator.clipboard.writeText(window.location.href); - alert('스터디 링크가 복사되었습니다!'); + try { + await navigator.clipboard.writeText(window.location.href); + showToast('스터디 링크가 복사되었습니다!'); + } catch { + showToast('클립보드 복사에 실패했습니다. 다시 시도해주세요.', 'error'); + } }; const handleApplySuccess = async () => { @@ -132,11 +138,16 @@ export default function SummaryStudyInfo({ data }: Props) { } }; + // 신청 마감 여부 체크 (스터디 시작일이 오늘 이전이거나 같은 경우) + const isDeadlinePassed = + !!startDate && !dayjs(startDate).isAfter(dayjs(), 'day'); + const isApplyDisabled = isLeader || myApplicationStatus?.status !== 'NONE' || groupStudyStatus !== 'RECRUITING' || - approvedCount >= maxMembersCount; + approvedCount >= maxMembersCount || + isDeadlinePassed; const getButtonText = () => { if (myApplicationStatus?.status === 'APPROVED') { @@ -148,6 +159,9 @@ export default function SummaryStudyInfo({ data }: Props) { if (myApplicationStatus?.status === 'REJECTED') { return '신청 거절됨'; } + if (isDeadlinePassed) { + return '모집 마감'; + } return '신청하기'; };