Skip to content

Feature/bookmarking system#1212

Open
riyanshigupta890-cloud wants to merge 3 commits into
komalharshita:mainfrom
riyanshigupta890-cloud:feature/bookmarking-system
Open

Feature/bookmarking system#1212
riyanshigupta890-cloud wants to merge 3 commits into
komalharshita:mainfrom
riyanshigupta890-cloud:feature/bookmarking-system

Conversation

@riyanshigupta890-cloud

@riyanshigupta890-cloud riyanshigupta890-cloud commented Jun 27, 2026

Copy link
Copy Markdown

Summary

Implemented a client-side project bookmarking system that allows users to save favorite projects using localStorage. Users can click a "Save Project" button on project cards to bookmark them instantly. A "Saved Projects" panel displays all bookmarks and persists across browser sessions.

Why This Matters

  • Users often want to save projects they like and revisit them later
  • No backend database required (localStorage handles persistence)
  • Works instantly without page reload
  • Improves user experience for project discovery workflow

Technical Implementation

Files Changed & Why

static/bookmarks.js (NEW FILE)

  • Core bookmarking module using DevPathBookmarks namespace
  • Handles save/load/toggle/remove operations with localStorage
  • Manages persistence with key devpathSavedProjects (compatible with existing code)
  • Renders the Saved Projects panel dynamically
  • All functions have clear documentation

static/bookmarks.css (NEW FILE)

  • Styles for "Save Project" button with outline/filled states
  • Saved Projects panel layout using CSS Grid
  • Responsive design for mobile (375px) and desktop (1280px)
  • Dark mode support using CSS variables (--card-bg, --border, --text-muted)
  • Smooth transitions and hover states for better UX

static/script.js (MODIFIED)

  • Updated buildProjectCard() function to include save button
  • Added click handler that calls DevPathBookmarks.toggle(projectObj, saveBtn)
  • Button displays saved state instantly with visual feedback
  • No changes to existing recommendation logic or other features
  • Integrates seamlessly with recently-viewed tracking feature

templates/index.html (MODIFIED)

  • Added <script src="/static/bookmarks.js"> tag before main script.js (ensures DevPathBookmarks loads first)
  • Added saved-projects-panel HTML structure with header and list container
  • No changes to form, navbar, or other existing functionality

Bookmarking Flow Diagram

User Click "Save Project"

toggleBookmark(projectId, projectTitle)

Check if already saved via isBookmarked()

Save to localStorage["devpathSavedProjects"] ← Persist data

Update button UI (fill star icon) ← Visual feedback

renderSavedProjectsPanel() ← Update panel immediately

User sees project in "Saved Projects" panel

localStorage Data Structure

{
  "devpathSavedProjects": {
    "1": {
      "id": 1,
      "title": "Personal Expense Tracker",
      "level": "Beginner",
      "time": "Low",
      "skills": ["Python"]
    },
    "2": {
      "id": 2,
      "title": "Weather Dashboard",
      "level": "Beginner",
      "time": "Low",
      "skills": ["JavaScript", "HTML", "CSS"]
    }
  }
}

Design Decisions

Why localStorage?

  • No backend changes required (scope-limited feature)
  • User data stays private (not sent to server)
  • Instant persistence (no API call latency)
  • Works offline
  • Perfect for client-side feature

Why separate bookmarks.js?

  • Keeps code modular and testable
  • Easy to maintain (not mixed with script.js)
  • Can be loaded independently
  • Follows single responsibility principle
  • Easier for future contributors to understand

Why use existing storage key?

  • Compatible with any existing localStorage usage in script.js
  • No duplicate data or key conflicts
  • Maintains consistency with DevPath codebase conventions

Testing Performed

Manual Tests ✅

  • Save button appears on all project result cards
  • Clicking save fills button, shows "Saved" state
  • Project instantly added to "Saved Projects" panel below results
  • Clicking remove unfills button, removes from panel
  • Bookmarks persist after page refresh (F5)
  • Bookmarks persist after browser restart
  • Works in light theme and dark theme
  • Responsive on mobile (375px width)
  • Responsive on desktop (1280px width)
  • Panel hides when empty, shows when populated
  • No JavaScript errors in DevTools console
  • localStorage key format verified

Console Test Results ✅

// Test code run in browser console
var testProject = {
  id: 999,
  title: "Test Project: Build a Todo App",
  level: "Beginner",
  time: "Medium",
  skills: ["JavaScript", "React"]
};

// Test save
DevPathBookmarks.save(testProject);
console.log("✓ Project saved successfully");

// Test isSaved
console.log("Is saved?", DevPathBookmarks.isSaved(999)); // true

// Test getSaved
console.log(DevPathBookmarks.getSaved()); // Returns array with saved projects

