forked from Qortal/q-blog
35 lines
1.5 KiB
Markdown
35 lines
1.5 KiB
Markdown
# Q-Blog — Multi-Blog Feature Notes (Patch)
|
||
|
||
Date: 2025-08-21
|
||
|
||
This patch implements ADR-0005 (Allow Multiple Blogs per Name) using the Plan A approach described in docs/features.
|
||
|
||
Highlights
|
||
|
||
- Added new route `/:user/blogs` listing all blogs for a Name.
|
||
- Added smart redirect for `/:user`:
|
||
- 1 blog → `/:user/:blog` (history replace)
|
||
- 0 or >1 → `/:user/blogs`
|
||
- Converted header action from a single “My Blog” link to a “My Blogs” dropdown with per-blog entries and a “Create new blog” action. For 0 blogs, the header shows a primary “Create Blog” button.
|
||
- Kept all existing blog-scoped routes intact.
|
||
|
||
Code Map
|
||
|
||
- `src/utils/blogs.ts`: list + fetch blog details helpers.
|
||
- `src/pages/UserBlogs/UserBlogs.tsx`: new list page with owner CTAs.
|
||
- `src/pages/UserBlogs/NameRootRedirect.tsx`: redirect component for `/:user`.
|
||
- `src/App.tsx`: routes added for `/:user/blogs` and `/:user`.
|
||
- `src/wrappers/GlobalWrapper.tsx`: fetches current user blogs; wires Navbar selection to set active `currentBlog` and navigate.
|
||
- `src/components/layout/Navbar/Navbar.tsx`: “My Blogs” dropdown, accessible popover menu; primary Create button when 0 blogs.
|
||
|
||
Tests
|
||
|
||
- `tests/routes/NameRootRedirect.test.tsx`: redirects for single vs multiple blogs.
|
||
- `tests/pages/UserBlogs.test.tsx`: renders list.
|
||
- `tests/components/Navbar.multiblog.test.tsx`: Create vs My Blogs visibility.
|
||
|
||
Notes
|
||
|
||
- Redirect target within Q-Blog is `/:user/:blog` (this app’s profile/posts page), not `…/posts`.
|
||
- No data migrations; all changes are UI/routing.
|