2026-02-14 15:26:42 +01:00
|
|
|
'use client'
|
|
|
|
|
|
2026-06-09 15:44:37 +02:00
|
|
|
import { BookOpen, Home, Trophy, ClipboardList, FileText } from 'lucide-react'
|
2026-02-14 15:26:42 +01:00
|
|
|
import { RoleNav, type NavItem, type RoleNavUser } from '@/components/layouts/role-nav'
|
|
|
|
|
import { trpc } from '@/lib/trpc/client'
|
|
|
|
|
import { Badge } from '@/components/ui/badge'
|
|
|
|
|
|
|
|
|
|
interface JuryNavProps {
|
|
|
|
|
user: RoleNavUser
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function RemainingBadge() {
|
|
|
|
|
const { data: assignments } = trpc.assignment.myAssignments.useQuery(
|
|
|
|
|
{},
|
|
|
|
|
{ refetchInterval: 60000 }
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if (!assignments) return null
|
|
|
|
|
|
|
|
|
|
const now = new Date()
|
|
|
|
|
const remaining = (assignments as Array<{
|
Competition/Round architecture: full platform rewrite (Phases 1-9)
Replace Pipeline/Stage system with Competition/Round architecture.
New schema: Competition, Round (7 types), JuryGroup, AssignmentPolicy,
ProjectRoundState, DeliberationSession, ResultLock, SubmissionWindow.
New services: round-engine, round-assignment, deliberation, result-lock,
submission-manager, competition-context, ai-prompt-guard.
Full admin/jury/applicant/mentor UI rewrite. AI prompt hardening with
structured prompts, retry logic, and injection detection. All legacy
pipeline/stage code removed. 4 new migrations + seed aligned.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 23:04:15 +01:00
|
|
|
round: { status: string; windowOpenAt: Date | null; windowCloseAt: Date | null } | null
|
2026-02-14 15:26:42 +01:00
|
|
|
evaluation: { status: string } | null
|
|
|
|
|
}>).filter((a) => {
|
|
|
|
|
const isActive =
|
Competition/Round architecture: full platform rewrite (Phases 1-9)
Replace Pipeline/Stage system with Competition/Round architecture.
New schema: Competition, Round (7 types), JuryGroup, AssignmentPolicy,
ProjectRoundState, DeliberationSession, ResultLock, SubmissionWindow.
New services: round-engine, round-assignment, deliberation, result-lock,
submission-manager, competition-context, ai-prompt-guard.
Full admin/jury/applicant/mentor UI rewrite. AI prompt hardening with
structured prompts, retry logic, and injection detection. All legacy
pipeline/stage code removed. 4 new migrations + seed aligned.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 23:04:15 +01:00
|
|
|
a.round?.status === 'ROUND_ACTIVE' &&
|
|
|
|
|
a.round.windowOpenAt &&
|
|
|
|
|
a.round.windowCloseAt &&
|
|
|
|
|
new Date(a.round.windowOpenAt) <= now &&
|
|
|
|
|
new Date(a.round.windowCloseAt) >= now
|
2026-02-14 15:26:42 +01:00
|
|
|
const isIncomplete = !a.evaluation || a.evaluation.status !== 'SUBMITTED'
|
|
|
|
|
return isActive && isIncomplete
|
|
|
|
|
}).length
|
|
|
|
|
|
|
|
|
|
if (remaining === 0) return null
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Badge variant="secondary" className="text-xs font-medium">
|
|
|
|
|
{remaining} remaining
|
|
|
|
|
</Badge>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function JuryNav({ user }: JuryNavProps) {
|
2026-02-17 11:48:14 +01:00
|
|
|
const { data: myAwards } = trpc.specialAward.getMyAwards.useQuery(
|
|
|
|
|
undefined,
|
|
|
|
|
{ refetchInterval: 60000 }
|
|
|
|
|
)
|
2026-03-03 23:09:29 +01:00
|
|
|
const { data: flags } = trpc.settings.getFeatureFlags.useQuery()
|
|
|
|
|
|
|
|
|
|
const useExternal = flags?.learningHubExternal && flags.learningHubExternalUrl
|
2026-02-17 11:48:14 +01:00
|
|
|
|
2026-02-14 15:26:42 +01:00
|
|
|
const navigation: NavItem[] = [
|
|
|
|
|
{
|
|
|
|
|
name: 'Dashboard',
|
|
|
|
|
href: '/jury',
|
|
|
|
|
icon: Home,
|
|
|
|
|
},
|
|
|
|
|
{
|
2026-02-17 11:48:14 +01:00
|
|
|
name: 'Assignments',
|
Competition/Round architecture: full platform rewrite (Phases 1-9)
Replace Pipeline/Stage system with Competition/Round architecture.
New schema: Competition, Round (7 types), JuryGroup, AssignmentPolicy,
ProjectRoundState, DeliberationSession, ResultLock, SubmissionWindow.
New services: round-engine, round-assignment, deliberation, result-lock,
submission-manager, competition-context, ai-prompt-guard.
Full admin/jury/applicant/mentor UI rewrite. AI prompt hardening with
structured prompts, retry logic, and injection detection. All legacy
pipeline/stage code removed. 4 new migrations + seed aligned.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 23:04:15 +01:00
|
|
|
href: '/jury/competitions',
|
2026-02-17 11:48:14 +01:00
|
|
|
icon: ClipboardList,
|
2026-02-14 15:26:42 +01:00
|
|
|
},
|
2026-06-09 15:44:37 +02:00
|
|
|
{
|
|
|
|
|
name: 'Finalist Documents',
|
|
|
|
|
href: '/jury/finals-documents',
|
|
|
|
|
icon: FileText,
|
|
|
|
|
},
|
2026-02-17 11:48:14 +01:00
|
|
|
...(myAwards && myAwards.length > 0
|
|
|
|
|
? [
|
|
|
|
|
{
|
|
|
|
|
name: 'Awards',
|
|
|
|
|
href: '/jury/awards',
|
|
|
|
|
icon: Trophy,
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
: []),
|
2026-02-14 15:26:42 +01:00
|
|
|
{
|
|
|
|
|
name: 'Learning Hub',
|
2026-03-03 23:09:29 +01:00
|
|
|
href: useExternal ? flags.learningHubExternalUrl : '/jury/learning',
|
2026-02-14 15:26:42 +01:00
|
|
|
icon: BookOpen,
|
2026-03-03 23:09:29 +01:00
|
|
|
external: !!useExternal,
|
2026-02-14 15:26:42 +01:00
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<RoleNav
|
|
|
|
|
navigation={navigation}
|
|
|
|
|
roleName="Jury"
|
|
|
|
|
user={user}
|
|
|
|
|
basePath="/jury"
|
|
|
|
|
statusBadge={<RemainingBadge />}
|
|
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
}
|