feat: add event narrative and evidence workflow

This commit is contained in:
2026-08-14 14:31:52 +02:00
parent edfa4c866c
commit e333d3b634
10 changed files with 143 additions and 14 deletions
+11 -2
View File
@@ -1,5 +1,5 @@
import type { ComponentType } from 'react'
import { BookOpen, FileText, Folder, FolderOpen, Image as ImageIcon, Pencil } from 'lucide-react'
import { BookOpen, CalendarClock, FileText, Folder, FolderOpen, Image as ImageIcon, Pencil } from 'lucide-react'
import type { CaseDocument, Evidence, EvidenceType, SourceFileType } from './types'
import { folderIsOpen } from './boardDomain'
@@ -9,6 +9,7 @@ export type ExhibitWidgetProps = {
onOpenSource: (id: string) => void
onToggleFolder: (id: string) => void
onEditFolder: (id: string) => void
onEditEvent: (id: string) => void
}
export type ExhibitWidgetDefinition = {
@@ -32,6 +33,14 @@ function StandardWidget({ exhibit, onOpenSource }: ExhibitWidgetProps) {
</div>
}
function EventWidget({ exhibit, onEditEvent }: ExhibitWidgetProps) {
const supportCount = exhibit.supportingEvidenceIds?.length || 0
return <div className="card-content"><h3>{exhibit.title}</h3><p>{exhibit.content}</p>
{exhibit.eventDate && <time>{new Date(exhibit.eventDate).toLocaleString()}</time>}
<div className="event-actions"><span>{supportCount} SUPPORTING EXHIBIT{supportCount === 1 ? '' : 'S'}</span><button onClick={() => onEditEvent(exhibit.id)}><CalendarClock size={12}/> EDIT EVENT</button></div>
</div>
}
const standardPoint = (exhibit: Evidence) => ({ x: exhibit.x + exhibit.width / 2, y: exhibit.y + 68 })
const folderDefinition: ExhibitWidgetDefinition = {
visualType: 'folder', heading: (_exhibit, documents) => `EVIDENCE FOLDER / ${documents.length}`,
@@ -42,7 +51,7 @@ export const exhibitWidgetRegistry: Record<EvidenceType, ExhibitWidgetDefinition
folder: folderDefinition,
evidence: folderDefinition,
note: { visualType: 'note', heading: () => 'INVESTIGATOR / NOTE', connectionPoint: exhibit => ({ x: exhibit.x + 54, y: exhibit.y + 12 }), Component: StandardWidget },
event: { visualType: 'event', heading: () => 'EVENT / THIS HAPPENED', connectionPoint: standardPoint, Component: StandardWidget },
event: { visualType: 'event', heading: () => 'EVENT / THIS HAPPENED', connectionPoint: standardPoint, Component: EventWidget },
}
export function exhibitWidget(type: EvidenceType) {