§22 S2: collection-scoped frontend path + API helpers

useCollectionId() hook; listRFCs/getRFC/proposeRFC take an optional collection
id and target the /collections/<cid>/ routes; add listCollections +
createCollection.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ben Stull
2026-06-05 13:11:27 -07:00
parent 0c654b173d
commit 98eea3e2d6
3 changed files with 93 additions and 7 deletions
+8
View File
@@ -4,6 +4,7 @@
// project-scoped, so the builders emit the default collection segment; the
// collection-aware link layer (named collections) lands in S2. Components build
// links via these helpers so that flip happens in one place.
import { useParams } from 'react-router-dom'
import { useProject } from '../components/ProjectLayout.jsx'
import { useDeployment } from '../context/DeploymentProvider'
@@ -37,3 +38,10 @@ export function useProjectId() {
const { defaultProjectId } = useDeployment()
return (ctx && ctx.projectId) || defaultProjectId
}
// §22 S2 — the collection id a component should scope to: the `/c/:collectionId/`
// route segment when present, else the project's default collection.
export function useCollectionId() {
const { collectionId } = useParams()
return collectionId || DEFAULT_COLLECTION
}