Compare commits

..

3 Commits

Author SHA1 Message Date
ee3bfec8b0 Add Tremor design tokens for Tailwind v4 compatibility
All checks were successful
Build and Push Docker Image / build (push) Successful in 8m27s
Tremor v3 expects its TW3 plugin to register tremor-* design tokens
(tremor-content, tremor-background, tremor-border, etc.). Since TW4
has no v3 plugin support, define these tokens manually in @theme and
safelist the utility classes via @source inline().

This fixes chart axis labels, grid lines, and tooltips rendering
without proper colors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 01:43:11 +01:00
8e607478d5 Fix Tremor chart colors: safelist dynamic utility classes for Tailwind v4
Tremor constructs class names via template literals (e.g. fill-${color}-${shade})
which Tailwind v4's scanner cannot detect statically. Added @source inline()
directives to explicitly safelist all color×shade×property combinations needed
by Tremor chart components.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 01:39:24 +01:00
6d4ee93ab3 Fix round completion rate: use evaluations/assignments, closed rounds=100%
The round breakdown was showing 200% for active rounds (assignments/projects)
and 0% for closed rounds. Now correctly computes evaluations/assignments for
active rounds and shows 100% for closed/archived rounds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 01:34:42 +01:00
3 changed files with 59 additions and 6 deletions

View File

@@ -72,7 +72,7 @@ type Stage = {
status: string
roundType: string
windowCloseAt: Date | null
_count: { projects: number; assignments: number }
_count: { projects: number; assignments: number; evaluations: number }
programId: string
programName: string
}
@@ -288,7 +288,13 @@ function ProgressTab({ selectedValue, stages, stagesLoading, selectedRound }: {
{stages.map((stage) => {
const projects = stage._count.projects
const assignments = stage._count.assignments
const rate = assignments > 0 && projects > 0 ? Math.round((assignments / projects) * 100) : 0
const evaluations = stage._count.evaluations
const isClosed = stage.status === 'ROUND_CLOSED' || stage.status === 'ROUND_ARCHIVED'
const rate = isClosed
? 100
: assignments > 0
? Math.min(100, Math.round((evaluations / assignments) * 100))
: 0
return (
<TableRow key={stage.id}>
<TableCell>
@@ -335,7 +341,13 @@ function ProgressTab({ selectedValue, stages, stagesLoading, selectedRound }: {
{stages.map((stage) => {
const projects = stage._count.projects
const assignments = stage._count.assignments
const rate = assignments > 0 && projects > 0 ? Math.round((assignments / projects) * 100) : 0
const evaluations = stage._count.evaluations
const isClosed = stage.status === 'ROUND_CLOSED' || stage.status === 'ROUND_ARCHIVED'
const rate = isClosed
? 100
: assignments > 0
? Math.min(100, Math.round((evaluations / assignments) * 100))
: 0
return (
<Card key={stage.id}>
<CardContent className="pt-4 space-y-3">
@@ -770,7 +782,7 @@ function ReportsPageContent() {
const { data: programs, isLoading: stagesLoading } = trpc.program.list.useQuery({ includeStages: true })
const stages: Stage[] = programs?.flatMap(p =>
((p.stages || []) as { id: string; name: string; status: string; roundType: string; windowCloseAt: Date | null; _count: { projects: number; assignments: number } }[]).map(s => ({
((p.stages || []) as { id: string; name: string; status: string; roundType: string; windowCloseAt: Date | null; _count: { projects: number; assignments: number; evaluations: number } }[]).map(s => ({
...s,
programId: p.id,
programName: `${p.year} Edition`,

View File

@@ -43,10 +43,44 @@
/* Source the JS config for extended theme values */
@config "../../tailwind.config.ts";
/* Tremor generates Tailwind utility classes dynamically (fill-blue-500, bg-emerald-500, etc.)
Tailwind v4 needs to scan Tremor's compiled JS to include them in the output. */
/* Tremor generates Tailwind utility classes dynamically via template literals
(e.g. `fill-${color}-${shade}`). Tailwind v4's scanner cannot detect these,
so we must explicitly safelist every color+shade+property combination. */
@source "../../node_modules/@tremor/react/dist/**/*.js";
/* Safelist Tremor chart color utilities — all colors × key shades × fill/stroke/bg */
@source inline("{fill,stroke,bg,text}-{blue,emerald,amber,violet,rose,indigo,sky,fuchsia,lime,orange,cyan,teal,purple,slate,gray,zinc,neutral,stone,red,yellow,green,pink}-{50,100,200,300,400,500,600,700,800,900,950}");
@source inline("hover:{bg,text,border}-{blue,emerald,amber,violet,rose,indigo,sky,fuchsia,lime,orange,cyan,teal,purple,slate,gray,zinc,neutral,stone,red,yellow,green,pink}-{50,100,200,300,400,500,600,700,800,900,950}");
@source inline("{border,ring}-{blue,emerald,amber,violet,rose,indigo,sky,fuchsia,lime,orange,cyan,teal,purple,slate,gray,zinc,neutral,stone,red,yellow,green,pink}-{50,100,200,300,400,500,600,700,800,900,950}");
/* Safelist Tremor design token utility classes */
@source inline("{fill,stroke,bg,text,border}-tremor-{brand,background,border,content,content-emphasis,default,label,card,dropdown}");
/* Tremor design tokens — normally registered by Tremor's TW3 plugin.
We define them manually for Tailwind v4 compatibility. */
@theme {
--color-tremor-brand: var(--color-blue-500);
--color-tremor-brand-emphasis: var(--color-blue-700);
--color-tremor-brand-inverted: #fff;
--color-tremor-brand-muted: var(--color-blue-200);
--color-tremor-brand-faint: var(--color-blue-50);
--color-tremor-background: #fff;
--color-tremor-background-emphasis: var(--color-gray-700);
--color-tremor-background-muted: var(--color-gray-50);
--color-tremor-background-subtle: var(--color-gray-100);
--color-tremor-border: var(--color-gray-200);
--color-tremor-content: var(--color-gray-500);
--color-tremor-content-emphasis: var(--color-gray-700);
--color-tremor-content-strong: var(--color-gray-900);
--color-tremor-content-subtle: var(--color-gray-400);
--color-tremor-content-inverted: #fff;
--color-tremor-ring: var(--color-gray-200);
--color-tremor-default: var(--color-gray-500);
--color-tremor-label: var(--color-gray-400);
--color-tremor-card: #fff;
--color-tremor-dropdown: #fff;
}
/* Theme variables - using CSS custom properties with Tailwind v4 @theme */
@theme {
/* Container */

View File

@@ -34,6 +34,10 @@ export const programRouter = router({
_count: {
select: { assignments: true, projectRoundStates: true },
},
assignments: {
where: { evaluation: { status: 'SUBMITTED' } },
select: { id: true },
},
},
},
},
@@ -52,9 +56,11 @@ export const programRouter = router({
// Provide `stages` as alias for backward compatibility
stages: allRounds.map((round: any) => ({
...round,
assignments: undefined, // don't leak raw assignments array
_count: {
projects: round._count?.projectRoundStates || 0,
assignments: round._count?.assignments || 0,
evaluations: round.assignments?.length || 0,
},
})),
// Main rounds array
@@ -68,6 +74,7 @@ export const programRouter = router({
_count: {
projects: round._count?.projectRoundStates || 0,
assignments: round._count?.assignments || 0,
evaluations: round.assignments?.length || 0,
},
})),
}