fix: a lot of minor improvements for dashboard

This commit is contained in:
Carl-Gerhard Lindesvärd
2025-11-07 12:28:54 +01:00
parent 5b1c582023
commit c762bd7c95
19 changed files with 591 additions and 388 deletions

View File

@@ -108,6 +108,12 @@ function Component() {
title="Dashboards"
description="Access all your dashboards here"
className="mb-8"
actions={
<Button icon={PlusIcon} onClick={() => pushModal('AddDashboard')}>
<span className="max-sm:hidden">Create dashboard</span>
<span className="sm:hidden">Dashboard</span>
</Button>
}
/>
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3">
{dashboards.map((item) => {

View File

@@ -460,63 +460,63 @@ function Component() {
return (
<PageContainer>
<div className="row mb-4 items-center justify-between">
<PageHeader
title={dashboard.name}
description="View and manage your reports"
className="mb-0"
/>
<div className="flex items-center justify-end gap-2">
<OverviewRange />
<OverviewInterval />
<LinkButton
from={Route.fullPath}
to={'/$organizationId/$projectId/reports'}
icon={PlusIcon}
>
<span className="max-sm:hidden">Create report</span>
<span className="sm:hidden">Report</span>
</LinkButton>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="outline">
<MoreHorizontal />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-[200px]">
<DropdownMenuGroup>
<DropdownMenuItem
onClick={() =>
showConfirm({
title: 'Reset layout',
text: 'Are you sure you want to reset the layout to default? This will clear all custom positioning and sizing.',
onConfirm: () =>
resetLayout.mutate({ dashboardId, projectId }),
})
}
>
<RotateCcw className="mr-2 size-4" />
Reset layout
</DropdownMenuItem>
<DropdownMenuItem
variant="destructive"
onClick={() =>
showConfirm({
title: 'Delete dashboard',
text: 'Are you sure you want to delete this dashboard? All your reports will be deleted!',
onConfirm: () =>
dashboardDeletion.mutate({ id: dashboardId }),
})
}
>
<TrashIcon className="mr-2 size-4" />
Delete dashboard
</DropdownMenuItem>
</DropdownMenuGroup>
</DropdownMenuContent>
</DropdownMenu>
</div>
</div>
<PageHeader
title={dashboard.name}
description="View and manage your reports"
className="mb-0"
actions={
<>
<OverviewRange />
<OverviewInterval />
<LinkButton
from={Route.fullPath}
to={'/$organizationId/$projectId/reports'}
icon={PlusIcon}
>
<span className="max-sm:hidden">Create report</span>
<span className="sm:hidden">Report</span>
</LinkButton>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="outline">
<MoreHorizontal />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-[200px]">
<DropdownMenuGroup>
<DropdownMenuItem
onClick={() =>
showConfirm({
title: 'Reset layout',
text: 'Are you sure you want to reset the layout to default? This will clear all custom positioning and sizing.',
onConfirm: () =>
resetLayout.mutate({ dashboardId, projectId }),
})
}
>
<RotateCcw className="mr-2 size-4" />
Reset layout
</DropdownMenuItem>
<DropdownMenuItem
variant="destructive"
onClick={() =>
showConfirm({
title: 'Delete dashboard',
text: 'Are you sure you want to delete this dashboard? All your reports will be deleted!',
onConfirm: () =>
dashboardDeletion.mutate({ id: dashboardId }),
})
}
>
<TrashIcon className="mr-2 size-4" />
Delete dashboard
</DropdownMenuItem>
</DropdownMenuGroup>
</DropdownMenuContent>
</DropdownMenu>
</>
}
/>
{reports.length === 0 ? (
<FullPageEmptyState title="No reports" icon={LayoutPanelTopIcon}>