"use client"; import { motion } from "framer-motion"; import { Clock, ExternalLink, LucideMapPin, MoreHorizontal, Pencil, Trash2, } from "lucide-react"; import { RRuleDisplay } from "@/components/rrule-display"; import { Button } from "@/components/ui/button"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { formatEventRangeLabel } from "@/lib/event-date-format"; import { getEventValidationIssues } from "@/lib/event-form"; import type { CalendarEvent } from "@/lib/types"; interface EventCardProps { event: CalendarEvent; onEdit: (event: CalendarEvent) => void; onDelete: (eventId: string) => void; } export const EVENT_CARD_SURFACE_CLASSES = "group cursor-pointer rounded-[10px] bg-card p-4 shadow-[0_0_0_1px_rgba(0,0,0,0.08),0_2px_2px_rgba(0,0,0,0.04),0_0_0_1px_#fafafa] transition-[background-color,transform,box-shadow] duration-150 hover:-translate-y-0.5 hover:bg-accent/20"; export const EventCard = ({ event, onEdit, onDelete }: EventCardProps) => { const validationIssues = getEventValidationIssues(event); const handleEdit = () => { onEdit({ id: event.id, title: event.title, description: event.description || "", location: event.location || "", url: event.url || "", start: event.start, end: event.end || "", allDay: event.allDay || false, recurrenceRule: event.recurrenceRule, }); }; return (

{event.title}

{event.description && (

{event.description}

)}
{formatEventRangeLabel(event)} {event.location && ( {event.location} )} {event.url && ( )}
{event.recurrenceRule && ( )} {validationIssues.length > 0 && (
Warning: {validationIssues[0]}.
)}
Edit onDelete(event.id)} className="text-destructive focus:text-destructive" > Delete
); };