'use client'; import { getEventLabel } from '@/lib/utils'; import type { SoundAssignments, HookEvent } from '@/lib/types'; interface AssignmentEntry { scope: string; event: HookEvent; sound: string; } interface AssignmentLogPanelProps { assignments: SoundAssignments; isDirty: boolean; onClear: (scope: string, event: HookEvent) => void; onSave: () => void; } export function AssignmentLogPanel({ assignments, isDirty, onClear, onSave }: AssignmentLogPanelProps) { const entries: AssignmentEntry[] = []; // Global entries for (const [event, sound] of Object.entries(assignments.global)) { if (sound) entries.push({ scope: 'GLOBAL', event: event as HookEvent, sound }); } // Agent entries for (const [agentName, config] of Object.entries(assignments.agents)) { for (const [event, sound] of Object.entries(config.hooks)) { if (sound) entries.push({ scope: agentName, event: event as HookEvent, sound }); } } return (
ASSIGNMENT LOG
{isDirty && (
● UNSAVED CHANGES
)}
{/* Assignment table */}
{entries.length === 0 ? (
NO ASSIGNMENTS
) : ( {entries.map((entry, i) => ( ))}
Scope Event Sound
{entry.scope} {getEventLabel(entry.event)} {entry.sound.split('/').pop()}
)}
{/* Save button */}
); }