From e051f4c688ef2255f41756b768106123cb235427 Mon Sep 17 00:00:00 2001 From: Manuel Ruwe Date: Sun, 8 Jan 2023 01:38:21 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20missing=20shape=20and=20ar?= =?UTF-8?q?ea=20for=20widgets=20in=20migrator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tools/config/migrateConfig.ts | 44 ++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/src/tools/config/migrateConfig.ts b/src/tools/config/migrateConfig.ts index 11cbe9c8b..182c31d7d 100644 --- a/src/tools/config/migrateConfig.ts +++ b/src/tools/config/migrateConfig.ts @@ -55,7 +55,7 @@ export function migrateConfig(config: Config): ConfigType { ], }; - config.services.forEach((service, index) => { + config.services.forEach((service) => { const { category: categoryName } = service; if (!categoryName) { @@ -96,24 +96,13 @@ const getConfigAndCreateIfNotExsists = ( const category: CategoryType = { id: uuidv4(), name: categoryName, - position: 0, + position: config.categories.length, }; config.categories.push(category); return category; }; -const getShapeForColumnCount = (index: number, columnCount: number) => ({ - location: { - x: index % columnCount, - y: Math.floor(index / columnCount), - }, - size: { - width: 1, - height: 1, - }, -}); - const migrateService = (oldService: serviceItem, areaType: AreaType): AppType => ({ id: uuidv4(), name: oldService.name, @@ -160,6 +149,7 @@ const migrateModules = (config: Config): IWidget[] => { id: 'default', }, }, + shape: {}, } as IBitTorrent; case 'weather': return { @@ -168,6 +158,13 @@ const migrateModules = (config: Config): IWidget[] => { displayInFahrenheit: oldModule.options?.freedomunit?.value ?? false, location: oldModule.options?.location?.value ?? 'Paris', }, + area: { + type: 'wrapper', + properties: { + id: 'default', + }, + }, + shape: {}, } as IWeatherWidget; case 'dashdot': case 'Dash.': @@ -180,6 +177,13 @@ const migrateModules = (config: Config): IWidget[] => { useCompactView: oldModule.options?.useCompactView?.value ?? false, graphs: oldModule.options?.graphs?.value ?? ['cpu', 'ram'], }, + area: { + type: 'wrapper', + properties: { + id: 'default', + }, + }, + shape: {}, } as IDashDotTile; case 'date': return { @@ -187,12 +191,26 @@ const migrateModules = (config: Config): IWidget[] => { properties: { display24HourFormat: oldModule.options?.full?.value ?? true, }, + area: { + type: 'wrapper', + properties: { + id: 'default', + }, + }, + shape: {}, } as IDateWidget; case 'Download Speed': case 'dlspeed': return { id: uuidv4(), properties: {}, + area: { + type: 'wrapper', + properties: { + id: 'default', + }, + }, + shape: {}, } as ITorrentNetworkTraffic; default: Consola.error(`Failed to map unknown module type ${moduleKey} to new type definitions.`);