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:
@@ -1,29 +1,27 @@
|
||||
import { SkillCategory, Team } from "./types";
|
||||
|
||||
// Import direct des données JSON depuis le dossier /data
|
||||
import frontendData from "@/data/skills/frontend.json";
|
||||
import backendData from "@/data/skills/backend.json";
|
||||
import devopsData from "@/data/skills/devops.json";
|
||||
import mobileData from "@/data/skills/mobile.json";
|
||||
import dataData from "@/data/skills/data.json";
|
||||
import cloudData from "@/data/skills/cloud.json";
|
||||
import securityData from "@/data/skills/security.json";
|
||||
import designData from "@/data/skills/design.json";
|
||||
import teamsData from "@/data/teams.json";
|
||||
|
||||
export async function loadSkillCategories(): Promise<SkillCategory[]> {
|
||||
return [
|
||||
frontendData,
|
||||
backendData,
|
||||
devopsData,
|
||||
mobileData,
|
||||
dataData,
|
||||
cloudData,
|
||||
securityData,
|
||||
designData,
|
||||
] as SkillCategory[];
|
||||
try {
|
||||
const response = await fetch("/api/skills");
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
return await response.json();
|
||||
} catch (error) {
|
||||
console.error("Failed to load skill categories:", error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
export async function loadTeams(): Promise<Team[]> {
|
||||
return teamsData.teams as Team[];
|
||||
}
|
||||
try {
|
||||
const response = await fetch("/api/teams");
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
return await response.json();
|
||||
} catch (error) {
|
||||
console.error("Failed to load teams:", error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user