Skip to content

Commit

Permalink
Merge pull request #4207 from signalco-io/next
Browse files Browse the repository at this point in the history
Next
  • Loading branch information
AleksandarDev authored Dec 27, 2023
2 parents 292343f + 7ce6732 commit 44e663a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 22 deletions.
11 changes: 6 additions & 5 deletions web/apps/app/components/dashboards/DashboardView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div ref={resizeObserverRef}>
<div
className="grid w-[--dashboard-w] grid-cols-[repeat(var(--dashboard-cols),1fr)] gap-2"
className="grid-rows-[repeat(auto-fill,--widget-size)]] grid w-[--dashboard-w] grid-cols-[repeat(var(--dashboard-cols),1fr)] gap-2"
style={{
'--dashboard-cols': numberOfColumns,
'--dashboard-w': `${widgetSize * numberOfColumns - 8}px`
'--dashboard-w': `${dynamicWidgetSize * numberOfColumns}px`,
'--widget-size': `${dynamicWidgetSize}px`
} as CSSProperties}
>
<GridWrapper isEditing={isEditing} order={widgetsOrder} orderChanged={handleOrderChanged}>
Expand Down
21 changes: 6 additions & 15 deletions web/apps/app/components/widgets/parts/WidgetCard.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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);
Expand All @@ -63,17 +61,11 @@ export default function WidgetCard(props: IWidgetCardProps) {

return (
<>
<Card
className="relative overflow-hidden"
<Card className="relative h-[--widget-instance-h] w-[--widget-instance-w] overflow-hidden p-0"
style={{
width: `${sizeWidth}px`,
height: `${sizeHeight}px`
}}>
<CardOverflow
style={{
width: `${sizeWidth}px`,
height: `${sizeHeight}px`
}}>
'--widget-instance-w': `calc(var(--widget-size)*${width}-${width}*2px)`,
'--widget-instance-h': `calc(var(--widget-size)*${height})`,
} as CSSProperties}>
{(!isLoading && needsConfiguration) ? (
<Stack justifyContent="stretch" className="h-full">
<Button disabled={!isEditMode} size="lg" fullWidth onClick={handleOnConfigureClicked}>Configure widget</Button>
Expand Down Expand Up @@ -101,8 +93,7 @@ export default function WidgetCard(props: IWidgetCardProps) {
</DropdownMenuContent>
</DropdownMenu>
</div>
)}
</CardOverflow>
)}
</Card>
{(isConfiguring && options) &&
<WidgetConfiguration
Expand Down
4 changes: 4 additions & 0 deletions web/apps/blog/app/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ html, body, #__next {
height: 100%;
width: 100%;
}

:target {
scroll-margin-top: 80px;
}
5 changes: 3 additions & 2 deletions web/apps/web/app/(rest)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { PropsWithChildren } from 'react';
import { PageLayout } from '../../components/layouts/PageLayout';

export default function RestLayout() {
return <PageLayout />;
export default function RestLayout({ children }: PropsWithChildren) {
return <PageLayout>{children}</PageLayout>;
}
4 changes: 4 additions & 0 deletions web/apps/web/app/global.css
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
@import '@signalco/ui/index.css';

:target {
scroll-margin-top: 80px;
}

7 comments on commit 44e663a

@vercel
Copy link

@vercel vercel bot commented on 44e663a Dec 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

signalco-uier – ./web/apps/uier

signalco-uier-signalco.vercel.app
signalco-uier-git-main-signalco.vercel.app
next.uier.io
uier.io
signalco-uier.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 44e663a Dec 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 44e663a Dec 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 44e663a Dec 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

signalco-blog – ./web/apps/blog

signalco-blog-signalco.vercel.app
signalco-blog-git-main-signalco.vercel.app
signalco-blog.vercel.app
blog.signalco.io

@vercel
Copy link

@vercel vercel bot commented on 44e663a Dec 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

signalco-app – ./web/apps/app

signalco-app-git-main-signalco.vercel.app
signalco-app.vercel.app
app.signalco.io
signalco-app-signalco.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 44e663a Dec 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 44e663a Dec 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

signalco-slco – ./web/apps/slco

signalco-slco-signalco.vercel.app
signalco-slco-git-main-signalco.vercel.app
slco.signalco.io
signalco-slco.vercel.app
slco.io

Please sign in to comment.