From 41dfda5f54fa368e82a3186b22b4a47f7b59091c Mon Sep 17 00:00:00 2001 From: David Lougheed Date: Fri, 6 Dec 2024 13:31:06 -0500 Subject: [PATCH 1/6] i18n: missing translations for chart management --- .../Overview/Drawer/ManageChartsDrawer.tsx | 12 ++++++++---- src/js/components/Overview/PublicOverview.tsx | 4 ++-- src/public/locales/en/default_translation_en.json | 3 +++ src/public/locales/fr/default_translation_fr.json | 3 +++ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/js/components/Overview/Drawer/ManageChartsDrawer.tsx b/src/js/components/Overview/Drawer/ManageChartsDrawer.tsx index f50f2854..370b0772 100644 --- a/src/js/components/Overview/Drawer/ManageChartsDrawer.tsx +++ b/src/js/components/Overview/Drawer/ManageChartsDrawer.tsx @@ -6,6 +6,7 @@ import ChartTree from './ChartTree'; import type { ChartDataField } from '@/types/data'; import { useAppSelector, useAppDispatch, useTranslationFn } from '@/hooks'; +import { useSmallScreen } from '@/hooks/useResponsiveContext'; import { hideAllSectionCharts, setAllDisplayedCharts, resetLayout } from '@/features/data/data.store'; const ManageChartsDrawer = ({ onManageDrawerClose, manageDrawerVisible }: ManageChartsDrawerProps) => { @@ -13,6 +14,8 @@ const ManageChartsDrawer = ({ onManageDrawerClose, manageDrawerVisible }: Manage const dispatch = useAppDispatch(); + const isSmallScreen = useSmallScreen(); + const { sections } = useAppSelector((state) => state.data); return ( @@ -21,6 +24,7 @@ const ManageChartsDrawer = ({ onManageDrawerClose, manageDrawerVisible }: Manage placement="right" onClose={onManageDrawerClose} open={manageDrawerVisible} + width={isSmallScreen ? '100vw' : 400} extra={ } @@ -55,7 +59,7 @@ const ManageChartsDrawer = ({ onManageDrawerClose, manageDrawerVisible }: Manage dispatch(setAllDisplayedCharts({ section: sectionTitle })); }} > - Show All + {t('Show All')} diff --git a/src/js/components/Overview/PublicOverview.tsx b/src/js/components/Overview/PublicOverview.tsx index 2c2bfcf2..1add9750 100644 --- a/src/js/components/Overview/PublicOverview.tsx +++ b/src/js/components/Overview/PublicOverview.tsx @@ -25,7 +25,7 @@ const ABOUT_CARD_STYLE = { width: '100%', maxWidth: '1390px', borderRadius: '11p const MANAGE_CHARTS_BUTTON_STYLE = { right: '5em', bottom: '1.5em', transform: 'scale(125%)' }; const PublicOverview = () => { - const { i18n } = useTranslation(); + const { i18n, t } = useTranslation(); const [drawerVisible, setDrawerVisible] = useState(false); const [aboutContent, setAboutContent] = useState(''); @@ -105,7 +105,7 @@ const PublicOverview = () => { } - tooltip="Manage Charts" + tooltip={t('Manage Charts')} style={MANAGE_CHARTS_BUTTON_STYLE} onClick={onManageChartsOpen} /> diff --git a/src/public/locales/en/default_translation_en.json b/src/public/locales/en/default_translation_en.json index 9582a7d1..21d14d27 100644 --- a/src/public/locales/en/default_translation_en.json +++ b/src/public/locales/en/default_translation_en.json @@ -64,6 +64,9 @@ "Download DATS File": "Download DATS File", "Charts": "Charts", "Manage Charts": "Manage Charts", + "Show All": "Show All", + "Reset": "Reset", + "Hide All": "Hide All", "Remove this chart": "Remove this chart", "Width": "Width", "Insufficient data available.": "Insufficient data available.", diff --git a/src/public/locales/fr/default_translation_fr.json b/src/public/locales/fr/default_translation_fr.json index a82f046a..8a280036 100644 --- a/src/public/locales/fr/default_translation_fr.json +++ b/src/public/locales/fr/default_translation_fr.json @@ -64,6 +64,9 @@ "Download DATS File": "Télécharcher le fichier DATS", "Charts": "Tableaux", "Manage Charts": "Gestion des tableaux", + "Show All": "Aff. tous", + "Reset": "Réinit.", + "Hide All": "Cacher tous", "Remove this chart": "Supprimer ce tableau", "Width": "Largeur", "Insufficient data available.": "Pas suffisamment de données.", From ac57386702705011cd305811f43dd2b6a0e8ded4 Mon Sep 17 00:00:00 2001 From: David Lougheed Date: Fri, 6 Dec 2024 13:36:24 -0500 Subject: [PATCH 2/6] lint: comment charts drawer width logic --- src/js/components/Overview/Drawer/ManageChartsDrawer.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/js/components/Overview/Drawer/ManageChartsDrawer.tsx b/src/js/components/Overview/Drawer/ManageChartsDrawer.tsx index 370b0772..c2720c3b 100644 --- a/src/js/components/Overview/Drawer/ManageChartsDrawer.tsx +++ b/src/js/components/Overview/Drawer/ManageChartsDrawer.tsx @@ -24,6 +24,8 @@ const ManageChartsDrawer = ({ onManageDrawerClose, manageDrawerVisible }: Manage placement="right" onClose={onManageDrawerClose} open={manageDrawerVisible} + // If we're on a small device, make the drawer full-screen width instead of a fixed width. + // The default value for Ant Design is 372. width={isSmallScreen ? '100vw' : 400} extra={ From 2b1c42a82f7babe1c7d102ae77573e382586cf71 Mon Sep 17 00:00:00 2001 From: David Lougheed Date: Fri, 6 Dec 2024 13:38:50 -0500 Subject: [PATCH 3/6] style: wider chart drawer + alt show transl --- src/js/components/Overview/Drawer/ManageChartsDrawer.tsx | 2 +- src/public/locales/fr/default_translation_fr.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/components/Overview/Drawer/ManageChartsDrawer.tsx b/src/js/components/Overview/Drawer/ManageChartsDrawer.tsx index c2720c3b..f1034704 100644 --- a/src/js/components/Overview/Drawer/ManageChartsDrawer.tsx +++ b/src/js/components/Overview/Drawer/ManageChartsDrawer.tsx @@ -26,7 +26,7 @@ const ManageChartsDrawer = ({ onManageDrawerClose, manageDrawerVisible }: Manage open={manageDrawerVisible} // If we're on a small device, make the drawer full-screen width instead of a fixed width. // The default value for Ant Design is 372. - width={isSmallScreen ? '100vw' : 400} + width={isSmallScreen ? '100vw' : 420} extra={