Repository navigation
STORY-142: Reading list (Save for later) UI - #83
devin-ai-integration[bot] wants to merge 3 commits into
Conversation
Add bookmark toggle on the article page, a private Reading list tab on your own profile, and ArticlesService bookmark/unbookmark/queryBookmarked. Add zone.js devDependency so the existing vitest suite can run. Co-Authored-By: Pedro Tabio <paltat@gmail.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
…or authors Co-Authored-By: Pedro Tabio <paltat@gmail.com>
…ive tab, no amber on blurred Save focus) Co-Authored-By: Pedro Tabio <paltat@gmail.com>
|
Ran an end-to-end test of 68268df against the real backend from COG-GTM/spring-boot-realworld-example-app#1202 (local, two users ana and bob). All STORY-142 acceptance criteria passed. Privacy and redirect evidence is below; the frame screenshots and walkthrough are in the PR description.
CI |
Story
STORY-142: Reading list (save articles for later). A logged-in reader can save articles to a private reading list and come back to them later, without making them public favorites.
Acceptance criteria this PR covers:
🔖 Savetoggle next to Favorite. Saving switches it to a filled amber🔖 Saved, and clicking again removes the save./login, not/registerlike Favorite does./profile/<someone-else>/reading-listdirectly redirects to/profile/<someone-else>and makes no bookmark request.Nothing saved yet. Use 🔖 Save on any article.What changed
Articlemodel: addedbookmarked?: boolean. It is optional so backends that don't send it still work; a missing value counts as not saved.ArticlesService: addedbookmark(slug),unbookmark(slug)(both returnArticle) andqueryBookmarked({limit, offset}).BookmarkButtonComponent(features/article/components/bookmark-button.component.ts), built on the same pattern asFavoriteButtonComponent(isSubmittingsignal,UserService.isAuthenticatedcheck,toggleoutput emitting the new state). Unsaved uses abtn-outline-bookmarkclass and saved uses a filledbtn-bookmarkclass (#f0ad4e, white text). Both classes live in the component's styles, so the theme is untouched. It isbtn-smlike the other buttons.article.component.html: added<app-bookmark-button>afterapp-favorite-buttonin both article-meta blocks (banner and below the body). Article authors also get it, placed after Edit/Delete in thecanModify()branch.onToggleBookmarkupdates thearticlesignal. The Follow/Favorite labels are unchanged.ProfileReadingListComponentplus areading-listchild route inprofile.routes.ts:authStateis no longerloading, then checks that the route username is the current user. If not, it redirects withreplaceUrlto/profile/<username>.author · date, a title linking to the article, the description, and a🔖 Savedbutton. There is no favorite heart or count on these cards.articlesCount > 10, the same page size as the other profile tabs. Un-saving the last card on a page recomputes the page count, and if other saves remain it moves to the last valid page and reloads it. The empty state only shows when there are no saves at all.profile.component.html: a third tab, Reading list, wrapped in@if (isUser()). The existing "My Posts" / "Favorited Posts" labels are unchanged.zone.js(~0.16.0) as a devDependency. Onmain, every spec importszone.js, but the "zoneless" commit removed it frompackage.json. As a result,bun run test -- --runfailed onmainwithFailed to resolve import "zone.js"(6 of 6 files failing, 0 tests run). Runningbun installalso syncedbun.lock's stale@angular/coreentry to the21.2.4thatpackage.jsonalready pins.author · dateinline in grey; the active Reading list tab text is amber (.reading-list-tab, scoped to the profile component); the outline Save is amber only on:hover, not:focus, so it doesn't look saved after an un-save.api.interceptor.tsis not changed.API contract consumed
The backend serves at the root path, and
api.interceptoradds the base URL.POST /articles/{slug}/bookmark→{ article }(bookmarked: true)DELETE /articles/{slug}/bookmark→{ article }(bookmarked: false)GET /articles/bookmarked?limit=10&offset=N→{ articles, articlesCount }, the current user's bookmarks only, newest saved firstArticlegainsbookmarked: boolean. There is no bookmark count anywhere. Auth uses the existingAuthorization: Token <jwt>header.Test results
New specs:
bookmark-button.component.spec.ts(7 tests): Save/Saved labels and classes, POST/DELETE, emit, error path, anonymous →/loginwith no HTTP call.profile-reading-list.component.spec.ts(7 tests): cards, exact empty state, un-save removes the card, pagination, going back a page after un-saving the only card on the last page, redirect for another user's profile and for anonymous users.profile.component.spec.ts(3 tests): the tab shows only on your own profile.articles.service.spec.ts: 4 new tests forbookmark,unbookmarkandqueryBookmarked.The Playwright e2e suites were not run locally; CI runs them on this PR.
End-to-end verification against the real backend
Ran locally: the backend from COG-GTM/spring-boot-realworld-example-app#1202 (
bootRun, JDK 11, SQLite,:8080) and this app (:4200), withapi.interceptor.tspointed athttp://localhost:8080only for the run (not committed; restored after). Two users, ana and bob:🔖 Save→ filled amber🔖 Saved→ back toSave. The state persists across reload, and Follow/Favorite are unchanged./login.Nothing saved yet. Use 🔖 Save on any article., which persists after reload./profile/ana/reading-listdirectly redirects to ana's public profile. Bob's own list is empty, and no save count appears anywhere.Known visual differences from the design that are outside this story: the app-wide article banner is white (the repo theme's
.banner), and default avatars from the external image host didn't load in the test environment. The active tab's underline is still the theme green; only the text is amber.Related
Screenshots
Walkthrough recording (4 fps):
Devin-Org: engineering
Link to Devin session: https://devin-gtm.devinenterprise.com/sessions/545bdc3ad8b44f1aa50622bfb619a654
Open in Devin Desktop: https://devin-gtm.devinenterprise.com/desktop/session/545bdc3ad8b44f1aa50622bfb619a654?variant=devin
Devin Review