From 99c3a87c87902205a5624bbdada21ec173d2e8ff Mon Sep 17 00:00:00 2001 From: Zaldimmar Date: Sun, 27 Sep 2026 14:42:12 -0500 Subject: [PATCH] Add a Tools block to the admin home with the QR code generator Co-Authored-By: Claude Opus 5.5 --- src/pages/admin/AdminHome.tsx | 12 +++++++++--- src/pages/admin/adminNav.ts | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/pages/admin/AdminHome.tsx b/src/pages/admin/AdminHome.tsx index 7e15f8c..c1312ce 100644 --- a/src/pages/admin/AdminHome.tsx +++ b/src/pages/admin/AdminHome.tsx @@ -9,8 +9,8 @@ reads, so a new entity shows up here the moment it's registered. Forms sit in their own block below: they're submissions coming in rather than content going out, and there'll be more of them - than the feedback queue eventually. The Panel block below that - only exists for superadmins. + than the feedback queue eventually. Tools come next, and the + Panel block below that only exists for superadmins. The right-hand panel is deliberately inert. Nothing here 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 { SITE_VERSION } from "../../lib/version.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 `after:absolute`, which makes the card clickable without nesting @@ -129,6 +129,12 @@ export default function AdminHome() { ))} + + {TOOLS_NAV.children.map((tool) => ( + + ))} + + {isSuper(user) && ( diff --git a/src/pages/admin/adminNav.ts b/src/pages/admin/adminNav.ts index 01e9648..0748c6c 100644 --- a/src/pages/admin/adminNav.ts +++ b/src/pages/admin/adminNav.ts @@ -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 outside the CMS rather than as another tab within it. */ export const PANEL_NAV = {