Docker images / prepare-release (push) Successful in 6s
Docker images / backend-image (push) Successful in 1m37s
Docker images / frontend-image (push) Successful in 1m50s
Docker images / updater-image (push) Successful in 44s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 7s
69 lines
1.7 KiB
TypeScript
69 lines
1.7 KiB
TypeScript
"use client"
|
|
|
|
import type { ReactNode } from "react"
|
|
import type { Table } from "@tanstack/react-table"
|
|
import {
|
|
DataGrid,
|
|
DataGridContainer,
|
|
DataGridPagination,
|
|
DataGridTable,
|
|
type DataGridProps,
|
|
} from "@/components/reui/data-grid"
|
|
import {
|
|
DATA_GRID_CONTAINER_CLASS,
|
|
DEFAULT_DATA_GRID_CLASS_NAMES,
|
|
DEFAULT_DATA_GRID_LAYOUT,
|
|
} from "@/components/data-grids/shared/data-grid-layout"
|
|
|
|
interface DataGridShellProps<TData extends object> {
|
|
table: Table<TData>
|
|
recordCount: number
|
|
children?: ReactNode
|
|
pagination?: boolean
|
|
isLoading?: boolean
|
|
loadingMode?: DataGridProps<TData>["loadingMode"]
|
|
emptyMessage?: ReactNode
|
|
onRowClick?: DataGridProps<TData>["onRowClick"]
|
|
tableLayout?: DataGridProps<TData>["tableLayout"]
|
|
tableClassNames?: DataGridProps<TData>["tableClassNames"]
|
|
}
|
|
|
|
function DataGridShell<TData extends object>({
|
|
table,
|
|
recordCount,
|
|
children,
|
|
pagination = false,
|
|
isLoading,
|
|
loadingMode,
|
|
emptyMessage,
|
|
onRowClick,
|
|
tableLayout = DEFAULT_DATA_GRID_LAYOUT,
|
|
tableClassNames = DEFAULT_DATA_GRID_CLASS_NAMES,
|
|
}: DataGridShellProps<TData>) {
|
|
return (
|
|
<DataGrid
|
|
table={table}
|
|
recordCount={recordCount}
|
|
isLoading={isLoading}
|
|
loadingMode={loadingMode}
|
|
emptyMessage={emptyMessage}
|
|
onRowClick={onRowClick}
|
|
tableLayout={tableLayout}
|
|
tableClassNames={tableClassNames}
|
|
>
|
|
{children ?? (
|
|
<>
|
|
<DataGridContainer border={false} className={DATA_GRID_CONTAINER_CLASS}>
|
|
<DataGridTable />
|
|
</DataGridContainer>
|
|
{pagination && recordCount > 0 && (
|
|
<DataGridPagination className="px-5 pb-3" />
|
|
)}
|
|
</>
|
|
)}
|
|
</DataGrid>
|
|
)
|
|
}
|
|
|
|
export { DataGridShell, type DataGridShellProps }
|