mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-09 06:55:51 +01:00
✨ Migrate tiles from id to type
This commit is contained in:
@@ -28,7 +28,7 @@ export const ChangeWidgetPositionModal = ({
|
|||||||
updateConfig(
|
updateConfig(
|
||||||
configName,
|
configName,
|
||||||
(prev) => {
|
(prev) => {
|
||||||
const currentWidget = prev.widgets.find((x) => x.id === innerProps.widgetId);
|
const currentWidget = prev.widgets.find((x) => x.type === innerProps.widgetType);
|
||||||
currentWidget!.shape[shapeSize] = {
|
currentWidget!.shape[shapeSize] = {
|
||||||
location: {
|
location: {
|
||||||
x,
|
x,
|
||||||
@@ -42,7 +42,10 @@ export const ChangeWidgetPositionModal = ({
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
...prev,
|
...prev,
|
||||||
widgets: [...prev.widgets.filter((x) => x.id !== innerProps.widgetId), currentWidget!],
|
widgets: [
|
||||||
|
...prev.widgets.filter((x) => x.type !== innerProps.widgetType),
|
||||||
|
currentWidget!,
|
||||||
|
],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
true
|
true
|
||||||
@@ -54,8 +57,8 @@ export const ChangeWidgetPositionModal = ({
|
|||||||
closeModal(id);
|
closeModal(id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const widthData = useWidthData(innerProps.widgetId);
|
const widthData = useWidthData(innerProps.widgetType);
|
||||||
const heightData = useHeightData(innerProps.widgetId);
|
const heightData = useHeightData(innerProps.widgetType);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ChangePositionModal
|
<ChangePositionModal
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { Grid, Text } from '@mantine/core';
|
import { Grid, Text } from '@mantine/core';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import { useConfigContext } from '../../../../../../config/provider';
|
|
||||||
import widgets from '../../../../../../widgets';
|
import widgets from '../../../../../../widgets';
|
||||||
import { SelectorBackArrow } from '../Shared/SelectorBackArrow';
|
import { SelectorBackArrow } from '../Shared/SelectorBackArrow';
|
||||||
import { WidgetElementType } from './WidgetElementType';
|
import { WidgetElementType } from './WidgetElementType';
|
||||||
@@ -13,7 +12,6 @@ export const AvailableIntegrationElements = ({
|
|||||||
onClickBack,
|
onClickBack,
|
||||||
}: AvailableIntegrationElementsProps) => {
|
}: AvailableIntegrationElementsProps) => {
|
||||||
const { t } = useTranslation('layout/element-selector/selector');
|
const { t } = useTranslation('layout/element-selector/selector');
|
||||||
const activeWidgets = useConfigContext().config?.widgets ?? [];
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<SelectorBackArrow onClickBack={onClickBack} />
|
<SelectorBackArrow onClickBack={onClickBack} />
|
||||||
@@ -23,11 +21,9 @@ export const AvailableIntegrationElements = ({
|
|||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
{Object.entries(widgets)
|
{Object.entries(widgets).map(([k, v]) => (
|
||||||
.filter(([widgetId]) => !activeWidgets.some((aw) => aw.id === widgetId))
|
<WidgetElementType key={k} id={k} image={v.icon} widget={v} />
|
||||||
.map(([k, v]) => (
|
))}
|
||||||
<WidgetElementType key={k} id={k} image={v.icon} widget={v} />
|
|
||||||
))}
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useModals } from '@mantine/modals';
|
|||||||
import { showNotification } from '@mantine/notifications';
|
import { showNotification } from '@mantine/notifications';
|
||||||
import { IconChecks, TablerIcon } from '@tabler/icons';
|
import { IconChecks, TablerIcon } from '@tabler/icons';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
import { useConfigContext } from '../../../../../../config/provider';
|
import { useConfigContext } from '../../../../../../config/provider';
|
||||||
import { useConfigStore } from '../../../../../../config/store';
|
import { useConfigStore } from '../../../../../../config/store';
|
||||||
import { IWidget, IWidgetDefinition } from '../../../../../../widgets/widgets';
|
import { IWidget, IWidgetDefinition } from '../../../../../../widgets/widgets';
|
||||||
@@ -32,9 +33,10 @@ export const WidgetElementType = ({ id, image, disabled, widget }: WidgetElement
|
|||||||
(prev) => ({
|
(prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
widgets: [
|
widgets: [
|
||||||
...prev.widgets.filter((w) => w.id !== widget.id),
|
...prev.widgets,
|
||||||
{
|
{
|
||||||
id: widget.id,
|
id: uuidv4(),
|
||||||
|
type: widget.id,
|
||||||
properties: Object.entries(widget.options).reduce((prev, [k, v]) => {
|
properties: Object.entries(widget.options).reduce((prev, [k, v]) => {
|
||||||
const newPrev = prev;
|
const newPrev = prev;
|
||||||
newPrev[k] = v.defaultValue;
|
newPrev[k] = v.defaultValue;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import { IWidget } from '../../../../widgets/widgets';
|
|||||||
import { DraggableList } from './DraggableList';
|
import { DraggableList } from './DraggableList';
|
||||||
|
|
||||||
export type WidgetEditModalInnerProps = {
|
export type WidgetEditModalInnerProps = {
|
||||||
widgetId: string;
|
widgetType: string;
|
||||||
options: IWidget<string, any>['properties'];
|
options: IWidget<string, any>['properties'];
|
||||||
widgetOptions: IWidget<string, any>['properties'];
|
widgetOptions: IWidget<string, any>['properties'];
|
||||||
};
|
};
|
||||||
@@ -37,7 +37,8 @@ export const WidgetsEditModal = ({
|
|||||||
id,
|
id,
|
||||||
innerProps,
|
innerProps,
|
||||||
}: ContextModalProps<WidgetEditModalInnerProps>) => {
|
}: ContextModalProps<WidgetEditModalInnerProps>) => {
|
||||||
const { t } = useTranslation([`modules/${innerProps.widgetId}`, 'common']);
|
console.log('?');
|
||||||
|
const { t } = useTranslation([`modules/${innerProps.widgetType}`, 'common']);
|
||||||
const [moduleProperties, setModuleProperties] = useState(innerProps.options);
|
const [moduleProperties, setModuleProperties] = useState(innerProps.options);
|
||||||
const items = Object.entries(innerProps.widgetOptions ?? {}) as [
|
const items = Object.entries(innerProps.widgetOptions ?? {}) as [
|
||||||
string,
|
string,
|
||||||
@@ -45,7 +46,7 @@ export const WidgetsEditModal = ({
|
|||||||
][];
|
][];
|
||||||
|
|
||||||
// Find the Key in the "Widgets" Object that matches the widgetId
|
// Find the Key in the "Widgets" Object that matches the widgetId
|
||||||
const currentWidgetDefinition = Widgets[innerProps.widgetId as keyof typeof Widgets];
|
const currentWidgetDefinition = Widgets[innerProps.widgetType as keyof typeof Widgets];
|
||||||
const { name: configName } = useConfigContext();
|
const { name: configName } = useConfigContext();
|
||||||
const updateConfig = useConfigStore((x) => x.updateConfig);
|
const updateConfig = useConfigStore((x) => x.updateConfig);
|
||||||
|
|
||||||
@@ -63,12 +64,15 @@ export const WidgetsEditModal = ({
|
|||||||
updateConfig(
|
updateConfig(
|
||||||
configName,
|
configName,
|
||||||
(prev) => {
|
(prev) => {
|
||||||
const currentWidget = prev.widgets.find((x) => x.id === innerProps.widgetId);
|
const currentWidget = prev.widgets.find((x) => x.type === innerProps.widgetType);
|
||||||
currentWidget!.properties = moduleProperties;
|
currentWidget!.properties = moduleProperties;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...prev,
|
...prev,
|
||||||
widgets: [...prev.widgets.filter((x) => x.id !== innerProps.widgetId), currentWidget!],
|
widgets: [
|
||||||
|
...prev.widgets.filter((x) => x.type !== innerProps.widgetType),
|
||||||
|
currentWidget!,
|
||||||
|
],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
true
|
true
|
||||||
@@ -76,6 +80,8 @@ export const WidgetsEditModal = ({
|
|||||||
context.closeModal(id);
|
context.closeModal(id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log('??');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<Stack>
|
||||||
{items.map(([key, _], index) => {
|
{items.map(([key, _], index) => {
|
||||||
@@ -100,7 +106,7 @@ export const WidgetsEditModal = ({
|
|||||||
<WidgetOptionTypeSwitch
|
<WidgetOptionTypeSwitch
|
||||||
key={`${key}.${index}`}
|
key={`${key}.${index}`}
|
||||||
option={option}
|
option={option}
|
||||||
widgetId={innerProps.widgetId}
|
widgetId={innerProps.widgetType}
|
||||||
propName={key}
|
propName={key}
|
||||||
value={value}
|
value={value}
|
||||||
handleChange={handleChange}
|
handleChange={handleChange}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { WidgetEditModalInnerProps } from './WidgetsEditModal';
|
|||||||
import { WidgetsRemoveModalInnerProps } from './WidgetsRemoveModal';
|
import { WidgetsRemoveModalInnerProps } from './WidgetsRemoveModal';
|
||||||
|
|
||||||
export type WidgetChangePositionModalInnerProps = {
|
export type WidgetChangePositionModalInnerProps = {
|
||||||
widgetId: string;
|
widgetType: string;
|
||||||
widget: IWidget<string, any>;
|
widget: IWidget<string, any>;
|
||||||
wrapperColumnCount: number;
|
wrapperColumnCount: number;
|
||||||
};
|
};
|
||||||
@@ -27,8 +27,8 @@ export const WidgetsMenu = ({ integration, widget }: WidgetsMenuProps) => {
|
|||||||
// Match widget.id with WidgetsDefinitions
|
// Match widget.id with WidgetsDefinitions
|
||||||
// First get the keys
|
// First get the keys
|
||||||
const keys = Object.keys(WidgetsDefinitions);
|
const keys = Object.keys(WidgetsDefinitions);
|
||||||
// Then find the key that matches the widget.id
|
// Then find the key that matches the widget.type
|
||||||
const widgetDefinition = keys.find((key) => key === widget.id);
|
const widgetDefinition = keys.find((key) => key === widget.type);
|
||||||
// Then get the widget definition
|
// Then get the widget definition
|
||||||
const widgetDefinitionObject =
|
const widgetDefinitionObject =
|
||||||
WidgetsDefinitions[widgetDefinition as keyof typeof WidgetsDefinitions];
|
WidgetsDefinitions[widgetDefinition as keyof typeof WidgetsDefinitions];
|
||||||
@@ -38,7 +38,7 @@ export const WidgetsMenu = ({ integration, widget }: WidgetsMenuProps) => {
|
|||||||
modal: 'integrationRemove',
|
modal: 'integrationRemove',
|
||||||
title: <Title order={4}>{t('common:remove')}</Title>,
|
title: <Title order={4}>{t('common:remove')}</Title>,
|
||||||
innerProps: {
|
innerProps: {
|
||||||
widgetId: integration,
|
widgetType: integration,
|
||||||
},
|
},
|
||||||
styles: {
|
styles: {
|
||||||
inner: {
|
inner: {
|
||||||
@@ -55,37 +55,24 @@ export const WidgetsMenu = ({ integration, widget }: WidgetsMenuProps) => {
|
|||||||
size: 'xl',
|
size: 'xl',
|
||||||
title: null,
|
title: null,
|
||||||
innerProps: {
|
innerProps: {
|
||||||
widgetId: integration,
|
widgetType: integration,
|
||||||
widget,
|
widget,
|
||||||
wrapperColumnCount,
|
wrapperColumnCount,
|
||||||
},
|
},
|
||||||
styles: {
|
|
||||||
inner: {
|
|
||||||
position: 'sticky',
|
|
||||||
top: 30,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleEditClick = () => {
|
const handleEditClick = () => {
|
||||||
openContextModalGeneric<WidgetEditModalInnerProps>({
|
openContextModalGeneric<WidgetEditModalInnerProps>({
|
||||||
modal: 'integrationOptions',
|
modal: 'integrationOptions',
|
||||||
title: <Title order={4}>{t('descriptor.settings.title')}</Title>,
|
title: t('descriptor.settings.title'),
|
||||||
innerProps: {
|
innerProps: {
|
||||||
widgetId: integration,
|
widgetType: integration,
|
||||||
options: widget.properties,
|
options: widget.properties,
|
||||||
// Cast as the right type for the correct widget
|
// Cast as the right type for the correct widget
|
||||||
widgetOptions: widgetDefinitionObject.options as any,
|
widgetOptions: widgetDefinitionObject.options as any,
|
||||||
},
|
},
|
||||||
zIndex: 5,
|
zIndex: 5,
|
||||||
styles: {
|
|
||||||
inner: {
|
|
||||||
position: 'sticky',
|
|
||||||
top: 30,
|
|
||||||
maxHeight: '100%',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { useConfigContext } from '../../../../config/provider';
|
|||||||
import { useConfigStore } from '../../../../config/store';
|
import { useConfigStore } from '../../../../config/store';
|
||||||
|
|
||||||
export type WidgetsRemoveModalInnerProps = {
|
export type WidgetsRemoveModalInnerProps = {
|
||||||
widgetId: string;
|
widgetType: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const WidgetsRemoveModal = ({
|
export const WidgetsRemoveModal = ({
|
||||||
@@ -14,7 +14,7 @@ export const WidgetsRemoveModal = ({
|
|||||||
id,
|
id,
|
||||||
innerProps,
|
innerProps,
|
||||||
}: ContextModalProps<WidgetsRemoveModalInnerProps>) => {
|
}: ContextModalProps<WidgetsRemoveModalInnerProps>) => {
|
||||||
const { t } = useTranslation([`modules/${innerProps.widgetId}`, 'common']);
|
const { t } = useTranslation([`modules/${innerProps.widgetType}`, 'common']);
|
||||||
const { name: configName } = useConfigContext();
|
const { name: configName } = useConfigContext();
|
||||||
if (!configName) return null;
|
if (!configName) return null;
|
||||||
const updateConfig = useConfigStore((x) => x.updateConfig);
|
const updateConfig = useConfigStore((x) => x.updateConfig);
|
||||||
@@ -23,7 +23,7 @@ export const WidgetsRemoveModal = ({
|
|||||||
configName,
|
configName,
|
||||||
(prev) => ({
|
(prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
widgets: prev.widgets.filter((w) => w.id !== innerProps.widgetId),
|
widgets: prev.widgets.filter((w) => w.type !== innerProps.widgetType),
|
||||||
}),
|
}),
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
@@ -35,7 +35,7 @@ export const WidgetsRemoveModal = ({
|
|||||||
<Trans
|
<Trans
|
||||||
i18nKey="common:removeConfirm"
|
i18nKey="common:removeConfirm"
|
||||||
components={[<Text weight={500} />]}
|
components={[<Text weight={500} />]}
|
||||||
values={{ item: innerProps.widgetId }}
|
values={{ item: innerProps.widgetType }}
|
||||||
/>
|
/>
|
||||||
<Group position="right">
|
<Group position="right">
|
||||||
<Button onClick={() => context.closeModal(id)} variant="light">
|
<Button onClick={() => context.closeModal(id)} variant="light">
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ export function RadarrMediaDisplay(props: any) {
|
|||||||
export function SonarrMediaDisplay(props: any) {
|
export function SonarrMediaDisplay(props: any) {
|
||||||
const { media }: { media: any } = props;
|
const { media }: { media: any } = props;
|
||||||
const { config } = useConfigContext();
|
const { config } = useConfigContext();
|
||||||
const calendar = config?.widgets.find((w) => w.id === 'calendar');
|
const calendar = config?.widgets.find((w) => w.type === 'calendar');
|
||||||
const useSonarrv4 = calendar?.properties.useSonarrv4 ?? false;
|
const useSonarrv4 = calendar?.properties.useSonarrv4 ?? false;
|
||||||
|
|
||||||
// Find a poster CoverType
|
// Find a poster CoverType
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ async function Get(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
const config = getConfig(configName);
|
const config = getConfig(configName);
|
||||||
|
|
||||||
// Find the calendar widget in the config
|
// Find the calendar widget in the config
|
||||||
const calendar = config.widgets.find((w) => w.id === 'calendar');
|
const calendar = config.widgets.find((w) => w.type === 'calendar');
|
||||||
const useSonarrv4 = calendar?.properties.useSonarrv4 ?? false;
|
const useSonarrv4 = calendar?.properties.useSonarrv4 ?? false;
|
||||||
|
|
||||||
const mediaAppIntegrationTypes: AppIntegrationType['type'][] = [
|
const mediaAppIntegrationTypes: AppIntegrationType['type'][] = [
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ async function Get(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
|
|
||||||
const config = getConfig(configName);
|
const config = getConfig(configName);
|
||||||
|
|
||||||
const dashDotWidget = config.widgets.find((x) => x.id === 'dashdot');
|
const dashDotWidget = config.widgets.find((x) => x.type === 'dashdot');
|
||||||
|
|
||||||
if (!dashDotWidget) {
|
if (!dashDotWidget) {
|
||||||
return res.status(400).json({
|
return res.status(400).json({
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ async function Get(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const config = getConfig(configName);
|
const config = getConfig(configName);
|
||||||
const dashDotWidget = config.widgets.find((x) => x.id === 'dashdot');
|
const dashDotWidget = config.widgets.find((x) => x.type === 'dashdot');
|
||||||
|
|
||||||
if (!dashDotWidget) {
|
if (!dashDotWidget) {
|
||||||
return res.status(400).json({
|
return res.status(400).json({
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export const Get = async (request: NextApiRequest, response: NextApiResponse) =>
|
|||||||
const configName = getCookie('config-name', { req: request });
|
const configName = getCookie('config-name', { req: request });
|
||||||
const config = getConfig(configName?.toString() ?? 'default');
|
const config = getConfig(configName?.toString() ?? 'default');
|
||||||
|
|
||||||
const rssWidget = config.widgets.find((x) => x.id === 'rss') as IRssWidget | undefined;
|
const rssWidget = config.widgets.find((x) => x.type === 'rss') as IRssWidget | undefined;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!rssWidget ||
|
!rssWidget ||
|
||||||
|
|||||||
@@ -183,7 +183,8 @@ const migrateModules = (config: Config): IWidget<string, any>[] => {
|
|||||||
case 'torrent-status':
|
case 'torrent-status':
|
||||||
case 'Torrent':
|
case 'Torrent':
|
||||||
return {
|
return {
|
||||||
id: 'torrents-status',
|
id: uuidv4(),
|
||||||
|
type: 'torrents-status',
|
||||||
properties: {
|
properties: {
|
||||||
refreshInterval: 10,
|
refreshInterval: 10,
|
||||||
displayCompletedTorrents: oldModule.options?.hideComplete?.value ?? false,
|
displayCompletedTorrents: oldModule.options?.hideComplete?.value ?? false,
|
||||||
@@ -199,7 +200,8 @@ const migrateModules = (config: Config): IWidget<string, any>[] => {
|
|||||||
} as ITorrent;
|
} as ITorrent;
|
||||||
case 'weather':
|
case 'weather':
|
||||||
return {
|
return {
|
||||||
id: 'weather',
|
id: uuidv4(),
|
||||||
|
type: 'weather',
|
||||||
properties: {
|
properties: {
|
||||||
displayInFahrenheit: oldModule.options?.freedomunit?.value ?? false,
|
displayInFahrenheit: oldModule.options?.freedomunit?.value ?? false,
|
||||||
location: oldModule.options?.location?.value ?? 'Paris',
|
location: oldModule.options?.location?.value ?? 'Paris',
|
||||||
@@ -216,7 +218,8 @@ const migrateModules = (config: Config): IWidget<string, any>[] => {
|
|||||||
case 'Dash.': {
|
case 'Dash.': {
|
||||||
const oldDashDotService = config.services.find((service) => service.type === 'Dash.');
|
const oldDashDotService = config.services.find((service) => service.type === 'Dash.');
|
||||||
return {
|
return {
|
||||||
id: 'dashdot',
|
id: uuidv4(),
|
||||||
|
type: 'dashdot',
|
||||||
properties: {
|
properties: {
|
||||||
url: oldModule.options?.url?.value ?? oldDashDotService?.url ?? '',
|
url: oldModule.options?.url?.value ?? oldDashDotService?.url ?? '',
|
||||||
cpuMultiView: oldModule.options?.cpuMultiView?.value ?? false,
|
cpuMultiView: oldModule.options?.cpuMultiView?.value ?? false,
|
||||||
@@ -235,7 +238,8 @@ const migrateModules = (config: Config): IWidget<string, any>[] => {
|
|||||||
}
|
}
|
||||||
case 'date':
|
case 'date':
|
||||||
return {
|
return {
|
||||||
id: 'date',
|
id: uuidv4(),
|
||||||
|
type: 'date',
|
||||||
properties: {
|
properties: {
|
||||||
display24HourFormat: oldModule.options?.full?.value ?? true,
|
display24HourFormat: oldModule.options?.full?.value ?? true,
|
||||||
},
|
},
|
||||||
@@ -249,7 +253,8 @@ const migrateModules = (config: Config): IWidget<string, any>[] => {
|
|||||||
} as IDateWidget;
|
} as IDateWidget;
|
||||||
case 'Download Speed' || 'dlspeed':
|
case 'Download Speed' || 'dlspeed':
|
||||||
return {
|
return {
|
||||||
id: 'dlspeed',
|
id: uuidv4(),
|
||||||
|
type: 'dlspeed',
|
||||||
properties: {},
|
properties: {},
|
||||||
area: {
|
area: {
|
||||||
type: 'wrapper',
|
type: 'wrapper',
|
||||||
@@ -261,7 +266,8 @@ const migrateModules = (config: Config): IWidget<string, any>[] => {
|
|||||||
} as ITorrentNetworkTraffic;
|
} as ITorrentNetworkTraffic;
|
||||||
case 'calendar':
|
case 'calendar':
|
||||||
return {
|
return {
|
||||||
id: 'calendar',
|
id: uuidv4(),
|
||||||
|
type: 'calendar',
|
||||||
properties: {},
|
properties: {},
|
||||||
area: {
|
area: {
|
||||||
type: 'wrapper',
|
type: 'wrapper',
|
||||||
@@ -273,7 +279,8 @@ const migrateModules = (config: Config): IWidget<string, any>[] => {
|
|||||||
} as ICalendarWidget;
|
} as ICalendarWidget;
|
||||||
case 'usenet':
|
case 'usenet':
|
||||||
return {
|
return {
|
||||||
id: 'usenet',
|
id: uuidv4(),
|
||||||
|
type: 'usenet',
|
||||||
properties: {},
|
properties: {},
|
||||||
area: {
|
area: {
|
||||||
type: 'wrapper',
|
type: 'wrapper',
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ const useWidget = <T extends IWidget<string, any>>(widget: T): T => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const WidgetWrapper = ({
|
export const WidgetWrapper = ({
|
||||||
widgetType: widgetId,
|
widgetType,
|
||||||
widget,
|
widget,
|
||||||
className,
|
className,
|
||||||
WidgetComponent,
|
WidgetComponent,
|
||||||
@@ -43,7 +43,7 @@ export const WidgetWrapper = ({
|
|||||||
return (
|
return (
|
||||||
<ErrorBoundary>
|
<ErrorBoundary>
|
||||||
<HomarrCardWrapper className={className}>
|
<HomarrCardWrapper className={className}>
|
||||||
<WidgetsMenu integration={widgetId} widget={widgetWithDefaultProps} />
|
<WidgetsMenu integration={widgetType} widget={widgetWithDefaultProps} />
|
||||||
<WidgetComponent widget={widgetWithDefaultProps} />
|
<WidgetComponent widget={widgetWithDefaultProps} />
|
||||||
</HomarrCardWrapper>
|
</HomarrCardWrapper>
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ const useDashDotStorage = () => {
|
|||||||
'dashdot/storage',
|
'dashdot/storage',
|
||||||
{
|
{
|
||||||
configName,
|
configName,
|
||||||
url: config?.widgets.find((x) => x.id === 'dashdot')?.properties.url,
|
url: config?.widgets.find((x) => x.type === 'dashdot')?.properties.url,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
queryFn: () => fetchDashDotStorageLoad(configName),
|
queryFn: () => fetchDashDotStorageLoad(configName),
|
||||||
|
|||||||
Reference in New Issue
Block a user