de28272914
Ships DOCS.md and the /docs route — a plain-prose translation of SPEC.md for users, distinct from the binding spec. Originating need was the admin-vs-owner role distinction on /admin/users (§6.1); response is a single guide that covers the framework's user-facing surfaces end-to-end (roles, proposing, branches, PRs, graduation, notifications). Mirrors /philosophy: markdown file at repo root + sibling backend loader + MarkdownPreview render. No schema migration. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
52 lines
1.7 KiB
React
52 lines
1.7 KiB
React
// `/docs` — the user-facing guide.
|
|
//
|
|
// Sibling of Philosophy.jsx: same chrome, same data path, different
|
|
// source file. Renders DOCS.md verbatim with light chrome around it.
|
|
// Reachable anonymously, same as `/philosophy`, so a visitor can read
|
|
// the guide before deciding to sign in.
|
|
|
|
import { useEffect, useState } from 'react'
|
|
import { Link, useNavigate } from 'react-router-dom'
|
|
import MarkdownPreview from './MarkdownPreview.jsx'
|
|
import { getDocs } from '../api.js'
|
|
|
|
export default function Docs({ authenticated }) {
|
|
const [body, setBody] = useState('')
|
|
const [error, setError] = useState(null)
|
|
const [loading, setLoading] = useState(true)
|
|
const navigate = useNavigate()
|
|
|
|
useEffect(() => {
|
|
let active = true
|
|
getDocs()
|
|
.then(r => { if (active) setBody(r.body || '') })
|
|
.catch(e => { if (active) setError(e.message || String(e)) })
|
|
.finally(() => { if (active) setLoading(false) })
|
|
return () => { active = false }
|
|
}, [])
|
|
|
|
return (
|
|
<div className="philosophy-page">
|
|
<header className="philosophy-header">
|
|
<button
|
|
className="philosophy-back"
|
|
onClick={() => (history.length > 1 ? navigate(-1) : navigate('/'))}
|
|
>
|
|
← Back
|
|
</button>
|
|
<span className="philosophy-title">User guide</span>
|
|
{!authenticated && (
|
|
<Link className="philosophy-signin" to="/">Home</Link>
|
|
)}
|
|
</header>
|
|
<article className="philosophy-body">
|
|
{loading && <p className="muted">Loading…</p>}
|
|
{error && <p className="error">Could not load the guide: {error}</p>}
|
|
{!loading && !error && (
|
|
<MarkdownPreview content={body} />
|
|
)}
|
|
</article>
|
|
</div>
|
|
)
|
|
}
|