Skip to content

Sync article card design on bookmarked and liked pages#18

Open
rasulkireev wants to merge 1 commit intomainfrom
cursor/sync-article-card-design-on-bookmarked-and-liked-pages-50b1
Open

Sync article card design on bookmarked and liked pages#18
rasulkireev wants to merge 1 commit intomainfrom
cursor/sync-article-card-design-on-bookmarked-and-liked-pages-50b1

Conversation

@rasulkireev
Copy link
Owner

Refactor bookmarked and liked article cards to match the homepage's visual design and functionality.


Slack Thread

Open in Cursor Open in Web

@cursor
Copy link

cursor bot commented Sep 2, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@rasulkireev rasulkireev marked this pull request as ready for review September 2, 2025 12:49
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR refactors the saved articles controller to synchronize the visual design of bookmarked and liked article cards with the homepage's article card design. The changes primarily focus on enhancing the JavaScript-generated HTML structure in frontend/src/controllers/saved_articles_controller.js to match the existing server-rendered template pattern.

The key modifications include:

  1. Enhanced Article Card Layout: The renderArticle method now generates a more comprehensive HTML structure that includes article descriptions, tags display, and improved visual styling that mirrors the homepage design.

  2. Likes Controller Integration: Added proper Stimulus controller integration by manually constructing the necessary data attributes (data-controller="likes", data-likes-article-id-value, etc.) and targets (data-likes-target="likeButton") for dynamically generated content.

  3. Tags Functionality: Implemented tags rendering with proper HTML escaping using a dedicated escapeHtml utility function to prevent XSS vulnerabilities while displaying article tags.

  4. Button Functionality: Enhanced like and bookmark buttons with consistent styling and proper event handling integration with existing Stimulus controllers.

This change bridges the gap between server-rendered templates (which automatically have Stimulus attributes) and JavaScript-generated content by manually replicating the same data structure and styling patterns. The implementation maintains the existing localStorage-based functionality for saved articles while providing a richer, more consistent user experience across different pages of the application.

Confidence score: 3/5

  • This PR requires careful testing due to complex JavaScript controller integration and potential runtime issues
  • Score reflects concerns about manual Stimulus controller setup in dynamically generated HTML and potential likes controller conflicts
  • Pay close attention to the likes controller integration and test the like/bookmark functionality thoroughly on saved articles pages

1 file reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

Comment on lines +56 to +59
data-controller="likes"
data-likes-article-id-value="${article.id}"
data-likes-article-slug-value="${article.slug}"
data-likes-article-title-value="${this.escapeHtml(article.title)}">
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: The likes controller expects additional article data (tags, description) that may not be available in localStorage. When articles are liked/bookmarked, only id, slug, title, and timestamp are stored, but the template now renders description and tags.

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.

2 participants