Add a section nav to the admin editor and fold repeater rows
Every record editor gets a sticky "On this page" column listing its field groups and collections (with row counts), lighting the one in view and marking any with a save error. Below lg it becomes a sticky "Jump to" menu. Editor pages widen to fit it through a small layout context; other admin pages keep their width. Each collection now sits in its own card, and repeater rows fold to their title line. Rows start folded, with Expand all and Collapse all; a new row, or one the server rejected, opens itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
eaff23839f
commit
8186aff62f
5 changed files with 402 additions and 67 deletions
|
|
@ -20,6 +20,7 @@ import { useCallback, useEffect, useMemo, useState } from "react";
|
|||
import { Link, NavLink, Outlet, useLocation, useNavigate } from "react-router-dom";
|
||||
import { useAuth } from "../../lib/auth.tsx";
|
||||
import { AdminTitleContext } from "../../lib/adminTitle.tsx";
|
||||
import { AdminWidthContext } from "../../lib/adminWidth.tsx";
|
||||
import { SITE_VERSION } from "../../lib/version.ts";
|
||||
import { ROLE_LABELS, isSuper } from "../../lib/roles.ts";
|
||||
import nguLogo from "../../assets/NGU_Logo.svg";
|
||||
|
|
@ -60,6 +61,10 @@ export default function AdminLayout() {
|
|||
const stableSet = useCallback((value) => setDetail(value), []);
|
||||
const titleContext = useMemo(() => ({ setDetail: stableSet }), [stableSet]);
|
||||
|
||||
// Whether the page below asked for extra room (the record editor,
|
||||
// for its section nav). setWide is a state setter, so it's stable.
|
||||
const [wide, setWide] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
// Sections only exist in the CMS. Home and Panel already say
|
||||
// what they are in the area title; "Panel | NGU Admin Panel"
|
||||
|
|
@ -159,9 +164,11 @@ export default function AdminLayout() {
|
|||
{/* flex-1 rather than a fixed height: the footer sits at the
|
||||
bottom of a short page and below the content of a long one,
|
||||
without ever floating over it. */}
|
||||
<main className="mx-auto w-full max-w-5xl flex-1 px-6 py-10">
|
||||
<main className={`mx-auto w-full flex-1 px-6 py-10 ${wide ? "max-w-[82rem]" : "max-w-5xl"}`}>
|
||||
<AdminTitleContext.Provider value={titleContext}>
|
||||
<Outlet />
|
||||
<AdminWidthContext.Provider value={setWide}>
|
||||
<Outlet />
|
||||
</AdminWidthContext.Provider>
|
||||
</AdminTitleContext.Provider>
|
||||
</main>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue