Add iModel recents and favorites functionality - #183
Conversation
…add iModel recents/favorites functionality - Added new features to manage iModel favorites, including a context provider and custom hooks. - Enhanced IModelTile components to support favorites functionality. - Implemented tests for the new favorites hook. - Updated IModelGrid to handle favorites and recents request types.
|
I had no idea about these enhancements to the service @robertas-kerpys , we should demo this at demo day at some point |
There was a problem hiding this comment.
Pull Request Overview
This PR adds iModel recents and favorites functionality by integrating new APIs for tracking recently used iModels and managing favorite iModels. Users can now mark iModels as favorites with a star icon and view their recent/favorite iModels through filtered views.
- Implements
useIModelFavoriteshook to manage favorites state and API calls - Adds
IModelFavoritesContextto provide favorites functionality throughout the component tree - Updates
IModelGridandIModelTilecomponents to display and interact with favorites - Adds support for "recents" and "favorites" request types in the data fetching logic
Reviewed Changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
IModelFavoritesContext.tsx |
New context provider for managing iModel favorites state |
useIIModelFavorites.ts |
New custom hook implementing favorites API calls and state management |
useIIModelFavorites.test.ts |
Unit tests for the favorites hook |
IModelTile.tsx |
Adds star icon button for toggling favorites and recents tracking on click |
useIModelTableConfig.tsx |
Adds favorites column to table view with star toggle button |
useIModelSort.ts |
Adds skipSort parameter to preserve API-provided ordering for recents |
useIModelData.ts |
Adds requestType parameter to support favorites/recents API endpoints |
IModelGrid.tsx |
Wraps grid in favorites provider and adds recents tracking on thumbnail click |
ITwinTile.tsx |
Adds conditional rendering for favorites button |
ITwinGrid.tsx |
Updates empty state messages for recents/favorites views |
ITwinTile.stories.tsx |
Adds missing displayName property to story |
IModelTile.stories.tsx |
Enhances story with additional props and examples |
omar-imodel-recent_2025-10-16-20-04.json |
Change log entry for the feature |
Files not reviewed (1)
- common/config/rush/pnpm-lock.yaml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…ModelTableConfig.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…IModelFavorites.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
simihartstein
left a comment
There was a problem hiding this comment.
Looks good. Most of these are small or repeated comments.
BIC and developer.bentley.com should also integrate these apis. or ideally the iTwin and iModel browser components in this package. I'm not sure who best to ask or if Omar reached out already... @michelledillard has been helpful with the developer website in the past. Scott Devoe mentioned @bill-mcnamara could point us in the right direction for BIC. |
…IModelFavorites.ts Co-authored-by: Simi Hartstein <6485888+simihartstein@users.noreply.github.com>
…ility function and updating IModelGrid and IModelTile components to use it
… iModel and ITwin components
…ndling of recents
…rides for conditional rendering
…Grid and useIModelFavorites
…useIModelFavorites
simihartstein
left a comment
There was a problem hiding this comment.
Thanks for making all the changes! Looks great!
…havior and remove unused favorites hook
Use the new recent and favorites APIs to manage iModels.