From 44121b3f1d3ddc2a3257e4f4d40a07892d8b1bca Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Tue, 3 Sep 2024 14:48:01 +0200 Subject: [PATCH 01/18] feat: Remove dimensions select in dialog preview --- .../components/add-dataset-dialog.tsx | 237 +++--------------- 1 file changed, 37 insertions(+), 200 deletions(-) diff --git a/app/configurator/components/add-dataset-dialog.tsx b/app/configurator/components/add-dataset-dialog.tsx index 989e5c027..70eebb022 100644 --- a/app/configurator/components/add-dataset-dialog.tsx +++ b/app/configurator/components/add-dataset-dialog.tsx @@ -23,7 +23,6 @@ import { InputAdornment, Link, ListItemText, - ListSubheader, MenuItem, OutlinedInput, paperClasses, @@ -330,8 +329,6 @@ const PreviewDataTable = ({ const locale = useLocale(); const isQueryPaused = !otherCubeComponents || !currentComponents; - const classes = useStyles(); - const cubeFilters = [ { iri: currentComponents!.dimensions?.[0].cubeIri, @@ -363,11 +360,6 @@ const PreviewDataTable = ({ const isFetching = fetchingComponents || observations.fetching || currentCubes.fetching; - const currentCubesByIri = useMemo( - () => keyBy(currentCubes.data?.dataCubesMetadata, (x) => x.iri), - [currentCubes.data?.dataCubesMetadata] - ); - const allColumns = useMemo(() => { const shouldIncludeColumnInPreview = (d: Dimension | Measure) => !isStandardErrorDimension(d); @@ -431,25 +423,6 @@ const PreviewDataTable = ({ otherCubeComponents?.measures, ]); - const dimensionMenuItemsGroups = useMemo(() => { - const allColumnsByCube = groupBy(allColumns, (c) => c.cubeIri); - return [...existingCubes.map((x) => x.iri), otherCube.iri].map( - (cubeIri) => { - return { - cubeIri, - groupName: currentCubesByIri[cubeIri]?.title ?? otherCube.title, - items: allColumnsByCube[cubeIri] ?? [], - }; - } - ); - }, [ - allColumns, - currentCubesByIri, - existingCubes, - otherCube.iri, - otherCube.title, - ]); - const [selectedColumnsRaw, setSelectedColumns] = useState< undefined | string[] >(undefined); @@ -477,44 +450,6 @@ const PreviewDataTable = ({ [selectedColumns] ); - const handleClickDimensionMenuItem = (ev: React.MouseEvent) => { - const columnId = ev.currentTarget.getAttribute("data-column-id"); - if (!columnId) { - return; - } - setSelectedColumns((prev_) => { - const prev = prev_ ?? []; - return selectedColumnsByIri[columnId] - ? prev.filter((x) => x !== columnId) - : [...prev, columnId]; - }); - }; - - const handleClickSelectAllFromCube = (cubeIri: string) => { - setSelectedColumns((prev_) => { - const prev = prev_ ?? []; - return uniq( - prev.concat( - allColumns - .filter((column) => column.cubeIri === cubeIri) - .map((column) => columnId(column)) - ) - ); - }); - }; - - const handleClickUnselectAllFromCube = (cubeIri: string) => { - setSelectedColumns((prev_) => { - const prev = prev_ ?? []; - const toRemove = new Set( - allColumns - .filter((column) => column.cubeIri === cubeIri) - .map((column) => columnId(column)) - ); - return uniq(prev.filter((x) => !toRemove.has(x))); - }); - }; - const previewObservations = useMemo(() => { const data = observations.data?.dataCubesObservations.data ?? []; const bestObservation = maxBy(data, (obs) => { @@ -529,139 +464,46 @@ const PreviewDataTable = ({ return ( <> - - - - Review available dimensions - - - - - Review all available dimensions before continuing to edit your - visualization. - - -
- - Datasets + + + + + Review available dimensions + + + + + Review all available dimensions before continuing to edit your + visualization. + - - - {currentCubes.data?.dataCubesMetadata[0].title} +
+ + Datasets -
- -
- - {otherCube.title} + + + {currentCubes.data?.dataCubesMetadata[0].title} -
- -
-
- - Dimensions - - -
- {isFetching ? : null} - {observations.error ? ( - - - {observations.error.name} - {observations.error.message} - - - ) : null} +
+ + + {isFetching ? : null} + {observations.error ? ( + + + {observations.error.name} + {observations.error.message} + + + ) : null} + {otherCubeComponents ? ( <> {observations.data?.dataCubesObservations ? ( @@ -673,12 +515,7 @@ const PreviewDataTable = ({ gap: 2, }} > - + From 1e1fde5c0458ae44ec32e277a23c9a0265340b1a Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Tue, 3 Sep 2024 15:14:21 +0200 Subject: [PATCH 02/18] feat: Allow closing the Dialog by clicking outside of its content --- app/components/confirmation-dialog.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/components/confirmation-dialog.tsx b/app/components/confirmation-dialog.tsx index 81a4cc6ee..36f47c64c 100644 --- a/app/components/confirmation-dialog.tsx +++ b/app/components/confirmation-dialog.tsx @@ -27,11 +27,8 @@ const ConfirmationDialog = ({ onClose: NonNullable; }) => { const [loading, setLoading] = useState(false); - return ( e.stopPropagation()} maxWidth="xs" {...props} > From 985e33846e43f2e2e06b61e093001ea2b296b4d6 Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Tue, 3 Sep 2024 15:15:28 +0200 Subject: [PATCH 03/18] style: Update styles of ConfirmationDialog --- app/components/confirmation-dialog.tsx | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/app/components/confirmation-dialog.tsx b/app/components/confirmation-dialog.tsx index 36f47c64c..b252404da 100644 --- a/app/components/confirmation-dialog.tsx +++ b/app/components/confirmation-dialog.tsx @@ -9,7 +9,7 @@ import { DialogProps, DialogTitle, } from "@mui/material"; -import React, { useState } from "react"; +import { useState } from "react"; const ConfirmationDialog = ({ title, @@ -30,36 +30,42 @@ const ConfirmationDialog = ({ return ( - - {title ?? + + {title || t({ id: "login.profile.chart.confirmation.default", message: "Are you sure you want to perform this action?", })} {text && ( - - {text} + + + {text} + )} .MuiButton-root": { justifyContent: "center", + minWidth: 76, + minHeight: "fit-content", pointerEvents: loading ? "none" : "auto", }, }} > )} From 8e0c5a1094a5c5e45cd7525226db5f95a8d6bf6f Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Tue, 3 Sep 2024 16:03:10 +0200 Subject: [PATCH 08/18] chore: Codegen --- app/locales/de/messages.po | 14 ++++---------- app/locales/en/messages.po | 14 ++++---------- app/locales/fr/messages.po | 14 ++++---------- app/locales/it/messages.po | 14 ++++---------- 4 files changed, 16 insertions(+), 40 deletions(-) diff --git a/app/locales/de/messages.po b/app/locales/de/messages.po index 57b5c2929..5456c3d45 100644 --- a/app/locales/de/messages.po +++ b/app/locales/de/messages.po @@ -508,12 +508,10 @@ msgstr "Kein Filter" msgid "controls.filter.nb-elements" msgstr "{0} von {1}" -#: app/configurator/components/add-dataset-dialog.tsx #: app/configurator/components/filters.tsx msgid "controls.filter.select.all" msgstr "Alle auswählen" -#: app/configurator/components/add-dataset-dialog.tsx #: app/configurator/components/filters.tsx msgid "controls.filter.select.none" msgstr "Alle abwählen" @@ -1185,14 +1183,6 @@ msgstr "Datensätze" msgid "dataset.search.preview.description" msgstr "Überprüfen Sie alle verfügbaren Dimensionen, bevor Sie mit der Bearbeitung Ihrer Visualisierung fortfahren." -#: app/configurator/components/add-dataset-dialog.tsx -msgid "dataset.search.preview.dimensions" -msgstr "Dimensionen" - -#: app/configurator/components/add-dataset-dialog.tsx -msgid "dataset.search.preview.dimensions-shown" -msgstr "{0} angezeigt in dieser Ansicht" - #: app/configurator/components/add-dataset-dialog.tsx msgid "dataset.search.preview.new-dimension" msgstr "Neu" @@ -1439,6 +1429,10 @@ msgstr "Datensatz" msgid "login.profile.my-visualizations.multiple-datasets" msgstr "" +#: app/login/components/login-menu.tsx +msgid "login.sign-in" +msgstr "" + #: app/components/header.tsx #: app/components/header.tsx msgid "logo.swiss.confederation" diff --git a/app/locales/en/messages.po b/app/locales/en/messages.po index 943bb0210..bd8fc7d3e 100644 --- a/app/locales/en/messages.po +++ b/app/locales/en/messages.po @@ -508,12 +508,10 @@ msgstr "No Filter" msgid "controls.filter.nb-elements" msgstr "{0} of {1}" -#: app/configurator/components/add-dataset-dialog.tsx #: app/configurator/components/filters.tsx msgid "controls.filter.select.all" msgstr "Select all" -#: app/configurator/components/add-dataset-dialog.tsx #: app/configurator/components/filters.tsx msgid "controls.filter.select.none" msgstr "Select none" @@ -1185,14 +1183,6 @@ msgstr "Datasets" msgid "dataset.search.preview.description" msgstr "Review data preview of new available dimensions and continue to edit visualization." -#: app/configurator/components/add-dataset-dialog.tsx -msgid "dataset.search.preview.dimensions" -msgstr "Dimensions" - -#: app/configurator/components/add-dataset-dialog.tsx -msgid "dataset.search.preview.dimensions-shown" -msgstr "{0} shown in this view" - #: app/configurator/components/add-dataset-dialog.tsx msgid "dataset.search.preview.new-dimension" msgstr "New" @@ -1439,6 +1429,10 @@ msgstr "Dataset" msgid "login.profile.my-visualizations.multiple-datasets" msgstr "Multiple datasets" +#: app/login/components/login-menu.tsx +msgid "login.sign-in" +msgstr "Sign in" + #: app/components/header.tsx #: app/components/header.tsx msgid "logo.swiss.confederation" diff --git a/app/locales/fr/messages.po b/app/locales/fr/messages.po index 0bb7e3560..ec8be2c28 100644 --- a/app/locales/fr/messages.po +++ b/app/locales/fr/messages.po @@ -508,12 +508,10 @@ msgstr "Aucune filtre" msgid "controls.filter.nb-elements" msgstr "{0} sur {1}" -#: app/configurator/components/add-dataset-dialog.tsx #: app/configurator/components/filters.tsx msgid "controls.filter.select.all" msgstr "Tout sélectionner" -#: app/configurator/components/add-dataset-dialog.tsx #: app/configurator/components/filters.tsx msgid "controls.filter.select.none" msgstr "Tout déselectionner" @@ -1185,14 +1183,6 @@ msgstr "Ensemble de données" msgid "dataset.search.preview.description" msgstr "Vérifiez les nouvelles dimensions disponibles puis continuez à modifier la visualisation." -#: app/configurator/components/add-dataset-dialog.tsx -msgid "dataset.search.preview.dimensions" -msgstr "Dimensions" - -#: app/configurator/components/add-dataset-dialog.tsx -msgid "dataset.search.preview.dimensions-shown" -msgstr "{0} affichée(s) dans cette vue" - #: app/configurator/components/add-dataset-dialog.tsx msgid "dataset.search.preview.new-dimension" msgstr "Nouveau" @@ -1439,6 +1429,10 @@ msgstr "Ensemble de données" msgid "login.profile.my-visualizations.multiple-datasets" msgstr "" +#: app/login/components/login-menu.tsx +msgid "login.sign-in" +msgstr "" + #: app/components/header.tsx #: app/components/header.tsx msgid "logo.swiss.confederation" diff --git a/app/locales/it/messages.po b/app/locales/it/messages.po index 4ff67a4e4..57094a9bf 100644 --- a/app/locales/it/messages.po +++ b/app/locales/it/messages.po @@ -508,12 +508,10 @@ msgstr "Nessun filtro" msgid "controls.filter.nb-elements" msgstr "{0} di {1}" -#: app/configurator/components/add-dataset-dialog.tsx #: app/configurator/components/filters.tsx msgid "controls.filter.select.all" msgstr "Seleziona tutti" -#: app/configurator/components/add-dataset-dialog.tsx #: app/configurator/components/filters.tsx msgid "controls.filter.select.none" msgstr "Deseleziona tutto" @@ -1185,14 +1183,6 @@ msgstr "Set di dati" msgid "dataset.search.preview.description" msgstr "Esamina tutte le dimensioni disponibili prima di continuare a modificare la visualizzazione." -#: app/configurator/components/add-dataset-dialog.tsx -msgid "dataset.search.preview.dimensions" -msgstr "Dimensioni" - -#: app/configurator/components/add-dataset-dialog.tsx -msgid "dataset.search.preview.dimensions-shown" -msgstr "{0} mostrate in questa vista" - #: app/configurator/components/add-dataset-dialog.tsx msgid "dataset.search.preview.new-dimension" msgstr "Nuovo" @@ -1439,6 +1429,10 @@ msgstr "Set di dati" msgid "login.profile.my-visualizations.multiple-datasets" msgstr "" +#: app/login/components/login-menu.tsx +msgid "login.sign-in" +msgstr "" + #: app/components/header.tsx #: app/components/header.tsx msgid "logo.swiss.confederation" From 2c6843c2f247acf851357219a47092b700402c34 Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Tue, 3 Sep 2024 16:27:49 +0200 Subject: [PATCH 09/18] refactor: Name iconName optional --- app/components/menu-action-item.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/components/menu-action-item.tsx b/app/components/menu-action-item.tsx index 2e3732669..11aa4b513 100644 --- a/app/components/menu-action-item.tsx +++ b/app/components/menu-action-item.tsx @@ -18,7 +18,7 @@ const StyledMenuItem = styled(MenuItem)(({ theme, color }) => ({ export type MenuActionProps = { label: string | NonNullable; - iconName: IconName; + iconName?: IconName; priority?: number; stayOpen?: boolean; color?: "primary" | "error"; @@ -60,7 +60,7 @@ export const MenuActionItem = ( label, color = "primary", }: { - icon: IconName; + icon?: IconName; label: string | NonNullable; color?: MenuActionProps["color"]; }) => { @@ -105,7 +105,9 @@ export const MenuActionItem = ( {...forwardedProps} sx={{ minHeight: 0 }} > - + {icon && ( + + )} {label} From eb59b2022bfa2f572f6ba3465da1d4ce0b60af42 Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Tue, 3 Sep 2024 16:42:49 +0200 Subject: [PATCH 10/18] feat: Add a login popover menu --- app/login/components/login-menu.tsx | 67 +++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 14 deletions(-) diff --git a/app/login/components/login-menu.tsx b/app/login/components/login-menu.tsx index b874b9ea7..9d19fcbb2 100644 --- a/app/login/components/login-menu.tsx +++ b/app/login/components/login-menu.tsx @@ -1,23 +1,62 @@ -import { Trans } from "@lingui/macro"; -import { Box, Button, Link, Typography } from "@mui/material"; -import { signIn } from "next-auth/react"; -import NextLink from "next/link"; +import { t, Trans } from "@lingui/macro"; +import { Button, Typography } from "@mui/material"; +import { signIn, signOut } from "next-auth/react"; +import { useState } from "react"; +import { ArrowMenuTopCenter } from "@/components/arrow-menu"; +import { MenuActionItem } from "@/components/menu-action-item"; +import { ADFS_PROFILE_URL } from "@/domain/env"; import { useUser } from "@/login/utils"; export const LoginMenu = () => { const user = useUser(); - + const [anchorEl, setAnchorEl] = useState(null); return ( - +
{user ? ( - - - - {user.name} - - - + <> + + setAnchorEl(null)} + > + + {ADFS_PROFILE_URL && ( + + )} + await signOut()} + /> + + ) : ( )} - +
); }; From c1ba7a414a6e59195e81e2f6bfe46032e2fc854e Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Tue, 3 Sep 2024 16:43:48 +0200 Subject: [PATCH 11/18] chore: Codegen --- app/locales/de/messages.po | 8 ++++++++ app/locales/en/messages.po | 8 ++++++++ app/locales/fr/messages.po | 8 ++++++++ app/locales/it/messages.po | 8 ++++++++ 4 files changed, 32 insertions(+) diff --git a/app/locales/de/messages.po b/app/locales/de/messages.po index 5456c3d45..2c1967746 100644 --- a/app/locales/de/messages.po +++ b/app/locales/de/messages.po @@ -1405,6 +1405,10 @@ msgstr "Meine Entwürfe" msgid "login.profile.my-published-visualizations" msgstr "Meine Visualisierungen" +#: app/login/components/login-menu.tsx +msgid "login.profile.my-visualizations" +msgstr "" + #: app/login/components/profile-tables.tsx msgid "login.profile.my-visualizations.chart-actions" msgstr "Aktionen" @@ -1433,6 +1437,10 @@ msgstr "" msgid "login.sign-in" msgstr "" +#: app/login/components/login-menu.tsx +msgid "login.sign-out" +msgstr "" + #: app/components/header.tsx #: app/components/header.tsx msgid "logo.swiss.confederation" diff --git a/app/locales/en/messages.po b/app/locales/en/messages.po index bd8fc7d3e..e2c9abf78 100644 --- a/app/locales/en/messages.po +++ b/app/locales/en/messages.po @@ -1405,6 +1405,10 @@ msgstr "My drafts" msgid "login.profile.my-published-visualizations" msgstr "My published visualizations" +#: app/login/components/login-menu.tsx +msgid "login.profile.my-visualizations" +msgstr "My visualizations" + #: app/login/components/profile-tables.tsx msgid "login.profile.my-visualizations.chart-actions" msgstr "Actions" @@ -1433,6 +1437,10 @@ msgstr "Multiple datasets" msgid "login.sign-in" msgstr "Sign in" +#: app/login/components/login-menu.tsx +msgid "login.sign-out" +msgstr "Sign out" + #: app/components/header.tsx #: app/components/header.tsx msgid "logo.swiss.confederation" diff --git a/app/locales/fr/messages.po b/app/locales/fr/messages.po index ec8be2c28..5490d1117 100644 --- a/app/locales/fr/messages.po +++ b/app/locales/fr/messages.po @@ -1405,6 +1405,10 @@ msgstr "Mes visualisations en brouillon" msgid "login.profile.my-published-visualizations" msgstr "Mes visualisations publiées" +#: app/login/components/login-menu.tsx +msgid "login.profile.my-visualizations" +msgstr "" + #: app/login/components/profile-tables.tsx msgid "login.profile.my-visualizations.chart-actions" msgstr "Actions" @@ -1433,6 +1437,10 @@ msgstr "" msgid "login.sign-in" msgstr "" +#: app/login/components/login-menu.tsx +msgid "login.sign-out" +msgstr "" + #: app/components/header.tsx #: app/components/header.tsx msgid "logo.swiss.confederation" diff --git a/app/locales/it/messages.po b/app/locales/it/messages.po index 57094a9bf..fccdbf5e8 100644 --- a/app/locales/it/messages.po +++ b/app/locales/it/messages.po @@ -1405,6 +1405,10 @@ msgstr "Le mie bozze" msgid "login.profile.my-published-visualizations" msgstr "Le mie visualizzazioni" +#: app/login/components/login-menu.tsx +msgid "login.profile.my-visualizations" +msgstr "" + #: app/login/components/profile-tables.tsx msgid "login.profile.my-visualizations.chart-actions" msgstr "Azioni" @@ -1433,6 +1437,10 @@ msgstr "" msgid "login.sign-in" msgstr "" +#: app/login/components/login-menu.tsx +msgid "login.sign-out" +msgstr "" + #: app/components/header.tsx #: app/components/header.tsx msgid "logo.swiss.confederation" From b9b4b3cd2e7ff5ff531fdf16b97345b165540475 Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Tue, 3 Sep 2024 16:47:11 +0200 Subject: [PATCH 12/18] docs: Update CHANGELOG (back-adding features from recent PRs) --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ebe03f69..70b779b69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ You can also check the # Unreleased +- Features + - It's now possible to label individual chart tabs - Fixes - Map is now correctly centered after copying a chart or switching to layout mode @@ -20,6 +22,7 @@ You can also check the - Renaming of charts through user profile now works correctly - Manually entering dates in date pickers works correctly again - Improved scrolling behavior in the chart tabs +- Style - Aligned editor and layouting page layouts # [4.7.4] - 2024-07-23 From c07eb586d6ca3dab061cb05eb0909bcefbf8ac55 Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Tue, 3 Sep 2024 17:02:32 +0200 Subject: [PATCH 13/18] docs: Update CHANGELOG --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70b779b69..1b9ac8c58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,11 @@ You can also check the - Features - It's now possible to label individual chart tabs + - Time is now displayed in addition to date in `Last edit` column in user + profile + - Free canvas layout option now includes a 3-column layout, depending on the + screen width + - Added a new popover login menu - Fixes - Map is now correctly centered after copying a chart or switching to layout mode @@ -24,6 +29,8 @@ You can also check the - Improved scrolling behavior in the chart tabs - Style - Aligned editor and layouting page layouts + - Removed dimension selection from modal when merging cubes + - Updated styles of confirmation dialog # [4.7.4] - 2024-07-23 From b56dcba13e8f3de7b1aa4f984b65ee1b6b896fc3 Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Wed, 4 Sep 2024 08:38:35 +0200 Subject: [PATCH 14/18] style: Constrain tab label width --- app/components/chart-selection-tabs.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/app/components/chart-selection-tabs.tsx b/app/components/chart-selection-tabs.tsx index d1530a713..babd96c5a 100644 --- a/app/components/chart-selection-tabs.tsx +++ b/app/components/chart-selection-tabs.tsx @@ -544,6 +544,7 @@ export const useIconStyles = makeStyles< flexWrap: "nowrap", whiteSpace: "nowrap", minWidth: 0, + maxWidth: 400, overflow: "hidden", minHeight: "100%", position: "relative", From 3c23415ba48726ba757eb750319f94933e0c457e Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Wed, 4 Sep 2024 08:49:42 +0200 Subject: [PATCH 15/18] feat: Add dataset back to chart footnotes --- app/components/chart-footnotes.tsx | 9 +++++++++ app/components/metadata-panel.tsx | 10 +++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app/components/chart-footnotes.tsx b/app/components/chart-footnotes.tsx index d744f37dc..3731be0f5 100644 --- a/app/components/chart-footnotes.tsx +++ b/app/components/chart-footnotes.tsx @@ -7,6 +7,7 @@ import { useMemo } from "react"; import { extractChartConfigComponentIris } from "@/charts/shared/chart-helpers"; import { LegendItem } from "@/charts/shared/legend-color"; import { ChartFiltersList } from "@/components/chart-filters-list"; +import { OpenMetadataPanelWrapper } from "@/components/metadata-panel"; import { ChartConfig, ComboLineColumnConfig, @@ -96,8 +97,16 @@ export const ChartFootnotes = ({ components={components} cubeIri={metadata.iri} /> + + + Dataset + + : + {metadata.title} + {metadata.dateModified ? ( + {", "} Latest data update : {formatLocale.format("%d.%m.%Y %H:%M")( diff --git a/app/components/metadata-panel.tsx b/app/components/metadata-panel.tsx index 880b56d1f..1746a12bf 100644 --- a/app/components/metadata-panel.tsx +++ b/app/components/metadata-panel.tsx @@ -211,13 +211,17 @@ export const OpenMetadataPanelWrapper = ({ component, }: { children: ReactNode; - component: Component; + component?: Component; }) => { const classes = useOtherStyles(); - const { openDimension } = useMetadataPanelStoreActions(); + const { openDimension, setOpen } = useMetadataPanelStoreActions(); const handleClick = useEvent((e: React.MouseEvent) => { e.stopPropagation(); - openDimension(component); + if (component) { + openDimension(component); + } else { + setOpen(true); + } }); return ( From b998c848320257e1e6021a386426d43dfcdd58c0 Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Wed, 4 Sep 2024 08:50:07 +0200 Subject: [PATCH 16/18] chore: Codegen --- app/locales/de/messages.po | 5 +++++ app/locales/en/messages.po | 5 +++++ app/locales/fr/messages.po | 5 +++++ app/locales/it/messages.po | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/app/locales/de/messages.po b/app/locales/de/messages.po index 2c1967746..3fb6f75c9 100644 --- a/app/locales/de/messages.po +++ b/app/locales/de/messages.po @@ -1083,6 +1083,10 @@ msgstr "Enthält Wert von" msgid "dataset-result.shared-dimensions" msgstr "Geteilte Dimensionen" +#: app/components/chart-footnotes.tsx +msgid "dataset.footnotes.dataset" +msgstr "" + #: app/components/chart-footnotes.tsx msgid "dataset.footnotes.updated" msgstr "Neuestes Datenupdate" @@ -1552,6 +1556,7 @@ msgstr "Woche" msgid "time-units.Year" msgstr "Jahr" +#: app/components/chart-footnotes.tsx #: app/components/chart-footnotes.tsx msgid "typography.colon" msgstr ": " diff --git a/app/locales/en/messages.po b/app/locales/en/messages.po index e2c9abf78..baefd055c 100644 --- a/app/locales/en/messages.po +++ b/app/locales/en/messages.po @@ -1083,6 +1083,10 @@ msgstr "Contains values from" msgid "dataset-result.shared-dimensions" msgstr "Shared dimensions:" +#: app/components/chart-footnotes.tsx +msgid "dataset.footnotes.dataset" +msgstr "Dataset" + #: app/components/chart-footnotes.tsx msgid "dataset.footnotes.updated" msgstr "Latest data update" @@ -1552,6 +1556,7 @@ msgstr "Week" msgid "time-units.Year" msgstr "Year" +#: app/components/chart-footnotes.tsx #: app/components/chart-footnotes.tsx msgid "typography.colon" msgstr ":" diff --git a/app/locales/fr/messages.po b/app/locales/fr/messages.po index 5490d1117..3ff318e74 100644 --- a/app/locales/fr/messages.po +++ b/app/locales/fr/messages.po @@ -1083,6 +1083,10 @@ msgstr "Contient des valeurs de" msgid "dataset-result.shared-dimensions" msgstr "Dimensions partagées" +#: app/components/chart-footnotes.tsx +msgid "dataset.footnotes.dataset" +msgstr "" + #: app/components/chart-footnotes.tsx msgid "dataset.footnotes.updated" msgstr "Mise à jour des données" @@ -1552,6 +1556,7 @@ msgstr "Semaine" msgid "time-units.Year" msgstr "Année" +#: app/components/chart-footnotes.tsx #: app/components/chart-footnotes.tsx msgid "typography.colon" msgstr " : " diff --git a/app/locales/it/messages.po b/app/locales/it/messages.po index fccdbf5e8..ca4896101 100644 --- a/app/locales/it/messages.po +++ b/app/locales/it/messages.po @@ -1083,6 +1083,10 @@ msgstr "Contiene valore da" msgid "dataset-result.shared-dimensions" msgstr "Dimensioni condivise" +#: app/components/chart-footnotes.tsx +msgid "dataset.footnotes.dataset" +msgstr "" + #: app/components/chart-footnotes.tsx msgid "dataset.footnotes.updated" msgstr "Ultimo aggiornamento dei dati" @@ -1552,6 +1556,7 @@ msgstr "Settimana" msgid "time-units.Year" msgstr "Anno" +#: app/components/chart-footnotes.tsx #: app/components/chart-footnotes.tsx msgid "typography.colon" msgstr ": " From 8236dd9acf02402e48911bf933309826ea5f7d74 Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Wed, 4 Sep 2024 08:53:31 +0200 Subject: [PATCH 17/18] refactor: Improve variable names --- app/components/metadata-panel-store.tsx | 40 ++++++++++++++----------- app/components/metadata-panel.tsx | 22 +++++++------- 2 files changed, 33 insertions(+), 29 deletions(-) diff --git a/app/components/metadata-panel-store.tsx b/app/components/metadata-panel-store.tsx index 609c1c178..c107f9460 100644 --- a/app/components/metadata-panel-store.tsx +++ b/app/components/metadata-panel-store.tsx @@ -9,14 +9,14 @@ type MetadataPanelSection = "general" | "data"; type MetadataPanelState = { open: boolean; activeSection: MetadataPanelSection; - selectedDimension: Component | undefined; + selectedComponent: Component | undefined; actions: { - setOpen: (d: boolean) => void; + setOpen: (open: boolean) => void; toggle: () => void; - setActiveSection: (d: MetadataPanelSection) => void; - setSelectedDimension: (d: Component) => void; - clearSelectedDimension: () => void; - openDimension: (d: Component) => void; + setActiveSection: (activeSection: MetadataPanelSection) => void; + setSelectedComponent: (component: Component) => void; + clearSelectedComponent: () => void; + openComponent: (component: Component) => void; reset: () => void; }; }; @@ -25,28 +25,32 @@ export const createMetadataPanelStore = () => createStore((set, get) => ({ open: false, activeSection: "general", - selectedDimension: undefined, + selectedComponent: undefined, actions: { - setOpen: (d: boolean) => { - set({ open: d }); + setOpen: (open: boolean) => { + set({ open }); }, toggle: () => { set({ open: !get().open }); }, - setActiveSection: (d: MetadataPanelSection) => { - set({ activeSection: d }); + setActiveSection: (section: MetadataPanelSection) => { + set({ activeSection: section }); }, - setSelectedDimension: (d: Component) => { - set({ selectedDimension: d }); + setSelectedComponent: (component: Component) => { + set({ selectedComponent: component }); }, - clearSelectedDimension: () => { - set({ selectedDimension: undefined }); + clearSelectedComponent: () => { + set({ selectedComponent: undefined }); }, - openDimension: (d: Component) => { - set({ open: true, activeSection: "data", selectedDimension: d }); + openComponent: (component: Component) => { + set({ + open: true, + activeSection: "data", + selectedComponent: component, + }); }, reset: () => { - set({ activeSection: "general", selectedDimension: undefined }); + set({ activeSection: "general", selectedComponent: undefined }); }, }, })); diff --git a/app/components/metadata-panel.tsx b/app/components/metadata-panel.tsx index 1746a12bf..402451099 100644 --- a/app/components/metadata-panel.tsx +++ b/app/components/metadata-panel.tsx @@ -175,7 +175,7 @@ const useOtherStyles = makeStyles((theme) => { borderBottom: "none", }, }, - openDimension: { + openComponent: { minHeight: 0, verticalAlign: "baseline", padding: 0, @@ -214,11 +214,11 @@ export const OpenMetadataPanelWrapper = ({ component?: Component; }) => { const classes = useOtherStyles(); - const { openDimension, setOpen } = useMetadataPanelStoreActions(); + const { openComponent, setOpen } = useMetadataPanelStoreActions(); const handleClick = useEvent((e: React.MouseEvent) => { e.stopPropagation(); if (component) { - openDimension(component); + openComponent(component); } else { setOpen(true); } @@ -226,7 +226,7 @@ export const OpenMetadataPanelWrapper = ({ return (