From bd4b7b8c1363405d9772c53f07f8f5cc899bb266 Mon Sep 17 00:00:00 2001 From: Manuel Date: Sat, 5 Aug 2023 17:45:50 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=B7=EF=B8=8F=20Apply=20namespace=20typ?= =?UTF-8?q?es=20to=20translations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dashboard/Tiles/Widgets/WidgetsRemoveModal.tsx | 1 - src/pages/user/preferences.tsx | 2 +- src/widgets/dashDot/DashDotGraph.tsx | 6 +++++- src/widgets/weather/WeatherIcon.tsx | 6 +++++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/components/Dashboard/Tiles/Widgets/WidgetsRemoveModal.tsx b/src/components/Dashboard/Tiles/Widgets/WidgetsRemoveModal.tsx index dc1469d51..0afedf520 100644 --- a/src/components/Dashboard/Tiles/Widgets/WidgetsRemoveModal.tsx +++ b/src/components/Dashboard/Tiles/Widgets/WidgetsRemoveModal.tsx @@ -1,7 +1,6 @@ import { Button, Group, Stack, Text } from '@mantine/core'; import { ContextModalProps } from '@mantine/modals'; import { Trans, useTranslation } from 'next-i18next'; -import React from 'react'; import { useConfigContext } from '../../../../config/provider'; import { useConfigStore } from '../../../../config/store'; diff --git a/src/pages/user/preferences.tsx b/src/pages/user/preferences.tsx index 08eb89528..8ec563950 100644 --- a/src/pages/user/preferences.tsx +++ b/src/pages/user/preferences.tsx @@ -68,7 +68,7 @@ const SettingsComponent = ({ country: language.country, })); - const { t } = useTranslation('user/preferences'); + const { t } = useTranslation(['user/preferences', 'common']); const { i18nZodResolver } = useI18nZodResolver(); diff --git a/src/widgets/dashDot/DashDotGraph.tsx b/src/widgets/dashDot/DashDotGraph.tsx index 28d7d2382..21c5dbc45 100644 --- a/src/widgets/dashDot/DashDotGraph.tsx +++ b/src/widgets/dashDot/DashDotGraph.tsx @@ -4,8 +4,12 @@ import { useTranslation } from 'next-i18next'; import { DashDotCompactNetwork, DashDotInfo } from './DashDotCompactNetwork'; import { DashDotCompactStorage } from './DashDotCompactStorage'; +import { CustomTypeOptions } from 'i18next'; + +type GraphType = keyof CustomTypeOptions['resources']['modules/dashdot']['card']['graphs']; + interface DashDotGraphProps { - graph: string; + graph: GraphType; graphHeight: number; isCompact: boolean; multiView: boolean; diff --git a/src/widgets/weather/WeatherIcon.tsx b/src/widgets/weather/WeatherIcon.tsx index a32d9ffef..e92f6d90f 100644 --- a/src/widgets/weather/WeatherIcon.tsx +++ b/src/widgets/weather/WeatherIcon.tsx @@ -11,6 +11,8 @@ import { IconSun, } from '@tabler/icons-react'; import { useTranslation } from 'next-i18next'; +import { TranslationNamespace } from '~/i18n'; +import { CustomTypeOptions } from 'i18next'; interface WeatherIconProps { code: number; @@ -36,7 +38,9 @@ export const WeatherIcon = ({ code }: WeatherIconProps) => { ); }; -type WeatherDefinitionType = { icon: Icon; name: string; codes: number[] }; + +type WeatherDescription = keyof CustomTypeOptions['resources']['modules/weather']['card']['weatherDescriptions']; +type WeatherDefinitionType = { icon: Icon; name: WeatherDescription; codes: number[] }; // 0 Clear sky // 1, 2, 3 Mainly clear, partly cloudy, and overcast