Skip to content

Commit c40452d

Browse files
devin-ai-integration[bot]mlejvaben-fornefeld
authored
fix: make events empty state full width in grid table (#339)
Co-authored-by: vasek <vasek.mlejnsky@gmail.com> Co-authored-by: Ben Fornefeld <50748440+ben-fornefeld@users.noreply.github.com>
1 parent 92ee20a commit c40452d

2 files changed

Lines changed: 39 additions & 7 deletions

File tree

src/features/dashboard/common/virtualized-table-ui.tsx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { VirtualItem, Virtualizer } from '@tanstack/react-virtual'
22
import type { CSSProperties, ReactNode } from 'react'
33
import { Loader } from '@/ui/primitives/loader'
44
import { TableBody, TableCell, TableRow } from '@/ui/primitives/table'
5+
import { TableEmptyRowBorder } from '@/ui/primitives/table-empty-row-border'
56

67
export const getVirtualizedRowStyle = (
78
virtualRow: VirtualItem,
@@ -51,3 +52,36 @@ export const VirtualizedTableLoaderBody = () => (
5152
</TableRow>
5253
</TableBody>
5354
)
55+
56+
interface VirtualizedTableEmptyStateProps {
57+
children: ReactNode
58+
}
59+
60+
const EMPTY_STATE_ROWS = Array.from({ length: 3 })
61+
62+
export const VirtualizedTableEmptyState = ({
63+
children,
64+
}: VirtualizedTableEmptyStateProps) => (
65+
<TableBody className="grid">
66+
<TableRow className="flex min-w-full">
67+
<TableCell className="flex-1 p-0">
68+
<div className="w-full gap-2 relative flex flex-col justify-center items-center">
69+
{EMPTY_STATE_ROWS.map((_, index) => (
70+
<div
71+
key={index}
72+
className="h-11 w-full border border-bg-highlight relative flex items-center gap-2 justify-center overflow-hidden"
73+
>
74+
<TableEmptyRowBorder className="absolute bottom-0 left-0 rotate-180 opacity-99" />
75+
<TableEmptyRowBorder className="absolute bottom-0 right-0 opacity-99" />
76+
{index === 1 ? (
77+
<div className="text-fg prose-body-highlight flex items-center justify-center gap-2 px-2 text-center whitespace-nowrap">
78+
{children}
79+
</div>
80+
) : null}
81+
</div>
82+
))}
83+
</div>
84+
</TableCell>
85+
</TableRow>
86+
</TableBody>
87+
)

src/features/dashboard/sandbox/events/table.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
import { useMemo } from 'react'
99
import type { SandboxEventModel } from '@/core/modules/sandboxes/models'
1010
import {
11+
VirtualizedTableEmptyState,
1112
VirtualizedTableLoaderBody,
1213
VirtualizedTableRow,
1314
} from '@/features/dashboard/common/virtualized-table-ui'
@@ -21,7 +22,6 @@ import {
2122
Table,
2223
TableBody,
2324
TableCell,
24-
TableEmptyState,
2525
TableHead,
2626
TableHeader,
2727
TableRow,
@@ -90,12 +90,10 @@ export const SandboxEventsTable = ({
9090
scrollContainer={scrollContainer}
9191
/>
9292
) : (
93-
<TableBody>
94-
<TableEmptyState colSpan={4}>
95-
<HistoryIcon className="size-5" />
96-
No events found
97-
</TableEmptyState>
98-
</TableBody>
93+
<VirtualizedTableEmptyState>
94+
<HistoryIcon className="size-5" />
95+
No events found
96+
</VirtualizedTableEmptyState>
9997
)}
10098
</Table>
10199
)

0 commit comments

Comments
 (0)