'use client'; import { useQuery } from '@tanstack/react-query'; import { CardWithList } from '@/types'; import { fetcher } from '@/lib/fetcher'; import { AuditLog } from '@prisma/client'; import { useCardModal } from '@/hooks/use-card-modal'; import { Dialog, DialogContent } from '@/components/ui/dialog'; import { Header } from './header'; import { Description } from './description'; import { Actions } from './actions'; import { Activity } from './activity'; export const CardModal = () => { const id = useCardModal((state) => state.id); const isOpen = useCardModal((state) => state.isOpen); const onClose = useCardModal((state) => state.onClose); const { data: cardData } = useQuery({ queryKey: ['card', id], queryFn: () => fetcher(`/api/cards/${id}`), }); const { data: auditLogsData } = useQuery({ queryKey: ['card-logs', id], queryFn: () => fetcher(`/api/cards/${id}/logs`), }); return ( {!cardData ? :
}
{!cardData ? ( ) : ( )} {!auditLogsData ? ( ) : ( )}
{!cardData ? : }
); };