Skip to content

Commit 3e07dc8

Browse files
committed
feat(services): make table height responsive to window size
1 parent 33cb81d commit 3e07dc8

4 files changed

Lines changed: 25 additions & 10 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import type { ReactNode } from "react";
2+
3+
/** Bounded height for /services so the table can paginate inside the column. */
4+
export default function ServicesLayout({ children }: { children: ReactNode }) {
5+
return (
6+
<div className="flex h-full max-h-full min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden">
7+
{children}
8+
</div>
9+
);
10+
}

app/(authenticated)/services/page.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ export default async function ServicesPage() {
88
]);
99

1010
return (
11-
<main className="flex min-h-screen flex-col gap-6 p-8">
12-
<h1 className="text-3xl font-bold">Services</h1>
13-
<ServicesTable services={services} coordinators={coordinators} />
11+
<main className="flex h-full max-h-full min-h-0 w-full min-w-0 flex-1 flex-col gap-4 overflow-hidden p-8">
12+
<h1 className="shrink-0 text-3xl font-bold">Services</h1>
13+
<div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">
14+
<ServicesTable services={services} coordinators={coordinators} />
15+
</div>
1416
</main>
1517
);
1618
}

app/(authenticated)/services/services-data-table.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
TooltipContent,
1111
TooltipTrigger,
1212
} from "@/components/ui/tooltip";
13-
import { DataTable } from "@/components/data-table";
13+
import { UsersDataTable } from "@/app/(authenticated)/users/_components/users-data-table";
1414
import { formatDate } from "@/lib/format";
1515
import { statusBadgeClass } from "@/lib/service-status";
1616

@@ -172,7 +172,7 @@ export function ServicesDataTable({
172172
);
173173

174174
return (
175-
<DataTable
175+
<UsersDataTable
176176
columns={columns}
177177
data={services}
178178
emptyMessage="No services found."

app/(authenticated)/services/services-table.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ export function ServicesTable({
2828
}, [services, tab]);
2929

3030
return (
31-
<>
31+
<div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">
3232
<Tabs
3333
value={tab}
3434
onValueChange={(v) => setTab(v as StatusTab)}
35-
className="w-full"
35+
className="flex min-h-0 w-full min-w-0 flex-1 flex-col gap-2 overflow-hidden"
3636
>
37-
<div className="flex items-center justify-between">
37+
<div className="flex shrink-0 items-center justify-between">
3838
<TabsList className="border border-border">
3939
{statusTabs.map((status) => (
4040
<TabsTrigger key={status} value={status}>
@@ -45,7 +45,10 @@ export function ServicesTable({
4545
<ServiceDialog mode="add" coordinators={coordinators} />
4646
</div>
4747

48-
<TabsContent value={tab}>
48+
<TabsContent
49+
value={tab}
50+
className="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden focus-visible:outline-none"
51+
>
4952
<ServicesDataTable services={filtered} onEdit={setEditing} />
5053
</TabsContent>
5154
</Tabs>
@@ -58,6 +61,6 @@ export function ServicesTable({
5861
if (!v) setEditing(null);
5962
}}
6063
/>
61-
</>
64+
</div>
6265
);
6366
}

0 commit comments

Comments
 (0)