- Mobile: a hamburger nav with a dropdown, and ≤767/720px breakpoints across pages that collapse multi-column grids to one column and cut the 112px desktop side padding down for phones; admin gets a phone pass too. - Readability: bump the type-scale tokens and the small hardcoded sizes across user-facing pages (roadmap route excepted — already enlarged). - Pulse votes now sit in a warm terracotta-tinted panel so they stand out. - Header: 50% larger Fenja AI logo, the dot vertically centred to it, and a rebalanced "Project Bifrost" lockup (smaller, matched cap heights). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
413 lines
12 KiB
Text
413 lines
12 KiB
Text
---
|
|
import BaseLayout from './BaseLayout.astro';
|
|
import type { UserPublic } from '../lib/db';
|
|
|
|
interface Props {
|
|
title: string;
|
|
user: UserPublic;
|
|
}
|
|
|
|
const { title, user } = Astro.props;
|
|
|
|
const navLinks = [
|
|
{ href: '/pulse', label: 'Pulse' },
|
|
{ href: '/roadmap', label: 'Roadmap' },
|
|
];
|
|
|
|
const footerLinks = [
|
|
{ href: '/vision', label: 'Vision' },
|
|
];
|
|
|
|
const currentPath = Astro.url.pathname;
|
|
const year = new Date().getFullYear();
|
|
---
|
|
<BaseLayout title={title}>
|
|
<div class="app">
|
|
<header class="nav" role="banner">
|
|
<div class="nav-inner">
|
|
<a href="/" class="wordmark-link" aria-label="Project Bifrost — home">
|
|
<img src="/logo.svg" alt="Fenja AI" class="wordmark" />
|
|
<span class="wordmark-sep" aria-hidden="true">·</span>
|
|
<span class="wordmark-project">Project <em class="wordmark-bifrost">Bifrost</em></span>
|
|
</a>
|
|
|
|
<button
|
|
type="button"
|
|
class="nav-toggle"
|
|
id="nav-toggle"
|
|
aria-label="Menu"
|
|
aria-controls="nav-menu"
|
|
aria-expanded="false"
|
|
>
|
|
<svg viewBox="0 0 24 24" width="22" height="22" aria-hidden="true">
|
|
<path class="nav-toggle-bars" d="M3 6h18M3 12h18M3 18h18" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/>
|
|
<path class="nav-toggle-x" d="M5 5l14 14M19 5L5 19" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/>
|
|
</svg>
|
|
</button>
|
|
|
|
<nav class="nav-right" id="nav-menu" aria-label="Main navigation">
|
|
{navLinks.map(({ href, label }) => (
|
|
<a
|
|
href={href}
|
|
class:list={['nav-link', { active: currentPath === href || (href !== '/' && currentPath.startsWith(href)) }]}
|
|
>
|
|
{label}
|
|
</a>
|
|
))}
|
|
{user.role === 'fenja' && (
|
|
<a
|
|
href="/admin"
|
|
class:list={['nav-link', { active: currentPath.startsWith('/admin') }]}
|
|
>
|
|
Admin
|
|
</a>
|
|
)}
|
|
<span class="nav-divider" aria-hidden="true"></span>
|
|
<a href="/account" class="nav-user-name body-sm">{user.name}</a>
|
|
<form method="POST" action="/api/logout" class="nav-logout-form">
|
|
<button type="submit" class="logout-btn label-sm">Sign out</button>
|
|
</form>
|
|
</nav>
|
|
</div>
|
|
</header>
|
|
|
|
<main class="main-content">
|
|
<slot />
|
|
</main>
|
|
|
|
<footer class="footer" role="contentinfo">
|
|
<div class="footer-inner">
|
|
<div class="footer-left">
|
|
<img src="/logo-icon.svg" alt="" class="footer-mark" />
|
|
<span class="footer-copy label-sm">© {year} Fenja AI</span>
|
|
</div>
|
|
<nav class="footer-links" aria-label="Secondary">
|
|
{footerLinks.map(({ href, label }) => (
|
|
<a href={href} class="footer-link label-sm">{label}</a>
|
|
))}
|
|
</nav>
|
|
</div>
|
|
</footer>
|
|
</div>
|
|
</BaseLayout>
|
|
|
|
<style>
|
|
.app {
|
|
min-height: 100vh;
|
|
background: var(--background);
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
/* ── Nav ────────────────────────────────────────────────────────── */
|
|
.nav {
|
|
position: sticky;
|
|
top: 0;
|
|
z-index: 100;
|
|
background: var(--glass-surface);
|
|
backdrop-filter: var(--glass-blur);
|
|
-webkit-backdrop-filter: var(--glass-blur);
|
|
border-bottom: var(--ghost-border);
|
|
}
|
|
|
|
.nav-inner {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: var(--space-6);
|
|
padding: 0 var(--space-10);
|
|
height: 56px;
|
|
max-width: var(--content-max);
|
|
margin: 0 auto;
|
|
width: 100%;
|
|
}
|
|
|
|
.wordmark-link {
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
border-bottom: none;
|
|
color: var(--on-surface);
|
|
line-height: 1; /* belt + braces — no nav-row leading on the lockup */
|
|
}
|
|
.wordmark-link:hover {
|
|
border-bottom: none;
|
|
color: var(--on-surface);
|
|
}
|
|
.wordmark {
|
|
height: 30px; /* 50% larger than the prior 20px lockup */
|
|
width: auto;
|
|
display: block;
|
|
}
|
|
.wordmark-sep {
|
|
/* Flex-centred against the logo height so the dot sits on the vertical
|
|
middle of the "Fenja AI" logo. */
|
|
display: inline-flex;
|
|
align-items: center;
|
|
height: 30px;
|
|
color: var(--on-surface-muted);
|
|
font-family: var(--font-serif);
|
|
font-size: 22px;
|
|
line-height: 1;
|
|
}
|
|
/* Project (regular) + Bifrost (italic) share a baseline. Italic Newsreader
|
|
renders a touch taller at the same size, so Bifrost is set 1px smaller so
|
|
the two words read at the same cap height. inline-block + small symmetric
|
|
padding keeps the gradient-clip bbox from chopping the italic flourish. */
|
|
.wordmark-project,
|
|
.wordmark-bifrost {
|
|
font-family: var(--font-serif);
|
|
font-weight: 400;
|
|
letter-spacing: var(--tracking-snug);
|
|
line-height: 1;
|
|
}
|
|
.wordmark-project {
|
|
font-size: 20px;
|
|
color: var(--on-surface);
|
|
}
|
|
.wordmark-bifrost {
|
|
display: inline-block;
|
|
font-size: 19px;
|
|
font-style: italic;
|
|
padding: 2px 0;
|
|
vertical-align: baseline;
|
|
background-image: linear-gradient(
|
|
90deg,
|
|
var(--pigment-terracotta) 0%,
|
|
var(--pigment-ochre) 28%,
|
|
var(--pigment-copper) 54%,
|
|
var(--pigment-indigo) 78%,
|
|
var(--pigment-heather) 100%
|
|
);
|
|
-webkit-background-clip: text;
|
|
background-clip: text;
|
|
color: transparent;
|
|
}
|
|
|
|
/* ── Mobile menu toggle (hidden on desktop) ─────────────────────── */
|
|
.nav-toggle {
|
|
display: none;
|
|
margin-left: auto;
|
|
width: 40px;
|
|
height: 40px;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background: none;
|
|
border: none;
|
|
padding: 0;
|
|
cursor: pointer;
|
|
color: var(--on-surface);
|
|
border-radius: var(--radius-sm);
|
|
}
|
|
.nav-toggle .nav-toggle-x { display: none; }
|
|
|
|
/* ── Nav links ──────────────────────────────────────────────────── */
|
|
.nav-right {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: var(--space-1);
|
|
margin-left: auto;
|
|
}
|
|
.nav-divider {
|
|
display: inline-block;
|
|
width: 1px;
|
|
height: 18px;
|
|
background: rgba(0, 0, 0, 0.15);
|
|
margin: 0 18px;
|
|
transform: scaleX(0.5);
|
|
transform-origin: center;
|
|
}
|
|
.nav-logout-form { display: inline-flex; }
|
|
|
|
.nav-link {
|
|
position: relative;
|
|
font-family: var(--font-sans);
|
|
font-size: var(--text-label-md);
|
|
font-weight: 500;
|
|
letter-spacing: var(--tracking-wide);
|
|
text-transform: uppercase;
|
|
color: var(--on-surface-variant);
|
|
text-decoration: none;
|
|
padding: var(--space-2) var(--space-3);
|
|
border-radius: var(--radius-sm);
|
|
border-bottom: none;
|
|
transition: color var(--duration-fast) var(--ease-standard);
|
|
}
|
|
.nav-link:hover {
|
|
color: var(--on-surface);
|
|
border-bottom: none;
|
|
}
|
|
/* Active nav link: terracotta + slightly heavier weight. Colour alone
|
|
is the indicator — no badge, bullet, italic, or family swap. */
|
|
.nav-link.active {
|
|
color: var(--pigment-terracotta);
|
|
font-weight: 500;
|
|
}
|
|
|
|
/* ── User zone ──────────────────────────────────────────────────── */
|
|
.nav-user-name {
|
|
color: var(--on-surface-variant);
|
|
text-decoration: none;
|
|
border-bottom: none;
|
|
transition: color var(--duration-fast) var(--ease-standard);
|
|
}
|
|
.nav-user-name:hover {
|
|
color: var(--on-surface);
|
|
border-bottom: none;
|
|
}
|
|
|
|
.logout-btn {
|
|
background: none;
|
|
border: none;
|
|
cursor: pointer;
|
|
font-family: var(--font-sans);
|
|
font-size: var(--text-label-md);
|
|
letter-spacing: var(--tracking-wide);
|
|
text-transform: uppercase;
|
|
color: var(--on-surface-muted);
|
|
padding: var(--space-2) var(--space-3);
|
|
border-radius: var(--radius-sm);
|
|
transition: color var(--duration-fast) var(--ease-standard),
|
|
background var(--duration-fast) var(--ease-standard);
|
|
}
|
|
.logout-btn:hover {
|
|
color: var(--on-surface);
|
|
background: var(--surface-container-low);
|
|
}
|
|
|
|
/* ── Content ────────────────────────────────────────────────────── */
|
|
.main-content {
|
|
flex: 1;
|
|
}
|
|
|
|
/* ── Footer ─────────────────────────────────────────────────────── */
|
|
.footer {
|
|
margin-top: var(--space-16);
|
|
padding: var(--space-6) 0;
|
|
border-top: var(--ghost-border);
|
|
}
|
|
|
|
.footer-inner {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: var(--space-6);
|
|
padding: 0 var(--space-10);
|
|
max-width: var(--content-max);
|
|
margin: 0 auto;
|
|
width: 100%;
|
|
}
|
|
|
|
.footer-left {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: var(--space-3);
|
|
}
|
|
|
|
.footer-mark {
|
|
height: 16px;
|
|
width: auto;
|
|
display: block;
|
|
opacity: 0.7;
|
|
}
|
|
|
|
.footer-copy {
|
|
color: var(--on-surface-muted);
|
|
letter-spacing: var(--tracking-wide);
|
|
font-weight: 400;
|
|
}
|
|
|
|
.footer-links {
|
|
display: flex;
|
|
gap: var(--space-5);
|
|
}
|
|
|
|
.footer-link {
|
|
color: var(--on-surface-muted);
|
|
text-decoration: none;
|
|
border-bottom: none;
|
|
letter-spacing: var(--tracking-wide);
|
|
text-transform: uppercase;
|
|
transition: color var(--duration-fast) var(--ease-standard);
|
|
}
|
|
.footer-link:hover {
|
|
color: var(--on-surface-variant);
|
|
border-bottom: none;
|
|
}
|
|
|
|
/* ── Mobile (≤767px) ────────────────────────────────────────────── */
|
|
@media (max-width: 767px) {
|
|
.nav-inner { padding: 0 var(--space-5); gap: var(--space-3); }
|
|
|
|
.nav-toggle { display: inline-flex; }
|
|
.nav.open .nav-toggle-bars { display: none; }
|
|
.nav.open .nav-toggle-x { display: inline; }
|
|
|
|
/* Right-hand nav becomes a full-width dropdown under the bar. */
|
|
.nav-right {
|
|
position: absolute;
|
|
top: 56px;
|
|
left: 0;
|
|
right: 0;
|
|
margin-left: 0;
|
|
flex-direction: column;
|
|
align-items: stretch;
|
|
gap: 0;
|
|
padding: var(--space-2) var(--space-5) var(--space-4);
|
|
background: var(--glass-surface);
|
|
backdrop-filter: var(--glass-blur);
|
|
-webkit-backdrop-filter: var(--glass-blur);
|
|
border-bottom: var(--ghost-border);
|
|
box-shadow: var(--shadow-float);
|
|
display: none;
|
|
}
|
|
.nav.open .nav-right { display: flex; }
|
|
|
|
/* Comfortable tap targets in the dropdown. */
|
|
.nav-right .nav-link,
|
|
.nav-right .nav-user-name,
|
|
.nav-right .logout-btn {
|
|
display: flex;
|
|
align-items: center;
|
|
min-height: 44px;
|
|
width: 100%;
|
|
padding: var(--space-2) var(--space-2);
|
|
font-size: var(--text-body-md);
|
|
border-radius: var(--radius-sm);
|
|
}
|
|
.nav-divider {
|
|
width: auto;
|
|
height: 1px;
|
|
margin: var(--space-2) 0;
|
|
transform: scaleY(0.5);
|
|
}
|
|
.nav-logout-form { width: 100%; }
|
|
.logout-btn { justify-content: flex-start; }
|
|
|
|
/* Footer stacks. */
|
|
.footer-inner {
|
|
flex-direction: column;
|
|
align-items: flex-start;
|
|
gap: var(--space-4);
|
|
padding: 0 var(--space-5);
|
|
}
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
// Mobile nav: toggle the dropdown, keep aria in sync, close on link tap or
|
|
// when the viewport grows back to desktop.
|
|
const nav = document.querySelector<HTMLElement>('.nav');
|
|
const toggle = nav?.querySelector<HTMLButtonElement>('#nav-toggle');
|
|
const menu = nav?.querySelector<HTMLElement>('#nav-menu');
|
|
|
|
function setOpen(open: boolean) {
|
|
if (!nav || !toggle) return;
|
|
nav.classList.toggle('open', open);
|
|
toggle.setAttribute('aria-expanded', open ? 'true' : 'false');
|
|
}
|
|
|
|
toggle?.addEventListener('click', () => setOpen(!nav!.classList.contains('open')));
|
|
menu?.querySelectorAll('a').forEach((a) => a.addEventListener('click', () => setOpen(false)));
|
|
window.addEventListener('resize', () => { if (window.innerWidth > 767) setOpen(false); });
|
|
</script>
|