diff --git a/web/apps/app/components/dashboards/DashboardView.tsx b/web/apps/app/components/dashboards/DashboardView.tsx index 9479cf8413..af7eff30b2 100644 --- a/web/apps/app/components/dashboards/DashboardView.tsx +++ b/web/apps/app/components/dashboards/DashboardView.tsx @@ -66,18 +66,19 @@ function DashboardView(props: { dashboard: IDashboardModel, isEditing: boolean, } const WidgetComponent = isEditing ? DragableWidget : DisplayWidget; - const widgetSize = 1 + 76 + 1 + 8; // Default widget is 76x76 + 2px for border + 8 spacing between widgets (2x4px) - const numberOfColumns = Math.max(4, Math.floor(windowInnerWidth / widgetSize)); // When width is less than 400, set to quad column - const dynamicWidgetSize = windowInnerWidth / numberOfColumns; + const widgetSize = 1 + 64 + 1 + 4; // Default widget is 64x64 + 2px for border + 8 spacing between widgets (2x4px) + const dashboardWidth = windowInnerWidth; + const numberOfColumns = Math.max(2, Math.floor(dashboardWidth / widgetSize)); + const dynamicWidgetSize = `calc((${dashboardWidth}px - ${(numberOfColumns - 1) * 0.5}rem) / ${numberOfColumns})`; return (
diff --git a/web/apps/app/components/widgets/parts/WidgetCard.tsx b/web/apps/app/components/widgets/parts/WidgetCard.tsx index 2cbc9e5f72..fea99dcda3 100644 --- a/web/apps/app/components/widgets/parts/WidgetCard.tsx +++ b/web/apps/app/components/widgets/parts/WidgetCard.tsx @@ -63,8 +63,8 @@ export default function WidgetCard(props: IWidgetCardProps) { <> {(!isLoading && needsConfiguration) ? ( diff --git a/web/apps/app/components/widgets/parts/WidgetShades.tsx b/web/apps/app/components/widgets/parts/WidgetShades.tsx index 962264ea45..f6b6a33b91 100644 --- a/web/apps/app/components/widgets/parts/WidgetShades.tsx +++ b/web/apps/app/components/widgets/parts/WidgetShades.tsx @@ -104,7 +104,7 @@ function WidgetShades({ config, onOptions }: WidgetSharedProps) { {columns > 1 && (
2 ? 'space-between' : 'center'}> {columns > 2 && {label}} diff --git a/web/apps/app/components/widgets/parts/WidgetState.tsx b/web/apps/app/components/widgets/parts/WidgetState.tsx index 764dd09f36..98e840ce7b 100644 --- a/web/apps/app/components/widgets/parts/WidgetState.tsx +++ b/web/apps/app/components/widgets/parts/WidgetState.tsx @@ -152,8 +152,8 @@ function WidgetState(props: WidgetSharedProps) {