Add translations for en & de in Dashdot; Fix PR comments

This commit is contained in:
MauriceNino
2023-02-14 13:01:12 +01:00
parent 2a5a0a7699
commit 368707ed76
25 changed files with 177 additions and 61 deletions

View File

@@ -50,7 +50,7 @@
"cpu": { "cpu": {
"title": "CPU" "title": "CPU"
}, },
"memory": { "ram": {
"title": "RAM" "title": "RAM"
}, },
"gpu": { "gpu": {

View File

@@ -4,23 +4,77 @@
"description": "Zeigt die Graphen einer externen Dash.-Instanz innerhalb von Homarr an.", "description": "Zeigt die Graphen einer externen Dash.-Instanz innerhalb von Homarr an.",
"settings": { "settings": {
"title": "Einstellungen für Dash. Widget", "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": { "url": {
"label": "Dash. URL" "label": "Dash. URL"
}, },
"usePercentages": { "usePercentages": {
"label": "Prozentangaben anzeigen" "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": { "cpu": {
"title": "CPU" "title": "CPU"
}, },
"memory": { "ram": {
"title": "RAM" "title": "RAM"
}, },
"gpu": { "gpu": {

View File

@@ -50,7 +50,7 @@
"cpu": { "cpu": {
"title": "CPU" "title": "CPU"
}, },
"memory": { "ram": {
"title": "Μνήμη RAM" "title": "Μνήμη RAM"
}, },
"gpu": { "gpu": {

View File

@@ -4,23 +4,77 @@
"description": "Displays the graphs of an external Dash. instance inside of Homarr.", "description": "Displays the graphs of an external Dash. instance inside of Homarr.",
"settings": { "settings": {
"title": "Settings for Dash. widget", "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": { "url": {
"label": "Dash. URL" "label": "Dash. URL"
}, },
"usePercentages": { "usePercentages": {
"label": "Display percentages" "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": { "cpu": {
"title": "CPU" "title": "CPU"
}, },
"memory": { "ram": {
"title": "RAM" "title": "RAM"
}, },
"gpu": { "gpu": {

View File

@@ -50,7 +50,7 @@
"cpu": { "cpu": {
"title": "CPU" "title": "CPU"
}, },
"memory": { "ram": {
"title": "RAM" "title": "RAM"
}, },
"gpu": { "gpu": {

View File

@@ -50,7 +50,7 @@
"cpu": { "cpu": {
"title": "CPU" "title": "CPU"
}, },
"memory": { "ram": {
"title": "RAM" "title": "RAM"
}, },
"gpu": { "gpu": {

View File

@@ -50,7 +50,7 @@
"cpu": { "cpu": {
"title": "מעבד" "title": "מעבד"
}, },
"memory": { "ram": {
"title": "זיכרון פנימי" "title": "זיכרון פנימי"
}, },
"gpu": { "gpu": {

View File

@@ -50,7 +50,7 @@
"cpu": { "cpu": {
"title": "CPU" "title": "CPU"
}, },
"memory": { "ram": {
"title": "RAM" "title": "RAM"
}, },
"gpu": { "gpu": {

View File

@@ -50,7 +50,7 @@
"cpu": { "cpu": {
"title": "CPU" "title": "CPU"
}, },
"memory": { "ram": {
"title": "ラム" "title": "ラム"
}, },
"gpu": { "gpu": {

View File

@@ -50,7 +50,7 @@
"cpu": { "cpu": {
"title": "CPU" "title": "CPU"
}, },
"memory": { "ram": {
"title": "RAM" "title": "RAM"
}, },
"gpu": { "gpu": {

View File

@@ -50,7 +50,7 @@
"cpu": { "cpu": {
"title": "CPU" "title": "CPU"
}, },
"memory": { "ram": {
"title": "RAM" "title": "RAM"
}, },
"gpu": { "gpu": {

View File

@@ -50,7 +50,7 @@
"cpu": { "cpu": {
"title": "CPU" "title": "CPU"
}, },
"memory": { "ram": {
"title": "RAM" "title": "RAM"
}, },
"gpu": { "gpu": {

View File

@@ -50,7 +50,7 @@
"cpu": { "cpu": {
"title": "CPU" "title": "CPU"
}, },
"memory": { "ram": {
"title": "RAM" "title": "RAM"
}, },
"gpu": { "gpu": {

View File

@@ -50,7 +50,7 @@
"cpu": { "cpu": {
"title": "CPU" "title": "CPU"
}, },
"memory": { "ram": {
"title": "RAM" "title": "RAM"
}, },
"gpu": { "gpu": {

View File

@@ -50,7 +50,7 @@
"cpu": { "cpu": {
"title": "CPU" "title": "CPU"
}, },
"memory": { "ram": {
"title": "RAM" "title": "RAM"
}, },
"gpu": { "gpu": {

View File

@@ -50,7 +50,7 @@
"cpu": { "cpu": {
"title": "ЦП" "title": "ЦП"
}, },
"memory": { "ram": {
"title": "ОЗУ" "title": "ОЗУ"
}, },
"gpu": { "gpu": {

View File

@@ -50,7 +50,7 @@
"cpu": { "cpu": {
"title": "CPU" "title": "CPU"
}, },
"memory": { "ram": {
"title": "RAM" "title": "RAM"
}, },
"gpu": { "gpu": {

View File

@@ -50,7 +50,7 @@
"cpu": { "cpu": {
"title": "CPU" "title": "CPU"
}, },
"memory": { "ram": {
"title": "RAM" "title": "RAM"
}, },
"gpu": { "gpu": {

View File

@@ -50,7 +50,7 @@
"cpu": { "cpu": {
"title": "CPU" "title": "CPU"
}, },
"memory": { "ram": {
"title": "RAM" "title": "RAM"
}, },
"gpu": { "gpu": {

View File

@@ -50,7 +50,7 @@
"cpu": { "cpu": {
"title": "Процесор" "title": "Процесор"
}, },
"memory": { "ram": {
"title": "Оперативна пам'ять" "title": "Оперативна пам'ять"
}, },
"gpu": { "gpu": {

View File

@@ -50,7 +50,7 @@
"cpu": { "cpu": {
"title": "CPU" "title": "CPU"
}, },
"memory": { "ram": {
"title": "RAM" "title": "RAM"
}, },
"gpu": { "gpu": {

View File

@@ -50,7 +50,7 @@
"cpu": { "cpu": {
"title": "CPU" "title": "CPU"
}, },
"memory": { "ram": {
"title": "内存" "title": "内存"
}, },
"gpu": { "gpu": {

View File

@@ -1,7 +1,8 @@
import { Collapse, createStyles, Stack, Text } from '@mantine/core'; import { Collapse, createStyles, Stack, Text } from '@mantine/core';
import { useDisclosure } from '@mantine/hooks';
import { IconChevronDown, IconGripVertical } from '@tabler/icons'; import { IconChevronDown, IconGripVertical } from '@tabler/icons';
import { Reorder, useDragControls } from 'framer-motion'; import { Reorder, useDragControls } from 'framer-motion';
import { FC, ReactNode, useState } from 'react'; import { FC, ReactNode } from 'react';
import { IDraggableListInputValue } from '../../../../widgets/widgets'; import { IDraggableListInputValue } from '../../../../widgets/widgets';
const useStyles = createStyles((theme) => ({ const useStyles = createStyles((theme) => ({
@@ -14,7 +15,6 @@ const useStyles = createStyles((theme) => ({
}`, }`,
backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[5] : theme.white, backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[5] : theme.white,
marginBottom: theme.spacing.xs, marginBottom: theme.spacing.xs,
gap: theme.spacing.xs,
}, },
row: { row: {
display: 'flex', display: 'flex',
@@ -80,7 +80,7 @@ const ListItem: FC<{
const { classes, cx } = useStyles(); const { classes, cx } = useStyles();
const controls = useDragControls(); const controls = useDragControls();
const [showContent, setShowContent] = useState(false); const [opened, handlers] = useDisclosure(false);
const hasContent = props.children != null && Object.keys(props.children).length !== 0; const hasContent = props.children != null && Object.keys(props.children).length !== 0;
return ( return (
@@ -100,8 +100,8 @@ const ListItem: FC<{
{hasContent && ( {hasContent && (
<IconChevronDown <IconChevronDown
className={cx(classes.clickableIcons, { [classes.rotate]: showContent })} className={cx(classes.clickableIcons, { [classes.rotate]: opened })}
onClick={() => setShowContent(!showContent)} onClick={() => handlers.toggle()}
size={18} size={18}
stroke={1.5} stroke={1.5}
/> />
@@ -109,7 +109,7 @@ const ListItem: FC<{
</div> </div>
{hasContent && ( {hasContent && (
<Collapse in={showContent}> <Collapse in={opened}>
<Stack className={classes.collapseContent}>{props.children}</Stack> <Stack className={classes.collapseContent}>{props.children}</Stack>
</Collapse> </Collapse>
)} )}

View File

@@ -205,7 +205,7 @@ const WidgetOptionTypeSwitch: FC<{
labels={Object.fromEntries( labels={Object.fromEntries(
Object.entries(option.items).map(([graphName]) => [ Object.entries(option.items).map(([graphName]) => [
graphName, graphName,
t(`descriptor.settings.${graphName}.label`), t(`descriptor.settings.${key}.${graphName}.label`),
]) ])
)} )}
> >
@@ -217,7 +217,7 @@ const WidgetOptionTypeSwitch: FC<{
key={`${graphName}.${subKey}.${i}`} key={`${graphName}.${subKey}.${i}`}
option={setting as IWidgetOptionValue} option={setting as IWidgetOptionValue}
widgetId={widgetId} widgetId={widgetId}
propName={`${graphName}.${subKey}`} propName={`${key}.${graphName}.${subKey}`}
value={typedVal.find((v) => v.key === graphName)?.subValues?.[subKey]} value={typedVal.find((v) => v.key === graphName)?.subValues?.[subKey]}
handleChange={(_, newVal) => handleChange={(_, newVal) =>
handleChange( handleChange(

View File

@@ -1,4 +1,5 @@
import { createStyles, Title, useMantineTheme } from '@mantine/core'; import { createStyles, Title, useMantineTheme } from '@mantine/core';
import { useTranslation } from 'next-i18next';
import { DashDotCompactNetwork, DashDotInfo } from './DashDotCompactNetwork'; import { DashDotCompactNetwork, DashDotInfo } from './DashDotCompactNetwork';
import { DashDotCompactStorage } from './DashDotCompactStorage'; import { DashDotCompactStorage } from './DashDotCompactStorage';
@@ -21,21 +22,28 @@ export const DashDotGraph = ({
usePercentages, usePercentages,
info, info,
}: DashDotGraphProps) => { }: DashDotGraphProps) => {
const { t } = useTranslation('modules/dashdot');
const { classes } = useStyles(); const { classes } = useStyles();
return graph === 'storage' && isCompact ? ( if (graph === 'storage' && isCompact) {
<DashDotCompactStorage info={info} /> return <DashDotCompactStorage info={info} />;
) : graph === 'network' && isCompact ? ( }
<DashDotCompactNetwork info={info} />
) : ( if (graph === 'network' && isCompact) {
return <DashDotCompactNetwork info={info} />;
}
const title = t(`card.graphs.${graph}.title`);
return (
<div className={classes.graphContainer}> <div className={classes.graphContainer}>
<Title className={classes.graphTitle} order={4}> <Title className={classes.graphTitle} order={4}>
{graph} {title}
</Title> </Title>
<iframe <iframe
className={classes.iframe} className={classes.iframe}
key={graph} key={graph}
title={graph} title={title}
src={useIframeSrc(dashDotUrl, graph, multiView, usePercentages)} src={useIframeSrc(dashDotUrl, graph, multiView, usePercentages)}
style={{ style={{
height: `${graphHeight}px`, height: `${graphHeight}px`,