diff --git a/web/apps/app/components/dashboards/DashboardView.tsx b/web/apps/app/components/dashboards/DashboardView.tsx index cf66bcde11..9479cf8413 100644 --- a/web/apps/app/components/dashboards/DashboardView.tsx +++ b/web/apps/app/components/dashboards/DashboardView.tsx @@ -66,17 +66,18 @@ function DashboardView(props: { dashboard: IDashboardModel, isEditing: boolean, } const WidgetComponent = isEditing ? DragableWidget : DisplayWidget; - const widgetSize = 78 + 8; // Widget is 76x76 + 2px for border + 8 spacing between widgets (2x4px) - const dashbaordPadding = 0;//48 + 109; // Has 24 x padding (109 nav width) - const numberOfColumns = Math.max(4, Math.floor((windowInnerWidth - dashbaordPadding) / widgetSize)); // When width is less than 400, set to quad column + 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; return (
diff --git a/web/apps/app/components/widgets/parts/WidgetCard.tsx b/web/apps/app/components/widgets/parts/WidgetCard.tsx index f015f712cd..2cbc9e5f72 100644 --- a/web/apps/app/components/widgets/parts/WidgetCard.tsx +++ b/web/apps/app/components/widgets/parts/WidgetCard.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { CSSProperties, useState } from 'react'; import dynamic from 'next/dynamic'; import { Stack } from '@signalco/ui-primitives/Stack'; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@signalco/ui-primitives/Menu'; @@ -37,8 +37,6 @@ export default function WidgetCard(props: IWidgetCardProps) { const width = (config as CardConfig)?.columns || 2; const height = (config as CardConfig)?.rows || 2; - const sizeWidth = width * 78 + (width - 1) * 8; - const sizeHeight = height * 78 + (height - 1) * 8; const isLoading = typeof options === 'undefined'; const needsConfiguration = typeof options === 'undefined' || options == null || !IsConfigurationValid(config, options); @@ -63,17 +61,11 @@ export default function WidgetCard(props: IWidgetCardProps) { return ( <> - - + '--widget-instance-w': `calc(var(--widget-size)*${width}-${width}*2px)`, + '--widget-instance-h': `calc(var(--widget-size)*${height})`, + } as CSSProperties}> {(!isLoading && needsConfiguration) ? ( @@ -101,8 +93,7 @@ export default function WidgetCard(props: IWidgetCardProps) {
- )} - + )} {(isConfiguring && options) && ; +export default function RestLayout({ children }: PropsWithChildren) { + return {children}; } diff --git a/web/apps/web/app/global.css b/web/apps/web/app/global.css index 1fe6561470..4812ad2f3d 100644 --- a/web/apps/web/app/global.css +++ b/web/apps/web/app/global.css @@ -1 +1,5 @@ @import '@signalco/ui/index.css'; + +:target { + scroll-margin-top: 80px; +}