Skip to content

feat: add project favorites with star icon and sort-to-top#147

Open
R-Hart80 wants to merge 2 commits intoCatholicOS:devfrom
R-Hart80:feat/project-favorites
Open

feat: add project favorites with star icon and sort-to-top#147
R-Hart80 wants to merge 2 commits intoCatholicOS:devfrom
R-Hart80:feat/project-favorites

Conversation

@R-Hart80
Copy link
Copy Markdown
Contributor

Summary

  • Project interface: adds is_favorited?: boolean field
  • projectApi: adds favorite() and unfavorite() calling POST/DELETE /api/v1/projects/{id}/favorite
  • ProjectCard: star button shown only to authenticated users; clicking toggles the favorite state with optimistic UI (immediate visual feedback, rollback on API error); fully accessible with aria-label and aria-pressed
  • HomePage: tracks favorited IDs in local state and sorts favorited projects to the top within any active filter tab, maintaining existing creation-date order within each group

Note: requires backend issue ontokit-api#30 for the /favorite endpoints to be available.

Behavior

Scenario Behavior
Unauthenticated user Star icon hidden
Click star (unfavorited) Star fills yellow instantly; project moves to top
Click star (favorited) Star empties; project returns to normal order
API error Star reverts to previous state

Test plan

  • Star icon appears on cards when signed in, hidden when signed out
  • Clicking the star fills it yellow and moves the project to the top of the list
  • Clicking again removes the favorite and restores the order
  • Favorited state persists across page refreshes (returned by API in is_favorited)
  • Works across all filter tabs (My Projects, Public, Private, All)

Closes #78

🤖 Generated with Claude Code

- Project interface: add is_favorited?: boolean field
- projectApi: add favorite() and unfavorite() methods calling
  POST/DELETE /api/v1/projects/{id}/favorite
- ProjectCard: star button visible to authenticated users only;
  optimistic toggle with rollback on error; accessible with
  aria-label and aria-pressed attributes
- HomePage: track favorited IDs in local state, sort favorited
  projects to the top within any active filter/tab;
  pass accessToken and onFavoriteChange to ProjectCard

Closes CatholicOS#78

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 13, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0b54aa26-5177-450a-a1e3-4bdb75f5aa7d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

…overrides Map

Previously favoritedIds was a Set initialized once from the first page
load, causing newly paginated or refetched projects to miss their
is_favorited values from the server.

Replace it with a favoriteOverrides Map that only stores changes made
this session. The sort and display logic merges server data (source of
truth) with the override map, so all pages stay correct. On API error,
the rollback now calls onFavoriteChange back to the previous value,
keeping the override map as the single state location.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@JohnRDOrazio JohnRDOrazio changed the base branch from main to dev April 13, 2026 19:58
@JohnRDOrazio JohnRDOrazio added enhancement New feature or request UX User experience improvements labels Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request UX User experience improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add project favorites with star icon and sort-to-top

2 participants