Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions app/(authenticated)/services/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { ReactNode } from "react";

/** Bounded height for /services so the table can paginate inside the column. */
export default function ServicesLayout({ children }: { children: ReactNode }) {
return (
<div className="flex h-full max-h-full min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden">
{children}
</div>
);
}
16 changes: 9 additions & 7 deletions app/(authenticated)/services/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ export default async function ServicesPage() {
]);

return (
<main className="flex min-h-screen flex-col gap-6 p-8">
<h1 className="text-3xl font-bold">Services</h1>
<ServicesTable
services={services}
coordinators={coordinators}
forms={forms}
/>
<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">
<h1 className="shrink-0 text-3xl font-bold">Services</h1>
<div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">
<ServicesTable
services={services}
coordinators={coordinators}
forms={forms}
/>
</div>
</main>
);
}
11 changes: 8 additions & 3 deletions app/(authenticated)/services/services-data-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip";
import { DataTable } from "@/components/data-table";
import { UsersDataTable } from "@/app/(authenticated)/users/_components/users-data-table";
import { formatDate } from "@/lib/format";
import { statusBadgeClass, subscriptionBadgeClass } from "@/lib/service-badges";

Expand Down Expand Up @@ -44,13 +44,15 @@ export function ServicesDataTable({
{
accessorKey: "title",
header: "Program",
meta: { colWidth: "42%" },
cell: ({ row }) => (
<span className="font-medium">{row.original.title ?? "—"}</span>
),
},
{
accessorKey: "status",
header: "Status",
meta: { colWidth: "13%" },
cell: ({ row }) => (
<span
className={
Expand Down Expand Up @@ -79,6 +81,7 @@ export function ServicesDataTable({
{
id: "startDate",
header: "Start Date",
meta: { colWidth: "17%" },
cell: ({ row }) => {
const s = row.original.scheduledAt;
return s ? formatDate(s.startDate) : "—";
Expand All @@ -87,14 +90,16 @@ export function ServicesDataTable({
{
id: "endDate",
header: "End Date",
meta: { colWidth: "17%" },
cell: ({ row }) => {
const s = row.original.scheduledAt;
return s ? formatDate(s.endDate) : "—";
},
},
{
id: "actions",
header: () => <div className="text-right">Actions</div>,
header: "Actions",
meta: { colWidth: "11%", thClassName: "text-right", tdClassName: "text-right" },
cell: ({ row }) => {
const s = row.original;
return (
Expand Down Expand Up @@ -197,7 +202,7 @@ export function ServicesDataTable({
);

return (
<DataTable
<UsersDataTable
columns={columns}
data={services}
emptyMessage="No services found."
Expand Down
13 changes: 8 additions & 5 deletions app/(authenticated)/services/services-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ export function ServicesTable({
}, [services, tab]);

return (
<>
<div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">
<Tabs
value={tab}
onValueChange={(v) => setTab(v as StatusTab)}
className="w-full"
className="flex min-h-0 w-full min-w-0 flex-1 flex-col gap-2 overflow-hidden"
>
<div className="flex items-center justify-between">
<div className="flex shrink-0 items-center justify-between">
<TabsList className="border border-border">
{statusTabs.map((status) => (
<TabsTrigger key={status} value={status}>
Expand All @@ -52,7 +52,10 @@ export function ServicesTable({
/>
</div>

<TabsContent value={tab}>
<TabsContent
value={tab}
className="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden focus-visible:outline-none"
>
<ServicesDataTable services={filtered} onEdit={setEditing} />
</TabsContent>
</Tabs>
Expand All @@ -66,6 +69,6 @@ export function ServicesTable({
if (!v) setEditing(null);
}}
/>
</>
</div>
);
}
Loading