'use client'; import { motion } from 'framer-motion'; import Link from 'next/link'; import type { ActivityEvent } from '../../lib/activity'; import { Chip } from '../shared/chip'; interface EventCardProps { event: ActivityEvent; } export function EventCard({ event }: EventCardProps) { return (
{event.actor || 'System'} {getActionVerb(event.kind)} {event.beadTitle}
{event.projectName} {event.beadId}
); } function StatusIcon({ kind }: { kind: string }) { let color = 'bg-slate-500'; if (kind === 'created' || kind === 'reopened') color = 'bg-emerald-500'; if (kind === 'closed') color = 'bg-rose-500'; if (kind === 'status_changed') color = 'bg-amber-500'; if (kind.includes('comment')) color = 'bg-blue-500'; return (
); } function getActionVerb(kind: string): string { switch (kind) { case 'created': return 'created'; case 'closed': return 'closed'; case 'reopened': return 'reopened'; case 'status_changed': return 'moved'; case 'comment_added': return 'commented on'; case 'assignee_changed': return 'assigned'; default: return 'updated'; } } function EventPayload({ event }: { event: ActivityEvent }) { const { payload } = event; if (event.kind === 'status_changed') { return (
{payload.from} {payload.to}
); } if (event.kind === 'comment_added') { return (
"{payload.message}"
); } if (payload.from !== undefined && payload.to !== undefined) { return (
Changed {payload.field}: {String(payload.from)}{String(payload.to)}
); } if (payload.message) { return
{payload.message}
; } return null; }