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
|
|
@ -28,12 +28,12 @@ what a dropdown in the admin editor says.
|
||||||
| If it's… | It lives in… | Change it by… |
|
| If it's… | It lives in… | Change it by… |
|
||||||
| ------------------------------------------------------------ | ---------------- | ------------------------------------ |
|
| ------------------------------------------------------------ | ---------------- | ------------------------------------ |
|
||||||
| A record: an event, organization, person, team, award, timeline entry | the database | editing it in the admin |
|
| A record: an event, organization, person, team, award, timeline entry | the database | editing it in the admin |
|
||||||
| The front page's words, photos, bands, stats and paths | the database | Admin → Front page |
|
| The front page's words, photos, bands, stats and paths | the database | Admin → Pages → Front page |
|
||||||
| Blog posts, and the Community page's blog section (headings, pins, feeds) | the database | Admin → Blog |
|
| Blog posts, and the Community page's blog section (headings, pins, feeds) | the database | Admin → Pages → Blog posts, and Community blog section |
|
||||||
| The **label** a dropdown shows in the admin | code | [one file](#renaming-what-a-dropdown-shows) |
|
| The **label** a dropdown shows in the admin | code | [one file](#renaming-what-a-dropdown-shows) |
|
||||||
| The **list of allowed values** behind a fixed dropdown | database CHECK + code | [a migration and three files](#adding-removing-or-renaming-a-stored-value) |
|
| The **list of allowed values** behind a fixed dropdown | database CHECK + code | [a migration and three files](#adding-removing-or-renaming-a-stored-value) |
|
||||||
| Navigation, page section titles, colours, the site banner, history decades, the map grid | code | [the file named below](#other-content-that-lives-in-code) |
|
| Navigation, page section titles, colours, the site banner, history decades, the map grid | code | [the file named below](#other-content-that-lives-in-code) |
|
||||||
| Uploaded images | disk + the `media` table | Admin → Media, or any image field. See `docs/media-uploads.md` |
|
| Uploaded images | disk + the `media` table | Admin → Tools → Media, or any image field. See `docs/media-uploads.md` |
|
||||||
|
|
||||||
The rule of thumb from `CLAUDE.md`: data belongs in the database,
|
The rule of thumb from `CLAUDE.md`: data belongs in the database,
|
||||||
presentation belongs in code. A dropdown's *values* are data the
|
presentation belongs in code. A dropdown's *values* are data the
|
||||||
|
|
@ -184,7 +184,7 @@ also in `admin-schema.js` and a CHECK):
|
||||||
| Front page → Feature | none, livestream, video | **yes** | `HeroStage.tsx` |
|
| Front page → Feature | none, livestream, video | **yes** | `HeroStage.tsx` |
|
||||||
| Front page → Sections → Section | countdown, retreats, calendar, stats, timeline, connect, featured | **yes**, `FRONT_PAGE_SECTIONS` | `SECTIONS` in `src/pages/Home.tsx`; see [below](#front-page-section-names) |
|
| Front page → Sections → Section | countdown, retreats, calendar, stats, timeline, connect, featured | **yes**, `FRONT_PAGE_SECTIONS` | `SECTIONS` in `src/pages/Home.tsx`; see [below](#front-page-section-names) |
|
||||||
| Front page → Stats → Number Source | manual, years_since, regions, … | **yes**, `STAT_SOURCES` | `STAT_QUERIES` in `server/src/routes/home.js`; see [below](#front-page-stat-sources) |
|
| Front page → Stats → Number Source | manual, years_since, regions, … | **yes**, `STAT_SOURCES` | `STAT_QUERIES` in `server/src/routes/home.js`; see [below](#front-page-stat-sources) |
|
||||||
| Front page → Featured cards → Card type (Blog → Community section → Pinned community posts offers link and video only) | record, link, video | **yes**, `FEATURED_KINDS` | `FeaturedCards.tsx` (how each kind draws), `loadFeaturedCards` in `server/src/shape.js` |
|
| Front page → Featured cards → Card type (Community blog section → Pinned community posts offers link and video only) | record, link, video | **yes**, `FEATURED_KINDS` | `FeaturedCards.tsx` (how each kind draws), `loadFeaturedCards` in `server/src/shape.js` |
|
||||||
| Front page → Featured cards → Record type | event, organization, person, team, award | no | `FEATURED_REFS` in `server/src/shape.js` (what each fills the card with); the triggers in `030_featured_cards.sql` |
|
| Front page → Featured cards → Record type | event, organization, person, team, award | no | `FEATURED_REFS` in `server/src/shape.js` (what each fills the card with); the triggers in `030_featured_cards.sql` |
|
||||||
| Every list → Published / Listed / Featured filter | 1, 0 | **yes** | n/a |
|
| Every list → Published / Listed / Featured filter | 1, 0 | **yes** | n/a |
|
||||||
|
|
||||||
|
|
@ -200,7 +200,7 @@ code):
|
||||||
| Event → Scope (+ list filter); Front page → Countdown → Only this scope | `event_scopes` | the `event_scopes` table (migration only) |
|
| Event → Scope (+ list filter); Front page → Countdown → Only this scope | `event_scopes` | the `event_scopes` table (migration only) |
|
||||||
| Event hosts → Organization; affiliations; team and award "Organization" / "Awarded by"; person → Home organization | `organizations` | organizations, labelled by name |
|
| Event hosts → Organization; affiliations; team and award "Organization" / "Awarded by"; person → Home organization | `organizations` | organizations, labelled by name |
|
||||||
| Event hosts / event people / team members / timeline people → Person | `people` | people |
|
| Event hosts / event people / team members / timeline people → Person | `people` | people |
|
||||||
| Blog → Community section → Pinned posts → Post | `blog_posts` | blog posts, newest first |
|
| Community blog section → Pinned posts → Post | `blog_posts` | blog posts, newest first |
|
||||||
| Timeline → Record; Featured cards → Record | `record_refs` | every event, organization, award, person and team, narrowed by the type picked beside it |
|
| Timeline → Record; Featured cards → Record | `record_refs` | every event, organization, award, person and team, narrowed by the type picked beside it |
|
||||||
| Affiliations → Team | `teams` | teams, filtered to the chosen organization |
|
| Affiliations → Team | `teams` | teams, filtered to the chosen organization |
|
||||||
| Person awards → Award | `awards` | awards, labelled "Award (Organization)" |
|
| Person awards → Award | `awards` | awards, labelled "Award (Organization)" |
|
||||||
|
|
@ -216,7 +216,7 @@ each is changed in a different place:
|
||||||
|
|
||||||
| What you see | Where it's set |
|
| What you see | Where it's set |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| **The heading on the page** ("National Retreats", "What's on") | **Admin → Front page → Page sections → Heading.** Blank uses the default below. |
|
| **The heading on the page** ("National Retreats", "What's on") | **Admin → Pages → Front page → Page sections → Heading.** Blank uses the default below. |
|
||||||
| The default heading when that field is blank | `SECTIONS` in `src/pages/Home.tsx`, the `title` of each entry |
|
| The default heading when that field is blank | `SECTIONS` in `src/pages/Home.tsx`, the `title` of each entry |
|
||||||
| **The name in the admin's Section dropdown** ("Events Carousel (National Retreats)") | `FRONT_PAGE_SECTIONS` in `src/lib/adminSchema.ts` |
|
| **The name in the admin's Section dropdown** ("Events Carousel (National Retreats)") | `FRONT_PAGE_SECTIONS` in `src/lib/adminSchema.ts` |
|
||||||
| The subnav links under the header ("#Retreats", "#Calendar") | `PAGE_SECTIONS["/"]` in `src/navConfig.ts` |
|
| The subnav links under the header ("#Retreats", "#Calendar") | `PAGE_SECTIONS["/"]` in `src/navConfig.ts` |
|
||||||
|
|
@ -271,7 +271,7 @@ The numbers band's "Number Source" dropdown works the same way:
|
||||||
| Section titles, blurbs and colours on Retreats, Community, Leadership, Resources, Feedback, Privacy, Terms | the page file in `src/pages/` | the `SECTIONS` array at the top. A section's `id` must match its subnav `hash`. |
|
| Section titles, blurbs and colours on Retreats, Community, Leadership, Resources, Feedback, Privacy, Terms | the page file in `src/pages/` | the `SECTIONS` array at the top. A section's `id` must match its subnav `hash`. |
|
||||||
| Site-wide announcement banner | `src/data/bannerConfig.ts` | `enabled: false` hides it. Bump `id` when the message changes, so people who dismissed the old one see the new one. |
|
| Site-wide announcement banner | `src/data/bannerConfig.ts` | `enabled: false` hides it. Bump `id` when the message changes, so people who dismissed the old one see the new one. |
|
||||||
| History page decade headers | `src/data/historyDecades.ts` | Title, tagline and blurb per decade. |
|
| History page decade headers | `src/data/historyDecades.ts` | Title, tagline and blurb per decade. |
|
||||||
| Chapter map tiles and area names | `src/data/mapGrid.ts` | `AREAS` (tile positions) and `AREA_NAMES`. Which region paints which tile is in the database (Admin → Organizations → a region → Map areas). |
|
| Chapter map tiles and area names | `src/data/mapGrid.ts` | `AREAS` (tile positions) and `AREA_NAMES`. Which region paints which tile is in the database (Admin → Data → Organizations → a region → Map areas). |
|
||||||
| Feedback form types | `src/data/feedbackTypes.ts` **and** `TYPES` in `server/src/routes/feedback.js` | Keep the ids identical in both; the server stores unknown ids as `general`. Labels and hints are client-only. |
|
| Feedback form types | `src/data/feedbackTypes.ts` **and** `TYPES` in `server/src/routes/feedback.js` | Keep the ids identical in both; the server stores unknown ids as `general`. Labels and hints are client-only. |
|
||||||
| Event type labels and plurals (public site) | `src/lib/eventTypes.ts` | Also the order of the type filter chips. |
|
| Event type labels and plurals (public site) | `src/lib/eventTypes.ts` | Also the order of the type filter chips. |
|
||||||
| Event and person role labels (public site) | `ROLE_LABEL` in `src/pages/EventDetail.tsx` and `src/pages/PersonDetail.tsx` | |
|
| Event and person role labels (public site) | `ROLE_LABEL` in `src/pages/EventDetail.tsx` and `src/pages/PersonDetail.tsx` | |
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
Run without it again to take them back out.
|
Run without it again to take them back out.
|
||||||
|
|
||||||
Images point at /uploads/showcase.jpg. Upload any photo in
|
Images point at /uploads/showcase.jpg. Upload any photo in
|
||||||
Admin → Media and copy it to that name in the uploads directory,
|
Admin → Tools → Media and copy it to that name in the uploads directory,
|
||||||
or leave it missing to check how each page copes without one.
|
or leave it missing to check how each page copes without one.
|
||||||
|
|
||||||
A database under /var/lib/ngu (where the deployed service keeps
|
A database under /var/lib/ngu (where the deployed service keeps
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import { useCommunityBlog } from "../lib/useBlog.ts";
|
||||||
map is filtered to chapters; the vertical list is filtered to
|
map is filtered to chapters; the vertical list is filtered to
|
||||||
regions. Same rows, same endpoint, different shape on the page.
|
regions. Same rows, same endpoint, different shape on the page.
|
||||||
|
|
||||||
The blog's heading and blurb are the admin's (Blog → Community
|
The blog's heading and blurb are the admin's (Pages → Community blog
|
||||||
section), so that one entry is built here from the same cached
|
section), so that one entry is built here from the same cached
|
||||||
request CommunityBlog makes for its posts.
|
request CommunityBlog makes for its posts.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,8 @@
|
||||||
|
|
||||||
The cards come from adminNav.ts, the same list the CMS header
|
The cards come from adminNav.ts, the same list the CMS header
|
||||||
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
|
One block per header group, in the same order: Data, Pages,
|
||||||
in rather than content going out, and there'll be more of them
|
Forms, Tools, and Panel, which 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
|
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 +20,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, TOOLS_NAV, target } from "./adminNav.ts";
|
import { DATA_NAV, FORMS_NAV, PAGES_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
|
||||||
|
|
@ -98,6 +96,10 @@ function PanelSection({ title, children }) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The header's groups, in its order. Panel is drawn separately
|
||||||
|
below, since only superadmins get it. */
|
||||||
|
const GROUPS = [DATA_NAV, PAGES_NAV, FORMS_NAV, TOOLS_NAV];
|
||||||
|
|
||||||
const QUICK_ADD = [
|
const QUICK_ADD = [
|
||||||
{ to: "/admin/events/new", label: "New event" },
|
{ to: "/admin/events/new", label: "New event" },
|
||||||
{ to: "/admin/people/new", label: "New person" },
|
{ to: "/admin/people/new", label: "New person" },
|
||||||
|
|
@ -117,23 +119,13 @@ export default function AdminHome() {
|
||||||
</h1>
|
</h1>
|
||||||
<p className="mt-1 text-[#4a6b72]">Pick a section to work in.</p>
|
<p className="mt-1 text-[#4a6b72]">Pick a section to work in.</p>
|
||||||
|
|
||||||
<div className="mt-6 grid gap-4 sm:grid-cols-2">
|
{GROUPS.map((group) => (
|
||||||
{CMS_NAV.map((item) => (
|
<CardBlock key={group.label} title={group.label} blurb={group.blurb}>
|
||||||
<NavCard key={item.label} item={item} />
|
{group.children.map((item) => (
|
||||||
))}
|
<NavCard key={item.to} item={item} />
|
||||||
</div>
|
))}
|
||||||
|
</CardBlock>
|
||||||
<CardBlock title={FORMS_NAV.label} blurb={FORMS_NAV.blurb}>
|
))}
|
||||||
{FORMS_NAV.children.map((form) => (
|
|
||||||
<NavCard key={form.to} item={form} />
|
|
||||||
))}
|
|
||||||
</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.">
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,14 @@
|
||||||
wordmark names whichever one you're in, and from anywhere but
|
wordmark names whichever one you're in, and from anywhere but
|
||||||
Home it's the way back to Home.
|
Home it's the way back to Home.
|
||||||
|
|
||||||
The tab row is drawn everywhere except Home, where the card grid
|
The group menus (Data, Pages, Forms, Tools, Panel: adminNav.ts)
|
||||||
is the navigation and drawing both would say the same thing
|
are drawn everywhere except Home, where the card grid is the
|
||||||
twice. Which tabs appear depends on the signed-in user
|
navigation and drawing both would say the same thing twice. Each
|
||||||
(navFor() drops the superadmin-only ones), but that's cosmetics.
|
group's name opens its first item and hovering it lists the rest;
|
||||||
|
the strip under the header lists the open group's items, which is
|
||||||
|
also the way around on a touch screen. Which groups appear depends
|
||||||
|
on the signed-in user (navFor() drops the superadmin-only ones),
|
||||||
|
but that's cosmetics.
|
||||||
The route guard and the API are what actually say no.
|
The route guard and the API are what actually say no.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
|
@ -33,6 +37,52 @@ import {
|
||||||
target,
|
target,
|
||||||
} from "./adminNav.ts";
|
} from "./adminNav.ts";
|
||||||
|
|
||||||
|
/* One group in the header. The name opens the group's first item;
|
||||||
|
hovering it, or tabbing into it, drops down the rest. The menu is
|
||||||
|
CSS only (group-hover, group-focus-within), so it can't get stuck
|
||||||
|
open, and a keyboard reaches every item by tabbing on from the
|
||||||
|
name. A group of one has nothing to drop down. */
|
||||||
|
function GroupMenu({ item, lit, pathname }) {
|
||||||
|
const children = item.children ?? [];
|
||||||
|
const link = lit
|
||||||
|
? "font-semibold text-[#138ba0]"
|
||||||
|
: "text-[#4a6b72] transition-colors hover:text-[#138ba0]";
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="group relative">
|
||||||
|
<NavLink to={target(item)} className={`flex items-center gap-1 ${link}`}>
|
||||||
|
{item.label}
|
||||||
|
{children.length > 1 && (
|
||||||
|
<span aria-hidden="true" className="text-[10px] opacity-60">
|
||||||
|
▾
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</NavLink>
|
||||||
|
|
||||||
|
{children.length > 1 && (
|
||||||
|
<div className="invisible absolute left-0 top-full z-30 pt-2 opacity-0 transition-opacity group-focus-within:visible group-focus-within:opacity-100 group-hover:visible group-hover:opacity-100">
|
||||||
|
<ul className="min-w-52 rounded-xl border border-[#138ba0]/20 bg-white p-1.5 shadow-lg">
|
||||||
|
{children.map((child) => (
|
||||||
|
<li key={child.to}>
|
||||||
|
<NavLink
|
||||||
|
to={child.to}
|
||||||
|
className={`block rounded-lg px-3 py-2 text-sm transition-colors hover:bg-[#eef9fb] ${
|
||||||
|
matches(pathname, child.to)
|
||||||
|
? "font-semibold text-[#138ba0]"
|
||||||
|
: "text-[#26454c]"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{child.label}
|
||||||
|
</NavLink>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export default function AdminLayout() {
|
export default function AdminLayout() {
|
||||||
const { user, logout } = useAuth();
|
const { user, logout } = useAuth();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
@ -109,16 +159,7 @@ export default function AdminLayout() {
|
||||||
className="h-4 w-px bg-[#4a6b72]/25"
|
className="h-4 w-px bg-[#4a6b72]/25"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<NavLink
|
<GroupMenu item={item} lit={item === active} pathname={pathname} />
|
||||||
to={target(item)}
|
|
||||||
className={
|
|
||||||
item === active
|
|
||||||
? "font-semibold text-[#138ba0]"
|
|
||||||
: "text-[#4a6b72] transition-colors hover:text-[#138ba0]"
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{item.label}
|
|
||||||
</NavLink>
|
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</nav>
|
</nav>
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,26 @@
|
||||||
/* ═══════════════════════════════════════════════════════════════
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
ADMIN NAVIGATION: src/pages/admin/adminNav.ts
|
ADMIN NAVIGATION: src/pages/admin/adminNav.ts
|
||||||
|
|
||||||
Lifted out of AdminLayout because two things read it now: the
|
One list, read by two things: the header (a menu per group, its
|
||||||
header tabs and the card grid on the home page. Adding an entity
|
items on hover or focus, and the open group's items in the strip
|
||||||
stays one entry here plus a descriptor; there's still no second
|
below) and the admin home page (a block of cards per group).
|
||||||
list to keep in step, it just isn't inside the layout file
|
Adding an entity stays one entry here plus a descriptor; there's
|
||||||
any more.
|
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.
|
`blurb` is only read by the home cards. The header ignores it.
|
||||||
|
|
||||||
|
|
@ -31,73 +46,72 @@ export const AREA_TITLES = {
|
||||||
panel: "NGU Admin Panel",
|
panel: "NGU Admin Panel",
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The CMS tabs. Teams and Awards live under Organizations because
|
export const DATA_NAV = {
|
||||||
that's where they belong conceptually (a team is part of an org,
|
label: "Data",
|
||||||
an award is given by one), even though each is its own table and
|
blurb: "The records the site is built from.",
|
||||||
its own page. */
|
children: [
|
||||||
export const CMS_NAV = [
|
{
|
||||||
{
|
to: "/admin/events",
|
||||||
to: "/admin/events",
|
label: "Events",
|
||||||
label: "Events",
|
blurb: "Retreats, conferences and gatherings, with their sections and rosters.",
|
||||||
blurb: "Retreats, conferences and gatherings, with their sections and rosters.",
|
},
|
||||||
},
|
{
|
||||||
{
|
to: "/admin/organizations",
|
||||||
to: "/admin/organizations",
|
label: "Organizations",
|
||||||
label: "Organizations",
|
blurb: "The national organization, regions, chapters and partners.",
|
||||||
blurb: "Regions, chapters and partners, plus the teams and awards they own.",
|
},
|
||||||
children: [
|
{
|
||||||
{ to: "/admin/organizations", label: "All organizations" },
|
to: "/admin/teams",
|
||||||
{ to: "/admin/teams", label: "Teams" },
|
label: "Teams",
|
||||||
{ to: "/admin/awards", label: "Awards" },
|
blurb: "Boards, committees and leadership teams within an organization.",
|
||||||
],
|
},
|
||||||
},
|
{
|
||||||
{
|
to: "/admin/awards",
|
||||||
to: "/admin/people",
|
label: "Awards",
|
||||||
label: "People",
|
blurb: "Awards an organization gives. Who received one is edited on the person.",
|
||||||
blurb: "Bios, contact details, affiliations and awards received.",
|
},
|
||||||
},
|
{
|
||||||
// Its own tab rather than a child of anything: a timeline entry can
|
to: "/admin/people",
|
||||||
// point at an event, an organization, an award, a person or a team,
|
label: "People",
|
||||||
// so filing it under one of them would be arbitrary.
|
blurb: "Bios, contact details, affiliations and awards received.",
|
||||||
{
|
},
|
||||||
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.",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
/* Forms are submissions coming in rather than content going out, so
|
export const PAGES_NAV = {
|
||||||
they get their own group in the header and their own block on the
|
label: "Pages",
|
||||||
home page. A group with no `to` of its own opens its first child,
|
blurb: "What a page shows and in what order.",
|
||||||
so clicking the word Forms goes somewhere rather than nowhere. */
|
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 = {
|
export const FORMS_NAV = {
|
||||||
label: "Forms",
|
label: "Forms",
|
||||||
blurb: "Whatever the public site has sent us.",
|
blurb: "Whatever the public site has sent us.",
|
||||||
separated: true,
|
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
to: "/admin/feedback",
|
to: "/admin/feedback",
|
||||||
|
|
@ -107,13 +121,17 @@ export const FORMS_NAV = {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Tools are pages that make something rather than edit a record.
|
/* Pages that make something rather than edit a record. The QR page
|
||||||
They live on the public site, so they're on the home page only:
|
lives on the public site, so opening it leaves the admin. */
|
||||||
a header tab would leave the admin area. */
|
|
||||||
export const TOOLS_NAV = {
|
export const TOOLS_NAV = {
|
||||||
label: "Tools",
|
label: "Tools",
|
||||||
blurb: "Handy pages for making things.",
|
blurb: "Handy pages for making things.",
|
||||||
children: [
|
children: [
|
||||||
|
{
|
||||||
|
to: "/admin/media",
|
||||||
|
label: "Media",
|
||||||
|
blurb: "Uploaded images: logos, photos and backgrounds, ready to reuse.",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
to: "/qr",
|
to: "/qr",
|
||||||
label: "QR code generator",
|
label: "QR code generator",
|
||||||
|
|
@ -122,8 +140,8 @@ export const TOOLS_NAV = {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Accounts and server state, not content, which is why it sits
|
/* Accounts and server state, not content, which is why it's its
|
||||||
outside the CMS rather than as another tab within it. */
|
own area rather than a group of CMS pages. */
|
||||||
export const PANEL_NAV = {
|
export const PANEL_NAV = {
|
||||||
to: ADMIN_PANEL,
|
to: ADMIN_PANEL,
|
||||||
label: "Panel",
|
label: "Panel",
|
||||||
|
|
@ -132,18 +150,19 @@ export const PANEL_NAV = {
|
||||||
superOnly: true,
|
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. */
|
/* What this user may see. Call it with the user from useAuth. */
|
||||||
export function navFor(user) {
|
export function navFor(user) {
|
||||||
return NAV.filter((item) => !item.superOnly || isSuper(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. */
|
/admin/teams/ngu-board keeps Teams lit. */
|
||||||
export const matches = (pathname, to) =>
|
export const matches = (pathname, to) =>
|
||||||
Boolean(to) && (pathname === to || pathname.startsWith(`${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 const target = (item) => item.to ?? item.children?.[0]?.to;
|
||||||
|
|
||||||
export function areaFor(pathname) {
|
export function areaFor(pathname) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/* ═══════════════════════════════════════════════════════════════
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
COMMUNITY BLOG
|
COMMUNITY BLOG
|
||||||
|
|
||||||
The Community page's blog section (Admin → Blog → Community
|
The Community page's blog section (Admin → Pages → Community blog
|
||||||
section). Two halves, each pinned first and then newest, as
|
section). Two halves, each pinned first and then newest, as
|
||||||
routes/blog.js decides:
|
routes/blog.js decides:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue