Personal library: saved poets, works, couplets and words #45

Merged
anas merged 2 commits from feature/library into main 2026-10-08 21:51:05 +00:00
Owner

Closes #24, closes #25. Builds on #43 (profile): this branch contains it, so merge #43 first (or merge this one and #43 closes with it).

Saving while reading

  • ♡ پسندیدہ شاعر on poet pages and ♡ پسندیدہ کلام on work pages.
  • 🔖 bookmark on every couplet, line and prose paragraph (appears on hover; always visible on touch screens).
  • لفظ محفوظ کریں in the word sidebar and محفوظ in the selection menu; the couplet the word came from is remembered.
  • Signed-out readers who press any of these go to sign-in and come back.

میری لائبریری (/library, "لائبریری" in the header)

  • The reader's name and bio, then four sections: favourite poets, favourite works, bookmarked couplets (with the text), saved words.
  • Every item shows its full path (poet » book » section » work) and links to the exact couplet (poem pages now have #c0, #c1… anchors, highlighted when opened).
  • A note on any couplet or word; remove with ✕; saved words open the word sidebar.

API (api/src/library.ts), app-ready (JSON in/out, Bearer token, see #44): GET /api/library, GET /api/library/state, POST /api/library/toggle, POST /api/library/:id/note, POST /api/library/:id/delete. One library table; deleting an account deletes its library. The site's /api/library proxy refuses posts from other origins.

Tested

  • npm test: 25 pass (toggling each kind, missing targets 404, word cleaning, page state, full paths, both misras, notes, readers cannot see or change each other's items, account deletion clears the library).
  • Headless Chrome: signed-out ♡ goes to sign-in; poet ♡, work ♡ and two 🔖 saved and still set after reload; a word selected in a couplet saved from the sidebar; the library page lists all four sections with paths.

Bookmarked phrases and glyphs (added after review request)

  • Select any part of a couplet or paragraph and press نشان in the selection menu: the phrase is bookmarked and drawn underlined with a small 🔖 (also when it runs across the two misras). Clicking it asks "یہ نشان ہٹائیں؟" and removes it. The library lists them under نشان زدہ عبارتیں with the phrase marked inside its couplet.
  • Contents lists show ♥ beside favourite works and 🔖 beside works holding bookmarks; book/section cards and the home page's poet cards show 🔖 when they hold any. API: GET /api/library/marks.
  • Tested: npm test 25 pass (phrases inside and across misras, phrases not in the couplet refused, marks for work/book/poet); headless Chrome: cross-misra phrase saved and highlighted in both lines after reload; glyphs on the ghazal list, the غزل card and Ghalib's home card; library section; removal by click.

🤖 Generated with Claude Code

Closes #24, closes #25. **Builds on #43 (profile)**: this branch contains it, so merge #43 first (or merge this one and #43 closes with it). **Saving while reading** - **♡ پسندیدہ شاعر** on poet pages and **♡ پسندیدہ کلام** on work pages. - **🔖 bookmark** on every couplet, line and prose paragraph (appears on hover; always visible on touch screens). - **لفظ محفوظ کریں** in the word sidebar and **محفوظ** in the selection menu; the couplet the word came from is remembered. - Signed-out readers who press any of these go to sign-in and come back. **میری لائبریری** (`/library`, "لائبریری" in the header) - The reader's name and bio, then four sections: favourite poets, favourite works, bookmarked couplets (with the text), saved words. - Every item shows its **full path** (poet » book » section » work) and links to the exact couplet (poem pages now have `#c0`, `#c1`… anchors, highlighted when opened). - A note on any couplet or word; remove with ✕; saved words open the word sidebar. **API** (`api/src/library.ts`), app-ready (JSON in/out, Bearer token, see #44): `GET /api/library`, `GET /api/library/state`, `POST /api/library/toggle`, `POST /api/library/:id/note`, `POST /api/library/:id/delete`. One `library` table; deleting an account deletes its library. The site's `/api/library` proxy refuses posts from other origins. **Tested** - `npm test`: 25 pass (toggling each kind, missing targets 404, word cleaning, page state, full paths, both misras, notes, readers cannot see or change each other's items, account deletion clears the library). - Headless Chrome: signed-out ♡ goes to sign-in; poet ♡, work ♡ and two 🔖 saved and still set after reload; a word selected in a couplet saved from the sidebar; the library page lists all four sections with paths. **Bookmarked phrases and glyphs** (added after review request) - Select any part of a couplet or paragraph and press **نشان** in the selection menu: the phrase is bookmarked and drawn underlined with a small 🔖 (also when it runs across the two misras). Clicking it asks "یہ نشان ہٹائیں؟" and removes it. The library lists them under **نشان زدہ عبارتیں** with the phrase marked inside its couplet. - Contents lists show **♥** beside favourite works and **🔖** beside works holding bookmarks; book/section cards and the home page's poet cards show 🔖 when they hold any. API: `GET /api/library/marks`. - Tested: npm test 25 pass (phrases inside and across misras, phrases not in the couplet refused, marks for work/book/poet); headless Chrome: cross-misra phrase saved and highlighted in both lines after reload; glyphs on the ghazal list, the غزل card and Ghalib's home card; library section; removal by click. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
anas added 2 commits 2026-10-08 21:35:52 +00:00
Readers write their full name and a short bio (Urdu or any text) on /account; the name heads the
account page and the header shows the first name. API: POST /api/auth/profile (trimmed, control
characters dropped, 100 and 1,000 characters).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Save (♡) poets and works, bookmark (🔖) couplets and paragraphs, save words from the word sidebar
  or the selection menu (with the couplet they came from); notes on items.
- /library (میری لائبریری): the reader's name and bio, then favourite poets, works, bookmarked
  couplets and saved words, each with its full path (poet » book » section » work) and a link to
  the couplet (#cN anchors on poem pages); saved words open the word sidebar.
- API (api/src/library.ts), JSON + Bearer tokens so mobile apps (#44) can use it; deleting an
  account deletes its library. Signed-out readers are sent to sign-in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anas added 1 commit 2026-10-08 21:48:44 +00:00
- Select any part of a couplet or paragraph and press نشان (selection menu): the phrase is
  bookmarked and shown underlined with a small 🔖, also across the two misras; clicking it removes
  the bookmark (with a confirmation). Listed in the library as نشان زدہ عبارتیں.
- Contents lists show ♥ on favourite works and 🔖 on works holding bookmarks; book/section cards and
  poet cards (home) show 🔖 when they hold any. API: GET /api/library/marks; phrases in state and
  library; phrase kind validated against the couplet's text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anas merged commit c05ad94b53 into main 2026-10-08 21:51:05 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: anas/divan#45
No description provided.