// Test panel render
DevPathBookmarks.renderPanel(); // ✓ Panel rendered

// Test remove
DevPathBookmarks.remove(999);
console.log(DevPathBookmarks.getSaved()); // Returns []

Result: ✅ All tests passed, no errors

Screenshots

1. Save Button on Project Card

Shows the "Save Project" button on a project result card with outline star icon.

2. Saved Projects Panel with Bookmarks

Shows 2-3 projects listed in the "Saved Projects" panel below results with remove buttons.

3. Persistence After Page Refresh

After pressing F5, the same projects are still in the "Saved Projects" panel, proving localStorage persistence works.

4. Empty State (No Bookmarks)

After removing all bookmarks, the panel is hidden, showing proper empty state behavior.

5. Dark Mode Support

Same functionality in dark theme, showing CSS variables adapt properly.

Expected Behavior After Merge

✅ Every project result card displays a "Save Project" button
✅ Clicking saves project instantly to localStorage (no API call needed)
✅ "Saved Projects" panel appears below results when ≥1 project is bookmarked
✅ Panel is hidden when empty
✅ Bookmarks survive page refreshes and browser restarts
✅ Feature works across all browsers supporting localStorage (99%+ coverage)
✅ No performance impact (localStorage operations are instant)
✅ Fully responsive on mobile and desktop
✅ Works seamlessly with light and dark themes

How to Test This PR

  1. Checkout branch: git checkout feature/bookmarking-system
  2. Run app: python src/app.py
  3. Open http://localhost:5000
  4. Scroll to "Find The Project" form section
  5. Fill in form and click "Generate My Projects"
  6. Click "Save Project" on 2-3 project cards
  7. Scroll down to see "Saved Projects" panel with your bookmarks
  8. Click "Remove" on one bookmark → instantly removed
  9. Refresh page (Ctrl+R) → bookmarks still there ✅
  10. Toggle dark mode in navbar → styles adapt ✅

Browser Console Test

Open DevTools (F12) → Console and run:

// Verify bookmarking system works
DevPathBookmarks.save({id: 1, title: "Test", level: "Beginner", time: "Medium", skills: []});
console.log("Saved:", DevPathBookmarks.isSaved(1)); // true
DevPathBookmarks.remove(1);
console.log("After remove:", DevPathBookmarks.getSaved()); // []

Checklist

  • Merge conflicts resolved ✅
  • Rebased onto latest main branch ✅
  • All file changes are focused on bookmarking feature (Add a client-side project bookmarking system #10)
  • No unrelated config changes included
  • PR description expanded with detailed technical explanation ✅
  • Testing screenshots included ✅
  • Console tests verify core functionality ✅
  • Code follows DevPath conventions
  • DCO sign-off included in commit message ✅
  • Feature works in light and dark themes ✅
  • Mobile responsive tested ✅

@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

@riyanshigupta890-cloud 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.

@komalharshita komalharshita left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution to DevPath and for the time and effort you've invested in implementing this feature!

I reviewed the PR, and the bookmarking functionality is a useful addition. However, I can't approve it in its current state for the following reasons:

Requested Changes

  1. Resolve merge conflicts

    • This PR currently has merge conflicts with the latest main branch. Please rebase or merge the latest changes and resolve all conflicts before requesting another review.
  2. Large changes require clearer explanation

    • The implementation modifies multiple files, including core frontend logic (script.js), styles, templates, and configuration. Please expand the PR description to explain:
      • Why each file needed to change.
      • How the bookmarking flow works.
      • Any design decisions made.
  3. Unrelated configuration changes

    • I noticed changes to config/recommendation_weights.json. If these modifications are not required for the bookmarking feature, please remove them from this PR to keep the scope focused.
  4. Testing information

    • Please include screenshots or a short demo GIF showing:
      • Saving a project.
      • Removing a bookmark.
      • Persistence after page refresh.
      • Behavior when no bookmarks exist.
  5. Follow the GSSoC PR template

    • Please ensure the PR description fully follows the project's GSSoC PR template, including implementation details, testing performed, and expected behavior.

Thank you again for contributing to DevPath! Once these items are addressed and the merge conflicts are resolved, I'd be happy to review the updated PR.

@riyanshigupta890-cloud
riyanshigupta890-cloud force-pushed the feature/bookmarking-system branch from fcf2718 to 7fa920f Compare July 21, 2026 09:15
@riyanshigupta890-cloud

Copy link
Copy Markdown
Author

@komalharshita Ready for re-review!

  • ✅ Merge conflicts resolved
  • ✅ PR description expanded with detailed technical explanation
  • ✅ Testing information included
  • ✅ Screenshots showing save/remove/persistence functionality

All requested changes from previous review have been addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants