This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
// SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0
|
||||
// The organization's brand: name, colours and logos, with a preview of both themes and the contrast
|
||||
// each colour has there. Every member sees it; an administrator changes it (`branding.brand.write`,
|
||||
// which the kernel checks before a handler runs), and a member without that permission is shown the
|
||||
// same page read-only.
|
||||
|
||||
import { PROFILE } from "@app/config"
|
||||
import { brandGet } from "@app/modules/branding"
|
||||
import { BrandForm, brandFormLabels } from "@app/modules/branding/ui"
|
||||
import { tokens } from "@conusai-kit/brand"
|
||||
import { notFound } from "next/navigation"
|
||||
import type { ReactElement } from "react"
|
||||
import { orFallback } from "../../../src/server/guard"
|
||||
import { holdsAtLeast, pageContext } from "../../../src/server/page"
|
||||
import { AppTransport } from "../../../src/ui/transport"
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
export default async function BrandingPage({ params }: { params: Promise<{ org: string }> }): Promise<ReactElement> {
|
||||
const { org } = await params
|
||||
if (PROFILE === "convex") notFound()
|
||||
const page = await pageContext()
|
||||
const { caller, i18n, path } = page
|
||||
const brand = await orFallback(path, () => caller.call(brandGet, { org }))
|
||||
const canEdit = await holdsAtLeast(page, org, "admin")
|
||||
const t = (key: string, values?: Record<string, string | number>) => i18n.message(`branding.${key}`, values)
|
||||
|
||||
return (
|
||||
<>
|
||||
<h1>{i18n.message("branding.title")}</h1>
|
||||
<p>{i18n.message("branding.intro")}</p>
|
||||
<AppTransport>
|
||||
<BrandForm
|
||||
org={org}
|
||||
brand={brand}
|
||||
canEdit={canEdit}
|
||||
defaultPrimary={tokens.color.dark.accent}
|
||||
labels={brandFormLabels(t, i18n.message("app.failed"))}
|
||||
/>
|
||||
</AppTransport>
|
||||
</>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user