From 815feb9631854b6a11eb770fb3d3a5f3b1d0825d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Prod=27homme?= Date: Tue, 15 Oct 2024 10:55:16 +0200 Subject: [PATCH] Update the tables visually --- .../components/positional-scroll/index.tsx | 4 + .../containers/map/content/details/index.tsx | 12 +- .../table/expansion-controls/index.tsx | 2 +- .../map/content/details/table/index.tsx | 181 +++++++++--------- .../details/table/pagination/index.tsx | 2 +- .../table/scrolling-indicators/index.tsx | 20 +- frontend/src/containers/map/content/index.tsx | 2 +- .../panels/details/details-button/index.tsx | 10 +- 8 files changed, 116 insertions(+), 117 deletions(-) diff --git a/frontend/src/components/positional-scroll/index.tsx b/frontend/src/components/positional-scroll/index.tsx index dce19425..9b899a1d 100644 --- a/frontend/src/components/positional-scroll/index.tsx +++ b/frontend/src/components/positional-scroll/index.tsx @@ -24,6 +24,10 @@ const PositionalScroll: React.FC = ({ const handleScroll = useCallback(() => { const target = ref.current; + if (!target) { + return; + } + const xAtStartPosition = target.scrollLeft === 0; const xAtEndPosition = target.scrollLeft === target.scrollWidth - target.clientWidth; diff --git a/frontend/src/containers/map/content/details/index.tsx b/frontend/src/containers/map/content/details/index.tsx index d7c24a3f..275f7c34 100644 --- a/frontend/src/containers/map/content/details/index.tsx +++ b/frontend/src/containers/map/content/details/index.tsx @@ -13,8 +13,6 @@ import CloseIcon from '@/styles/icons/close.svg'; import { FCWithMessages } from '@/types'; import { getGetLocationsQueryOptions, useGetLocations } from '@/types/generated/location'; -import ScrollingIndicators from './table/scrolling-indicators'; - const MapDetails: FCWithMessages = () => { const t = useTranslations('containers.map'); const locale = useLocale(); @@ -135,8 +133,8 @@ const MapDetails: FCWithMessages = () => { }, [locale, tablesSettings, tab, locationsQuery.data]); return ( -
-
+
+

{table.title}

@@ -149,10 +147,8 @@ const MapDetails: FCWithMessages = () => {
-
- - - +
+
); diff --git a/frontend/src/containers/map/content/details/table/expansion-controls/index.tsx b/frontend/src/containers/map/content/details/table/expansion-controls/index.tsx index 3821499e..b77e0271 100644 --- a/frontend/src/containers/map/content/details/table/expansion-controls/index.tsx +++ b/frontend/src/containers/map/content/details/table/expansion-controls/index.tsx @@ -28,7 +28,7 @@ const ExpansionControls: React.FC = ({ row, children }) {isRowExpandable && (
- +
); }; diff --git a/frontend/src/containers/map/content/details/table/pagination/index.tsx b/frontend/src/containers/map/content/details/table/pagination/index.tsx index ba0900f6..faa018ce 100644 --- a/frontend/src/containers/map/content/details/table/pagination/index.tsx +++ b/frontend/src/containers/map/content/details/table/pagination/index.tsx @@ -18,7 +18,7 @@ const Pagination = ({ const t = useTranslations('containers.map'); return ( -
+
{t('results-out-of', { startIndex: pagination.pageIndex * pagination.pageSize + 1, diff --git a/frontend/src/containers/map/content/details/table/scrolling-indicators/index.tsx b/frontend/src/containers/map/content/details/table/scrolling-indicators/index.tsx index 54a10c71..9b459f27 100644 --- a/frontend/src/containers/map/content/details/table/scrolling-indicators/index.tsx +++ b/frontend/src/containers/map/content/details/table/scrolling-indicators/index.tsx @@ -23,16 +23,7 @@ const ScrollingIndicators: React.FC = ({ className, ch {(xScrollPosition === 'start' || xScrollPosition === 'middle') && ( <> - - - - - - + @@ -41,14 +32,7 @@ const ScrollingIndicators: React.FC = ({ className, ch {(xScrollPosition === 'middle' || xScrollPosition === 'end') && ( <> - - - - - - + diff --git a/frontend/src/containers/map/content/index.tsx b/frontend/src/containers/map/content/index.tsx index 332d342a..89c905d5 100644 --- a/frontend/src/containers/map/content/index.tsx +++ b/frontend/src/containers/map/content/index.tsx @@ -11,7 +11,7 @@ const MapContent: FCWithMessages = () => { <> {showDetails && ( -
+
)} diff --git a/frontend/src/containers/map/sidebar/main-panel/panels/details/details-button/index.tsx b/frontend/src/containers/map/sidebar/main-panel/panels/details/details-button/index.tsx index a077ae4f..e870e3e0 100644 --- a/frontend/src/containers/map/sidebar/main-panel/panels/details/details-button/index.tsx +++ b/frontend/src/containers/map/sidebar/main-panel/panels/details/details-button/index.tsx @@ -16,7 +16,7 @@ type DetailsButtonProps = { const DetailsButton: FCWithMessages = ({ className, locationType }) => { const t = useTranslations('containers.map-sidebar-main-panel'); - const [{ tab }, setSettings] = useSyncMapContentSettings(); + const [{ tab, showDetails }, setSettings] = useSyncMapContentSettings(); const handleButtonClick = useCallback(() => { setSettings((prevSettings) => ({ ...prevSettings, showDetails: !prevSettings.showDetails })); @@ -24,7 +24,13 @@ const DetailsButton: FCWithMessages = ({ className, location return (