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

@@ -0,0 +1,103 @@
'use client'
import { useState } from 'react'
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
DialogTrigger,
} from '@/components/ui/dialog'
import { Button } from '@/components/ui/button'
import { Eye, Download, FileText, Image as ImageIcon, Video, File } from 'lucide-react'
interface FilePreviewProps {
fileName: string
mimeType: string
downloadUrl: string
}
function getPreviewType(mimeType: string): 'pdf' | 'image' | 'video' | 'unsupported' {
if (mimeType === 'application/pdf') return 'pdf'
if (mimeType.startsWith('image/')) return 'image'
if (mimeType.startsWith('video/')) return 'video'
return 'unsupported'
}
function getFileIcon(mimeType: string) {
if (mimeType === 'application/pdf') return FileText
if (mimeType.startsWith('image/')) return ImageIcon
if (mimeType.startsWith('video/')) return Video
return File
}
export function FilePreview({ fileName, mimeType, downloadUrl }: FilePreviewProps) {
const [open, setOpen] = useState(false)
const previewType = getPreviewType(mimeType)
const Icon = getFileIcon(mimeType)
const canPreview = previewType !== 'unsupported'
if (!canPreview) {
return (
<Button variant="outline" size="sm" asChild>
<a href={downloadUrl} target="_blank" rel="noopener noreferrer">
<Download className="mr-2 h-4 w-4" />
Download
</a>
</Button>
)
}
return (
<Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger asChild>
<Button variant="outline" size="sm">
<Eye className="mr-2 h-4 w-4" />
Preview
</Button>
</DialogTrigger>
<DialogContent className="max-w-4xl max-h-[90vh]">
<DialogHeader>
<DialogTitle className="flex items-center gap-2 truncate">
<Icon className="h-4 w-4 shrink-0" />
{fileName}
</DialogTitle>
</DialogHeader>
<div className="overflow-auto">
{previewType === 'pdf' && (
<iframe
src={`${downloadUrl}#toolbar=0`}
className="w-full h-[70vh] rounded-md"
title={fileName}
/>
)}
{previewType === 'image' && (
<img
src={downloadUrl}
alt={fileName}
className="w-full h-auto max-h-[70vh] object-contain rounded-md"
/>
)}
{previewType === 'video' && (
<video
src={downloadUrl}
controls
className="w-full max-h-[70vh] rounded-md"
preload="metadata"
>
Your browser does not support the video tag.
</video>
)}
</div>
<div className="flex justify-end">
<Button variant="outline" size="sm" asChild>
<a href={downloadUrl} target="_blank" rel="noopener noreferrer">
<Download className="mr-2 h-4 w-4" />
Download
</a>
</Button>
</div>
</DialogContent>
</Dialog>
)
}