Employee directory
A list of employees with server-side search, a status filter and a link to each record. It loads its data on the server through the block's client.
pnpm dev:example) to see it.Add the components
terminal npx shadcn addInstall the glue
Install the block with
npx better-supabase add employees. The glue items are copied into your app, so edit them as you need.None: the page calls the block's client on the server.
Write the screen
React and shadcn
View in the exampleemployee-overview.tsx /** * Render inside `<Suspense>`: every employee on the list kit, with the add * action for callers who can write. */ export async function EmployeeOverview() { const [t, permissions] = await Promise.all([ getExtracted("people"), getPermissions(), ]); if (!can(permissions, "employees.read")) { forbidden(); } const directory = await settle(loadDirectory); if (directory.kind === "no-organization") { return null; } if (directory.kind === "error") { return <PeopleLoadError title={t("The directory didn't load")} />; } const { initial, managers } = directory.data; return ( <div className="flex flex-col gap-4"> {can(permissions, "employees.write") ? ( <div className="flex justify-end"> <AddEmployeeDialog managers={managers} canViewSensitive={can(permissions, "employees.read_sensitive")} /> </div> ) : null} <EmployeeRecordList initial={initial} /> </div> ); }