Skip to content

Commit 841cb42

Browse files
committed
fix group bugs
1 parent aa206d1 commit 841cb42

File tree

3 files changed

+29
-25
lines changed

3 files changed

+29
-25
lines changed

backend/src/routes/jellyseerr.route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import axios from 'axios';
2-
import { Request, response, Response, Router } from 'express';
2+
import { Request, Response, Router } from 'express';
33
import https from 'https';
44

55
import { getItemConnectionInfo } from '../utils/config-lookup';

frontend/src/components/dashboard/base-items/widgets/GroupWidget.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ const SortableGroupItem: React.FC<SortableGroupItemProps> = ({
122122
opacity: isDragging ? 0.5 : 1,
123123
position: 'relative',
124124
touchAction: 'none', // Ensure touch events are captured properly on mobile
125+
display: 'flex',
126+
justifyContent: 'center',
127+
alignItems: 'center'
125128
}}
126129
data-item-id={item.id}
127130
data-group-id={groupId}
@@ -647,12 +650,13 @@ const GroupWidget: React.FC<GroupWidgetProps> = ({
647650
sx={{
648651
flex: 1,
649652
display: 'grid',
650-
gridTemplateColumns: layout === '2x3' ? 'repeat(2, 1fr)' : layout === '4x2' ? 'repeat(4, 1fr)' : 'repeat(3, 1fr)',
653+
gridTemplateColumns: layout === '2x3' ? 'repeat(2, minmax(100px, 160px))' : layout === '4x2' ? 'repeat(4, minmax(70px, 115px))' : 'repeat(3, minmax(90px, 150px))',
651654
gridTemplateRows: layout === '2x3' ? 'repeat(3, 1fr)' : 'repeat(2, 1fr)',
652-
gap: 1,
655+
gap: 3,
653656
gridAutoFlow: 'row', // Fill row by row (left to right, top to bottom)
654657
justifyItems: 'stretch', // Items fill their grid cells
655658
alignItems: 'stretch',
659+
justifyContent: 'center', // Center the grid content horizontally
656660
overflowY: 'hidden',
657661
overflowX: 'hidden',
658662
p: { lg: 2 },

frontend/src/components/forms/configs/DualWidgetConfig.tsx

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -129,30 +129,30 @@ export const DualWidgetConfig = ({ formContext, existingItem }: DualWidgetConfig
129129

130130
// Extract top widget configuration
131131
if (existingConfig.topWidget?.config) {
132-
const topWidgetType = existingConfig.topWidget.type;
132+
const existingTopWidgetType = existingConfig.topWidget.type;
133133
const topConfig = existingConfig.topWidget.config;
134134

135-
if (topWidgetType) {
136-
formContext.setValue('topWidgetType', topWidgetType);
135+
if (existingTopWidgetType) {
136+
formContext.setValue('topWidgetType', existingTopWidgetType);
137137

138138
// Map configuration based on widget type
139-
if (topWidgetType === ITEM_TYPE.WEATHER_WIDGET) {
139+
if (existingTopWidgetType === ITEM_TYPE.WEATHER_WIDGET) {
140140
topWidgetFields = {
141141
temperatureUnit: topConfig.temperatureUnit || 'fahrenheit',
142142
location: topConfig.location || null
143143
};
144144
formContext.setValue('top_temperatureUnit', topConfig.temperatureUnit || 'fahrenheit');
145145
formContext.setValue('top_location', topConfig.location || null);
146146
}
147-
else if (topWidgetType === ITEM_TYPE.DATE_TIME_WIDGET) {
147+
else if (existingTopWidgetType === ITEM_TYPE.DATE_TIME_WIDGET) {
148148
topWidgetFields = {
149149
location: topConfig.location || null,
150150
timezone: topConfig.timezone || ''
151151
};
152152
formContext.setValue('top_location', topConfig.location || null);
153153
formContext.setValue('top_timezone', topConfig.timezone || '');
154154
}
155-
else if (topWidgetType === ITEM_TYPE.SYSTEM_MONITOR_WIDGET) {
155+
else if (existingTopWidgetType === ITEM_TYPE.SYSTEM_MONITOR_WIDGET) {
156156
const gauges = topConfig.gauges || ['cpu', 'temp', 'ram'];
157157
topWidgetFields = {
158158
temperatureUnit: topConfig.temperatureUnit || 'fahrenheit',
@@ -173,7 +173,7 @@ export const DualWidgetConfig = ({ formContext, existingItem }: DualWidgetConfig
173173
formContext.setValue('top_showSystemInfo', topConfig.showSystemInfo !== false);
174174
formContext.setValue('top_showInternetStatus', topConfig.showInternetStatus !== false);
175175
}
176-
else if (topWidgetType === ITEM_TYPE.DISK_MONITOR_WIDGET) {
176+
else if (existingTopWidgetType === ITEM_TYPE.DISK_MONITOR_WIDGET) {
177177
topWidgetFields = {
178178
selectedDisks: topConfig.selectedDisks || [],
179179
showIcons: topConfig.showIcons !== false,
@@ -185,7 +185,7 @@ export const DualWidgetConfig = ({ formContext, existingItem }: DualWidgetConfig
185185
formContext.setValue('top_showName', topConfig.showName !== false);
186186
formContext.setValue('top_layout', '2x2');
187187
}
188-
else if (topWidgetType === ITEM_TYPE.PIHOLE_WIDGET) {
188+
else if (existingTopWidgetType === ITEM_TYPE.PIHOLE_WIDGET) {
189189
// Use masked values for sensitive fields if they exist
190190
const maskedApiToken = topConfig._hasApiToken ? '**********' : '';
191191
const maskedPassword = topConfig._hasPassword ? '**********' : '';
@@ -207,7 +207,7 @@ export const DualWidgetConfig = ({ formContext, existingItem }: DualWidgetConfig
207207
formContext.setValue('top_piholeName', topConfig.displayName || '');
208208
formContext.setValue('top_showLabel', topConfig.showLabel !== undefined ? topConfig.showLabel : true);
209209
}
210-
else if (topWidgetType === ITEM_TYPE.ADGUARD_WIDGET) {
210+
else if (existingTopWidgetType === ITEM_TYPE.ADGUARD_WIDGET) {
211211
// Use masked values for sensitive fields if they exist
212212
const maskedUsername = topConfig._hasUsername ? '**********' : '';
213213
const maskedPassword = topConfig._hasPassword ? '**********' : '';
@@ -234,15 +234,15 @@ export const DualWidgetConfig = ({ formContext, existingItem }: DualWidgetConfig
234234

235235
// Extract bottom widget configuration
236236
if (existingConfig.bottomWidget?.config) {
237-
const bottomWidgetType = existingConfig.bottomWidget.type;
237+
const existingBottomWidgetType = existingConfig.bottomWidget.type;
238238
const bottomConfig = existingConfig.bottomWidget.config;
239239

240-
if (bottomWidgetType) {
240+
if (existingBottomWidgetType) {
241241
// Set the bottomWidgetType directly
242-
formContext.setValue('bottomWidgetType', bottomWidgetType);
242+
formContext.setValue('bottomWidgetType', existingBottomWidgetType);
243243

244244
// Map configuration based on widget type
245-
if (bottomWidgetType === ITEM_TYPE.WEATHER_WIDGET) {
245+
if (existingBottomWidgetType === ITEM_TYPE.WEATHER_WIDGET) {
246246
const temperatureUnit = bottomConfig.temperatureUnit || 'fahrenheit';
247247
const location = bottomConfig.location || null;
248248

@@ -260,7 +260,7 @@ export const DualWidgetConfig = ({ formContext, existingItem }: DualWidgetConfig
260260
formContext.setValue('bottom_location', null);
261261
}
262262
}
263-
else if (bottomWidgetType === ITEM_TYPE.DATE_TIME_WIDGET) {
263+
else if (existingBottomWidgetType === ITEM_TYPE.DATE_TIME_WIDGET) {
264264
const location = bottomConfig.location || null;
265265
const timezone = bottomConfig.timezone || '';
266266

@@ -278,7 +278,7 @@ export const DualWidgetConfig = ({ formContext, existingItem }: DualWidgetConfig
278278

279279
formContext.setValue('bottom_timezone', timezone);
280280
}
281-
else if (bottomWidgetType === ITEM_TYPE.SYSTEM_MONITOR_WIDGET) {
281+
else if (existingBottomWidgetType === ITEM_TYPE.SYSTEM_MONITOR_WIDGET) {
282282
const gauges = bottomConfig.gauges || ['cpu', 'temp', 'ram'];
283283
bottomWidgetFields = {
284284
temperatureUnit: bottomConfig.temperatureUnit || 'fahrenheit',
@@ -299,7 +299,7 @@ export const DualWidgetConfig = ({ formContext, existingItem }: DualWidgetConfig
299299
formContext.setValue('bottom_showSystemInfo', bottomConfig.showSystemInfo !== false);
300300
formContext.setValue('bottom_showInternetStatus', bottomConfig.showInternetStatus !== false);
301301
}
302-
else if (bottomWidgetType === ITEM_TYPE.DISK_MONITOR_WIDGET) {
302+
else if (existingBottomWidgetType === ITEM_TYPE.DISK_MONITOR_WIDGET) {
303303
bottomWidgetFields = {
304304
selectedDisks: bottomConfig.selectedDisks || [],
305305
showIcons: bottomConfig.showIcons !== false,
@@ -311,7 +311,7 @@ export const DualWidgetConfig = ({ formContext, existingItem }: DualWidgetConfig
311311
formContext.setValue('bottom_showName', bottomConfig.showName !== false);
312312
formContext.setValue('bottom_layout', '2x2');
313313
}
314-
else if (bottomWidgetType === ITEM_TYPE.PIHOLE_WIDGET) {
314+
else if (existingBottomWidgetType === ITEM_TYPE.PIHOLE_WIDGET) {
315315
// Use masked values for sensitive fields if they exist
316316
const maskedApiToken = bottomConfig._hasApiToken ? '**********' : '';
317317
const maskedPassword = bottomConfig._hasPassword ? '**********' : '';
@@ -333,7 +333,7 @@ export const DualWidgetConfig = ({ formContext, existingItem }: DualWidgetConfig
333333
formContext.setValue('bottom_piholeName', bottomConfig.displayName || '');
334334
formContext.setValue('bottom_showLabel', bottomConfig.showLabel !== undefined ? bottomConfig.showLabel : true);
335335
}
336-
else if (bottomWidgetType === ITEM_TYPE.ADGUARD_WIDGET) {
336+
else if (existingBottomWidgetType === ITEM_TYPE.ADGUARD_WIDGET) {
337337
// Use masked values for sensitive fields if they exist
338338
const maskedUsername = bottomConfig._hasUsername ? '**********' : '';
339339
const maskedPassword = bottomConfig._hasPassword ? '**********' : '';
@@ -820,8 +820,8 @@ export const DualWidgetConfig = ({ formContext, existingItem }: DualWidgetConfig
820820
useEffect(() => {
821821
const handleFormSubmit = async () => {
822822
// Capture widget types immediately before they can be lost
823-
const topWidgetType = formContext.getValues('topWidgetType');
824-
const bottomWidgetType = formContext.getValues('bottomWidgetType');
823+
const currentTopWidgetType = formContext.getValues('topWidgetType');
824+
const currentBottomWidgetType = formContext.getValues('bottomWidgetType');
825825

826826
// Grab the current page's state first
827827
const currentPosition = currentPage === 0 ? 'top' : 'bottom';
@@ -832,8 +832,8 @@ export const DualWidgetConfig = ({ formContext, existingItem }: DualWidgetConfig
832832
captureFormValuesToState('bottom');
833833

834834
// Build individual widget configs using captured types
835-
const topWidget = topWidgetType ? await buildWidgetConfigWithType('top', topWidgetType) : undefined;
836-
const bottomWidget = bottomWidgetType ? await buildWidgetConfigWithType('bottom', bottomWidgetType) : undefined;
835+
const topWidget = currentTopWidgetType ? await buildWidgetConfigWithType('top', currentTopWidgetType) : undefined;
836+
const bottomWidget = currentBottomWidgetType ? await buildWidgetConfigWithType('bottom', currentBottomWidgetType) : undefined;
837837

838838
// Create the final dual widget config
839839
const dualWidgetConfig = {

0 commit comments

Comments
 (0)