Skip to content

Feat: notes - #54

Draft
khanzadimahdi wants to merge 1 commit into
mainfrom
feat/notes
Draft

Feat: notes#54
khanzadimahdi wants to merge 1 commit into
mainfrom
feat/notes

Conversation

@khanzadimahdi

Copy link
Copy Markdown
Member

A note is a short, body-only piece of content — no title, no cover image. It's multilingual the same way an article is, keyed by correlation UUID and language code.

Pairs with backend PR Tarhche/backend#73 — this branch calls the note endpoints and the widened hashtag/author responses that PR adds. Merge the backend first.

Public

  • /{lang}/notes/{slug} — note detail, with comments and bookmarking.
  • An author now has one page: /{lang}/authors/{identity}, with articles and notes behind tabs, replacing /author/{identity}/articles. Hashtag pages get the same two tabs.
  • next.config.mjs redirects send the old URL shapes to the tab showing the same content, so existing links and anything already indexed keep working.

Dashboard

  • Notes CRUD at /dashboard/notes, plus own-scope creating and editing under /dashboard/my/notes.
  • Notes and comments each list both scopes on one page behind tabs, selected by a ?scope= param, instead of a separate /dashboard/my/* route. That's what removes /dashboard/my/comments. Creating and editing stay on separate routes per scope, because each scope talks to its own API endpoint.
  • One sidebar entry now covers both scopes — it shows for anyone who can read either, and the page decides which tabs to offer.

Supporting refactors

These are the parts worth reviewing most carefully, since they move code that already worked:

  • Comments and bookmarks move out of features/articles into features/comments and features/bookmarks, because notes use them too. Both now carry an explicit object type instead of hardcoding "article" — that's threaded through the DAL, the actions, and the edit form (which echoes the type back on submit so an update doesn't reassign it).
  • The bookmarks table gains a type column, and each row links to the page that actually shows the bookmarked thing.
  • languageMiddleware no longer treats any dotted last segment as a static asset. public/ is flat, so an asset is always a single segment with an extension. A dot elsewhere doesn't make a path an asset — usernames may contain one, as in /authors/@ada.lovelace, which the old check sent to the wrong place.

Notes for review

  • APP_PATHS.dashboard.notes.index stays a bare path while list(scope) adds the query, because revalidatePath ignores query strings.
  • This branch also carries the unstable_rethrow line in remove-bookmark.ts and delete-comment.ts. Those belong to the block users PR's sweep, but both files are substantially rewritten here, so carrying the line avoids a pointless conflict — the sweep ends up complete whichever order you merge in.
  • Verified with tsc --noEmit and next build on this branch alone; all note routes appear in the manifest and the old author/my-comments routes are gone. The repo has jest configured but no test files.
  • prettier --check reports four files, all already unformatted on main and untouched here. Their fixes are in a separate chore PR.

Relationship to the other PRs

Split out of one working branch alongside contact-us and block users. All three are cut from main and mergeable in any order; the overlap is app-paths.ts, app-permissions.ts, layout-sidebar.tsx and the two dictionaries, all additive on both sides.

🤖 Generated with Claude Code

A note is a short, body-only piece of content — no title, no cover. It is
multilingual the same way an article is, keyed by correlation UUID and
language code.

Public
- /{lang}/notes/{slug} with a note detail, comments and bookmarking
- An author now has one page, /{lang}/authors/{identity}, with articles
  and notes behind tabs, replacing /author/{identity}/articles. Hashtag
  pages get the same two tabs
- next.config redirects send the old shapes to the tab showing the same
  content, so existing links keep working

Dashboard
- Notes CRUD at /dashboard/notes, plus own-scope creating and editing
  under /dashboard/my/notes
- Notes and comments each now list both scopes on one page behind tabs
  instead of a separate /dashboard/my/* route, which is what removes
  /dashboard/my/comments

Supporting refactors
- Comments and bookmarks move out of features/articles into their own
  features, since notes use them too. Both carry an object type now
  rather than assuming "article"
- languageMiddleware no longer treats any dotted last segment as a static
  asset; public/ is flat, so an asset is a single segment with an
  extension. Usernames may contain a dot, as in /authors/@ada.lovelace

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant