From 368707ed76c2a94688579dd69170fe9bdb4680d8 Mon Sep 17 00:00:00 2001 From: MauriceNino Date: Tue, 14 Feb 2023 13:01:12 +0100 Subject: [PATCH] Add translations for en & de in Dashdot; Fix PR comments --- public/locales/da/modules/dashdot.json | 2 +- public/locales/de/modules/dashdot.json | 80 ++++++++++++++++--- public/locales/el/modules/dashdot.json | 2 +- public/locales/en/modules/dashdot.json | 80 ++++++++++++++++--- public/locales/es/modules/dashdot.json | 2 +- public/locales/fr/modules/dashdot.json | 2 +- public/locales/he/modules/dashdot.json | 2 +- public/locales/it/modules/dashdot.json | 2 +- public/locales/ja/modules/dashdot.json | 2 +- public/locales/ko/modules/dashdot.json | 2 +- public/locales/lol/modules/dashdot.json | 2 +- public/locales/nl/modules/dashdot.json | 2 +- public/locales/no/modules/dashdot.json | 2 +- public/locales/pl/modules/dashdot.json | 2 +- public/locales/pt/modules/dashdot.json | 2 +- public/locales/ru/modules/dashdot.json | 2 +- public/locales/sk/modules/dashdot.json | 2 +- public/locales/sl/modules/dashdot.json | 2 +- public/locales/sv/modules/dashdot.json | 2 +- public/locales/uk/modules/dashdot.json | 2 +- public/locales/vi/modules/dashdot.json | 2 +- public/locales/zh/modules/dashdot.json | 2 +- .../Dashboard/Tiles/Widgets/DraggableList.tsx | 12 +-- .../Tiles/Widgets/WidgetsEditModal.tsx | 4 +- src/widgets/dashDot/DashDotGraph.tsx | 22 +++-- 25 files changed, 177 insertions(+), 61 deletions(-) diff --git a/public/locales/da/modules/dashdot.json b/public/locales/da/modules/dashdot.json index 5842ba00b..99469ca96 100644 --- a/public/locales/da/modules/dashdot.json +++ b/public/locales/da/modules/dashdot.json @@ -50,7 +50,7 @@ "cpu": { "title": "CPU" }, - "memory": { + "ram": { "title": "RAM" }, "gpu": { diff --git a/public/locales/de/modules/dashdot.json b/public/locales/de/modules/dashdot.json index eda1d7840..89d6d8e9f 100644 --- a/public/locales/de/modules/dashdot.json +++ b/public/locales/de/modules/dashdot.json @@ -4,23 +4,77 @@ "description": "Zeigt die Graphen einer externen Dash.-Instanz innerhalb von Homarr an.", "settings": { "title": "Einstellungen für Dash. Widget", - "cpuMultiView": { - "label": "CPU Multi-Core View" - }, - "storageMultiView": { - "label": "Speicher Multi-Drive View" - }, - "useCompactView": { - "label": "Kompaktmodus verwenden" - }, - "graphs": { - "label": "Graphen" - }, "url": { "label": "Dash. URL" }, "usePercentages": { "label": "Prozentangaben anzeigen" + }, + "columns": { + "label": "Anzahl Spalten" + }, + "graphHeight": { + "label": "Höhe der Graphen" + }, + "graphsOrder": { + "label": "Graphen (Reihenfolge)", + "storage": { + "label": "Speicher", + "enabled": { + "label": "Im Widget anzeigen" + }, + "span": { + "label": "Spaltenbreite" + }, + "compactView": { + "label": "Als Text anzeigen (Kompakt)" + }, + "multiView": { + "label": "Als Multi-Laufwerk anzeigen" + } + }, + "network": { + "label": "Netzwerk", + "enabled": { + "label": "Im Widget anzeigen" + }, + "span": { + "label": "Spaltenbreite" + }, + "compactView": { + "label": "Als Text anzeigen (Kompakt)" + } + }, + "cpu": { + "label": "CPU", + "enabled": { + "label": "Im Widget anzeigen" + }, + "span": { + "label": "Spaltenbreite" + }, + "multiView": { + "label": "Als Multi-Core anzeigen" + } + }, + "ram": { + "label": "RAM", + "enabled": { + "label": "Im Widget anzeigen" + }, + "span": { + "label": "Spaltenbreite" + } + }, + "gpu": { + "label": "GPU", + "enabled": { + "label": "Im Widget anzeigen" + }, + "span": { + "label": "Spaltenbreite" + } + } } } }, @@ -50,7 +104,7 @@ "cpu": { "title": "CPU" }, - "memory": { + "ram": { "title": "RAM" }, "gpu": { diff --git a/public/locales/el/modules/dashdot.json b/public/locales/el/modules/dashdot.json index 047c3fb3a..b130e02c2 100644 --- a/public/locales/el/modules/dashdot.json +++ b/public/locales/el/modules/dashdot.json @@ -50,7 +50,7 @@ "cpu": { "title": "CPU" }, - "memory": { + "ram": { "title": "Μνήμη RAM" }, "gpu": { diff --git a/public/locales/en/modules/dashdot.json b/public/locales/en/modules/dashdot.json index 31532659e..488a02225 100644 --- a/public/locales/en/modules/dashdot.json +++ b/public/locales/en/modules/dashdot.json @@ -4,23 +4,77 @@ "description": "Displays the graphs of an external Dash. instance inside of Homarr.", "settings": { "title": "Settings for Dash. widget", - "cpuMultiView": { - "label": "CPU Multi-Core View" - }, - "storageMultiView": { - "label": "Storage Multi-Drive View" - }, - "useCompactView": { - "label": "Use Compact View" - }, - "graphs": { - "label": "Graphs" - }, "url": { "label": "Dash. URL" }, "usePercentages": { "label": "Display percentages" + }, + "columns": { + "label": "Display columns" + }, + "graphHeight": { + "label": "Height of graphs" + }, + "graphsOrder": { + "label": "Graphs (Order)", + "storage": { + "label": "Storage", + "enabled": { + "label": "Show in widget" + }, + "span": { + "label": "Column span" + }, + "compactView": { + "label": "Show as text (compact)" + }, + "multiView": { + "label": "Show as multi-drive-view" + } + }, + "network": { + "label": "Network", + "enabled": { + "label": "Show in widget" + }, + "span": { + "label": "Column span" + }, + "compactView": { + "label": "Show as text (compact)" + } + }, + "cpu": { + "label": "CPU", + "enabled": { + "label": "Show in widget" + }, + "span": { + "label": "Column span" + }, + "multiView": { + "label": "Show as multi-core-view" + } + }, + "ram": { + "label": "RAM", + "enabled": { + "label": "Show in widget" + }, + "span": { + "label": "Column span" + } + }, + "gpu": { + "label": "GPU", + "enabled": { + "label": "Show in widget" + }, + "span": { + "label": "Column span" + } + } } } }, @@ -50,7 +104,7 @@ "cpu": { "title": "CPU" }, - "memory": { + "ram": { "title": "RAM" }, "gpu": { diff --git a/public/locales/es/modules/dashdot.json b/public/locales/es/modules/dashdot.json index f70aad204..840e726b4 100644 --- a/public/locales/es/modules/dashdot.json +++ b/public/locales/es/modules/dashdot.json @@ -50,7 +50,7 @@ "cpu": { "title": "CPU" }, - "memory": { + "ram": { "title": "RAM" }, "gpu": { diff --git a/public/locales/fr/modules/dashdot.json b/public/locales/fr/modules/dashdot.json index 0ef538f2f..da8094447 100644 --- a/public/locales/fr/modules/dashdot.json +++ b/public/locales/fr/modules/dashdot.json @@ -50,7 +50,7 @@ "cpu": { "title": "CPU" }, - "memory": { + "ram": { "title": "RAM" }, "gpu": { diff --git a/public/locales/he/modules/dashdot.json b/public/locales/he/modules/dashdot.json index 36552683b..79bf3a652 100644 --- a/public/locales/he/modules/dashdot.json +++ b/public/locales/he/modules/dashdot.json @@ -50,7 +50,7 @@ "cpu": { "title": "מעבד" }, - "memory": { + "ram": { "title": "זיכרון פנימי" }, "gpu": { diff --git a/public/locales/it/modules/dashdot.json b/public/locales/it/modules/dashdot.json index 68be4c2bb..609f86aa1 100644 --- a/public/locales/it/modules/dashdot.json +++ b/public/locales/it/modules/dashdot.json @@ -50,7 +50,7 @@ "cpu": { "title": "CPU" }, - "memory": { + "ram": { "title": "RAM" }, "gpu": { diff --git a/public/locales/ja/modules/dashdot.json b/public/locales/ja/modules/dashdot.json index 88b64c660..a2a8353af 100644 --- a/public/locales/ja/modules/dashdot.json +++ b/public/locales/ja/modules/dashdot.json @@ -50,7 +50,7 @@ "cpu": { "title": "CPU" }, - "memory": { + "ram": { "title": "ラム" }, "gpu": { diff --git a/public/locales/ko/modules/dashdot.json b/public/locales/ko/modules/dashdot.json index 29b39ffd1..affe87d41 100644 --- a/public/locales/ko/modules/dashdot.json +++ b/public/locales/ko/modules/dashdot.json @@ -50,7 +50,7 @@ "cpu": { "title": "CPU" }, - "memory": { + "ram": { "title": "RAM" }, "gpu": { diff --git a/public/locales/lol/modules/dashdot.json b/public/locales/lol/modules/dashdot.json index 5c58b8e2e..38c944e3a 100644 --- a/public/locales/lol/modules/dashdot.json +++ b/public/locales/lol/modules/dashdot.json @@ -50,7 +50,7 @@ "cpu": { "title": "CPU" }, - "memory": { + "ram": { "title": "RAM" }, "gpu": { diff --git a/public/locales/nl/modules/dashdot.json b/public/locales/nl/modules/dashdot.json index e40b1330a..712f252fe 100644 --- a/public/locales/nl/modules/dashdot.json +++ b/public/locales/nl/modules/dashdot.json @@ -50,7 +50,7 @@ "cpu": { "title": "CPU" }, - "memory": { + "ram": { "title": "RAM" }, "gpu": { diff --git a/public/locales/no/modules/dashdot.json b/public/locales/no/modules/dashdot.json index 7c7f752bf..2d47c9f1d 100644 --- a/public/locales/no/modules/dashdot.json +++ b/public/locales/no/modules/dashdot.json @@ -50,7 +50,7 @@ "cpu": { "title": "CPU" }, - "memory": { + "ram": { "title": "RAM" }, "gpu": { diff --git a/public/locales/pl/modules/dashdot.json b/public/locales/pl/modules/dashdot.json index 766f4eaf4..2667f12a8 100644 --- a/public/locales/pl/modules/dashdot.json +++ b/public/locales/pl/modules/dashdot.json @@ -50,7 +50,7 @@ "cpu": { "title": "CPU" }, - "memory": { + "ram": { "title": "RAM" }, "gpu": { diff --git a/public/locales/pt/modules/dashdot.json b/public/locales/pt/modules/dashdot.json index 69d8cdda8..71aebef0a 100644 --- a/public/locales/pt/modules/dashdot.json +++ b/public/locales/pt/modules/dashdot.json @@ -50,7 +50,7 @@ "cpu": { "title": "CPU" }, - "memory": { + "ram": { "title": "RAM" }, "gpu": { diff --git a/public/locales/ru/modules/dashdot.json b/public/locales/ru/modules/dashdot.json index 6f5b5783f..a75a0aa3c 100644 --- a/public/locales/ru/modules/dashdot.json +++ b/public/locales/ru/modules/dashdot.json @@ -50,7 +50,7 @@ "cpu": { "title": "ЦП" }, - "memory": { + "ram": { "title": "ОЗУ" }, "gpu": { diff --git a/public/locales/sk/modules/dashdot.json b/public/locales/sk/modules/dashdot.json index 2381cb6da..33ed4c3bd 100644 --- a/public/locales/sk/modules/dashdot.json +++ b/public/locales/sk/modules/dashdot.json @@ -50,7 +50,7 @@ "cpu": { "title": "CPU" }, - "memory": { + "ram": { "title": "RAM" }, "gpu": { diff --git a/public/locales/sl/modules/dashdot.json b/public/locales/sl/modules/dashdot.json index 0184054f9..11fd741f0 100644 --- a/public/locales/sl/modules/dashdot.json +++ b/public/locales/sl/modules/dashdot.json @@ -50,7 +50,7 @@ "cpu": { "title": "CPU" }, - "memory": { + "ram": { "title": "RAM" }, "gpu": { diff --git a/public/locales/sv/modules/dashdot.json b/public/locales/sv/modules/dashdot.json index 40441c40c..938aff756 100644 --- a/public/locales/sv/modules/dashdot.json +++ b/public/locales/sv/modules/dashdot.json @@ -50,7 +50,7 @@ "cpu": { "title": "CPU" }, - "memory": { + "ram": { "title": "RAM" }, "gpu": { diff --git a/public/locales/uk/modules/dashdot.json b/public/locales/uk/modules/dashdot.json index 14ab03307..06d2b49c2 100644 --- a/public/locales/uk/modules/dashdot.json +++ b/public/locales/uk/modules/dashdot.json @@ -50,7 +50,7 @@ "cpu": { "title": "Процесор" }, - "memory": { + "ram": { "title": "Оперативна пам'ять" }, "gpu": { diff --git a/public/locales/vi/modules/dashdot.json b/public/locales/vi/modules/dashdot.json index 2e5f70ff9..5a8d4132b 100644 --- a/public/locales/vi/modules/dashdot.json +++ b/public/locales/vi/modules/dashdot.json @@ -50,7 +50,7 @@ "cpu": { "title": "CPU" }, - "memory": { + "ram": { "title": "RAM" }, "gpu": { diff --git a/public/locales/zh/modules/dashdot.json b/public/locales/zh/modules/dashdot.json index 547fe75a1..387ca359e 100644 --- a/public/locales/zh/modules/dashdot.json +++ b/public/locales/zh/modules/dashdot.json @@ -50,7 +50,7 @@ "cpu": { "title": "CPU" }, - "memory": { + "ram": { "title": "内存" }, "gpu": { diff --git a/src/components/Dashboard/Tiles/Widgets/DraggableList.tsx b/src/components/Dashboard/Tiles/Widgets/DraggableList.tsx index ae6d68998..768323170 100644 --- a/src/components/Dashboard/Tiles/Widgets/DraggableList.tsx +++ b/src/components/Dashboard/Tiles/Widgets/DraggableList.tsx @@ -1,7 +1,8 @@ import { Collapse, createStyles, Stack, Text } from '@mantine/core'; +import { useDisclosure } from '@mantine/hooks'; import { IconChevronDown, IconGripVertical } from '@tabler/icons'; import { Reorder, useDragControls } from 'framer-motion'; -import { FC, ReactNode, useState } from 'react'; +import { FC, ReactNode } from 'react'; import { IDraggableListInputValue } from '../../../../widgets/widgets'; const useStyles = createStyles((theme) => ({ @@ -14,7 +15,6 @@ const useStyles = createStyles((theme) => ({ }`, backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[5] : theme.white, marginBottom: theme.spacing.xs, - gap: theme.spacing.xs, }, row: { display: 'flex', @@ -80,7 +80,7 @@ const ListItem: FC<{ const { classes, cx } = useStyles(); const controls = useDragControls(); - const [showContent, setShowContent] = useState(false); + const [opened, handlers] = useDisclosure(false); const hasContent = props.children != null && Object.keys(props.children).length !== 0; return ( @@ -100,8 +100,8 @@ const ListItem: FC<{ {hasContent && ( setShowContent(!showContent)} + className={cx(classes.clickableIcons, { [classes.rotate]: opened })} + onClick={() => handlers.toggle()} size={18} stroke={1.5} /> @@ -109,7 +109,7 @@ const ListItem: FC<{ {hasContent && ( - + {props.children} )} diff --git a/src/components/Dashboard/Tiles/Widgets/WidgetsEditModal.tsx b/src/components/Dashboard/Tiles/Widgets/WidgetsEditModal.tsx index 3d53a395a..564171a9f 100644 --- a/src/components/Dashboard/Tiles/Widgets/WidgetsEditModal.tsx +++ b/src/components/Dashboard/Tiles/Widgets/WidgetsEditModal.tsx @@ -205,7 +205,7 @@ const WidgetOptionTypeSwitch: FC<{ labels={Object.fromEntries( Object.entries(option.items).map(([graphName]) => [ graphName, - t(`descriptor.settings.${graphName}.label`), + t(`descriptor.settings.${key}.${graphName}.label`), ]) )} > @@ -217,7 +217,7 @@ const WidgetOptionTypeSwitch: FC<{ key={`${graphName}.${subKey}.${i}`} option={setting as IWidgetOptionValue} widgetId={widgetId} - propName={`${graphName}.${subKey}`} + propName={`${key}.${graphName}.${subKey}`} value={typedVal.find((v) => v.key === graphName)?.subValues?.[subKey]} handleChange={(_, newVal) => handleChange( diff --git a/src/widgets/dashDot/DashDotGraph.tsx b/src/widgets/dashDot/DashDotGraph.tsx index 2bd11955f..6977005cd 100644 --- a/src/widgets/dashDot/DashDotGraph.tsx +++ b/src/widgets/dashDot/DashDotGraph.tsx @@ -1,4 +1,5 @@ import { createStyles, Title, useMantineTheme } from '@mantine/core'; +import { useTranslation } from 'next-i18next'; import { DashDotCompactNetwork, DashDotInfo } from './DashDotCompactNetwork'; import { DashDotCompactStorage } from './DashDotCompactStorage'; @@ -21,21 +22,28 @@ export const DashDotGraph = ({ usePercentages, info, }: DashDotGraphProps) => { + const { t } = useTranslation('modules/dashdot'); const { classes } = useStyles(); - return graph === 'storage' && isCompact ? ( - - ) : graph === 'network' && isCompact ? ( - - ) : ( + if (graph === 'storage' && isCompact) { + return ; + } + + if (graph === 'network' && isCompact) { + return ; + } + + const title = t(`card.graphs.${graph}.title`); + + return (
- {graph} + {title}