mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-10 15:35:55 +01:00
Linting and fixint errors
This commit is contained in:
@@ -3,15 +3,10 @@ import { closeModal, ContextModalProps } from '@mantine/modals';
|
||||
import { useConfigContext } from '../../../../config/provider';
|
||||
import { useConfigStore } from '../../../../config/store';
|
||||
import { IntegrationsType } from '../../../../types/integration';
|
||||
import { TileBaseType } from '../../../../types/tile';
|
||||
import { IntegrationChangePositionModalInnerProps } from '../../Tiles/Integrations/IntegrationsMenu';
|
||||
import { Tiles } from '../../Tiles/tilesDefinitions';
|
||||
import { ChangePositionModal } from './ChangePositionModal';
|
||||
|
||||
export type IntegrationChangePositionModalInnerProps = {
|
||||
integration: keyof IntegrationsType;
|
||||
module: TileBaseType;
|
||||
};
|
||||
|
||||
export const ChangeIntegrationPositionModal = ({
|
||||
context,
|
||||
id,
|
||||
|
||||
@@ -12,8 +12,7 @@ interface IntegrationTabProps {
|
||||
|
||||
export const IntegrationTab = ({ form }: IntegrationTabProps) => {
|
||||
const { t } = useTranslation('');
|
||||
const hasIntegrationSelected =
|
||||
form.values.integration?.type;
|
||||
const hasIntegrationSelected = form.values.integration?.type;
|
||||
|
||||
return (
|
||||
<Tabs.Panel value="integration" pt="lg">
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
export type EditServiceModalTab = 'general' | 'behaviour' | 'network' | 'appereance' | 'integration';
|
||||
export type EditServiceModalTab =
|
||||
| 'general'
|
||||
| 'behaviour'
|
||||
| 'network'
|
||||
| 'appereance'
|
||||
| 'integration';
|
||||
|
||||
@@ -6,14 +6,14 @@ interface SelectorBackArrowProps {
|
||||
}
|
||||
|
||||
export const SelectorBackArrow = ({ onClickBack }: SelectorBackArrowProps) => (
|
||||
<Button
|
||||
leftIcon={<IconArrowNarrowLeft />}
|
||||
onClick={onClickBack}
|
||||
styles={{ inner: { width: 'fit-content' } }}
|
||||
fullWidth
|
||||
variant='default'
|
||||
mb="md"
|
||||
>
|
||||
<Text>See all available elements</Text>
|
||||
</Button>
|
||||
);
|
||||
<Button
|
||||
leftIcon={<IconArrowNarrowLeft />}
|
||||
onClick={onClickBack}
|
||||
styles={{ inner: { width: 'fit-content' } }}
|
||||
fullWidth
|
||||
variant="default"
|
||||
mb="md"
|
||||
>
|
||||
<Text>See all available elements</Text>
|
||||
</Button>
|
||||
);
|
||||
|
||||
@@ -2,12 +2,21 @@ import { Group, Stack, Text } from '@mantine/core';
|
||||
import { IconArrowNarrowDown, IconArrowNarrowUp } from '@tabler/icons';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { bytes } from '../../../../tools/bytesHelper';
|
||||
import { DashDotInfo } from './DashDotTile';
|
||||
|
||||
interface DashDotCompactNetworkProps {
|
||||
info: DashDotInfo;
|
||||
}
|
||||
|
||||
export interface DashDotInfo {
|
||||
storage: {
|
||||
layout: { size: number }[];
|
||||
};
|
||||
network: {
|
||||
speedUp: number;
|
||||
speedDown: number;
|
||||
};
|
||||
}
|
||||
|
||||
export const DashDotCompactNetwork = ({ info }: DashDotCompactNetworkProps) => {
|
||||
const { t } = useTranslation('modules/dashdot');
|
||||
|
||||
@@ -15,7 +24,7 @@ export const DashDotCompactNetwork = ({ info }: DashDotCompactNetworkProps) => {
|
||||
const downSpeed = bytes.toPerSecondString(info?.network?.speedDown);
|
||||
|
||||
return (
|
||||
<Group noWrap align="start" position="apart" w={'100%'} maw={'251px'}>
|
||||
<Group noWrap align="start" position="apart" w="100%" maw="251px">
|
||||
<Text weight={500}>{t('card.graphs.network.label')}</Text>
|
||||
<Stack align="end" spacing={0}>
|
||||
<Group spacing={0}>
|
||||
|
||||
@@ -25,7 +25,7 @@ export const DashDotCompactStorage = ({ info }: DashDotCompactStorageProps) => {
|
||||
});
|
||||
|
||||
return (
|
||||
<Group noWrap align="start" position="apart" w={'100%'} maw={'251px'}>
|
||||
<Group noWrap align="start" position="apart" w="100%" maw="251px">
|
||||
<Text weight={500}>{t('card.graphs.storage.label')}</Text>
|
||||
<Stack align="end" spacing={0}>
|
||||
<Text color="dimmed" size="xs">
|
||||
@@ -42,11 +42,8 @@ export const DashDotCompactStorage = ({ info }: DashDotCompactStorageProps) => {
|
||||
const calculateTotalLayoutSize = <TLayoutItem,>({
|
||||
layout,
|
||||
key,
|
||||
}: CalculateTotalLayoutSizeProps<TLayoutItem>) => {
|
||||
return layout.reduce((total, current) => {
|
||||
return total + (current[key] as number);
|
||||
}, 0);
|
||||
};
|
||||
}: CalculateTotalLayoutSizeProps<TLayoutItem>) =>
|
||||
layout.reduce((total, current) => total + (current[key] as number), 0);
|
||||
|
||||
interface CalculateTotalLayoutSizeProps<TLayoutItem> {
|
||||
layout: TLayoutItem[];
|
||||
@@ -68,13 +65,13 @@ const useDashDotStorage = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const fetchDashDotStorageLoad = async (configName: string | undefined) => {
|
||||
console.log('storage request: ' + configName);
|
||||
if (!configName) return;
|
||||
async function fetchDashDotStorageLoad(configName: string | undefined) {
|
||||
console.log(`storage request: ${configName}`);
|
||||
if (!configName) throw new Error('configName is undefined');
|
||||
return (await (
|
||||
await axios.get('/api/modules/dashdot/storage', { params: { configName } })
|
||||
).data) as DashDotStorageLoad;
|
||||
};
|
||||
}
|
||||
|
||||
interface DashDotStorageLoad {
|
||||
layout: { load: number }[];
|
||||
|
||||
@@ -1,24 +1,15 @@
|
||||
import {
|
||||
Card,
|
||||
createStyles,
|
||||
Flex,
|
||||
Grid,
|
||||
Group,
|
||||
Stack,
|
||||
Title,
|
||||
useMantineTheme,
|
||||
} from '@mantine/core';
|
||||
import { createStyles, Group, Title } from '@mantine/core';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import axios from 'axios';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { DashDotCompactNetwork } from './DashDotCompactNetwork';
|
||||
import { DashDotCompactStorage } from './DashDotCompactStorage';
|
||||
import { DashDotCompactNetwork, DashDotInfo } from './DashDotCompactNetwork';
|
||||
import { BaseTileProps } from '../type';
|
||||
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';
|
||||
|
||||
interface DashDotTileProps extends BaseTileProps {
|
||||
module: DashDotIntegrationType | undefined;
|
||||
@@ -132,16 +123,6 @@ const fetchDashDotInfo = async (configName: string | undefined) => {
|
||||
).data) as DashDotInfo;
|
||||
};
|
||||
|
||||
export interface DashDotInfo {
|
||||
storage: {
|
||||
layout: { size: number }[];
|
||||
};
|
||||
network: {
|
||||
speedUp: number;
|
||||
speedDown: number;
|
||||
};
|
||||
}
|
||||
|
||||
export const useDashDotTileStyles = createStyles(() => ({
|
||||
graphsContainer: {
|
||||
display: 'flex',
|
||||
@@ -151,7 +132,7 @@ export const useDashDotTileStyles = createStyles(() => ({
|
||||
columnGap: 10,
|
||||
},
|
||||
graphsWrapper: {
|
||||
[`& > *:nth-child(odd):last-child`]: {
|
||||
'& > *:nth-child(odd):last-child': {
|
||||
width: '100% !important',
|
||||
maxWidth: '100% !important',
|
||||
},
|
||||
|
||||
@@ -11,5 +11,13 @@ export const HomarrCardWrapper = ({ ...props }: HomarrCardWrapperProps) => {
|
||||
cx,
|
||||
classes: { card: cardClass },
|
||||
} = useCardStyles();
|
||||
return <Card {...props} className={cx(props.className, cardClass)} withBorder radius="lg" shadow="md" />;
|
||||
return (
|
||||
<Card
|
||||
{...props}
|
||||
className={cx(props.className, cardClass)}
|
||||
withBorder
|
||||
radius="lg"
|
||||
shadow="md"
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -4,7 +4,6 @@ import { openContextModalGeneric } from '../../../../tools/mantineModalManagerEx
|
||||
import { IntegrationsType } from '../../../../types/integration';
|
||||
import { TileBaseType } from '../../../../types/tile';
|
||||
import { GenericTileMenu } from '../GenericTileMenu';
|
||||
import { IntegrationChangePositionModalInnerProps } from '../../Modals/ChangePosition/ChangeIntegrationPositionModal';
|
||||
import { IntegrationRemoveModalInnerProps } from '../IntegrationRemoveModal';
|
||||
import {
|
||||
IntegrationEditModalInnerProps,
|
||||
@@ -13,6 +12,11 @@ import {
|
||||
IntegrationOptions,
|
||||
} from '../IntegrationsEditModal';
|
||||
|
||||
export type IntegrationChangePositionModalInnerProps = {
|
||||
integration: keyof IntegrationsType;
|
||||
module: TileBaseType;
|
||||
};
|
||||
|
||||
interface IntegrationsMenuProps<TIntegrationKey extends keyof IntegrationsType> {
|
||||
integration: TIntegrationKey;
|
||||
module: TileBaseType | undefined;
|
||||
|
||||
@@ -34,28 +34,26 @@ export const IntegrationsEditModal = ({
|
||||
|
||||
const handleChange = (key: string, value: IntegrationOptionsValueType) => {
|
||||
setModuleProperties((prev) => {
|
||||
let copyOfPrev: any = { ...prev };
|
||||
const copyOfPrev: any = { ...prev };
|
||||
copyOfPrev[key] = value;
|
||||
return copyOfPrev;
|
||||
});
|
||||
};
|
||||
|
||||
const handleSave = () => {
|
||||
updateConfig(configName, (prev) => {
|
||||
return {
|
||||
...prev,
|
||||
integrations: {
|
||||
...prev.integrations,
|
||||
[innerProps.integration]:
|
||||
'properties' in (prev.integrations[innerProps.integration] ?? {})
|
||||
? {
|
||||
...prev.integrations[innerProps.integration],
|
||||
properties: moduleProperties,
|
||||
}
|
||||
: prev.integrations[innerProps.integration],
|
||||
},
|
||||
};
|
||||
});
|
||||
updateConfig(configName, (prev) => ({
|
||||
...prev,
|
||||
integrations: {
|
||||
...prev.integrations,
|
||||
[innerProps.integration]:
|
||||
'properties' in (prev.integrations[innerProps.integration] ?? {})
|
||||
? {
|
||||
...prev.integrations[innerProps.integration],
|
||||
properties: moduleProperties,
|
||||
}
|
||||
: prev.integrations[innerProps.integration],
|
||||
},
|
||||
}));
|
||||
context.closeModal(id);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Card, 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 { WeatherIcon } from './WeatherIcon';
|
||||
import { BaseTileProps } from '../type';
|
||||
@@ -91,6 +91,5 @@ export const WeatherTile = ({ className, module }: WeatherTileProps) => {
|
||||
);
|
||||
};
|
||||
|
||||
const getPerferedUnit = (value: number, isFahrenheit: boolean = false): string => {
|
||||
return isFahrenheit ? `${(value * (9 / 5) + 32).toFixed(1)}°F` : `${value.toFixed(1)}°C`;
|
||||
};
|
||||
const getPerferedUnit = (value: number, isFahrenheit = false): string =>
|
||||
isFahrenheit ? `${(value * (9 / 5) + 32).toFixed(1)}°F` : `${value.toFixed(1)}°C`;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { GridStack, GridStackNode } from 'fily-publish-gridstack';
|
||||
import {
|
||||
createRef,
|
||||
LegacyRef,
|
||||
MutableRefObject,
|
||||
RefObject,
|
||||
useEffect,
|
||||
|
||||
@@ -110,6 +110,5 @@ const useDeleteConfigMutation = (configName: string) => {
|
||||
});
|
||||
};
|
||||
|
||||
const fetchDeletion = async (configName: string) => {
|
||||
return await (await fetch(`/api/configs/${configName}`)).json();
|
||||
};
|
||||
const fetchDeletion = async (configName: string) =>
|
||||
(await fetch(`/api/configs/${configName}`)).json();
|
||||
|
||||
@@ -39,10 +39,6 @@ export function SearchNewTabSwitch({ defaultValue }: SearchNewTabSwitchProps) {
|
||||
};
|
||||
|
||||
return (
|
||||
<Switch
|
||||
checked={openInNewTab}
|
||||
onChange={toggleOpenInNewTab}
|
||||
label={t('searchNewTab.label')}
|
||||
/>
|
||||
<Switch checked={openInNewTab} onChange={toggleOpenInNewTab} label={t('searchNewTab.label')} />
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user