diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 869e9cc..43da3a1 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -10,6 +10,7 @@ module.exports = { parserOptions: { ecmaVersion: "latest", sourceType: "module" }, plugins: ["react-refresh", "prettier"], rules: { + "@typescript-eslint/switch-exhaustiveness-check": "error", "react-refresh/only-export-components": "warn", "prettier/prettier": "warn", }, diff --git a/src/components/custom-ui/Alert.tsx b/src/components/custom-ui/Alert.tsx index 347fe1a..37a8394 100644 --- a/src/components/custom-ui/Alert.tsx +++ b/src/components/custom-ui/Alert.tsx @@ -38,19 +38,27 @@ export default function Alert({ } function GetIcon(level: Level) { - if (level === "error") return ; - if (level === "warning") return ; - if (level === "info") return ; - if (level === "success") return ; + switch (level) { + case "error": + return ; + case "warning": + return ; + case "info": + return ; + case "success": + return ; + } } const getColors = (level: Level) => { - if (level === "error") - return "bg-red-300/5 border-red-600 text-red-600 dark:bg-red-100/5 dark:border-red-300 dark:text-red-300"; - if (level === "warning") - return "bg-amber-300/5 border-amber-600 text-amber-600 dark:bg-amber-100/5 dark:border-amber-200 dark:text-amber-200"; - if (level === "info") - return "bg-sky-300/5 border-sky-600 text-sky-600 dark:bg-sky-100/5 dark:border-sky-200 dark:text-sky-200"; - if (level === "success") - return "bg-green-300/5 border-green-600 text-green-600 dark:bg-green-100/5 dark:border-green-200 dark:text-green-200"; + switch (level) { + case "error": + return "bg-red-300/5 border-red-600 text-red-600 dark:bg-red-100/5 dark:border-red-300 dark:text-red-300"; + case "warning": + return "bg-amber-300/5 border-amber-600 text-amber-600 dark:bg-amber-100/5 dark:border-amber-200 dark:text-amber-200"; + case "info": + return "bg-sky-300/5 border-sky-600 text-sky-600 dark:bg-sky-100/5 dark:border-sky-200 dark:text-sky-200"; + case "success": + return "bg-green-300/5 border-green-600 text-green-600 dark:bg-green-100/5 dark:border-green-200 dark:text-green-200"; + } }; diff --git a/src/routes/homepage/chooseSchool.tsx b/src/routes/homepage/chooseSchool.tsx index 06e821a..d82afda 100644 --- a/src/routes/homepage/chooseSchool.tsx +++ b/src/routes/homepage/chooseSchool.tsx @@ -3,6 +3,20 @@ import { Button } from "@/components/ui/button"; import { homepageRoute } from "."; import { ButtonGrid } from "@/components/Homepage/ButtonGrid"; import DevSettings from "@/components/DevSettings"; +import School from "@/utils/types/data/School"; + +function getSchoolEmoji(school: School) { + switch (school) { + case "Architettura": + return (📐); + case "Design": + return (🖌️); + case "Ingegneria": + return (🛠️); + case "Urbanistica": + return (🏡); + } +} export const chooseSchoolRoute = new Route({ getParentRoute: () => homepageRoute, @@ -37,6 +51,7 @@ export const chooseSchoolRoute = new Route({ className="h-full" > diff --git a/tsconfig.json b/tsconfig.json index ea0727c..ad6b6e1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,9 +15,11 @@ /* Linting */ "strict": true, + "strictNullChecks": true, "noUnusedLocals": true, "noUnusedParameters": true, "noFallthroughCasesInSwitch": true, + "noImplicitReturns": true, // for shadcn/ui "baseUrl": ".",