diff --git a/.eslintrc.cjs b/.eslintrc.cjs
index 869e9ccd..43da3a12 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 347fe1a3..37a8394f 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/about/index.tsx b/src/routes/about/index.tsx
index a1a4b7c6..dc2910ec 100644
--- a/src/routes/about/index.tsx
+++ b/src/routes/about/index.tsx
@@ -62,16 +62,19 @@ export const aboutRoute = new Route({
-
diff --git a/src/routes/homepage/chooseSchool.tsx b/src/routes/homepage/chooseSchool.tsx
index 06e821a0..d82afda9 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/src/routes/viewer/Table/FilterBtn.tsx b/src/routes/viewer/Table/FilterBtn.tsx
index 3466db22..f44dc8a4 100644
--- a/src/routes/viewer/Table/FilterBtn.tsx
+++ b/src/routes/viewer/Table/FilterBtn.tsx
@@ -19,6 +19,7 @@ import {
PopoverTrigger,
} from "@/components/ui/popover";
import { Separator } from "@/components/ui/separator";
+import { useState } from "react";
export type FilterOption = {
originalValue: T;
@@ -38,11 +39,29 @@ export function FilterBtn({
title,
options,
}: Props) {
+ const [open, setOpen] = useState(false);
const facets = column.getFacetedUniqueValues();
const selectedValues = new Set(column?.getFilterValue() as string[]);
+ function handleClearFilter(): void {
+ column?.setFilterValue(undefined);
+ setOpen(false);
+ }
+
+ function handleOptionSelect(
+ option: FilterOption,
+ isSelected: boolean,
+ ): void {
+ if (options.length <= 2) selectedValues.clear(); // filter with radio behaviour
+ if (isSelected) selectedValues.delete(option.value); // toggle behaviour
+ else selectedValues.add(option.value);
+
+ const filterValues = Array.from(selectedValues); // get selected filter options
+ column?.setFilterValue(filterValues.length ? filterValues : undefined); // update table
+ }
+
return (
-
+