Migrate tiles from id to type

This commit is contained in:
Meier Lukas
2023-03-30 22:20:56 +02:00
parent 43dc1cd70c
commit 525985b1dc
14 changed files with 59 additions and 58 deletions

View File

@@ -6,7 +6,7 @@ import { useConfigContext } from '../../../../config/provider';
import { useConfigStore } from '../../../../config/store';
export type WidgetsRemoveModalInnerProps = {
widgetId: string;
widgetType: string;
};
export const WidgetsRemoveModal = ({
@@ -14,7 +14,7 @@ export const WidgetsRemoveModal = ({
id,
innerProps,
}: ContextModalProps<WidgetsRemoveModalInnerProps>) => {
const { t } = useTranslation([`modules/${innerProps.widgetId}`, 'common']);
const { t } = useTranslation([`modules/${innerProps.widgetType}`, 'common']);
const { name: configName } = useConfigContext();
if (!configName) return null;
const updateConfig = useConfigStore((x) => x.updateConfig);
@@ -23,7 +23,7 @@ export const WidgetsRemoveModal = ({
configName,
(prev) => ({
...prev,
widgets: prev.widgets.filter((w) => w.id !== innerProps.widgetId),
widgets: prev.widgets.filter((w) => w.type !== innerProps.widgetType),
}),
true
);
@@ -35,7 +35,7 @@ export const WidgetsRemoveModal = ({
<Trans
i18nKey="common:removeConfirm"
components={[<Text weight={500} />]}
values={{ item: innerProps.widgetId }}
values={{ item: innerProps.widgetType }}
/>
<Group position="right">
<Button onClick={() => context.closeModal(id)} variant="light">