'use client' import { Label } from '@/components/ui/label' import { Switch } from '@/components/ui/switch' import { Card, CardContent } from '@/components/ui/card' import { Bell } from 'lucide-react' type NotificationsSectionProps = { config: Record onChange: (config: Record) => void overridePolicy: Record onOverridePolicyChange: (policy: Record) => void isActive?: boolean } const NOTIFICATION_EVENTS = [ { key: 'stage.transitioned', label: 'Stage Transitioned', description: 'When a stage changes status (draft → active → closed)', }, { key: 'filtering.completed', label: 'Filtering Completed', description: 'When batch filtering finishes processing', }, { key: 'assignment.generated', label: 'Assignments Generated', description: 'When jury assignments are created or updated', }, { key: 'routing.executed', label: 'Routing Executed', description: 'When projects are routed into tracks/stages', }, { key: 'live.cursor.updated', label: 'Live Cursor Updated', description: 'When the live presentation moves to next project', }, { key: 'cohort.window.changed', label: 'Cohort Window Changed', description: 'When a cohort voting window opens or closes', }, { key: 'decision.overridden', label: 'Decision Overridden', description: 'When an admin overrides an automated decision', }, { key: 'award.winner.finalized', label: 'Award Winner Finalized', description: 'When a special award winner is selected', }, ] export function NotificationsSection({ config, onChange, overridePolicy, onOverridePolicyChange, isActive, }: NotificationsSectionProps) { const toggleEvent = (key: string, enabled: boolean) => { onChange({ ...config, [key]: enabled }) } return (

Choose which pipeline events trigger notifications. All events are enabled by default.

{NOTIFICATION_EVENTS.map((event) => (

{event.description}

toggleEvent(event.key, checked)} disabled={isActive} />
))}
{/* Override Governance */}

Who can override automated decisions in this pipeline?

{ const roles = Array.isArray(overridePolicy.allowedRoles) ? [...overridePolicy.allowedRoles] : ['SUPER_ADMIN'] if (checked && !roles.includes('PROGRAM_ADMIN')) { roles.push('PROGRAM_ADMIN') } else if (!checked) { const idx = roles.indexOf('PROGRAM_ADMIN') if (idx >= 0) roles.splice(idx, 1) } onOverridePolicyChange({ ...overridePolicy, allowedRoles: roles }) }} />
{ const roles = Array.isArray(overridePolicy.allowedRoles) ? [...overridePolicy.allowedRoles] : ['SUPER_ADMIN'] if (checked && !roles.includes('AWARD_MASTER')) { roles.push('AWARD_MASTER') } else if (!checked) { const idx = roles.indexOf('AWARD_MASTER') if (idx >= 0) roles.splice(idx, 1) } onOverridePolicyChange({ ...overridePolicy, allowedRoles: roles }) }} />
) }