feat: admin evaluation editing, ranking improvements, status transition fix
All checks were successful
Build and Push Docker Image / build (push) Successful in 9m26s
All checks were successful
Build and Push Docker Image / build (push) Successful in 9m26s
- Add adminEditEvaluation mutation and getJurorEvaluations query - Create shared EvaluationEditSheet component with inline feedback editing - Add Evaluations tab to member detail page (grouped by round) - Make jury group member names clickable (link to member detail) - Replace inline EvaluationDetailSheet on project page with shared component - Fix project status transition validation (skip when status unchanged) - Fix frontend to not send status when unchanged on project edit - Ranking dashboard improvements and boolean decision converter fixes - Backfill script updates for binary decisions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -33,8 +33,10 @@ import {
|
||||
TableRow,
|
||||
} from '@/components/ui/table'
|
||||
import { toast } from 'sonner'
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
|
||||
import { TagInput } from '@/components/shared/tag-input'
|
||||
import { UserActivityLog } from '@/components/shared/user-activity-log'
|
||||
import { EvaluationEditSheet } from '@/components/admin/evaluation-edit-sheet'
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
@@ -53,6 +55,10 @@ import {
|
||||
Shield,
|
||||
Loader2,
|
||||
AlertCircle,
|
||||
ClipboardList,
|
||||
Eye,
|
||||
ThumbsUp,
|
||||
ThumbsDown,
|
||||
} from 'lucide-react'
|
||||
|
||||
export default function MemberDetailPage() {
|
||||
@@ -73,6 +79,16 @@ export default function MemberDetailPage() {
|
||||
{ enabled: user?.role === 'MENTOR' }
|
||||
)
|
||||
|
||||
// Juror evaluations (only fetched for jury members)
|
||||
const isJuror = user?.role === 'JURY_MEMBER' || user?.roles?.includes('JURY_MEMBER')
|
||||
const { data: jurorEvaluations } = trpc.evaluation.getJurorEvaluations.useQuery(
|
||||
{ userId },
|
||||
{ enabled: !!user && !!isJuror }
|
||||
)
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const [selectedEvaluation, setSelectedEvaluation] = useState<any>(null)
|
||||
|
||||
const [name, setName] = useState('')
|
||||
const [email, setEmail] = useState('')
|
||||
const [role, setRole] = useState<string>('JURY_MEMBER')
|
||||
@@ -207,6 +223,26 @@ export default function MemberDetailPage() {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Tabs defaultValue="profile" className="space-y-6">
|
||||
<TabsList>
|
||||
<TabsTrigger value="profile">
|
||||
<User className="h-4 w-4 mr-1" />
|
||||
Profile
|
||||
</TabsTrigger>
|
||||
{isJuror && (
|
||||
<TabsTrigger value="evaluations">
|
||||
<ClipboardList className="h-4 w-4 mr-1" />
|
||||
Evaluations
|
||||
{jurorEvaluations && jurorEvaluations.length > 0 && (
|
||||
<Badge variant="secondary" className="ml-1.5 text-xs px-1.5 py-0">
|
||||
{jurorEvaluations.length}
|
||||
</Badge>
|
||||
)}
|
||||
</TabsTrigger>
|
||||
)}
|
||||
</TabsList>
|
||||
|
||||
<TabsContent value="profile" className="space-y-6">
|
||||
<div className="grid gap-6 md:grid-cols-2">
|
||||
{/* Basic Info */}
|
||||
<Card>
|
||||
@@ -430,6 +466,121 @@ export default function MemberDetailPage() {
|
||||
Save Changes
|
||||
</Button>
|
||||
</div>
|
||||
</TabsContent>
|
||||
|
||||
{/* Evaluations Tab */}
|
||||
{isJuror && (
|
||||
<TabsContent value="evaluations" className="space-y-4">
|
||||
{!jurorEvaluations || jurorEvaluations.length === 0 ? (
|
||||
<Card>
|
||||
<CardContent className="flex flex-col items-center justify-center py-12 text-center">
|
||||
<ClipboardList className="h-12 w-12 text-muted-foreground/30" />
|
||||
<p className="mt-2 text-muted-foreground">No evaluations submitted yet</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
) : (
|
||||
(() => {
|
||||
// Group evaluations by round
|
||||
const byRound = new Map<string, typeof jurorEvaluations>()
|
||||
for (const ev of jurorEvaluations) {
|
||||
const key = ev.roundName
|
||||
if (!byRound.has(key)) byRound.set(key, [])
|
||||
byRound.get(key)!.push(ev)
|
||||
}
|
||||
return Array.from(byRound.entries()).map(([roundName, evals]) => (
|
||||
<Card key={roundName}>
|
||||
<CardHeader>
|
||||
<CardTitle className="text-base">{roundName}</CardTitle>
|
||||
<CardDescription>{evals.length} evaluation{evals.length !== 1 ? 's' : ''}</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>Project</TableHead>
|
||||
<TableHead>Score</TableHead>
|
||||
<TableHead>Decision</TableHead>
|
||||
<TableHead>Status</TableHead>
|
||||
<TableHead>Submitted</TableHead>
|
||||
<TableHead className="w-10"></TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{evals.map((ev) => (
|
||||
<TableRow key={ev.assignmentId}>
|
||||
<TableCell className="font-medium">
|
||||
<Link
|
||||
href={`/admin/projects/${ev.projectId}`}
|
||||
className="hover:underline text-primary"
|
||||
>
|
||||
{ev.projectTitle}
|
||||
</Link>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
{ev.evaluation.globalScore !== null && ev.evaluation.globalScore !== undefined
|
||||
? <span className="font-medium">{ev.evaluation.globalScore}/10</span>
|
||||
: <span className="text-muted-foreground">-</span>}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
{ev.evaluation.binaryDecision !== null && ev.evaluation.binaryDecision !== undefined ? (
|
||||
ev.evaluation.binaryDecision ? (
|
||||
<div className="flex items-center gap-1 text-green-600">
|
||||
<ThumbsUp className="h-4 w-4" />
|
||||
<span className="text-sm">Yes</span>
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex items-center gap-1 text-red-600">
|
||||
<ThumbsDown className="h-4 w-4" />
|
||||
<span className="text-sm">No</span>
|
||||
</div>
|
||||
)
|
||||
) : (
|
||||
<span className="text-muted-foreground">-</span>
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Badge variant={ev.evaluation.status === 'SUBMITTED' ? 'default' : 'secondary'}>
|
||||
{ev.evaluation.status.replace('_', ' ')}
|
||||
</Badge>
|
||||
</TableCell>
|
||||
<TableCell className="text-sm text-muted-foreground">
|
||||
{ev.evaluation.submittedAt
|
||||
? new Date(ev.evaluation.submittedAt).toLocaleDateString()
|
||||
: '-'}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => setSelectedEvaluation({
|
||||
...ev,
|
||||
user: user,
|
||||
evaluation: ev.evaluation,
|
||||
})}
|
||||
>
|
||||
<Eye className="h-4 w-4" />
|
||||
</Button>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</CardContent>
|
||||
</Card>
|
||||
))
|
||||
})()
|
||||
)}
|
||||
|
||||
<EvaluationEditSheet
|
||||
assignment={selectedEvaluation}
|
||||
open={!!selectedEvaluation}
|
||||
onOpenChange={(open) => { if (!open) setSelectedEvaluation(null) }}
|
||||
onSaved={() => utils.evaluation.getJurorEvaluations.invalidate({ userId })}
|
||||
/>
|
||||
</TabsContent>
|
||||
)}
|
||||
</Tabs>
|
||||
|
||||
|
||||
{/* Super Admin Confirmation Dialog */}
|
||||
<AlertDialog open={showSuperAdminConfirm} onOpenChange={setShowSuperAdminConfirm}>
|
||||
|
||||
Reference in New Issue
Block a user