Group the admin nav into Data, Pages, Forms, Tools and Panel
The header now has one menu per group: its name opens the first item, and hovering or tabbing into it drops down the rest. The strip under the header lists the open group's items, which is also the way around on a touch screen. The admin home shows the same groups as card blocks, from the same list in adminNav.ts. Data holds the record types, Pages the front page, timeline, blog posts and the Community blog section, Tools the media library and QR codes. Docs and comments name the new menu paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
06e443ba23
commit
29202f2eb1
7 changed files with 173 additions and 121 deletions
|
|
@ -1,11 +1,26 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
ADMIN NAVIGATION: src/pages/admin/adminNav.ts
|
||||
|
||||
Lifted out of AdminLayout because two things read it now: the
|
||||
header tabs and the card grid on the home page. Adding an entity
|
||||
stays one entry here plus a descriptor; there's still no second
|
||||
list to keep in step, it just isn't inside the layout file
|
||||
any more.
|
||||
One list, read by two things: the header (a menu per group, its
|
||||
items on hover or focus, and the open group's items in the strip
|
||||
below) and the admin home page (a block of cards per group).
|
||||
Adding an entity stays one entry here plus a descriptor; there's
|
||||
no second list to keep in step.
|
||||
|
||||
Five groups, each a menu in the header and a block on the home
|
||||
page:
|
||||
|
||||
Data the records: events, organizations, teams, awards, people
|
||||
Pages what edits a page rather than a record type: the front
|
||||
page, the history timeline, the blog and its Community
|
||||
section
|
||||
Forms what the public site has sent us
|
||||
Tools pages that make something: the media library, QR codes
|
||||
Panel accounts and the server (superadmins only)
|
||||
|
||||
Clicking a group's name opens its first item. That's also the
|
||||
touch path, where hover doesn't exist: the strip under the header
|
||||
lists the rest of the open group.
|
||||
|
||||
`blurb` is only read by the home cards. The header ignores it.
|
||||
|
||||
|
|
@ -31,73 +46,72 @@ export const AREA_TITLES = {
|
|||
panel: "NGU Admin Panel",
|
||||
};
|
||||
|
||||
/* The CMS tabs. Teams and Awards live under Organizations because
|
||||
that's where they belong conceptually (a team is part of an org,
|
||||
an award is given by one), even though each is its own table and
|
||||
its own page. */
|
||||
export const CMS_NAV = [
|
||||
{
|
||||
to: "/admin/events",
|
||||
label: "Events",
|
||||
blurb: "Retreats, conferences and gatherings, with their sections and rosters.",
|
||||
},
|
||||
{
|
||||
to: "/admin/organizations",
|
||||
label: "Organizations",
|
||||
blurb: "Regions, chapters and partners, plus the teams and awards they own.",
|
||||
children: [
|
||||
{ to: "/admin/organizations", label: "All organizations" },
|
||||
{ to: "/admin/teams", label: "Teams" },
|
||||
{ to: "/admin/awards", label: "Awards" },
|
||||
],
|
||||
},
|
||||
{
|
||||
to: "/admin/people",
|
||||
label: "People",
|
||||
blurb: "Bios, contact details, affiliations and awards received.",
|
||||
},
|
||||
// Its own tab rather than a child of anything: a timeline entry can
|
||||
// point at an event, an organization, an award, a person or a team,
|
||||
// so filing it under one of them would be arbitrary.
|
||||
{
|
||||
to: "/admin/timeline",
|
||||
label: "Timeline",
|
||||
blurb: "What the history page shows, and the order it shows it in.",
|
||||
},
|
||||
// One record, not a list: the tab opens it directly.
|
||||
{
|
||||
to: "/admin/front_page",
|
||||
label: "Front page",
|
||||
blurb: "The hero, its photos or livestream, and which bands the home page draws.",
|
||||
},
|
||||
// Posts, and the Community page section that lists them. Two
|
||||
// entities, one tab, like Organizations with Teams and Awards.
|
||||
{
|
||||
to: "/admin/blog_posts",
|
||||
label: "Blog",
|
||||
blurb: "Posts of our own, and the Community page's blog section.",
|
||||
children: [
|
||||
{ to: "/admin/blog_posts", label: "Posts" },
|
||||
{ to: "/admin/community_page", label: "Community section" },
|
||||
],
|
||||
},
|
||||
// Not an entity: the uploaded-image library every image field
|
||||
// picks from. Its own page, AdminMedia.tsx.
|
||||
{
|
||||
to: "/admin/media",
|
||||
label: "Media",
|
||||
blurb: "Uploaded images: logos, photos and backgrounds, ready to reuse.",
|
||||
},
|
||||
];
|
||||
export const DATA_NAV = {
|
||||
label: "Data",
|
||||
blurb: "The records the site is built from.",
|
||||
children: [
|
||||
{
|
||||
to: "/admin/events",
|
||||
label: "Events",
|
||||
blurb: "Retreats, conferences and gatherings, with their sections and rosters.",
|
||||
},
|
||||
{
|
||||
to: "/admin/organizations",
|
||||
label: "Organizations",
|
||||
blurb: "The national organization, regions, chapters and partners.",
|
||||
},
|
||||
{
|
||||
to: "/admin/teams",
|
||||
label: "Teams",
|
||||
blurb: "Boards, committees and leadership teams within an organization.",
|
||||
},
|
||||
{
|
||||
to: "/admin/awards",
|
||||
label: "Awards",
|
||||
blurb: "Awards an organization gives. Who received one is edited on the person.",
|
||||
},
|
||||
{
|
||||
to: "/admin/people",
|
||||
label: "People",
|
||||
blurb: "Bios, contact details, affiliations and awards received.",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
/* Forms are submissions coming in rather than content going out, so
|
||||
they get their own group in the header and their own block on the
|
||||
home page. A group with no `to` of its own opens its first child,
|
||||
so clicking the word Forms goes somewhere rather than nowhere. */
|
||||
export const PAGES_NAV = {
|
||||
label: "Pages",
|
||||
blurb: "What a page shows and in what order.",
|
||||
children: [
|
||||
// One record, not a list: the item opens it directly.
|
||||
{
|
||||
to: "/admin/front_page",
|
||||
label: "Front page",
|
||||
blurb: "The hero, its photos or livestream, and which bands the home page draws.",
|
||||
},
|
||||
// A timeline entry can point at an event, an organization, an
|
||||
// award, a person or a team, so it isn't filed under any of them.
|
||||
{
|
||||
to: "/admin/timeline",
|
||||
label: "Timeline",
|
||||
blurb: "What the history page shows, and the order it shows it in.",
|
||||
},
|
||||
{
|
||||
to: "/admin/blog_posts",
|
||||
label: "Blog posts",
|
||||
blurb: "Posts of our own, each at /blog/…",
|
||||
},
|
||||
{
|
||||
to: "/admin/community_page",
|
||||
label: "Community blog section",
|
||||
blurb: "The Community page's blog: headings, pinned posts and feeds.",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
/* Submissions coming in rather than content going out. */
|
||||
export const FORMS_NAV = {
|
||||
label: "Forms",
|
||||
blurb: "Whatever the public site has sent us.",
|
||||
separated: true,
|
||||
children: [
|
||||
{
|
||||
to: "/admin/feedback",
|
||||
|
|
@ -107,13 +121,17 @@ 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. */
|
||||
/* Pages that make something rather than edit a record. The QR page
|
||||
lives on the public site, so opening it leaves the admin. */
|
||||
export const TOOLS_NAV = {
|
||||
label: "Tools",
|
||||
blurb: "Handy pages for making things.",
|
||||
children: [
|
||||
{
|
||||
to: "/admin/media",
|
||||
label: "Media",
|
||||
blurb: "Uploaded images: logos, photos and backgrounds, ready to reuse.",
|
||||
},
|
||||
{
|
||||
to: "/qr",
|
||||
label: "QR code generator",
|
||||
|
|
@ -122,8 +140,8 @@ export const TOOLS_NAV = {
|
|||
],
|
||||
};
|
||||
|
||||
/* Accounts and server state, not content, which is why it sits
|
||||
outside the CMS rather than as another tab within it. */
|
||||
/* Accounts and server state, not content, which is why it's its
|
||||
own area rather than a group of CMS pages. */
|
||||
export const PANEL_NAV = {
|
||||
to: ADMIN_PANEL,
|
||||
label: "Panel",
|
||||
|
|
@ -132,18 +150,19 @@ export const PANEL_NAV = {
|
|||
superOnly: true,
|
||||
};
|
||||
|
||||
export const NAV: any[] = [...CMS_NAV, FORMS_NAV, PANEL_NAV];
|
||||
export const NAV: any[] = [DATA_NAV, PAGES_NAV, FORMS_NAV, TOOLS_NAV, PANEL_NAV];
|
||||
|
||||
/* What this user may see. Call it with the user from useAuth. */
|
||||
export function navFor(user) {
|
||||
return NAV.filter((item) => !item.superOnly || isSuper(user));
|
||||
}
|
||||
|
||||
/* A tab owns its own page and everything below it, so editing
|
||||
/* An item owns its own page and everything below it, so editing
|
||||
/admin/teams/ngu-board keeps Teams lit. */
|
||||
export const matches = (pathname, to) =>
|
||||
Boolean(to) && (pathname === to || pathname.startsWith(`${to}/`));
|
||||
|
||||
/* Where a group's name goes: its own page, else its first item. */
|
||||
export const target = (item) => item.to ?? item.children?.[0]?.to;
|
||||
|
||||
export function areaFor(pathname) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue