mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-09 15:05:48 +01:00
🎨 Moved integrations in widgets directory
This commit is contained in:
@@ -3,7 +3,7 @@ import { closeModal, ContextModalProps } from '@mantine/modals';
|
|||||||
import { useConfigContext } from '../../../../config/provider';
|
import { useConfigContext } from '../../../../config/provider';
|
||||||
import { useConfigStore } from '../../../../config/store';
|
import { useConfigStore } from '../../../../config/store';
|
||||||
import { IntegrationsType } from '../../../../types/integration';
|
import { IntegrationsType } from '../../../../types/integration';
|
||||||
import { IntegrationChangePositionModalInnerProps } from '../../Tiles/Integrations/IntegrationsMenu';
|
import { WidgetChangePositionModalInnerProps } from '../../Tiles/Widgets/WidgetsMenu';
|
||||||
import { Tiles } from '../../Tiles/tilesDefinitions';
|
import { Tiles } from '../../Tiles/tilesDefinitions';
|
||||||
import { ChangePositionModal } from './ChangePositionModal';
|
import { ChangePositionModal } from './ChangePositionModal';
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ export const ChangeIntegrationPositionModal = ({
|
|||||||
context,
|
context,
|
||||||
id,
|
id,
|
||||||
innerProps,
|
innerProps,
|
||||||
}: ContextModalProps<IntegrationChangePositionModalInnerProps>) => {
|
}: ContextModalProps<WidgetChangePositionModalInnerProps>) => {
|
||||||
const { name: configName } = useConfigContext();
|
const { name: configName } = useConfigContext();
|
||||||
const updateConfig = useConfigStore((x) => x.updateConfig);
|
const updateConfig = useConfigStore((x) => x.updateConfig);
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ export const ServiceMenu = ({ service }: TileMenuProps) => {
|
|||||||
service,
|
service,
|
||||||
allowServiceNamePropagation: false,
|
allowServiceNamePropagation: false,
|
||||||
},
|
},
|
||||||
|
styles: {
|
||||||
|
root: {
|
||||||
|
zIndex: 201,
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -24,6 +29,11 @@ export const ServiceMenu = ({ service }: TileMenuProps) => {
|
|||||||
innerProps: {
|
innerProps: {
|
||||||
service,
|
service,
|
||||||
},
|
},
|
||||||
|
styles: {
|
||||||
|
root: {
|
||||||
|
zIndex: 201,
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ import { Button, Group, MultiSelect, Stack, Switch, TextInput } from '@mantine/c
|
|||||||
import { ContextModalProps } from '@mantine/modals';
|
import { ContextModalProps } from '@mantine/modals';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useConfigContext } from '../../../config/provider';
|
import { useConfigContext } from '../../../../config/provider';
|
||||||
import { useConfigStore } from '../../../config/store';
|
import { useConfigStore } from '../../../../config/store';
|
||||||
import { DashDotGraphType, IntegrationsType } from '../../../types/integration';
|
import { DashDotGraphType, IntegrationsType } from '../../../../types/integration';
|
||||||
|
|
||||||
export type IntegrationEditModalInnerProps<
|
export type WidgetEditModalInnerProps<
|
||||||
TIntegrationKey extends keyof IntegrationsType = keyof IntegrationsType
|
TIntegrationKey extends keyof IntegrationsType = keyof IntegrationsType
|
||||||
> = {
|
> = {
|
||||||
integration: TIntegrationKey;
|
integration: TIntegrationKey;
|
||||||
@@ -14,11 +14,11 @@ export type IntegrationEditModalInnerProps<
|
|||||||
labels: IntegrationOptionLabels<IntegrationOptions<TIntegrationKey>>;
|
labels: IntegrationOptionLabels<IntegrationOptions<TIntegrationKey>>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const IntegrationsEditModal = ({
|
export const WidgetsEditModal = ({
|
||||||
context,
|
context,
|
||||||
id,
|
id,
|
||||||
innerProps,
|
innerProps,
|
||||||
}: ContextModalProps<IntegrationEditModalInnerProps>) => {
|
}: ContextModalProps<WidgetEditModalInnerProps>) => {
|
||||||
const translationKey = integrationModuleTranslationsMap.get(innerProps.integration);
|
const translationKey = integrationModuleTranslationsMap.get(innerProps.integration);
|
||||||
const { t } = useTranslation([translationKey ?? '', 'common']);
|
const { t } = useTranslation([translationKey ?? '', 'common']);
|
||||||
const [moduleProperties, setModuleProperties] = useState(innerProps.options);
|
const [moduleProperties, setModuleProperties] = useState(innerProps.options);
|
||||||
@@ -4,38 +4,38 @@ import { openContextModalGeneric } from '../../../../tools/mantineModalManagerEx
|
|||||||
import { IntegrationsType } from '../../../../types/integration';
|
import { IntegrationsType } from '../../../../types/integration';
|
||||||
import { TileBaseType } from '../../../../types/tile';
|
import { TileBaseType } from '../../../../types/tile';
|
||||||
import { GenericTileMenu } from '../GenericTileMenu';
|
import { GenericTileMenu } from '../GenericTileMenu';
|
||||||
import { IntegrationRemoveModalInnerProps } from '../IntegrationRemoveModal';
|
import { WidgetsRemoveModalInnerProps } from './WidgetsRemoveModal';
|
||||||
import {
|
import {
|
||||||
IntegrationEditModalInnerProps,
|
WidgetEditModalInnerProps,
|
||||||
integrationModuleTranslationsMap,
|
integrationModuleTranslationsMap,
|
||||||
IntegrationOptionLabels,
|
IntegrationOptionLabels,
|
||||||
IntegrationOptions,
|
IntegrationOptions,
|
||||||
} from '../IntegrationsEditModal';
|
} from './WidgetsEditModal';
|
||||||
|
|
||||||
export type IntegrationChangePositionModalInnerProps = {
|
export type WidgetChangePositionModalInnerProps = {
|
||||||
integration: keyof IntegrationsType;
|
integration: keyof IntegrationsType;
|
||||||
module: TileBaseType;
|
module: TileBaseType;
|
||||||
};
|
};
|
||||||
|
|
||||||
interface IntegrationsMenuProps<TIntegrationKey extends keyof IntegrationsType> {
|
interface WidgetsMenuProps<TIntegrationKey extends keyof IntegrationsType> {
|
||||||
integration: TIntegrationKey;
|
integration: TIntegrationKey;
|
||||||
module: TileBaseType | undefined;
|
module: TileBaseType | undefined;
|
||||||
options: IntegrationOptions<TIntegrationKey> | undefined;
|
options: IntegrationOptions<TIntegrationKey> | undefined;
|
||||||
labels: IntegrationOptionLabels<IntegrationOptions<TIntegrationKey>>;
|
labels: IntegrationOptionLabels<IntegrationOptions<TIntegrationKey>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const IntegrationsMenu = <TIntegrationKey extends keyof IntegrationsType>({
|
export const WidgetsMenu = <TIntegrationKey extends keyof IntegrationsType>({
|
||||||
integration,
|
integration,
|
||||||
options,
|
options,
|
||||||
labels,
|
labels,
|
||||||
module,
|
module,
|
||||||
}: IntegrationsMenuProps<TIntegrationKey>) => {
|
}: WidgetsMenuProps<TIntegrationKey>) => {
|
||||||
const { t } = useTranslation(integrationModuleTranslationsMap.get(integration));
|
const { t } = useTranslation(integrationModuleTranslationsMap.get(integration));
|
||||||
|
|
||||||
if (!module) return null;
|
if (!module) return null;
|
||||||
|
|
||||||
const handleDeleteClick = () => {
|
const handleDeleteClick = () => {
|
||||||
openContextModalGeneric<IntegrationRemoveModalInnerProps>({
|
openContextModalGeneric<WidgetsRemoveModalInnerProps>({
|
||||||
modal: 'integrationRemove',
|
modal: 'integrationRemove',
|
||||||
title: <Title order={4}>{t('descriptor.remove.title')}</Title>,
|
title: <Title order={4}>{t('descriptor.remove.title')}</Title>,
|
||||||
innerProps: {
|
innerProps: {
|
||||||
@@ -45,7 +45,7 @@ export const IntegrationsMenu = <TIntegrationKey extends keyof IntegrationsType>
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleChangeSizeClick = () => {
|
const handleChangeSizeClick = () => {
|
||||||
openContextModalGeneric<IntegrationChangePositionModalInnerProps>({
|
openContextModalGeneric<WidgetChangePositionModalInnerProps>({
|
||||||
modal: 'changeIntegrationPositionModal',
|
modal: 'changeIntegrationPositionModal',
|
||||||
size: 'xl',
|
size: 'xl',
|
||||||
title: null,
|
title: null,
|
||||||
@@ -57,7 +57,7 @@ export const IntegrationsMenu = <TIntegrationKey extends keyof IntegrationsType>
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleEditClick = () => {
|
const handleEditClick = () => {
|
||||||
openContextModalGeneric<IntegrationEditModalInnerProps<TIntegrationKey>>({
|
openContextModalGeneric<WidgetEditModalInnerProps<TIntegrationKey>>({
|
||||||
modal: 'integrationOptions',
|
modal: 'integrationOptions',
|
||||||
title: <Title order={4}>{t('descriptor.settings.title')}</Title>,
|
title: <Title order={4}>{t('descriptor.settings.title')}</Title>,
|
||||||
innerProps: {
|
innerProps: {
|
||||||
@@ -2,18 +2,18 @@ import React from 'react';
|
|||||||
import { Button, Group, Stack, Text } from '@mantine/core';
|
import { Button, Group, Stack, Text } from '@mantine/core';
|
||||||
import { ContextModalProps } from '@mantine/modals';
|
import { ContextModalProps } from '@mantine/modals';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import { IntegrationsType } from '../../../types/integration';
|
import { IntegrationsType } from '../../../../types/integration';
|
||||||
import { integrationModuleTranslationsMap } from './IntegrationsEditModal';
|
import { integrationModuleTranslationsMap } from './WidgetsEditModal';
|
||||||
|
|
||||||
export type IntegrationRemoveModalInnerProps = {
|
export type WidgetsRemoveModalInnerProps = {
|
||||||
integration: keyof IntegrationsType;
|
integration: keyof IntegrationsType;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const IntegrationRemoveModal = ({
|
export const WidgetsRemoveModal = ({
|
||||||
context,
|
context,
|
||||||
id,
|
id,
|
||||||
innerProps,
|
innerProps,
|
||||||
}: ContextModalProps<IntegrationRemoveModalInnerProps>) => {
|
}: ContextModalProps<WidgetsRemoveModalInnerProps>) => {
|
||||||
const translationKey = integrationModuleTranslationsMap.get(innerProps.integration);
|
const translationKey = integrationModuleTranslationsMap.get(innerProps.integration);
|
||||||
const { t } = useTranslation([translationKey ?? '', 'common']);
|
const { t } = useTranslation([translationKey ?? '', 'common']);
|
||||||
const handleDeletion = () => {
|
const handleDeletion = () => {
|
||||||
@@ -1,15 +1,13 @@
|
|||||||
import { IntegrationsType } from '../../../types/integration';
|
import { IntegrationsType } from '../../../types/integration';
|
||||||
import { CalendarTile } from './Calendar/CalendarTile';
|
import { CalendarTile } from '../../../widgets/calendar/CalendarTile';
|
||||||
import { ClockTile } from './Clock/ClockTile';
|
import { ClockTile } from '../../../widgets/clock/ClockTile';
|
||||||
import { DashDotTile } from './DashDot/DashDotTile';
|
import { DashDotTile } from '../../../widgets/dashDot/DashDotTile';
|
||||||
|
import { UseNetTile } from '../../../widgets/useNet/UseNetTile';
|
||||||
|
import { WeatherTile } from '../../../widgets/weather/WeatherTile';
|
||||||
import { EmptyTile } from './EmptyTile';
|
import { EmptyTile } from './EmptyTile';
|
||||||
import { ServiceTile } from './Service/ServiceTile';
|
import { ServiceTile } from './Service/ServiceTile';
|
||||||
import { UseNetTile } from './UseNet/UseNetTile';
|
|
||||||
import { WeatherTile } from './Weather/WeatherTile';
|
|
||||||
/*import { CalendarTile } from './calendar';
|
|
||||||
import { ClockTile } from './clock';
|
|
||||||
import { DashDotTile } from './dash-dot';*/
|
|
||||||
|
|
||||||
|
// TODO: just remove and use service (later app) directly. For widgets the the definition should contain min/max width/height
|
||||||
type TileDefinitionProps = {
|
type TileDefinitionProps = {
|
||||||
[key in keyof IntegrationsType | 'service']: {
|
[key in keyof IntegrationsType | 'service']: {
|
||||||
minWidth?: number;
|
minWidth?: number;
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import { ChangeIntegrationPositionModal } from '../components/Dashboard/Modals/C
|
|||||||
import { ChangeServicePositionModal } from '../components/Dashboard/Modals/ChangePosition/ChangeServicePositionModal';
|
import { ChangeServicePositionModal } from '../components/Dashboard/Modals/ChangePosition/ChangeServicePositionModal';
|
||||||
import { EditServiceModal } from '../components/Dashboard/Modals/EditService/EditServiceModal';
|
import { EditServiceModal } from '../components/Dashboard/Modals/EditService/EditServiceModal';
|
||||||
import { SelectElementModal } from '../components/Dashboard/Modals/SelectElement/SelectElementModal';
|
import { SelectElementModal } from '../components/Dashboard/Modals/SelectElement/SelectElementModal';
|
||||||
import { IntegrationRemoveModal } from '../components/Dashboard/Tiles/IntegrationRemoveModal';
|
import { WidgetsRemoveModal } from '../components/Dashboard/Tiles/Widgets/WidgetsRemoveModal';
|
||||||
import { IntegrationsEditModal } from '../components/Dashboard/Tiles/IntegrationsEditModal';
|
import { WidgetsEditModal } from '../components/Dashboard/Tiles/Widgets/WidgetsEditModal';
|
||||||
import { CategoryEditModal } from '../components/Dashboard/Wrappers/Category/CategoryEditModal';
|
import { CategoryEditModal } from '../components/Dashboard/Wrappers/Category/CategoryEditModal';
|
||||||
import { ConfigProvider } from '../config/provider';
|
import { ConfigProvider } from '../config/provider';
|
||||||
import '../styles/global.scss';
|
import '../styles/global.scss';
|
||||||
@@ -88,8 +88,8 @@ function App(this: any, props: AppProps & { colorScheme: ColorScheme }) {
|
|||||||
modals={{
|
modals={{
|
||||||
editService: EditServiceModal,
|
editService: EditServiceModal,
|
||||||
selectElement: SelectElementModal,
|
selectElement: SelectElementModal,
|
||||||
integrationOptions: IntegrationsEditModal,
|
integrationOptions: WidgetsEditModal,
|
||||||
integrationRemove: IntegrationRemoveModal,
|
integrationRemove: WidgetsRemoveModal,
|
||||||
categoryEditModal: CategoryEditModal,
|
categoryEditModal: CategoryEditModal,
|
||||||
changeServicePositionModal: ChangeServicePositionModal,
|
changeServicePositionModal: ChangeServicePositionModal,
|
||||||
changeIntegrationPositionModal: ChangeIntegrationPositionModal,
|
changeIntegrationPositionModal: ChangeIntegrationPositionModal,
|
||||||
|
|||||||
@@ -2,17 +2,17 @@ import { createStyles, MantineThemeColors, useMantineTheme } from '@mantine/core
|
|||||||
import { Calendar } from '@mantine/dates';
|
import { Calendar } from '@mantine/dates';
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useConfigContext } from '../../../../config/provider';
|
import { HomarrCardWrapper } from '../../components/Dashboard/Tiles/HomarrCardWrapper';
|
||||||
import { useColorTheme } from '../../../../tools/color';
|
import { BaseTileProps } from '../../components/Dashboard/Tiles/type';
|
||||||
import { isToday } from '../../../../tools/isToday';
|
import { useConfigContext } from '../../config/provider';
|
||||||
import { CalendarIntegrationType } from '../../../../types/integration';
|
import { useColorTheme } from '../../tools/color';
|
||||||
import { HomarrCardWrapper } from '../HomarrCardWrapper';
|
import { isToday } from '../../tools/isToday';
|
||||||
import { BaseTileProps } from '../type';
|
import { CalendarIntegrationType } from '../../types/integration';
|
||||||
import { CalendarDay } from './CalendarDay';
|
import { CalendarDay } from './CalendarDay';
|
||||||
import { MediasType } from './type';
|
import { MediasType } from './type';
|
||||||
|
|
||||||
interface CalendarTileProps extends BaseTileProps {
|
interface CalendarTileProps extends BaseTileProps {
|
||||||
module: CalendarIntegrationType | undefined;
|
module: CalendarIntegrationType | undefined; // TODO: change to new type defined through widgetDefinition
|
||||||
}
|
}
|
||||||
|
|
||||||
export const CalendarTile = ({ className, module }: CalendarTileProps) => {
|
export const CalendarTile = ({ className, module }: CalendarTileProps) => {
|
||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
RadarrMediaDisplay,
|
RadarrMediaDisplay,
|
||||||
ReadarrMediaDisplay,
|
ReadarrMediaDisplay,
|
||||||
SonarrMediaDisplay,
|
SonarrMediaDisplay,
|
||||||
} from '../../../../modules/common';
|
} from '../../modules/common';
|
||||||
import { MediasType } from './type';
|
import { MediasType } from './type';
|
||||||
|
|
||||||
interface MediaListProps {
|
interface MediaListProps {
|
||||||
@@ -1,23 +1,24 @@
|
|||||||
import { Center, Stack, Text, Title } from '@mantine/core';
|
import { Center, Stack, Text, Title } from '@mantine/core';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
import { useSetSafeInterval } from '../../../../tools/hooks/useSetSafeInterval';
|
import { HomarrCardWrapper } from '../../components/Dashboard/Tiles/HomarrCardWrapper';
|
||||||
import { ClockIntegrationType } from '../../../../types/integration';
|
import { WidgetsMenu } from '../../components/Dashboard/Tiles/Widgets/WidgetsMenu';
|
||||||
import { HomarrCardWrapper } from '../HomarrCardWrapper';
|
import { BaseTileProps } from '../../components/Dashboard/Tiles/type';
|
||||||
import { IntegrationsMenu } from '../Integrations/IntegrationsMenu';
|
import { useSetSafeInterval } from '../../tools/hooks/useSetSafeInterval';
|
||||||
import { BaseTileProps } from '../type';
|
import { ClockIntegrationType } from '../../types/integration';
|
||||||
|
|
||||||
interface ClockTileProps extends BaseTileProps {
|
interface ClockTileProps extends BaseTileProps {
|
||||||
module: ClockIntegrationType | undefined;
|
module: ClockIntegrationType; // TODO: change to new type defined through widgetDefinition
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ClockTile = ({ className, module }: ClockTileProps) => {
|
export const ClockTile = ({ className, module }: ClockTileProps) => {
|
||||||
const date = useDateState();
|
const date = useDateState();
|
||||||
const formatString = module?.properties.is24HoursFormat ? 'HH:mm' : 'h:mm A';
|
const formatString = module?.properties.is24HoursFormat ? 'HH:mm' : 'h:mm A';
|
||||||
|
|
||||||
|
// TODO: add widgetWrapper that is generic and uses the definition
|
||||||
return (
|
return (
|
||||||
<HomarrCardWrapper className={className}>
|
<HomarrCardWrapper className={className}>
|
||||||
<IntegrationsMenu<'clock'>
|
<WidgetsMenu<'clock'>
|
||||||
integration="clock"
|
integration="clock"
|
||||||
module={module}
|
module={module}
|
||||||
options={module?.properties}
|
options={module?.properties}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Group, Stack, Text } from '@mantine/core';
|
import { Group, Stack, Text } from '@mantine/core';
|
||||||
import { IconArrowNarrowDown, IconArrowNarrowUp } from '@tabler/icons';
|
import { IconArrowNarrowDown, IconArrowNarrowUp } from '@tabler/icons';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import { bytes } from '../../../../tools/bytesHelper';
|
import { bytes } from '../../tools/bytesHelper';
|
||||||
|
|
||||||
interface DashDotCompactNetworkProps {
|
interface DashDotCompactNetworkProps {
|
||||||
info: DashDotInfo;
|
info: DashDotInfo;
|
||||||
@@ -2,10 +2,10 @@ import { Group, Stack, Text } from '@mantine/core';
|
|||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import { useConfigContext } from '../../../../config/provider';
|
import { useConfigContext } from '../../config/provider';
|
||||||
import { bytes } from '../../../../tools/bytesHelper';
|
import { bytes } from '../../tools/bytesHelper';
|
||||||
import { percentage } from '../../../../tools/percentage';
|
import { percentage } from '../../tools/percentage';
|
||||||
import { DashDotInfo } from './DashDotTile';
|
import { DashDotInfo } from './DashDotCompactNetwork';
|
||||||
|
|
||||||
interface DashDotCompactStorageProps {
|
interface DashDotCompactStorageProps {
|
||||||
info: DashDotInfo;
|
info: DashDotInfo;
|
||||||
@@ -3,16 +3,16 @@ import { useQuery } from '@tanstack/react-query';
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import { DashDotCompactNetwork, DashDotInfo } from './DashDotCompactNetwork';
|
import { DashDotCompactNetwork, DashDotInfo } from './DashDotCompactNetwork';
|
||||||
import { BaseTileProps } from '../type';
|
|
||||||
import { DashDotGraph } from './DashDotGraph';
|
import { DashDotGraph } from './DashDotGraph';
|
||||||
import { DashDotIntegrationType } from '../../../../types/integration';
|
|
||||||
import { IntegrationsMenu } from '../Integrations/IntegrationsMenu';
|
|
||||||
import { useConfigContext } from '../../../../config/provider';
|
|
||||||
import { HomarrCardWrapper } from '../HomarrCardWrapper';
|
|
||||||
import { DashDotCompactStorage } from './DashDotCompactStorage';
|
import { DashDotCompactStorage } from './DashDotCompactStorage';
|
||||||
|
import { BaseTileProps } from '../../components/Dashboard/Tiles/type';
|
||||||
|
import { DashDotIntegrationType } from '../../types/integration';
|
||||||
|
import { WidgetsMenu } from '../../components/Dashboard/Tiles/Widgets/WidgetsMenu';
|
||||||
|
import { HomarrCardWrapper } from '../../components/Dashboard/Tiles/HomarrCardWrapper';
|
||||||
|
import { useConfigContext } from '../../config/provider';
|
||||||
|
|
||||||
interface DashDotTileProps extends BaseTileProps {
|
interface DashDotTileProps extends BaseTileProps {
|
||||||
module: DashDotIntegrationType | undefined;
|
module: DashDotIntegrationType; // TODO: change to new type defined through widgetDefinition
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DashDotTile = ({ module, className }: DashDotTileProps) => {
|
export const DashDotTile = ({ module, className }: DashDotTileProps) => {
|
||||||
@@ -39,7 +39,8 @@ export const DashDotTile = ({ module, className }: DashDotTileProps) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const menu = (
|
const menu = (
|
||||||
<IntegrationsMenu<'dashDot'>
|
// TODO: add widgetWrapper that is generic and uses the definition
|
||||||
|
<WidgetsMenu<'dashDot'>
|
||||||
module={module}
|
module={module}
|
||||||
integration="dashDot"
|
integration="dashDot"
|
||||||
options={module?.properties}
|
options={module?.properties}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { DashDotGraphType } from '../../../../types/integration';
|
import { DashDotGraphType } from '../../types/integration';
|
||||||
|
|
||||||
export interface DashDotGraph {
|
export interface DashDotGraph {
|
||||||
id: DashDotGraphType;
|
id: DashDotGraphType;
|
||||||
2
src/widgets/index.ts
Normal file
2
src/widgets/index.ts
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
export {};
|
||||||
|
// TODO: add exports of new IWidgetDefinitions to here
|
||||||
@@ -16,18 +16,14 @@ import { useElementSize } from '@mantine/hooks';
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import duration from 'dayjs/plugin/duration';
|
import duration from 'dayjs/plugin/duration';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import { useConfigContext } from '../../../../config/provider';
|
|
||||||
import { UsenetQueueList } from './UsenetQueueList';
|
import { UsenetQueueList } from './UsenetQueueList';
|
||||||
import {
|
|
||||||
useGetUsenetInfo,
|
|
||||||
usePauseUsenetQueue,
|
|
||||||
useResumeUsenetQueue,
|
|
||||||
} from '../../../../tools/hooks/api';
|
|
||||||
import { humanFileSize } from '../../../../tools/humanFileSize';
|
|
||||||
import { ServiceIntegrationType } from '../../../../types/service';
|
|
||||||
import { HomarrCardWrapper } from '../HomarrCardWrapper';
|
|
||||||
import { BaseTileProps } from '../type';
|
|
||||||
import { UsenetHistoryList } from './UsenetHistoryList';
|
import { UsenetHistoryList } from './UsenetHistoryList';
|
||||||
|
import { BaseTileProps } from '../../components/Dashboard/Tiles/type';
|
||||||
|
import { ServiceIntegrationType } from '../../types/service';
|
||||||
|
import { useConfigContext } from '../../config/provider';
|
||||||
|
import { useGetUsenetInfo, usePauseUsenetQueue, useResumeUsenetQueue } from '../../tools/hooks/api';
|
||||||
|
import { HomarrCardWrapper } from '../../components/Dashboard/Tiles/HomarrCardWrapper';
|
||||||
|
import { humanFileSize } from '../../tools/humanFileSize';
|
||||||
|
|
||||||
dayjs.extend(duration);
|
dayjs.extend(duration);
|
||||||
|
|
||||||
@@ -18,9 +18,9 @@ import dayjs from 'dayjs';
|
|||||||
import duration from 'dayjs/plugin/duration';
|
import duration from 'dayjs/plugin/duration';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import { FunctionComponent, useState } from 'react';
|
import { FunctionComponent, useState } from 'react';
|
||||||
import { useGetUsenetHistory } from '../../../../tools/hooks/api';
|
import { useGetUsenetHistory } from '../../tools/hooks/api';
|
||||||
import { humanFileSize } from '../../../../tools/humanFileSize';
|
import { humanFileSize } from '../../tools/humanFileSize';
|
||||||
import { parseDuration } from '../../../../tools/parseDuration';
|
import { parseDuration } from '../../tools/parseDuration';
|
||||||
|
|
||||||
dayjs.extend(duration);
|
dayjs.extend(duration);
|
||||||
|
|
||||||
@@ -21,8 +21,8 @@ import dayjs from 'dayjs';
|
|||||||
import duration from 'dayjs/plugin/duration';
|
import duration from 'dayjs/plugin/duration';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import { FunctionComponent, useState } from 'react';
|
import { FunctionComponent, useState } from 'react';
|
||||||
import { useGetUsenetDownloads } from '../../../../tools/hooks/api';
|
import { useGetUsenetDownloads } from '../../tools/hooks/api';
|
||||||
import { humanFileSize } from '../../../../tools/humanFileSize';
|
import { humanFileSize } from '../../tools/humanFileSize';
|
||||||
|
|
||||||
dayjs.extend(duration);
|
dayjs.extend(duration);
|
||||||
|
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
import { Center, Group, Skeleton, Stack, Text, Title } from '@mantine/core';
|
import { Center, Group, Skeleton, Stack, Text, Title } from '@mantine/core';
|
||||||
import { IconArrowDownRight, IconArrowUpRight } from '@tabler/icons';
|
import { IconArrowDownRight, IconArrowUpRight } from '@tabler/icons';
|
||||||
import { WeatherIcon } from './WeatherIcon';
|
import { HomarrCardWrapper } from '../../components/Dashboard/Tiles/HomarrCardWrapper';
|
||||||
import { BaseTileProps } from '../type';
|
import { WidgetsMenu } from '../../components/Dashboard/Tiles/Widgets/WidgetsMenu';
|
||||||
|
import { BaseTileProps } from '../../components/Dashboard/Tiles/type';
|
||||||
|
import { WeatherIntegrationType } from '../../types/integration';
|
||||||
import { useWeatherForCity } from './useWeatherForCity';
|
import { useWeatherForCity } from './useWeatherForCity';
|
||||||
import { WeatherIntegrationType } from '../../../../types/integration';
|
import { WeatherIcon } from './WeatherIcon';
|
||||||
import { HomarrCardWrapper } from '../HomarrCardWrapper';
|
|
||||||
import { IntegrationsMenu } from '../Integrations/IntegrationsMenu';
|
|
||||||
|
|
||||||
interface WeatherTileProps extends BaseTileProps {
|
interface WeatherTileProps extends BaseTileProps {
|
||||||
module: WeatherIntegrationType | undefined;
|
module: WeatherIntegrationType; // TODO: change to new type defined through widgetDefinition
|
||||||
}
|
}
|
||||||
|
|
||||||
export const WeatherTile = ({ className, module }: WeatherTileProps) => {
|
export const WeatherTile = ({ className, module }: WeatherTileProps) => {
|
||||||
@@ -43,9 +43,10 @@ export const WeatherTile = ({ className, module }: WeatherTileProps) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: add widgetWrapper that is generic and uses the definition
|
||||||
return (
|
return (
|
||||||
<HomarrCardWrapper className={className}>
|
<HomarrCardWrapper className={className}>
|
||||||
<IntegrationsMenu
|
<WidgetsMenu
|
||||||
integration="weather"
|
integration="weather"
|
||||||
module={module}
|
module={module}
|
||||||
options={module?.properties}
|
options={module?.properties}
|
||||||
Reference in New Issue
Block a user