feat: add localStorage bookmarking system with session-based recently viewed projects#1255
Open
divyanshim27 wants to merge 7 commits into
Open
feat: add localStorage bookmarking system with session-based recently viewed projects#1255divyanshim27 wants to merge 7 commits into
divyanshim27 wants to merge 7 commits into
Conversation
- Add BookmarkManager (localStorage) with 10-item cap and duplicate prevention - Add bookmark toggle button on project detail page - Add /bookmarks route and template - Track last 5 recently viewed projects via Flask session - Add /api/recently-viewed endpoint - Add homepage recently-viewed section - Add 4 backend tests; bookmark JS logic covered by manual QA (no JS test runner in repo) Closes komalharshita#1230
|
@divyanshim27 is attempting to deploy a commit to the komalsony234-1530's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the two Advanced-level open issues listed in the README: a client-side
bookmarking system and server-side "recently viewed" tracking. No database changes
required — bookmarks live in
localStorage, recently viewed uses Flask's built-insession.
Closes #1230
What Changed
Bookmarking (client-side,
static/script.js)BookmarkManagerobject handling get/add/remove/isBookmarked againstlocalStorageJSON.parsein try/catch to recover gracefully from corrupted/hand-edited localStorage instead of crashing the page#bookmark-btn) totemplates/project.html, witharia-pressedstate kept in sync for screen readers/bookmarksroute +templates/bookmarks.htmlrendering all saved projects client-sideRecently Viewed (server-side,
routes/main_routes.py)/project/<int:project_id>now records the visit insession["recently_viewed"], capped at the last 5, most-recent-firstGET /api/recently-viewedendpoint returning full project objects for the session's recently viewed IDsfetch("/api/recently-viewed")and hidden when emptyOther
app.secret_keyconfig (required for Flask sessions) — sourced fromSECRET_KEYenv var with a dev-only fallback; documented in.env.exampleFiles Changed
static/script.js—BookmarkManager, bookmark button init, homepage recently-viewed fetchtemplates/project.html— bookmark button markuptemplates/bookmarks.html— newtemplates/index.html— recently-viewed sectionroutes/main_routes.py— session tracking +/api/recently-viewedapp.py—secret_keyconfig.env.example—SECRET_KEYdocumentedstatic/style.css— minor bookmark button stylingtests/test_basic.py— 4 new testsREADME.md— feature docsAcceptance Criteria
BookmarkManagerimplemented instatic/script.jsusinglocalStorage/bookmarksroute and template showing all saved projectsTesting
Automated (
python tests/test_basic.py):test_recently_viewed_tracks_last_fivetest_recently_viewed_revisit_moves_to_fronttest_bookmarks_page_loadstest_project_detail_404_for_invalid_idAll existing tests still pass.
Manual QA — bookmark add/remove/dedup logic is pure client-side
localStoragestate with no server round-trip, so it isn't covered by the Flask test client. This
repo doesn't currently have a JS test runner configured (no Jest/Vitest in
package.jsonor equivalent), so I verified manually:/bookmarkswith 0 saved → empty state message shown/bookmarkswith saved projects → cards render correctlyOpen to adding a Jest setup in a follow-up if