-
Notifications
You must be signed in to change notification settings - Fork 3.3k
fix: BROS-340: Display Recent projects on the Home page #8993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ts (and the same order) like on All Project page
…projects to fill up the 10 projects on Home page. Filter recently viewed projects by userid.
✅ Deploy Preview for label-studio-docs-new-theme canceled.
|
✅ Deploy Preview for label-studio-playground ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for heartex-docs canceled.
|
✅ Deploy Preview for label-studio-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #8993 +/- ##
===========================================
- Coverage 66.70% 57.88% -8.82%
===========================================
Files 828 562 -266
Lines 64762 40576 -24186
Branches 10986 10990 +4
===========================================
- Hits 43198 23488 -19710
+ Misses 21560 17084 -4476
Partials 4 4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
/git merge
|
| // Fetch visited projects specifically by their IDs | ||
| const { data: visitedProjectsData } = useQuery({ | ||
| queryKey: ["visited-projects", { ids: visitedIds }], | ||
| async queryFn() { | ||
| if (visitedIds.length === 0) return { results: [], count: 0 }; | ||
|
|
||
| return api.callApi<{ results: APIProject[]; count: number }>("projects", { | ||
| params: { | ||
| ids: visitedIds.join(","), | ||
| page_size: visitedIds.length, | ||
| }, | ||
| }); | ||
| }, | ||
| enabled: visitedIds.length > 0, | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this may fit better in the ProjectProvider then you can use it here.
moving it to ProjectProvider will help keep the Project query code together and reuse it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realised we have another hook above that should be moved over - maybe we can circle back and clean this up later.
yyassi-heartex
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me - just make sure all checks pass and run selenium - changing the order of the home projects may impact selenium tests so updates may be required
This pull request introduces a "recently visited projects" feature to the Home page, improving the user experience by displaying projects in the order they were last accessed. It leverages Jotai atoms for state management and localStorage for persistence. The Home page now sorts and displays projects based on visit history, and records visits automatically when a project is accessed.
Recording
https://www.loom.com/share/c2134c86f53b48d78eb7470361229e6b
Key changes include:
Recently Visited Projects Feature:
getVisitedProjectIdsandaddVisitedProjectinvisitedProjects.tsto manage a per-user list of recently visited project IDs, stored in localStorage and capped at 10 entries.Home Page State Management and Sorting:
HomePage.tsxto use Jotai atoms for dialog state, project data, and sorting logic. Introduced atoms for modal state, project data, and a derived atom that sorts projects by visit history, showing recently visited projects first. [1] [2] [3] [4] [5] [6]Project Visit Tracking:
ProjectProvider.tsxto calladdVisitedProjectwhenever a project is loaded, ensuring visits are recorded for the current user. [1] [2]These changes collectively enhance the Home page by making it more responsive to user activity and improving discoverability of recently accessed projects.