import { Dialog, DialogContent, DialogHeader, DialogTitle, } from "@/components/ui/dialog"; import { CalendarDays, Globe, Tag, Clock, AlarmClock } from "lucide-react"; import { Conference } from "@/types/conference"; import { formatDistanceToNow, parseISO, isValid } from "date-fns"; interface ConferenceDialogProps { conference: Conference; open: boolean; onOpenChange: (open: boolean) => void; } const ConferenceDialog = ({ conference, open, onOpenChange }: ConferenceDialogProps) => { const deadlineDate = conference.deadline && conference.deadline !== 'TBD' ? parseISO(conference.deadline) : null; const daysLeft = deadlineDate && isValid(deadlineDate) ? formatDistanceToNow(deadlineDate, { addSuffix: true }) : 'TBD'; const getCountdownColor = () => { if (!deadlineDate || !isValid(deadlineDate)) return "text-neutral-600"; const daysRemaining = Math.ceil((deadlineDate.getTime() - new Date().getTime()) / (1000 * 60 * 60 * 24)); if (daysRemaining <= 7) return "text-red-600"; if (daysRemaining <= 30) return "text-orange-600"; return "text-green-600"; }; return ( {conference.title} {conference.full_name && (

{conference.full_name}

)}
{conference.date}
{conference.place}
Deadline: {conference.deadline === 'TBD' ? 'TBD' : conference.deadline} {conference.timezone && ( Timezone: {conference.timezone} )}
{daysLeft}
{conference.abstract_deadline && (
Abstract Deadline: {conference.abstract_deadline}
)} {Array.isArray(conference.tags) && conference.tags.length > 0 && (
{conference.tags.map((tag) => ( {tag} ))}
)} {conference.note && (
)} {conference.link && (
Visit Conference Website →
)}
); }; export default ConferenceDialog;