From 497251cf596dcec9bcc355c5dd8746667968269f Mon Sep 17 00:00:00 2001 From: Jeffrey Smith Date: Fri, 27 Mar 2026 13:34:11 +0000 Subject: [PATCH] Replace admin Back button with UserMenu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the Back button and its sessionStorage return-URL stash logic. Add UserMenu to the right side of the admin topbar, providing consistent navigation to all surfaces and eliminating the infinite-loop problem (Back → / → admin → Back → ...). Co-Authored-By: Claude Opus 4.6 (1M context) --- src/js/sw/surfaces/admin/index.js | 34 +++++-------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/src/js/sw/surfaces/admin/index.js b/src/js/sw/surfaces/admin/index.js index 0b912d2..b4b6cb4 100644 --- a/src/js/sw/surfaces/admin/index.js +++ b/src/js/sw/surfaces/admin/index.js @@ -15,6 +15,7 @@ const { render } = preact; import { ToastContainer } from '../../primitives/toast.js'; import { DialogStack } from '../../shell/dialog-stack.js'; +import { UserMenu } from '../../shell/user-menu.js'; // ── Category → Section mapping ────────────── const ADMIN_SECTIONS = { @@ -121,26 +122,6 @@ function AdminSurface() { } }, [section]); - // Back button with return URL stash - useEffect(() => { - const RETURN_KEY = 'sb_admin_return'; - if (!sessionStorage.getItem(RETURN_KEY)) { - const ref = document.referrer; - if (ref && ref.startsWith(location.origin) && !ref.includes('/admin')) { - sessionStorage.setItem(RETURN_KEY, ref); - } else { - sessionStorage.setItem(RETURN_KEY, location.origin + BASE + '/'); - } - } - }, []); - - const backClick = useCallback((e) => { - e.preventDefault(); - const RETURN_KEY = 'sb_admin_return'; - const returnURL = sessionStorage.getItem(RETURN_KEY); - sessionStorage.removeItem(RETURN_KEY); - location.href = returnURL || BASE + '/'; - }, []); const navClick = useCallback((e) => { e.preventDefault(); @@ -155,15 +136,6 @@ function AdminSurface() {
${/* Top Bar */``}
- - - - - - Back - -
Administration @@ -179,6 +151,10 @@ function AdminSurface() { `)}
+ +
+ <${UserMenu} placement="down-right" /> +