mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-12 00:15:48 +01:00
🐛 accidental translation of module name
This commit is contained in:
@@ -1,25 +1,40 @@
|
|||||||
import { Checkbox, SimpleGrid, Stack, Title } from '@mantine/core';
|
import { Checkbox, Popover, SimpleGrid, Stack, Text, Title } from '@mantine/core';
|
||||||
|
import { useDisclosure } from '@mantine/hooks';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import * as Modules from '../../modules';
|
import * as Modules from '../../modules';
|
||||||
|
import { IModule } from '../../modules/ModuleTypes';
|
||||||
import { useConfig } from '../../tools/state';
|
import { useConfig } from '../../tools/state';
|
||||||
|
|
||||||
export default function ModuleEnabler(props: any) {
|
export default function ModuleEnabler(props: any) {
|
||||||
const { config, setConfig } = useConfig();
|
|
||||||
const { t } = useTranslation('settings/general/module-enabler');
|
const { t } = useTranslation('settings/general/module-enabler');
|
||||||
const modules = Object.values(Modules).map((module) => module);
|
const modules = Object.values(Modules).map((module) => module);
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<Stack>
|
||||||
<Title order={4}>{t('title')}</Title>
|
<Title order={4}>{t('title')}</Title>
|
||||||
<SimpleGrid cols={3} spacing="xs">
|
<SimpleGrid cols={3} spacing="xs">
|
||||||
{modules.map((module) => {
|
{modules.map((module) => (
|
||||||
|
<ModuleToggle module={module} />
|
||||||
|
))}
|
||||||
|
</SimpleGrid>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ModuleToggle = ({ module }: { module: IModule }) => {
|
||||||
|
const { config, setConfig } = useConfig();
|
||||||
const { t: translationModules } = useTranslation(module.translationNamespace);
|
const { t: translationModules } = useTranslation(module.translationNamespace);
|
||||||
|
const [opened, { close, open }] = useDisclosure(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<Popover opened={opened} withArrow withinPortal width={200}>
|
||||||
|
<Popover.Target>
|
||||||
|
<div onMouseEnter={open} onMouseLeave={close}>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
key={module.title}
|
key={module.title}
|
||||||
size="md"
|
size="md"
|
||||||
checked={config.modules?.[module.title]?.enabled ?? false}
|
checked={config.modules?.[module.title]?.enabled ?? false}
|
||||||
label={translationModules(module.title, {
|
label={translationModules('descriptor.name', {
|
||||||
defaultValue: 'UNKNOWN MODULE NAME',
|
defaultValue: 'Unknown',
|
||||||
})}
|
})}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setConfig({
|
setConfig({
|
||||||
@@ -34,9 +49,12 @@ export default function ModuleEnabler(props: any) {
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
|
</Popover.Target>
|
||||||
|
<Popover.Dropdown>
|
||||||
|
<Text weight="bold">{translationModules('descriptor.name')}</Text>
|
||||||
|
<Text>{translationModules('descriptor.description')}</Text>
|
||||||
|
</Popover.Dropdown>
|
||||||
|
</Popover>
|
||||||
);
|
);
|
||||||
})}
|
};
|
||||||
</SimpleGrid>
|
|
||||||
</Stack>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|||||||
1
src/modules/ModuleTypes.d.ts
vendored
1
src/modules/ModuleTypes.d.ts
vendored
@@ -7,7 +7,6 @@ import { TablerIcon } from '@tabler/icons';
|
|||||||
// Note: Maybe use context to keep track of the modules
|
// Note: Maybe use context to keep track of the modules
|
||||||
export interface IModule {
|
export interface IModule {
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
|
||||||
icon: TablerIcon;
|
icon: TablerIcon;
|
||||||
component: React.ComponentType;
|
component: React.ComponentType;
|
||||||
options?: Option;
|
options?: Option;
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ import { serviceItem } from '../../tools/types';
|
|||||||
import { useColorTheme } from '../../tools/color';
|
import { useColorTheme } from '../../tools/color';
|
||||||
|
|
||||||
export const CalendarModule: IModule = {
|
export const CalendarModule: IModule = {
|
||||||
title: 'descriptor.name',
|
title: 'Calendar',
|
||||||
description: 'descriptor.description',
|
|
||||||
icon: CalendarIcon,
|
icon: CalendarIcon,
|
||||||
component: CalendarComponent,
|
component: CalendarComponent,
|
||||||
options: {
|
options: {
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ import { IModule } from '../ModuleTypes';
|
|||||||
|
|
||||||
const asModule = <T extends IModule>(t: T) => t;
|
const asModule = <T extends IModule>(t: T) => t;
|
||||||
export const DashdotModule = asModule({
|
export const DashdotModule = asModule({
|
||||||
title: 'descriptor.name',
|
title: 'Dash.',
|
||||||
description: 'descriptor.description',
|
|
||||||
icon: CalendarIcon,
|
icon: CalendarIcon,
|
||||||
component: DashdotComponent,
|
component: DashdotComponent,
|
||||||
options: {
|
options: {
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ import { IModule } from '../ModuleTypes';
|
|||||||
import { useSetSafeInterval } from '../../tools/hooks/useSetSafeInterval';
|
import { useSetSafeInterval } from '../../tools/hooks/useSetSafeInterval';
|
||||||
|
|
||||||
export const DateModule: IModule = {
|
export const DateModule: IModule = {
|
||||||
title: 'descriptor.name',
|
title: 'Date',
|
||||||
description: 'descriptor.description',
|
|
||||||
icon: Clock,
|
icon: Clock,
|
||||||
component: DateComponent,
|
component: DateComponent,
|
||||||
options: {
|
options: {
|
||||||
|
|||||||
@@ -12,8 +12,7 @@ import { useConfig } from '../../tools/state';
|
|||||||
import { IModule } from '../ModuleTypes';
|
import { IModule } from '../ModuleTypes';
|
||||||
|
|
||||||
export const DockerModule: IModule = {
|
export const DockerModule: IModule = {
|
||||||
title: 'descriptor.name',
|
title: 'Docker',
|
||||||
description: 'descriptor.description',
|
|
||||||
icon: IconBrandDocker,
|
icon: IconBrandDocker,
|
||||||
component: DockerMenuButton,
|
component: DockerMenuButton,
|
||||||
translationNamespace: 'modules/docker-module',
|
translationNamespace: 'modules/docker-module',
|
||||||
|
|||||||
@@ -23,8 +23,7 @@ import { useSetSafeInterval } from '../../tools/hooks/useSetSafeInterval';
|
|||||||
import { humanFileSize } from '../../tools/humanFileSize';
|
import { humanFileSize } from '../../tools/humanFileSize';
|
||||||
|
|
||||||
export const DownloadsModule: IModule = {
|
export const DownloadsModule: IModule = {
|
||||||
title: 'descriptor.name',
|
title: 'Torrent',
|
||||||
description: 'descriptor.description',
|
|
||||||
icon: Download,
|
icon: Download,
|
||||||
component: DownloadComponent,
|
component: DownloadComponent,
|
||||||
options: {
|
options: {
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ import { IModule } from '../ModuleTypes';
|
|||||||
import { useSetSafeInterval } from '../../tools/hooks/useSetSafeInterval';
|
import { useSetSafeInterval } from '../../tools/hooks/useSetSafeInterval';
|
||||||
|
|
||||||
export const TotalDownloadsModule: IModule = {
|
export const TotalDownloadsModule: IModule = {
|
||||||
title: 'descriptor.name',
|
title: 'Download Speed',
|
||||||
description: 'descriptor.description',
|
|
||||||
icon: Download,
|
icon: Download,
|
||||||
component: TotalDownloadsComponent,
|
component: TotalDownloadsComponent,
|
||||||
translationNamespace: 'modules/total-downloads-module',
|
translationNamespace: 'modules/total-downloads-module',
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ import { OverseerrMediaDisplay } from '../common';
|
|||||||
import { IModule } from '../ModuleTypes';
|
import { IModule } from '../ModuleTypes';
|
||||||
|
|
||||||
export const OverseerrModule: IModule = {
|
export const OverseerrModule: IModule = {
|
||||||
title: 'descriptor.name',
|
title: 'Overseerr',
|
||||||
description: 'descriptor.description',
|
|
||||||
icon: IconEyeglass,
|
icon: IconEyeglass,
|
||||||
component: OverseerrMediaDisplay,
|
component: OverseerrMediaDisplay,
|
||||||
translationNamespace: 'modules/overseerr-module',
|
translationNamespace: 'modules/overseerr-module',
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ import { useConfig } from '../../tools/state';
|
|||||||
import { IModule } from '../ModuleTypes';
|
import { IModule } from '../ModuleTypes';
|
||||||
|
|
||||||
export const PingModule: IModule = {
|
export const PingModule: IModule = {
|
||||||
title: 'descriptor.name',
|
title: 'Ping Services',
|
||||||
description: 'descriptor.description',
|
|
||||||
icon: Plug,
|
icon: Plug,
|
||||||
component: PingComponent,
|
component: PingComponent,
|
||||||
translationNamespace: 'modules/ping-module',
|
translationNamespace: 'modules/ping-module',
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ const useStyles = createStyles((theme) => ({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
export const SearchModule: IModule = {
|
export const SearchModule: IModule = {
|
||||||
title: 'descriptor.name',
|
title: 'Search',
|
||||||
description: 'descriptor.description',
|
|
||||||
icon: Search,
|
icon: Search,
|
||||||
component: SearchBar,
|
component: SearchBar,
|
||||||
translationNamespace: 'modules/search-module',
|
translationNamespace: 'modules/search-module',
|
||||||
|
|||||||
@@ -19,8 +19,7 @@ import { IModule } from '../ModuleTypes';
|
|||||||
import { WeatherResponse } from './WeatherInterface';
|
import { WeatherResponse } from './WeatherInterface';
|
||||||
|
|
||||||
export const WeatherModule: IModule = {
|
export const WeatherModule: IModule = {
|
||||||
title: 'descriptor.name',
|
title: 'Weather',
|
||||||
description: 'descriptor.description',
|
|
||||||
icon: Sun,
|
icon: Sun,
|
||||||
component: WeatherComponent,
|
component: WeatherComponent,
|
||||||
options: {
|
options: {
|
||||||
|
|||||||
Reference in New Issue
Block a user