-
- Timeline & History
-
- Historical events and milestones for {entityName}
-
-
+
+ {/* Header with Add Event button */}
+
+
+ {user && hasPendingEvents && (
+
+ )}
+
+ {user && (
-
-
-
-
-
+ )}
+
+ {/* Pending Events Section */}
+ {user && hasPendingEvents && showPending && (
+
+
+
+
Pending Submissions
+
+
+ {pendingEvents.map((event) => (
+
+ ))}
+
+
+
+ )}
+
+ {/* Approved Timeline Events */}
+
+
+
+
Timeline History
+
+ {historyEvents.length > 0 ? (
+
+ ) : (
+
+ No timeline events yet. Be the first to add one!
+
+ )}
+
+
+ {/* Editor Dialog */}
refetch()}
+ existingEvent={editingEvent}
+ onSuccess={handleSuccess}
/>
-
+
);
-}
+}
\ No newline at end of file
diff --git a/src/components/timeline/TimelineEventCard.tsx b/src/components/timeline/TimelineEventCard.tsx
new file mode 100644
index 00000000..e33ca45e
--- /dev/null
+++ b/src/components/timeline/TimelineEventCard.tsx
@@ -0,0 +1,117 @@
+import { Edit, Trash, Clock, CheckCircle } from 'lucide-react';
+import { Button } from '@/components/ui/button';
+import { Card, CardContent } from '@/components/ui/card';
+import { Badge } from '@/components/ui/badge';
+import { format } from 'date-fns';
+import type { TimelineEvent } from '@/types/timeline';
+
+interface TimelineEventCardProps {
+ event: TimelineEvent;
+ onEdit?: (event: TimelineEvent) => void;
+ onDelete?: (eventId: string) => void;
+ canEdit: boolean;
+ canDelete: boolean;
+ isPending?: boolean;
+}
+
+const formatEventDate = (date: string, precision: string = 'day') => {
+ const dateObj = new Date(date);
+
+ switch (precision) {
+ case 'year':
+ return format(dateObj, 'yyyy');
+ case 'month':
+ return format(dateObj, 'MMMM yyyy');
+ case 'day':
+ default:
+ return format(dateObj, 'MMMM d, yyyy');
+ }
+};
+
+const getEventTypeLabel = (type: string): string => {
+ return type.split('_').map(word =>
+ word.charAt(0).toUpperCase() + word.slice(1)
+ ).join(' ');
+};
+
+export function TimelineEventCard({
+ event,
+ onEdit,
+ onDelete,
+ canEdit,
+ canDelete,
+ isPending = false
+}: TimelineEventCardProps) {
+ return (
+