Implement 15 platform features: digest, availability, templates, comparison, live voting SSE, file versioning, mentorship, messaging, analytics, drafts, webhooks, peer review, audit enhancements, i18n

Features implemented:
- F1: Email digest notifications with cron endpoint and per-user frequency
- F2: Jury availability windows and workload preferences in smart assignment
- F3: Round templates with save-from-round and CRUD management
- F4: Side-by-side project comparison view for jury members
- F5: Real-time voting dashboard with Server-Sent Events (SSE)
- F6: Live voting UX: QR codes, audience voting, tie-breaking, score animations
- F7: File versioning, inline preview, bulk download with presigned URLs
- F8: Mentor dashboard: milestones, private notes, activity tracking
- F9: Communication hub with broadcasts, templates, and recipient targeting
- F10: Advanced analytics: cross-round comparison, juror consistency, diversity metrics, PDF export
- F11: Applicant draft saving with magic link resume and cron cleanup
- F12: Webhook integration layer with HMAC signing, retry, and delivery logs
- F13: Peer review discussions with anonymized scores and threaded comments
- F14: Audit log enhancements: before/after diffs, session grouping, anomaly detection, retention
- F15: i18n foundation with next-intl (EN/FR), cookie-based locale, language switcher

Schema: 12 new models, field additions to User, Project, ProjectFile, LiveVotingSession, LiveVote, MentorAssignment, AuditLog, Program
New routers: roundTemplate, message, webhook (registered in _app.ts)
New services: email-digest, webhook-dispatcher
New cron endpoints: /api/cron/digest, /api/cron/draft-cleanup, /api/cron/audit-cleanup
New API routes: /api/live-voting/stream (SSE), /api/files/bulk-download

All features are admin-configurable via SystemSettings or per-model settingsJson fields.
Docker build verified successfully.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-05 23:31:41 +01:00
parent f038c95777
commit 59436ed67a
68 changed files with 14541 additions and 546 deletions

View File

@@ -34,7 +34,8 @@ import {
FormMessage,
} from '@/components/ui/form'
import { RoundTypeSettings } from '@/components/forms/round-type-settings'
import { ArrowLeft, Loader2, AlertCircle, Bell } from 'lucide-react'
import { ArrowLeft, Loader2, AlertCircle, Bell, LayoutTemplate } from 'lucide-react'
import { toast } from 'sonner'
import { DateTimePicker } from '@/components/ui/datetime-picker'
// Available notification types for teams entering a round
@@ -71,9 +72,38 @@ function CreateRoundContent() {
const [roundType, setRoundType] = useState<'FILTERING' | 'EVALUATION' | 'LIVE_EVENT'>('EVALUATION')
const [roundSettings, setRoundSettings] = useState<Record<string, unknown>>({})
const [entryNotificationType, setEntryNotificationType] = useState<string>('')
const [selectedTemplateId, setSelectedTemplateId] = useState<string>('')
const utils = trpc.useUtils()
const { data: programs, isLoading: loadingPrograms } = trpc.program.list.useQuery()
const { data: templates } = trpc.roundTemplate.list.useQuery()
const loadTemplate = (templateId: string) => {
if (!templateId || !templates) return
const template = templates.find((t) => t.id === templateId)
if (!template) return
// Apply template settings
const typeMap: Record<string, 'FILTERING' | 'EVALUATION' | 'LIVE_EVENT'> = {
EVALUATION: 'EVALUATION',
SELECTION: 'EVALUATION',
FINAL: 'EVALUATION',
LIVE_VOTING: 'LIVE_EVENT',
FILTERING: 'FILTERING',
}
setRoundType(typeMap[template.roundType] || 'EVALUATION')
if (template.settingsJson && typeof template.settingsJson === 'object') {
setRoundSettings(template.settingsJson as Record<string, unknown>)
}
if (template.name) {
form.setValue('name', template.name)
}
setSelectedTemplateId(templateId)
toast.success(`Loaded template: ${template.name}`)
}
const createRound = trpc.round.create.useMutation({
onSuccess: (data) => {
@@ -155,6 +185,56 @@ function CreateRoundContent() {
</p>
</div>
{/* Template Selector */}
{templates && templates.length > 0 && (
<Card>
<CardHeader className="pb-3">
<CardTitle className="text-lg flex items-center gap-2">
<LayoutTemplate className="h-5 w-5" />
Start from Template
</CardTitle>
<CardDescription>
Load settings from a saved template to get started quickly
</CardDescription>
</CardHeader>
<CardContent>
<div className="flex items-center gap-3">
<Select
value={selectedTemplateId}
onValueChange={loadTemplate}
>
<SelectTrigger className="w-full max-w-sm">
<SelectValue placeholder="Select a template..." />
</SelectTrigger>
<SelectContent>
{templates.map((t) => (
<SelectItem key={t.id} value={t.id}>
{t.name}
{t.description ? ` - ${t.description}` : ''}
</SelectItem>
))}
</SelectContent>
</Select>
{selectedTemplateId && (
<Button
variant="ghost"
size="sm"
onClick={() => {
setSelectedTemplateId('')
setRoundType('EVALUATION')
setRoundSettings({})
form.reset()
toast.info('Template cleared')
}}
>
Clear
</Button>
)}
</div>
</CardContent>
</Card>
)}
{/* Form */}
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-6">