themes-coffee/templates/overrides/coffee/auth-status.ninjatpl
Alex Dunmow 023bd23d96 feat(coffee): Wave A override contract — 49 builtin overrides, 7 page templates, persona blocks, seed
WO-TF-013. Bring the coffee theme up to the frozen OVERRIDE-CONTRACT:

- 49 mandatory builtin overrides in templates/overrides/coffee/ (chrome,
  marketing, primitives, commerce/local, blog family, auth surface,
  page-suggestions), each re-skinned in cafe/roastery chrome over the builtin
  data model. Legacy button/heading/image/text field reads updated to the new
  builtin contract (link/label/style, media/text).
- Signature moves: chalkboard menu panel (menu-list), hand-drawn doodle
  dividers, torn-paper edges, kraft-tag stamped buttons, circular roast stamps,
  hours "today" highlight. Semantic tokens only; CSS-first motion with
  prefers-reduced-motion fallbacks.
- 7 page templates: default, landing, article, full-width, blog-index, contact,
  auth.
- Blocks rework: deleted the five builtin-duplicating theme blocks (menu_board,
  hours_strip, location_card, footer, doodle_divider) — now overrides. Kept/added
  4 persona blocks: featured_pour, roast_profile, loyalty_card, brew_guide.
- 5 dual-mode presets (mode "both"), all 19 tokens, light and dark tuned.
- Bundled Fraunces / Work Sans / Caveat woff2 (OFL, latin subset, license
  recorded); fonts.json populated; all font-family via var(--font-*). Updated
  RECOMMENDED_FONTS.md, added RECOMMENDED_ICONS.md; required_icon_packs declared.
- Themed email-safe wrapper retained (tables, inline styles).
- Master pages rebuilt on builtin keys. Demo seed (demo:true): home, about,
  blog + 3 posts, contact (form + contact_submissions data table + row_inserted
  email-admins workflow), login. Cafe voice.

make (codeless build + verify) and check-safety both exit 0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 10:57:54 +08:00

28 lines
2.3 KiB
Plaintext

{# coffee auth-status — header login state. Auth state via the auth_state provider;
endpoints match the platform (/login, /login?tab=register, /api/auth/logout,
/api/auth/resend-verification). #}
{% if not auth.logged_in %}
<div class="auth-status flex items-center gap-2">
<a href="/login" class="coffee-body rounded-lg px-3 py-1.5 text-sm font-medium opacity-80 transition-colors hover:bg-muted hover:opacity-100">Login</a>
<a href="/login?tab=register" class="kraft-tag text-sm">Sign up</a>
</div>
{% else %}
{% if not auth.email_verified %}<div class="fixed inset-x-0 top-16 z-40 bg-accent px-4 py-2 text-center text-sm text-accent-foreground">Please verify your email address. <button hx-post="/api/auth/resend-verification" hx-swap="outerHTML" class="font-medium underline">Resend verification email</button></div>{% endif %}
<div class="auth-status relative">
<button type="button" onclick="this.nextElementSibling.classList.toggle('hidden')" class="coffee-body flex items-center gap-2 rounded-lg px-3 py-1.5 text-sm font-medium opacity-90 transition-colors hover:bg-muted hover:opacity-100">
<span class="coffee-hand flex h-7 w-7 items-center justify-center rounded-full bg-accent text-sm text-accent-foreground">{{ auth.display_name|first|upper }}</span>
<span>{{ auth.display_name }}</span>
<svg class="h-4 w-4" aria-hidden="true"><use href="/icons/lucide.svg#chevron-down"></use></svg>
</button>
<div id="auth-dropdown-menu" class="coffee-card absolute right-0 top-full z-50 mt-1 hidden w-48 py-1 shadow-lg">
<a href="/account" class="coffee-body block px-4 py-2 text-sm text-foreground hover:bg-muted">My profile</a>
<a href="/account/reviews" class="coffee-body block px-4 py-2 text-sm text-foreground hover:bg-muted">My reviews</a>
<hr class="my-1 border-dashed border-border">
<button hx-post="/api/auth/logout" hx-swap="none" class="coffee-body block w-full px-4 py-2 text-left text-sm text-destructive hover:bg-muted">Logout</button>
</div>
</div>
<script>
(function(){document.addEventListener('click',function(e){var menu=document.getElementById('auth-dropdown-menu');var btn=document.querySelector('.auth-status > button');if(!menu||!btn)return;if(!btn.contains(e.target)&&!menu.contains(e.target)){menu.classList.add('hidden');}});})();
</script>
{% endif %}