diff --git a/client/src/components/ui/score-card.tsx b/client/src/components/ui/score-card.tsx index fa469504..03a5ae96 100644 --- a/client/src/components/ui/score-card.tsx +++ b/client/src/components/ui/score-card.tsx @@ -5,13 +5,12 @@ import { cn } from "@/lib/utils"; interface ScoreIndicatorProps { className?: string; children?: React.ReactNode; - bgColorClasses?: Record; } -export const DEFAULT_BG_CLASSES = { - high: "bg-high", - medium: "bg-medium", - low: "bg-low", +export const DEFAULT_BG_CLASSES: Record = { + [PROJECT_SCORE.HIGH]: "bg-high", + [PROJECT_SCORE.MEDIUM]: "bg-medium", + [PROJECT_SCORE.LOW]: "bg-low", }; export const ScoreIndicator = ({ diff --git a/client/src/containers/overview/filters/index.tsx b/client/src/containers/overview/filters/index.tsx index 4ec22527..afcce826 100644 --- a/client/src/containers/overview/filters/index.tsx +++ b/client/src/containers/overview/filters/index.tsx @@ -76,7 +76,7 @@ export default function ProjectsFilters() { setFiltersOpen((prev) => ({ ...prev, filtersOpen: false })); }; - const { queryKey } = queryKeys.tables.countries; + const { queryKey } = queryKeys.countries.all; const { data: countryOptions } = client.projects.getProjectCountries.useQuery( queryKey, {}, diff --git a/client/src/containers/overview/table/utils.ts b/client/src/containers/overview/table/utils.ts index 7c351913..296ff8d1 100644 --- a/client/src/containers/overview/table/utils.ts +++ b/client/src/containers/overview/table/utils.ts @@ -2,7 +2,7 @@ import { z } from "zod"; import { filtersSchema } from "@/app/(overview)/url-store"; -import { scorecardFiltersSchema } from "./view/scorecard-prioritization/schema"; +import { scorecardFiltersSchema } from "@/containers/overview/table/view/scorecard-prioritization/schema"; export const NO_DATA = []; @@ -16,8 +16,7 @@ const OMITTED_FIELDS = [ export const filtersToQueryParams = ( filters: z.infer, ) => { - debugger; - const queryParams = Object.keys(filters) + return Object.keys(filters) .filter((key) => !OMITTED_FIELDS.includes(key)) .reduce( (acc, key) => ({ @@ -28,5 +27,4 @@ export const filtersToQueryParams = ( }), {}, ); - return queryParams; }; diff --git a/client/src/containers/overview/table/view/scorecard-prioritization/schema.ts b/client/src/containers/overview/table/view/scorecard-prioritization/schema.ts index 0f596461..f51472f2 100644 --- a/client/src/containers/overview/table/view/scorecard-prioritization/schema.ts +++ b/client/src/containers/overview/table/view/scorecard-prioritization/schema.ts @@ -1,6 +1,7 @@ import { PROJECT_SCORE } from "@shared/entities/project-score.enum"; import { z } from "zod"; +// todo: replace this schema with the one coming from create-custom-project.schema.ts once implemented there. export const scorecardFiltersSchema = z.object({ availabilityOfExperiencedLabor: z.nativeEnum(PROJECT_SCORE).optional(), availabilityOfAlternatingFunding: z.nativeEnum(PROJECT_SCORE).optional(), diff --git a/client/src/lib/query-keys.ts b/client/src/lib/query-keys.ts index 3727a3d9..d0a6a303 100644 --- a/client/src/lib/query-keys.ts +++ b/client/src/lib/query-keys.ts @@ -22,6 +22,10 @@ export const geometriesKeys = createQueryKeys("geometries", { all: (filters: z.infer) => [filters], }); +export const countriesKeys = createQueryKeys("countries", { + all: null, +}); + export const tableKeys = createQueryKeys("tables", { all: ( tableView: (typeof TABLE_VIEWS)[number], @@ -32,7 +36,6 @@ export const tableKeys = createQueryKeys("tables", { }, ) => ["all", tableView, filters], id: (id: string) => [id], - countries: null, }); export const queryKeys = mergeQueryKeys( @@ -40,4 +43,5 @@ export const queryKeys = mergeQueryKeys( userKeys, geometriesKeys, tableKeys, + countriesKeys, );