import { debugProps } from '@/lib/debug' interface StoryLogEntry { id: string type: string content: string status: string | null commit_hash: string | null commit_message: string | null created_at: string } interface StoryLogProps { logs: StoryLogEntry[] repoUrl?: string | null } const TYPE_STYLES: Record = { IMPLEMENTATION_PLAN: { bg: 'bg-info-container/50 border-info/20', label: 'Implementatieplan', labelColor: 'text-info', }, TEST_RESULT: { bg: 'bg-surface-container border-border', label: 'Testresultaat', labelColor: 'text-foreground', }, COMMIT: { bg: 'bg-secondary-container/30 border-secondary/20', label: 'Commit', labelColor: 'text-secondary', }, } export function StoryLog({ logs, repoUrl }: StoryLogProps) { if (logs.length === 0) { return (

Nog geen activiteit. Gebruik de REST API om logs toe te voegen.

) } return (
{logs.map(log => { const style = TYPE_STYLES[log.type] ?? TYPE_STYLES.IMPLEMENTATION_PLAN const isTestResult = log.type === 'TEST_RESULT' const testPassed = log.status === 'PASSED' return (
{style.label} {isTestResult && ` — ${testPassed ? 'Geslaagd' : 'Mislukt'}`} {new Date(log.created_at).toLocaleDateString('nl-NL', { day: 'numeric', month: 'short', hour: '2-digit', minute: '2-digit', })}

{log.content}

{log.commit_hash && (
{repoUrl ? ( {log.commit_hash.slice(0, 7)} ) : ( {log.commit_hash.slice(0, 7)} )} {log.commit_message && ( {log.commit_message} )}
)}
) })}
) }