Drop the bottom-right floating "Admin mode" switch in favour of a proper
account menu in the header's upper-right (every tool's .header-right).
New shared/profile-menu.{js,css}: a circular avatar button (email initial)
opening a dropdown with the signed-in email, an "Admin mode" item (only for
can_elevate principals — drives elevation.setOn/setOff, drops on leave),
Profile (/.profile), and Access tokens (/.tokens). The panel is portaled to
<body> + position:fixed so it overlays content reliably regardless of the
app's stacking contexts; the button shows a red ring while elevated.
No logout: authentication is the upstream proxy's concern (oauth2-proxy /
Authelia) — ZDDC owns no session, so the menu doesn't render sign-out.
elevation.js keeps the state machine (cookie, armed banner/frame, ephemeral
pagehide-clear, zddc:elevationchange, ?admin= URL) but no longer renders any
control — the profile menu is the UI. elevation.css drops the floating-
toggle styles (keeps banner + frame). All 7 templates drop the dead
elevation-toggle placeholder; all 7 build.sh bundle profile-menu.{js,css}.
Validated in a containerized browser: menu items, links, elevation arming +
armed ring, dropdown overlays content, no floating toggle.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
111 lines
2.8 KiB
CSS
111 lines
2.8 KiB
CSS
/* shared/profile-menu.css — header account menu (upper-right).
|
|
shared/profile-menu.js mounts a button into `.header-right` and toggles
|
|
a dropdown with the signed-in email, Admin mode, Profile, Access tokens,
|
|
and Sign out. Server mode only. */
|
|
|
|
.profile-menu {
|
|
position: relative;
|
|
display: inline-flex;
|
|
}
|
|
|
|
/* The button: a small circular avatar showing the email initial. */
|
|
.profile-btn {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 0;
|
|
width: 1.9rem;
|
|
height: 1.9rem;
|
|
border-radius: 50%;
|
|
line-height: 1;
|
|
}
|
|
.profile-btn__avatar {
|
|
font-size: 0.8rem;
|
|
font-weight: 700;
|
|
letter-spacing: 0.01em;
|
|
text-transform: uppercase;
|
|
}
|
|
/* Armed (admin mode on): a red ring so the elevated state reads from the
|
|
button even when the menu is closed — pairs with the page banner/frame. */
|
|
.profile-btn--armed {
|
|
box-shadow: 0 0 0 2px var(--danger, #dc3545);
|
|
border-color: var(--danger, #dc3545);
|
|
color: var(--danger, #dc3545);
|
|
}
|
|
|
|
.profile-menu__panel {
|
|
display: none;
|
|
/* Fixed + JS-positioned from the button rect: an absolute panel gets
|
|
trapped below the content layer by the app's stacking contexts, so
|
|
anchor it to the viewport instead (profile-menu.js sets top/right). */
|
|
position: fixed;
|
|
min-width: 15rem;
|
|
z-index: 9400; /* above the is-elevated frame (9200) + banner (9100) */
|
|
background: var(--bg, #fff);
|
|
border: 1px solid var(--border, #ddd);
|
|
border-radius: var(--radius, 6px);
|
|
box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16);
|
|
padding: 0.3rem;
|
|
font-size: 0.85rem;
|
|
}
|
|
.profile-menu__panel.open { display: block; }
|
|
|
|
.profile-menu__id {
|
|
padding: 0.35rem 0.55rem 0.45rem;
|
|
}
|
|
.profile-menu__email {
|
|
font-weight: 600;
|
|
color: var(--text, #222);
|
|
word-break: break-all;
|
|
}
|
|
.profile-menu__role {
|
|
margin-top: 0.1rem;
|
|
font-size: 0.72rem;
|
|
font-weight: 600;
|
|
letter-spacing: 0.04em;
|
|
text-transform: uppercase;
|
|
color: var(--danger, #dc3545);
|
|
}
|
|
|
|
.profile-menu__sep {
|
|
height: 1px;
|
|
margin: 0.25rem 0;
|
|
background: var(--border, #eee);
|
|
}
|
|
|
|
.profile-menu__item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
width: 100%;
|
|
box-sizing: border-box;
|
|
padding: 0.4rem 0.55rem;
|
|
border-radius: var(--radius, 4px);
|
|
color: var(--text, #222);
|
|
text-decoration: none;
|
|
cursor: pointer;
|
|
background: none;
|
|
border: none;
|
|
text-align: left;
|
|
font: inherit;
|
|
}
|
|
.profile-menu__item:hover {
|
|
background: var(--bg-hover, rgba(0, 0, 0, 0.05));
|
|
}
|
|
|
|
.profile-menu__toggle { cursor: pointer; }
|
|
.profile-menu__check {
|
|
margin: 0;
|
|
cursor: pointer;
|
|
accent-color: var(--danger, #dc3545);
|
|
flex-shrink: 0;
|
|
}
|
|
.profile-menu__toggle-label {
|
|
display: flex;
|
|
flex-direction: column;
|
|
line-height: 1.25;
|
|
}
|
|
.profile-menu__hint {
|
|
font-size: 0.72rem;
|
|
color: var(--text-muted, #888);
|
|
}
|