feat(home): role-based / redirect via homeRouteForRole

cab and fenja are sent to /pulse on landing; pilot continues to see the
existing editorial home content in place. Uses the same helper the test
suite already covers, so behaviour is locked in.

Adds a minimal /pulse stub so the redirect target resolves; step 7 replaces
it with the full member view.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonathan Hvid 2026-05-11 14:47:28 +02:00
parent 267ba34747
commit 3cb76b33c8
2 changed files with 35 additions and 0 deletions

View file

@ -2,10 +2,17 @@
import AppLayout from '../layouts/AppLayout.astro';
import ProjectLockup from '../components/ProjectLockup.astro';
import { hasJoinRequest } from '../lib/db';
import { homeRouteForRole } from '../lib/routing';
import { existsSync } from 'fs';
import { join } from 'path';
const user = Astro.locals.user;
// Council members (cab) and Fenja team (fenja) land on /pulse; pilots see
// the existing editorial home below — the right audience for that content.
const redirectTo = homeRouteForRole(user.role);
if (redirectTo) return Astro.redirect(redirectTo);
const firstName = user.name.split(' ')[0];
const alreadyJoined = hasJoinRequest(user.id);
const innofoundarLogoExists = existsSync(join(process.cwd(), 'public/innofounder-logo.png'));

28
src/pages/pulse.astro Normal file
View file

@ -0,0 +1,28 @@
---
import AppLayout from '../layouts/AppLayout.astro';
const user = Astro.locals.user;
const firstName = user.name.split(' ')[0];
---
<AppLayout title="Pulse" user={user}>
<div class="page">
<p class="label-sm eyebrow">Pulse</p>
<h1 class="display-md">Welcome back, <em>{firstName}</em>.</h1>
<p class="lead">The full member view lands in the next commit.</p>
</div>
</AppLayout>
<style>
.page {
padding: var(--space-12) var(--space-20) var(--space-16);
max-width: var(--content-max);
margin: 0 auto;
}
.eyebrow {
letter-spacing: var(--tracking-wider);
text-transform: uppercase;
color: var(--on-surface-muted);
margin-bottom: var(--space-3);
}
.lead { color: var(--on-surface-variant); max-width: var(--reading-max); }
</style>