From dc13efa27d12e6a76f84341953614554359da42c Mon Sep 17 00:00:00 2001 From: Manuel Ruwe Date: Sat, 7 Jan 2023 20:24:15 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20Fix=20build=20warnings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChangePosition/ChangeWidgetPositionModal.tsx | 12 ++++++++---- .../Wrappers/gridstack/use-gridstack.ts | 16 ++++++++-------- .../Customization/CustomizationSettings.tsx | 2 +- src/tools/config/migrateConfig.ts | 1 - 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/components/Dashboard/Modals/ChangePosition/ChangeWidgetPositionModal.tsx b/src/components/Dashboard/Modals/ChangePosition/ChangeWidgetPositionModal.tsx index 60bfdb9b3..241503adb 100644 --- a/src/components/Dashboard/Modals/ChangePosition/ChangeWidgetPositionModal.tsx +++ b/src/components/Dashboard/Modals/ChangePosition/ChangeWidgetPositionModal.tsx @@ -16,6 +16,10 @@ export const ChangeWidgetPositionModal = ({ const updateConfig = useConfigStore((x) => x.updateConfig); const shapeSize = useGridstackStore((x) => x.currentShapeSize); + if (shapeSize === null) { + return null; + } + const handleSubmit = (x: number, y: number, width: number, height: number) => { if (!configName) { return; @@ -59,10 +63,10 @@ export const ChangeWidgetPositionModal = ({ onCancel={handleCancel} heightData={heightData} widthData={widthData} - initialX={innerProps.widget.shape[shapeSize].location.x} - initialY={innerProps.widget.shape[shapeSize].location.y} - initialWidth={innerProps.widget.shape[shapeSize].size.width} - initialHeight={innerProps.widget.shape[shapeSize].size.height} + initialX={innerProps.widget.shape[shapeSize]?.location.x} + initialY={innerProps.widget.shape[shapeSize]?.location.y} + initialWidth={innerProps.widget.shape[shapeSize]?.size.width} + initialHeight={innerProps.widget.shape[shapeSize]?.size.height} /> ); }; diff --git a/src/components/Dashboard/Wrappers/gridstack/use-gridstack.ts b/src/components/Dashboard/Wrappers/gridstack/use-gridstack.ts index a47f07486..5c401f5ac 100644 --- a/src/components/Dashboard/Wrappers/gridstack/use-gridstack.ts +++ b/src/components/Dashboard/Wrappers/gridstack/use-gridstack.ts @@ -104,12 +104,12 @@ export const useGridstack = ( currentItem.shape[shapeSize] = { location: { - x: changedNode.x ?? currentItem.shape[shapeSize].location.x, - y: changedNode.y ?? currentItem.shape[shapeSize].location.y, + x: changedNode.x!, + y: changedNode.y!, }, size: { - width: changedNode.w ?? currentItem.shape[shapeSize].size.width, - height: changedNode.h ?? currentItem.shape[shapeSize].size.height, + width: changedNode.w!, + height: changedNode.h!, }, }; @@ -170,12 +170,12 @@ export const useGridstack = ( currentItem.shape[shapeSize] = { location: { - x: addedNode.x ?? currentItem.shape[shapeSize].location.x, - y: addedNode.y ?? currentItem.shape[shapeSize].location.y, + x: addedNode.x!, + y: addedNode.y!, }, size: { - width: addedNode.w ?? currentItem.shape[shapeSize].size.width, - height: addedNode.h ?? currentItem.shape[shapeSize].size.height, + width: addedNode.w!, + height: addedNode.h!, }, }; diff --git a/src/components/Settings/Customization/CustomizationSettings.tsx b/src/components/Settings/Customization/CustomizationSettings.tsx index bc95fc785..8265ac4a6 100644 --- a/src/components/Settings/Customization/CustomizationSettings.tsx +++ b/src/components/Settings/Customization/CustomizationSettings.tsx @@ -1,4 +1,4 @@ -import { Button, ScrollArea, Stack } from '@mantine/core'; +import { ScrollArea, Stack } from '@mantine/core'; import { useViewportSize } from '@mantine/hooks'; import { useTranslation } from 'next-i18next'; import { useConfigContext } from '../../../config/provider'; diff --git a/src/tools/config/migrateConfig.ts b/src/tools/config/migrateConfig.ts index d147d9f57..a98e5dd29 100644 --- a/src/tools/config/migrateConfig.ts +++ b/src/tools/config/migrateConfig.ts @@ -4,7 +4,6 @@ import { AppIntegrationType, AppType, IntegrationType } from '../../types/app'; import { AreaType } from '../../types/area'; import { CategoryType } from '../../types/category'; import { ConfigType } from '../../types/config'; -import widgets from '../../widgets'; import { IBitTorrent } from '../../widgets/bitTorrent/BitTorrentTile'; import { IDashDotTile } from '../../widgets/dashDot/DashDotTile'; import { IDateWidget } from '../../widgets/date/DateTile';