import { PERMS } from "@/lib/permission-slugs"; import { createCorrelationId, fail, type HousekeepingCapabilityContext, type HousekeepingResult, } from "../../../foundation/contracts"; import type { HousekeepingPageInput } from "../../../route-handlers"; import { type PeopleStaffQueryData, peopleStaffQuery } from "../queries/staff"; import { PeoplePageFrame, parsePeopleListInput } from "./page-state"; import { PeopleCommandForm } from "./people-command-form"; interface PeopleStaffPageProps { readonly context: HousekeepingCapabilityContext; readonly result?: HousekeepingResult; } export function PeopleStaffPage({ context, result }: PeopleStaffPageProps) { return ( data.page.items.length === 0} > {(data) => (
{data.kind === "applications" ? (
    {data.page.items.map((application) => (
  • {application.username ?? `User #${application.userId}`}

    {application.content}

    {context.has(PERMS.USERS_EDIT) ? ( ) : null}
  • ))}
) : data.kind === "teams" ? (
{context.has(PERMS.USERS_EDIT) ? ( ) : null}
    {data.page.items.map((team) => (
  • {team.name}

    {team.jobDescription ?? "No job description"}

    {context.has(PERMS.USERS_EDIT) ? ( ) : null}
  • ))}
) : data.kind === "moderation-team" ? (
    {data.page.items.map((member) => (
  • {member.username}

    {member.openCfh} CFH · {member.openTickets} tickets ·{" "} {member.actionCount} actions

  • ))}
) : null}
)}
); } export async function renderPeopleStaffPage(input: HousekeepingPageInput) { const routeId = input.match.routeId; const result = routeId === "people.staff.applications" || routeId === "people.staff.teams" || routeId === "people.staff.moderation-team" ? await peopleStaffQuery.run(input.context, { routeId, list: parsePeopleListInput(input.searchParams ?? {}), }) : fail( "NOT_FOUND", "errors.housekeeping.notFound", createCorrelationId(), ); return ; }