From 7b4fd2e13a549e0099a53443ac7a6cd301919055 Mon Sep 17 00:00:00 2001 From: atrincas Date: Tue, 17 Dec 2024 08:31:15 +0100 Subject: [PATCH] Refactor disabling parameters options --- client/src/app/(overview)/url-store.ts | 13 +++++++++++++ .../containers/overview/header/parameters/index.tsx | 12 ++++++------ .../overview/project-details/parameters/index.tsx | 11 +++++------ 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/client/src/app/(overview)/url-store.ts b/client/src/app/(overview)/url-store.ts index 5aff30ce..99d2afd1 100644 --- a/client/src/app/(overview)/url-store.ts +++ b/client/src/app/(overview)/url-store.ts @@ -23,6 +23,19 @@ import { TABLE_VIEWS } from "@/containers/overview/table/toolbar/table-selector" const SUB_ACTIVITIES = RESTORATION_ACTIVITY_SUBTYPE; +interface ParameterOption { + label: string; + value: string; + disabled?: boolean; +} + +export interface Parameter { + key: keyof Omit, "keyword">; + label: string; + className: string; + options: ParameterOption[]; +} + export const filtersSchema = z.object({ [FILTER_KEYS[0]]: z.string().optional(), [FILTER_KEYS[1]]: z.nativeEnum(PROJECT_SIZE_FILTER), diff --git a/client/src/containers/overview/header/parameters/index.tsx b/client/src/containers/overview/header/parameters/index.tsx index e54e32ad..3bab65cc 100644 --- a/client/src/containers/overview/header/parameters/index.tsx +++ b/client/src/containers/overview/header/parameters/index.tsx @@ -6,7 +6,7 @@ import { import { z } from "zod"; import { FILTER_KEYS } from "@/app/(overview)/constants"; -import { useGlobalFilters } from "@/app/(overview)/url-store"; +import { Parameter, useGlobalFilters } from "@/app/(overview)/url-store"; import { filtersSchema } from "@/app/(overview)/url-store"; import { INITIAL_COST_RANGE } from "@/containers/overview/filters/constants"; @@ -19,7 +19,8 @@ import { SelectTrigger, SelectValue, } from "@/components/ui/select"; -export const PROJECT_PARAMETERS = [ + +export const PROJECT_PARAMETERS: Parameter[] = [ { key: FILTER_KEYS[1], label: "Project size", @@ -51,6 +52,7 @@ export const PROJECT_PARAMETERS = [ { label: PROJECT_PRICE_TYPE.OPEN_BREAK_EVEN_PRICE, value: PROJECT_PRICE_TYPE.OPEN_BREAK_EVEN_PRICE, + disabled: true, }, ], }, @@ -94,7 +96,7 @@ export default function ParametersProjects() { { handleParameters(v, parameter.key); }} @@ -112,9 +113,7 @@ export default function ParametersProjects() { {option.label}