Add a Tools block to the admin home with the QR code generator

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-27 14:42:12 -05:00
parent c4970af3b8
commit 99c3a87c87
2 changed files with 24 additions and 3 deletions

View file

@ -9,8 +9,8 @@
reads, so a new entity shows up here the moment it's registered. reads, so a new entity shows up here the moment it's registered.
Forms sit in their own block below: they're submissions coming Forms sit in their own block below: they're submissions coming
in rather than content going out, and there'll be more of them in rather than content going out, and there'll be more of them
than the feedback queue eventually. The Panel block below that than the feedback queue eventually. Tools come next, and the
only exists for superadmins. Panel block below that only exists for superadmins.
The right-hand panel is deliberately inert. Nothing here The right-hand panel is deliberately inert. Nothing here
fetches, so the landing page can't be slow or half-broken on fetches, so the landing page can't be slow or half-broken on
@ -22,7 +22,7 @@ import { Link } from "react-router-dom";
import { useAuth } from "../../lib/auth.tsx"; import { useAuth } from "../../lib/auth.tsx";
import { SITE_VERSION } from "../../lib/version.ts"; import { SITE_VERSION } from "../../lib/version.ts";
import { ROLE_LABELS, isSuper } from "../../lib/roles.ts"; import { ROLE_LABELS, isSuper } from "../../lib/roles.ts";
import { CMS_NAV, FORMS_NAV, PANEL_NAV, target } from "./adminNav.ts"; import { CMS_NAV, FORMS_NAV, PANEL_NAV, TOOLS_NAV, target } from "./adminNav.ts";
/* One card. The title link is stretched over the whole card with /* One card. The title link is stretched over the whole card with
`after:absolute`, which makes the card clickable without nesting `after:absolute`, which makes the card clickable without nesting
@ -129,6 +129,12 @@ export default function AdminHome() {
))} ))}
</CardBlock> </CardBlock>
<CardBlock title={TOOLS_NAV.label} blurb={TOOLS_NAV.blurb}>
{TOOLS_NAV.children.map((tool) => (
<NavCard key={tool.to} item={tool} />
))}
</CardBlock>
{isSuper(user) && ( {isSuper(user) && (
<CardBlock title="Superadmin" blurb="Only superadmins see this block."> <CardBlock title="Superadmin" blurb="Only superadmins see this block.">
<NavCard item={PANEL_NAV} /> <NavCard item={PANEL_NAV} />

View file

@ -89,6 +89,21 @@ export const FORMS_NAV = {
], ],
}; };
/* Tools are pages that make something rather than edit a record.
They live on the public site, so they're on the home page only:
a header tab would leave the admin area. */
export const TOOLS_NAV = {
label: "Tools",
blurb: "Handy pages for making things.",
children: [
{
to: "/qr",
label: "QR code generator",
blurb: "Codes for flyers, slides and signs, pointing at any page on the site.",
},
],
};
/* Accounts and server state, not content, which is why it sits /* Accounts and server state, not content, which is why it sits
outside the CMS rather than as another tab within it. */ outside the CMS rather than as another tab within it. */
export const PANEL_NAV = { export const PANEL_NAV = {