Skip to content

Commit

Permalink
feat: ApplicantsDialog에서 ticleId를 사용하여 신청자 데이터를 가져오도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
seoko97 committed Dec 5, 2024
1 parent 6378217 commit b8431db
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
11 changes: 6 additions & 5 deletions apps/web/src/components/dashboard/open/ApplicantsDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import { DashboardApplicantsResponse } from '@repo/types';

import Avatar from '@/components/common/Avatar';
import { Dialog } from '@/components/common/Dialog';
import Empty from '@/components/common/Empty';
import { useApplicantsTicle } from '@/hooks/api/dashboard';

interface ApplicantsDialogProps {
ticleId: number;
isOpen: boolean;
onClose: () => void;
applicants: DashboardApplicantsResponse;
}

function ApplicantsDialog({ isOpen, onClose, applicants }: ApplicantsDialogProps) {
function ApplicantsDialog({ ticleId, isOpen, onClose }: ApplicantsDialogProps) {
const { data: applicants } = useApplicantsTicle(ticleId.toString());

return (
<Dialog.Root isOpen={isOpen} onClose={onClose}>
<Dialog.Title align="center">신청자 목록</Dialog.Title>
<Dialog.Close onClose={onClose} />
<Dialog.Content className="custom-scrollbar h-56 overflow-y-scroll">
<ul className="flex h-full flex-col gap-4">
{applicants.length === 0 ? (
{!applicants || applicants.length === 0 ? (
<Empty imageSize={80} className="h-full" />
) : (
applicants.map((applicant) => (
Expand Down
5 changes: 1 addition & 4 deletions apps/web/src/components/dashboard/open/TicleInfoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,11 @@ function TicleInfoCard({ ticleId, ticleTitle, startTime, endTime, status }: Ticl
onClose: onAiSummaryDialogClose,
} = useModal();

const { data: applicantsData } = useApplicantsTicle(ticleId.toString());
const { mutate: ticleStartMutate } = useStartTicle();
const { dateStr, timeRangeStr } = formatDateTimeRange(startTime, endTime);

const navigate = useNavigate();

if (!applicantsData) return;

const handleTicleStart = (e: MouseEvent<HTMLButtonElement>) => {
e.preventDefault();
ticleStartMutate(ticleId.toString());
Expand Down Expand Up @@ -107,9 +104,9 @@ function TicleInfoCard({ ticleId, ticleTitle, startTime, endTime, status }: Ticl
</div>
{isApplicantsDialogOpen && (
<ApplicantsDialog
ticleId={ticleId}
onClose={onApplicantsDialogClose}
isOpen={isApplicantsDialogOpen}
applicants={applicantsData}
/>
)}
{isAiSummaryDialogOpen && (
Expand Down

0 comments on commit b8431db

Please sign in to comment.