feat: replace layout with fixed left sidebar and top strip

This commit is contained in:
Jennie Robinson Faber 2026-04-02 21:11:47 +01:00
parent 238d68d063
commit dbb3fbbc1b
5 changed files with 342 additions and 268 deletions

View file

@ -1,6 +1,5 @@
<template> <template>
<UApp> <UApp>
<SvgFilters />
<NuxtLayout> <NuxtLayout>
<NuxtPage /> <NuxtPage />
</NuxtLayout> </NuxtLayout>

View file

@ -1,246 +1,266 @@
<template> <template>
<nav <aside :class="isMobile ? 'sidebar sidebar-mobile' : 'sidebar'">
:class="[ <!-- Brand -->
isMobile <NuxtLink to="/" class="sidebar-brand" @click="handleNavigate">
? 'w-full flex flex-col bg-transparent' Ghost Guild
: 'w-64 lg:w-80 backdrop-blur-sm h-screen sticky top-0 flex flex-col bg-guild-900 border-r border-guild-700',
]"
>
<!-- Logo/Brand at top (desktop only) -->
<!-- Logo/Brand: designer will replace text with logo asset -->
<div v-if="!isMobile" class="p-8 border-b border-guild-700 bg-guild-900">
<NuxtLink to="/" class="flex flex-col items-center gap-3 group">
<slot name="logo">
<span class="text-display-sm font-bold text-candlelight-400 warm-text tracking-wider"
>Ghost Guild</span
>
</slot>
</NuxtLink> </NuxtLink>
</div>
<!-- Vertical Navigation --> <!-- Navigation sections -->
<div <div class="sidebar-body">
:class=" <template v-if="isAuthenticated">
isMobile ? 'flex-1 p-6 overflow-y-auto' : 'flex-1 p-8 overflow-y-auto' <!-- Logged-in nav -->
" <div class="sidebar-section">You</div>
> <ul class="sidebar-nav">
<ul :class="isMobile ? 'space-y-4' : 'space-y-6'"> <li v-for="item in youItems" :key="item.path">
<li v-for="item in navigationItems" :key="item.path">
<NuxtLink <NuxtLink
:to="item.path" :to="item.path"
class="block group relative" :class="{ active: isActive(item.path) }"
@click="handleNavigate" @click="handleNavigate"
> >{{ item.label }}</NuxtLink>
<!-- Hover indicator -->
<span
class="text-guild-200 hover:text-guild-100 transition-all duration-300 text-lg tracking-wide block py-2 hover:warm-text"
active-class="text-guild-100 warm-text translate-x-2"
>
{{ item.label }}
</span>
</NuxtLink>
</li> </li>
</ul> </ul>
<!-- Contact Email --> <div class="sidebar-section">Explore</div>
<div class="mt-8 pt-6 border-t border-guild-800/50"> <ul class="sidebar-nav">
<p class="text-guild-500 text-xs"> <li v-for="item in exploreItems" :key="item.path">
Contact us:
<a
href="mailto:hello@ghostguild.org"
class="text-guild-400 hover:text-guild-300 transition-colors"
>hello@ghostguild.org</a
>
</p>
</div>
<!-- Color Mode Switcher -->
<div class="mb-6">
<UColorModeButton size="md" class="w-full" />
</div>
<!-- Auth section -->
<div
:class="
isMobile
? 'mt-8 pt-6 border-t border-guild-800/50'
: 'mt-12 pt-8 border-t border-guild-800/50'
"
>
<div v-if="isAuthenticated" class="space-y-4">
<NuxtLink <NuxtLink
to="/member/dashboard" :to="item.path"
class="block text-guild-300 hover:text-guild-100 hover:warm-text transition-all duration-300 py-2" :class="{ active: isActive(item.path) }"
@click="handleNavigate" @click="handleNavigate"
> >{{ item.label }}</NuxtLink>
<span class="block text-sm text-candlelight-400 mb-1">{{ </li>
memberData?.name || "Member" </ul>
}}</span>
Dashboard
</NuxtLink>
<button
@click="handleLogout"
class="text-guild-500 hover:text-guild-300 transition-all duration-300 text-sm"
>
Logout
</button>
</div>
<div v-else class="space-y-4">
<p class="text-guild-400 text-sm mb-4">
Enter your email to receive a login link
</p>
<UForm :state="loginForm" @submit="handleLogin"> <div class="sidebar-section">Community</div>
<UFormField name="email"> <ul class="sidebar-nav">
<UInput <li v-for="item in communityItems" :key="item.path">
v-model="loginForm.email" <NuxtLink
type="email" :to="item.path"
size="md" :class="{ active: isActive(item.path) }"
placeholder="your.email@example.com" @click="handleNavigate"
class="w-full" >{{ item.label }}</NuxtLink>
/> </li>
</UFormField> </ul>
</template>
<UButton <template v-else>
type="submit" <!-- Public nav -->
:loading="isLoggingIn" <div class="sidebar-section">Navigate</div>
:disabled="!isLoginFormValid" <ul class="sidebar-nav">
size="md" <li v-for="item in publicItems" :key="item.path">
class="w-full mt-3" <NuxtLink
> :to="item.path"
Send Magic Link :class="{ active: isActive(item.path) }"
</UButton> @click="handleNavigate"
</UForm> >{{ item.label }}</NuxtLink>
</li>
</ul>
<div <div class="sidebar-section">Join</div>
v-if="loginSuccess" <ul class="sidebar-nav">
class="p-3 bg-candlelight-900/20 rounded border border-candlelight-800" <li v-for="item in joinItems" :key="item.path">
> <NuxtLink
<p class="text-candlelight-400 text-sm">Check your email!</p> :to="item.path"
:class="{ active: isActive(item.path) }"
@click="handleNavigate"
>{{ item.label }}</NuxtLink>
</li>
</ul>
</template>
</div> </div>
<div <!-- Meta at bottom -->
v-if="loginError" <div class="sidebar-meta">
class="p-3 bg-ember-900/20 rounded border border-ember-800" <template v-if="isAuthenticated">
> <span class="member-name">{{ memberData?.name || 'Member' }}</span><br>
<p class="text-ember-400 text-sm">{{ loginError }}</p> <span
v-if="memberData?.circle"
class="member-circle"
:style="{ color: `var(--c-${memberData.circle})` }"
>{{ memberData.circle }}</span>
<br v-if="memberData?.circle">
<a href="#" @click.prevent="handleLogout">Sign out</a>
</template>
<template v-else>
Part of <a href="https://babyghosts.fund" target="_blank">Baby Ghosts</a><br>
A Canadian nonprofit<br>
<a href="#" @click.prevent="openLogin">Sign in</a>
</template>
</div> </div>
</div> </aside>
</div>
</div>
</nav>
</template> </template>
<script setup> <script setup>
import { reactive, ref, computed } from "vue";
const props = defineProps({ const props = defineProps({
isMobile: { isMobile: {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
}); })
const emit = defineEmits(["navigate"]); const emit = defineEmits(['navigate'])
const { isAuthenticated, logout, memberData } = useAuth(); const route = useRoute()
const { isAuthenticated, logout, memberData } = useAuth()
const { openLoginModal } = useLoginModal()
const handleNavigate = () => { const handleNavigate = () => {
if (props.isMobile) { if (props.isMobile) {
emit("navigate"); emit('navigate')
} }
}; }
const handleLogout = async () => { const handleLogout = async () => {
await logout(); await logout()
if (props.isMobile) { handleNavigate()
emit("navigate"); }
}
};
const publicNavigationItems = [ const openLogin = () => {
{ label: "Home", path: "/", accent: "entry point" }, openLoginModal()
{ label: "About", path: "/about", accent: "who we are" }, handleNavigate()
{ label: "Events", path: "/events", accent: "gatherings" }, }
{ label: "Join", path: "/join", accent: "become one" },
];
const memberNavigationItems = [ const isActive = (path) => {
{ label: "Dashboard", path: "/member/dashboard" }, if (path === '/') return route.path === '/'
{ label: "Events", path: "/events" }, return route.path.startsWith(path)
{ label: "Members", path: "/members" }, }
{ label: "Resources", path: "/resources" },
{ label: "Profile", path: "/member/profile" },
];
const navigationItems = computed(() => // Public nav items
isAuthenticated.value ? memberNavigationItems : publicNavigationItems, const publicItems = [
); { label: 'Home', path: '/' },
{ label: 'About', path: '/about' },
{ label: 'Events', path: '/events' },
{ label: 'Members', path: '/members' },
{ label: 'Wiki', path: '/wiki' },
]
// Login form state const joinItems = [
const loginForm = reactive({ { label: 'Become a member', path: '/join' },
email: "", { label: 'Propose an event', path: '/events' },
}); ]
const isLoggingIn = ref(false); // Logged-in nav items
const loginSuccess = ref(false); const youItems = [
const loginError = ref(""); { label: 'Dashboard', path: '/member/dashboard' },
{ label: 'Profile', path: '/member/profile' },
{ label: 'Account', path: '/member/account' },
{ label: 'My Updates', path: '/member/my-updates' },
]
const isLoginFormValid = computed(() => { const exploreItems = [
return loginForm.email && loginForm.email.includes("@"); { label: 'Events', path: '/events' },
}); { label: 'Members', path: '/members' },
{ label: 'Wiki', path: '/wiki' },
{ label: 'About', path: '/about' },
]
const handleLogin = async () => { const communityItems = [
if (isLoggingIn.value) return; { label: 'Peer Support', path: '/members' },
{ label: 'Propose an Event', path: '/events' },
isLoggingIn.value = true; ]
loginError.value = "";
loginSuccess.value = false;
try {
const response = await $fetch("/api/auth/login", {
method: "POST",
body: {
email: loginForm.email,
},
});
if (response.success) {
loginSuccess.value = true;
loginError.value = "";
loginForm.email = "";
}
} catch (err) {
console.error("Login error:", err);
if (err.statusCode === 500) {
loginError.value = "Failed to send email";
} else {
loginError.value = "Something went wrong";
}
} finally {
isLoggingIn.value = false;
}
};
</script> </script>
<style scoped> <style scoped>
@keyframes float { .sidebar {
0%, position: fixed;
100% { top: 0;
transform: translateY(0) rotate(0deg); left: 0;
} bottom: 0;
50% { width: 220px;
transform: translateY(-5px) rotate(10deg); padding: 0;
} border-right: 1px dashed var(--border);
display: flex;
flex-direction: column;
background: var(--bg);
z-index: 10;
} }
.delay-75 { .sidebar-mobile {
animation-delay: 75ms; position: static;
width: 100%;
min-height: 100%;
border-right: none;
} }
.delay-150 { .sidebar-brand {
animation-delay: 150ms; display: block;
font-family: 'Brygada 1918', serif;
font-size: 16px;
font-weight: 600;
color: var(--candle);
padding: 24px 24px 16px;
border-bottom: 1px dashed var(--border);
text-decoration: none;
}
.sidebar-brand:hover {
text-decoration: none;
}
.sidebar-body {
flex: 1;
overflow-y: auto;
}
.sidebar-section {
font-size: 10px;
letter-spacing: 0.12em;
text-transform: uppercase;
color: var(--text-faint);
margin: 20px 0 8px;
padding: 0 24px;
}
.sidebar-nav {
list-style: none;
margin-bottom: 0;
padding: 0 14px;
}
.sidebar-nav li {
margin-bottom: 2px;
}
.sidebar-nav a {
display: block;
padding: 6px 10px;
color: var(--text-dim);
font-size: 13px;
transition: all 0.15s;
text-decoration: none;
}
.sidebar-nav a:hover {
color: var(--text);
background: var(--surface);
text-decoration: none;
}
.sidebar-nav a.active {
color: var(--text-bright);
background: var(--surface);
}
.sidebar-meta {
margin-top: auto;
font-size: 11px;
color: var(--text-faint);
line-height: 1.7;
padding: 16px 24px 24px;
border-top: 1px dashed var(--border);
}
.sidebar-meta a {
color: var(--candle-dim);
}
.member-name {
color: var(--text);
font-size: 12px;
}
.member-circle {
font-size: 10px;
letter-spacing: 0.06em;
text-transform: uppercase;
} }
</style> </style>

View file

@ -0,0 +1,42 @@
<template>
<div class="top-strip">
<span>
<slot name="left">ghostguild.org{{ pagePath ? ` / ${pagePath}` : '' }}</slot>
</span>
<span>
<slot name="right">
<template v-if="memberData">
Signed in as {{ memberData.name }}
<template v-if="memberData.circle">
&middot; {{ memberData.circle }}
</template>
</template>
<template v-else>
A cooperative for game developers
</template>
</slot>
</span>
</div>
</template>
<script setup>
defineProps({
pagePath: { type: String, default: '' },
})
const { memberData } = useAuth()
</script>
<style scoped>
.top-strip {
padding: 16px 32px;
border-bottom: 1px dashed var(--border);
font-size: 12px;
color: var(--text-dim);
display: flex;
justify-content: space-between;
align-items: center;
}
.top-strip a { color: var(--text-faint); }
.top-strip a:hover { color: var(--candle); }
</style>

View file

@ -1,71 +1,84 @@
<template> <template>
<div class="min-h-screen bg-guild-900 relative"> <div class="site">
<!-- Background image at top - full page width --> <!-- Desktop Sidebar -->
<div <AppNavigation class="sidebar-desktop" />
class="absolute inset-x-0 pointer-events-none z-0"
style="
background-image: url(&quot;/background-dither.webp&quot;);
background-size: 100% auto;
background-position: top center;
background-repeat: no-repeat;
mask-image: linear-gradient(
to bottom,
rgba(0, 0, 0, 1) 0%,
rgba(0, 0, 0, 0) 100%
);
-webkit-mask-image: linear-gradient(
to bottom,
rgba(0, 0, 0, 1) 0%,
rgba(0, 0, 0, 0) 100%
);
"
/>
<!-- Mobile Header --> <!-- Mobile Header -->
<div <div class="mobile-header">
class="lg:hidden fixed top-0 left-0 right-0 z-50 bg-guild-900/95 backdrop-blur-md border-b border-guild-700" <NuxtLink to="/" class="brand">Ghost Guild</NuxtLink>
> <button class="btn" @click="isMobileMenuOpen = true">Menu</button>
<div class="flex items-center justify-between p-4">
<NuxtLink
to="/"
class="text-display-sm font-bold text-candlelight-400 warm-text tracking-wider"
>
Ghost Guild
</NuxtLink>
<UButton
icon="i-lucide-menu"
color="neutral"
variant="ghost"
size="lg"
@click="isMobileMenuOpen = true"
aria-label="Open menu"
/>
</div>
</div> </div>
<!-- Container to center content and sidebar together --> <!-- Main Content -->
<div class="lg:flex lg:justify-center lg:gap-0"> <main class="main">
<!-- Main Content Column --> <TopStrip :page-path="currentPageName" />
<div class="lg:w-[800px] overflow-y-auto relative z-[5] guild-interior">
<div class="relative">
<slot /> <slot />
</div> </main>
<AppFooter />
</div>
<!-- Desktop Navigation Column --> <!-- Mobile Drawer -->
<AppNavigation class="hidden lg:block relative z-20" /> <USlideover v-model:open="isMobileMenuOpen" side="left">
</div>
<!-- Mobile Navigation Drawer -->
<USlideover v-model:open="isMobileMenuOpen" side="right">
<template #body> <template #body>
<AppNavigation :is-mobile="true" @navigate="isMobileMenuOpen = false" /> <AppNavigation :is-mobile="true" @navigate="isMobileMenuOpen = false" />
</template> </template>
</USlideover> </USlideover>
</div> </div>
</template> </template>
<script setup> <script setup>
const isMobileMenuOpen = ref(false); const isMobileMenuOpen = ref(false)
const route = useRoute()
const currentPageName = computed(() => {
const path = route.path
if (path === '/') return ''
// Convert /member/dashboard member / dashboard
return path.slice(1).replace(/\//g, ' / ')
})
</script> </script>
<style scoped>
.site {
min-height: 100vh;
}
.main {
margin-left: 220px;
}
.sidebar-desktop {
display: block;
}
.mobile-header {
display: none;
}
.brand {
font-family: 'Brygada 1918', serif;
font-size: 16px;
font-weight: 600;
color: var(--candle);
text-decoration: none;
}
@media (max-width: 768px) {
.sidebar-desktop {
display: none;
}
.mobile-header {
display: flex;
padding: 12px 20px;
border-bottom: 1px dashed var(--border);
align-items: center;
justify-content: space-between;
background: var(--bg);
position: sticky;
top: 0;
z-index: 50;
}
.main {
margin-left: 0;
}
}
</style>

View file

@ -148,7 +148,7 @@
import { getCircleOptions } from "~/config/circles"; import { getCircleOptions } from "~/config/circles";
definePageMeta({ definePageMeta({
layout: "landing", layout: "default",
}); });
const circles = getCircleOptions(); const circles = getCircleOptions();