Add score color logic and evaluation migration

- Introduced `getScoreColors` function to dynamically set badge colors based on skill scores for better visual feedback.
- Updated HomePage to display skill evaluation percentages with corresponding colors.
- Implemented `migrateEvaluation` function to ensure existing evaluations are updated with new skill categories, enhancing data integrity.
- Refactored data loading in `loadSkillCategories` and `loadTeams` to fetch from API endpoints, improving flexibility and maintainability.
This commit is contained in:
Julien Froidefond
2025-08-20 16:50:30 +02:00
parent 38d8e7ec40
commit ab9c35c276
5 changed files with 206 additions and 41 deletions

25
app/api/teams/route.ts Normal file
View File

@@ -0,0 +1,25 @@
import { NextResponse } from "next/server";
import fs from "fs";
import path from "path";
import { Team } from "@/lib/types";
export async function GET() {
try {
const filePath = path.join(process.cwd(), "data", "teams.json");
if (!fs.existsSync(filePath)) {
return NextResponse.json({ teams: [] });
}
const fileContent = fs.readFileSync(filePath, "utf-8");
const data = JSON.parse(fileContent);
return NextResponse.json(data.teams as Team[]);
} catch (error) {
console.error("Error loading teams:", error);
return NextResponse.json(
{ error: "Failed to load teams" },
{ status: 500 }
);
}
}