From 160bed0927ceaa2193f7bfd51a85ad239173d202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Gonz=C3=A1lez?= Date: Tue, 7 May 2024 18:56:37 +0200 Subject: [PATCH] analysis: grouped categories selector --- client/.eslintrc.cjs | 2 +- client/package.json | 1 + .../src/components/tree-select/component.tsx | 7 +- client/src/components/ui/select.tsx | 33 ++--- .../analysis-chart/impact-chart/component.tsx | 6 +- .../analysis-dynamic-metadata/component.tsx | 13 +- .../analysis-filters/component.tsx | 18 ++- .../analysis-filters/indicators/component.tsx | 88 ------------- .../analysis-filters/indicators/index.tsx | 123 +++++++++++++++++- .../analysis-filters/indicators/map/index.tsx | 116 +++++++++++++++++ .../impact-legend-item/component.tsx | 10 +- .../material-legend-item/component.tsx | 7 +- .../analysis-table/component.tsx | 92 +++++++------ .../analysis-table/types.d.ts | 1 + .../src/containers/mode-control/component.tsx | 23 +++- client/src/hooks/h3-data/utils.ts | 4 +- client/src/hooks/layers/impact.ts | 17 ++- client/src/pages/analysis/chart.tsx | 45 ++++--- client/src/store/features/analysis/filters.ts | 4 +- client/src/store/hooks.ts | 9 ++ client/src/types.d.ts | 1 + client/src/utils/indicator-param.ts | 10 -- client/yarn.lock | 19 +++ 23 files changed, 431 insertions(+), 218 deletions(-) delete mode 100644 client/src/containers/analysis-visualization/analysis-filters/indicators/component.tsx create mode 100644 client/src/containers/analysis-visualization/analysis-filters/indicators/map/index.tsx delete mode 100644 client/src/utils/indicator-param.ts diff --git a/client/.eslintrc.cjs b/client/.eslintrc.cjs index 8f39e003b..155b018fd 100644 --- a/client/.eslintrc.cjs +++ b/client/.eslintrc.cjs @@ -7,7 +7,7 @@ module.exports = { ], plugins: ['prettier'], rules: { - '@typescript-eslint/no-unused-vars': ['warn'], + '@typescript-eslint/no-unused-vars': ['warn', { ignoreRestSiblings: true }], 'import/order': [ 'warn', { diff --git a/client/package.json b/client/package.json index 4c0482036..f98244838 100644 --- a/client/package.json +++ b/client/package.json @@ -76,6 +76,7 @@ "maplibre-gl": "3.6.2", "next": "14.2.2", "next-auth": "4.24.7", + "nuqs": "1.17.2", "postcss": "8.4.31", "query-string": "8.1.0", "rc-tree": "5.7.0", diff --git a/client/src/components/tree-select/component.tsx b/client/src/components/tree-select/component.tsx index 1aea66c27..98ba01415 100644 --- a/client/src/components/tree-select/component.tsx +++ b/client/src/components/tree-select/component.tsx @@ -429,7 +429,12 @@ const InnerTreeSelect = ( {theme === 'inline-primary' && index < currentOptions.length - 1 && ','} ))} - {currentOptions?.length > badgesToShow && ( + {!badgesToShow && currentOptions?.length > 0 && ( + + {currentOptions.length - badgesToShow} selected + + )} + {currentOptions?.length > badgesToShow && Boolean(badgesToShow) && ( {currentOptions.length - badgesToShow} more selected diff --git a/client/src/components/ui/select.tsx b/client/src/components/ui/select.tsx index 989cba607..887be33e7 100644 --- a/client/src/components/ui/select.tsx +++ b/client/src/components/ui/select.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import * as SelectPrimitive from '@radix-ui/react-select'; -import { Check, ChevronDown, ChevronUp } from 'lucide-react'; +import { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/solid'; import { cn } from '@/lib/utils'; @@ -17,14 +17,23 @@ const SelectTrigger = React.forwardRef< span]:line-clamp-1', + 'group flex h-10 w-full items-center justify-between rounded-md border border-gray-200 bg-background px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:border-navy-400 focus:outline-none focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1', className, )} {...props} > {children} - + <> + )); @@ -39,7 +48,7 @@ const SelectScrollUpButton = React.forwardRef< className={cn('flex cursor-default items-center justify-center py-1', className)} {...props} > - +