A new public /docs area covering the whole platform, organized by Diátaxis: tutorials (learning), how-to guides (tasks), reference (facts), and explanation (the why). 29 pages, each grounded in the actual routes, actions, schema, and UI — verified against the code and corrected for accuracy (e.g. admin-only vs admin+board gating, where the permissions matrix actually lives, how Stripe reconciliation matches). Implementation: - lib/docs/nav.ts is the single source of truth (categories + pages), driving the sidebar, static params, and prev/next. - Content authored as content/docs/<category>/<slug>.md, read at build time (the routes are statically generated), rendered by <DocsMarkdown> — reuses the existing react-markdown/GFM stack, no new dependencies. - (docs) route group with its own theme (docs.css) matching the public site's dark / monospace / lime aesthetic; sidebar with active-state, breadcrumb, prev/next, and a Diátaxis home. Public — signed-in users can read it too. - "Docs" link added to the landing nav. typecheck 0 · lint 0 errors · build ok (all /docs pages prerendered)
34 lines
958 B
TypeScript
34 lines
958 B
TypeScript
'use client'
|
|
|
|
import Link from 'next/link'
|
|
import { usePathname } from 'next/navigation'
|
|
import { DOC_CATEGORIES } from '@/lib/docs/nav'
|
|
|
|
export function DocsSidebar() {
|
|
const pathname = usePathname()
|
|
|
|
return (
|
|
<aside className="docs-sidebar" aria-label="Docs navigation">
|
|
{DOC_CATEGORIES.map(cat => (
|
|
<div key={cat.id} className="docs-sidebar-group">
|
|
<p className="docs-sidebar-group-label">{cat.label}</p>
|
|
{cat.pages.map(page => {
|
|
const href = `/docs/${cat.id}/${page.slug}`
|
|
const isActive = pathname === href
|
|
return (
|
|
<Link
|
|
key={page.slug}
|
|
href={href}
|
|
className={`docs-sidebar-link${isActive ? ' is-active' : ''}`}
|
|
aria-current={isActive ? 'page' : undefined}
|
|
>
|
|
{page.title}
|
|
</Link>
|
|
)
|
|
})}
|
|
</div>
|
|
))}
|
|
</aside>
|
|
)
|
|
}
|