mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 20:01:09 +02:00
feat(shared-ui): add "Anmelden" entry to the guest user-menu bar
When the right-hand user pill is clicked as a guest (barMode), the opening bar used to show just a decorative "Menü" label pill on the left and then settings + theme toggles — none of which are a useful first action for someone not logged in. - phosphor-icon-map: register SignIn as `login`, so PillDropdownBar can render it the same way as the existing `logout` glyph. - PillNavigation.userMenuBarItems: prepend an "Anmelden" item for guests (no userEmail + loginHref given) that navigates to loginHref. It becomes the first CTA in the bar, above settings / theme / language. - PillNavigation.userBarConfig: drop the bar-header label when the viewer is a guest. The decorative "Menü" pill added nothing alongside the new Anmelden action and just cluttered the leading edge of the bar. The popover variant of the user menu (UserMenuPanel) already had its own guest login button — this mirrors that behaviour for the bottom-bar variant used on mobile / narrow layouts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
98347cfd89
commit
39c85ccdcc
2 changed files with 22 additions and 2 deletions
|
|
@ -552,6 +552,20 @@
|
|||
// light/dark/system toggle, theme button.
|
||||
const userMenuBarItems = $derived.by<PillDropdownItem[]>(() => {
|
||||
const out: PillDropdownItem[] = [];
|
||||
// Guest → put "Anmelden" first. Everything else in the menu
|
||||
// (settings, theme, logout) is a user-only action or a trivial
|
||||
// toggle, so the login entry should be the obvious call-to-action
|
||||
// at the top of the bar.
|
||||
if (!userEmail && loginHref) {
|
||||
out.push({
|
||||
id: 'login',
|
||||
label: 'Anmelden',
|
||||
icon: 'login',
|
||||
onClick: () => {
|
||||
window.location.href = loginHref;
|
||||
},
|
||||
});
|
||||
}
|
||||
if (settingsHref) {
|
||||
out.push({
|
||||
id: 'settings',
|
||||
|
|
@ -758,10 +772,14 @@
|
|||
<!-- User Menu -->
|
||||
{#if (userEmail || loginHref) && barMode}
|
||||
{@const userLabel = userEmail ? truncateEmail(userEmail) : guestMenuLabel}
|
||||
<!-- For guests we omit the bar header label: the first item in
|
||||
userMenuBarItems is the "Anmelden" call-to-action, and a
|
||||
decorative "Menü" pill sitting to its left just clutters
|
||||
the bar without adding information. -->
|
||||
{@const userBarConfig = {
|
||||
id: 'user',
|
||||
label: userLabel,
|
||||
icon: 'user',
|
||||
label: userEmail ? userLabel : '',
|
||||
icon: userEmail ? 'user' : undefined,
|
||||
items: userMenuBarItems,
|
||||
}}
|
||||
<Pill
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ import {
|
|||
ShareFat,
|
||||
ShareNetwork,
|
||||
Shield,
|
||||
SignIn,
|
||||
SignOut,
|
||||
Sparkle,
|
||||
Spiral,
|
||||
|
|
@ -95,6 +96,7 @@ export const phosphorIcons: Record<string, any> = {
|
|||
compass: Compass,
|
||||
moon: Moon,
|
||||
sun: Sun,
|
||||
login: SignIn,
|
||||
logout: SignOut,
|
||||
chevronDown: CaretDown,
|
||||
menu: List,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue