From 3d379d41a8631e5574267203a8718e6a2509df57 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 11 Sep 2026 20:27:55 +0200 Subject: [PATCH] refactor(settings): drop Safety and the classifier rollback, collapse the Access tree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Safety held one thing: rolling back the AI classification tag assignments. The classifier is gone, so the panel had nothing left to be about and the section is removed, along with the snapshot state and the rollback call that fed it. Permissions — the other thing that section might have grown into — already have a page in Access. "Search and sign-up" carried two controls that live somewhere else: a Public Registration toggle that Access and joining already owns, and an embedding model field that belongs with the other models. The duplicate registration toggle is gone and the section is now just Search. The account menu no longer offers Administration. It pointed at /settings?s=people — the same page the Settings entry above it opens — so it was two names for one door. Settings already shows the site sections to an administrator. Access: the branch tree opened its top level by default and ran to hundreds of rows, which buried the image libraries below it. Every branch now starts closed, opening one closes the one before it at the same depth, and the tree scrolls inside a bounded box. Picking a different person collapses it again. A "Clear all access" control removes every grant a person holds, including the everything role, for starting over. The standfirst is reworded to lead with what to do rather than with a definition. Tests updated rather than worked around: the Settings test asserted Safety was a section, and the Access test reached a child branch that is no longer open on load. Both now assert the new behaviour, plus two new cases — that branches start collapsed, and that opening one closes the previous. 346 frontend tests pass. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Dv6sqaY6Vq3ChZHMem3cnU --- frontend/src/components/Navbar.jsx | 8 +- frontend/src/pages/AccessPage.css | 24 ++++ frontend/src/pages/AccessPage.jsx | 71 ++++++++--- frontend/src/pages/AccessPage.test.jsx | 26 ++++ frontend/src/pages/AdminPage.jsx | 156 +---------------------- frontend/src/pages/SettingsPage.jsx | 7 +- frontend/src/pages/SettingsPage.test.jsx | 6 +- 7 files changed, 116 insertions(+), 182 deletions(-) diff --git a/frontend/src/components/Navbar.jsx b/frontend/src/components/Navbar.jsx index 41632b4..1397672 100644 --- a/frontend/src/components/Navbar.jsx +++ b/frontend/src/components/Navbar.jsx @@ -166,12 +166,10 @@ function AccountMenu({ user, onLogout }) { setOpen(false)}>Dashboard {/* Settings opens on the account, so a separate Account entry was two doors to the same room. */} + {/* One door. Settings already shows the site sections to an + administrator, so a second entry pointing into the same page was + two names for one place. */} setOpen(false)}>Settings - {user?.role === 'admin' && ( - setOpen(false)}> - Administration - - )} diff --git a/frontend/src/pages/AccessPage.css b/frontend/src/pages/AccessPage.css index 65f9a34..3f90a60 100644 --- a/frontend/src/pages/AccessPage.css +++ b/frontend/src/pages/AccessPage.css @@ -83,3 +83,27 @@ .ac-people ul { max-height: 240px; } .ac-counts { display: none; } } + +/* ── Bounded branch list ─────────────────────────────────────────────── + The category tree runs to hundreds of rows. Left to its own height it + pushed the image libraries and everything else off the bottom of the + page, so it scrolls inside itself and starts fully collapsed. */ +.ac-tree-box { + max-height: 380px; + overflow-y: auto; + border: 1px solid var(--border); + border-radius: 10px; + padding: 6px 4px; +} +.ac-tree-box .ac-tree { margin: 0; } + +.ac-person-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; } +.ac-reset { + flex: 0 0 auto; + font: inherit; font-size: 0.8rem; font-weight: 600; + color: var(--danger, #dc2626); + background: none; border: 1px solid var(--border); border-radius: 8px; + padding: 6px 12px; cursor: pointer; +} +.ac-reset:hover:not(:disabled) { border-color: var(--danger, #dc2626); } +.ac-reset:disabled { opacity: .55; cursor: default; } diff --git a/frontend/src/pages/AccessPage.jsx b/frontend/src/pages/AccessPage.jsx index ae0fa32..6e1f333 100644 --- a/frontend/src/pages/AccessPage.jsx +++ b/frontend/src/pages/AccessPage.jsx @@ -27,8 +27,13 @@ function buildTree(categories) { * separately grantable: the grant already reaches them, and offering a * checkbox that changes nothing is how a permissions screen starts lying. */ -function Branch({ node, byParent, granted, covered, onToggle, busy, depth = 0 }) { - const [open, setOpen] = useState(depth === 0) +function Branch({ node, byParent, granted, covered, onToggle, busy, depth = 0, openPath, onOpen }) { + // Which branch is open is held above rather than per-node: opening one has to + // close the one before it, and a node cannot know about its siblings. Every + // branch starts closed — the full tree is hundreds of rows, and scrolling + // past all of it to reach the next top-level subject is the thing that made + // this unusable. + const open = openPath.includes(node.id) const children = byParent.get(node.id) || [] const isGranted = granted.has(node.id) const isCovered = !isGranted && covered.has(node.id) @@ -39,7 +44,7 @@ function Branch({ node, byParent, granted, covered, onToggle, busy, depth = 0 }) {children.length > 0 ? ( + onClick={() => onOpen(node.id, depth, !open)}>{open ? '▾' : '▸'} ) :