999c4b65ef
Implements the M3-frontend slice of the §22 multi-project track, per docs/superpowers/specs/2026-06-03-m3-frontend-design.md (design merged in #10). Completes the runtime-config cut 0.33.0 (M3-backend Plan A) began. Frontend: - DeploymentProvider boots GET /api/deployment → {name, tagline, defaultProjectId, projects}; brandTitle() neutral 'RFC' pre-fetch fallback. - /p/:projectId/* routing with generic /e/<slug> segment. ProjectLayout fetches /api/projects/:id, applies per-project theme (reset on switch), provides ProjectContext, guards the corpus (served only for the default; others get NotServedPlaceholder — decouples this slice from Plan B). - Directory at / (2+ projects) with N=1 redirect into the single project; ProjectSwitcher in deployment chrome; entry-noun by project type. - VITE_APP_NAME hard cut: removed from vite.config + index.html; the 6 brand reads now use deployment.name via context; static <title>RFC</title> + JS document.title. Internal /rfc·/proposals links → /p/<project>/e|proposals via lib/entryPaths. Backend: - GET /api/deployment returns default_project_id (the guard contract). - Server-side 308s: /rfc/<slug>, /rfc/<slug>/pr/<n>, /proposals/<n> → /p/<default>/… . nginx (testing + prod) routes /rfc/ and /proposals/ to the backend. Tests: 3 new backend redirect/deployment tests (438 pass); Vitest unit for DeploymentProvider, ProjectLayout (theme/guard/404), Directory (11 pass); clean build with no VITE_APP_NAME. Playwright e2e deferred until Tier-1 seeds a registry (see CHANGELOG 0.35.0 step 5). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
31 lines
1.2 KiB
React
31 lines
1.2 KiB
React
// §22.10 (M3) — the deployment directory at `/`. Renders the caller-visible
|
|
// projects (from /api/deployment) as cards linking into each project's
|
|
// `/p/<id>/` home. App's DeploymentLanding only mounts this when 2+ projects
|
|
// are visible; the N=1 case redirects straight into the single project so
|
|
// OHM's "land in the corpus" UX is preserved.
|
|
import { Link } from 'react-router-dom'
|
|
import { useDeployment } from '../context/DeploymentProvider'
|
|
import { entryNoun } from './ProjectLayout.jsx'
|
|
|
|
export default function Directory() {
|
|
const { name, tagline, projects } = useDeployment()
|
|
return (
|
|
<main className="chrome-pane">
|
|
<div className="directory">
|
|
<h1>{name}</h1>
|
|
{tagline && <p className="directory-tagline">{tagline}</p>}
|
|
<ul className="directory-list">
|
|
{projects.map(p => (
|
|
<li key={p.id} className="directory-card">
|
|
<Link to={`/p/${p.id}/`}>
|
|
<span className="directory-card-name">{p.name}</span>
|
|
<span className="directory-card-type">{entryNoun(p.type)}s</span>
|
|
</Link>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</div>
|
|
</main>
|
|
)
|
|
}
|