// SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0 // The workspaces of the organization, and a form to create one (spec ยง3.1). A workspace is where // projects live and where a restricted group of people works apart from the rest of the // organization; creating one is for administrators (`tenancy.workspace.manage`), so the form is shown // to them and the kernel refuses everybody else regardless. import { workspaceList } from "@conusai-kit/tenancy" import type { ReactElement } from "react" import { orFallback } from "../../../src/server/guard" import { holdsAtLeast, pageContext } from "../../../src/server/page" import { ProcedureForm } from "../../../src/ui/procedure-form" export const dynamic = "force-dynamic" export default async function Workspaces({ params }: { params: Promise<{ org: string }> }): Promise { const { org } = await params const page = await pageContext() const { caller, i18n, path } = page const { workspaces } = await orFallback(path, () => caller.call(workspaceList, { org })) const mayCreate = await holdsAtLeast(page, org, "admin") return ( <>

{i18n.message("workspace.list")}

{workspaces.length === 0 ? (

{i18n.message("workspace.none")}

) : ( {workspaces.map((workspace) => ( ))}
{i18n.message("app.name")} {i18n.message("workspace.visibility")}
{workspace.name} {workspace.isDefault ? ` (${i18n.message("workspace.default")})` : ""} {workspace.visibility === "org" ? i18n.message("workspace.visibilityOrg") : i18n.message("workspace.visibilityRestricted")}
)} {mayCreate ? ( <>

{i18n.message("workspace.create")}