-
Notifications
You must be signed in to change notification settings - Fork 15
Add iModel recents and favorites functionality #183
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
Merged
Merged
Changes from 25 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
ee6e4a3
feat: update @itwin/itwinui-react to version 3.19.4 in storybook and …
arome 5beb83c
refactor: remove unused refetch logic from useIModelFavorites and con…
arome 05ad731
fix: ensure iTwinId is validated before fetching iModel favorites
arome 9f9781f
Fix storybook not applying correct theme on first render
arome f7356d9
fix: rename internalOnClick to handleClickAndAddToRecents for clarity…
arome fd3fd6e
revert changes to storybook and create a separate PR for it
arome 85b5bd4
fix: update no iTwin/iModel messages for clarity based on request type
arome d7bfc4e
fix: allow iTwinId to be optional in IModelFavoritesProvider and useI…
arome 392eaae
feat: add iModel recents and favorites functionality
arome b014a55
fix: improve clarity of no iTwin messages for recents and favorites
arome f55d135
Merge branch 'main' into omar/imodel-recent
arome f5155c0
Update packages/modules/imodel-browser/src/containers/iModelGrid/useI…
arome c8155b7
Update packages/modules/imodel-browser/src/containers/iModelGrid/useI…
arome 0789c86
Update packages/modules/imodel-browser/src/containers/iModelGrid/useI…
arome 0d8577e
Add comment for requestType
arome 3ee47aa
Refactor iModel recents handling by introducing addIModelToRecents ut…
arome 30a8925
fix naming of file useIModelFavorites
arome dc5ac40
Refactor access token handling to use AccessTokenProvider type across…
arome 49e2053
Update sorting logic in useIModelData and useIModelSort to improve ha…
arome 05e862c
Refactor IModelTile to rename onClick prop to tilePropsOnClick for cl…
arome b50de10
Fix dependency array in useIModelSort to include enableSort for prope…
arome 22bec73
remove unnecessary if condition in handleClick
arome 83daffd
Add hover state and styling for favorite icon in IModelTile and ITwin…
arome c874b2b
Add handling for thumbnail click to invoke tilePropsOnClick or onThum…
arome 057de9f
Implement client-side filtering for recents and favorites based on se…
arome ef38ce1
Refactor iModel favorites management: streamline API calls and enhanc…
arome 751593d
Replace SvgStar with SvgApple in IModelGrid story and adjust cellOver…
arome 735e8c6
Add disableAddToRecents prop to IModelGrid and update IModelTile clic…
arome 28ce0e5
Remove unused import of addIModelToRecents from IModelTile
arome 4d68802
Rename iModelApi to iModelApi-rename-fix and update imports in IModel…
arome 5dc9eec
Refactor iModelApi: rename file and update imports in IModelGrid and …
arome 3754455
Add hideFavoriteIcon prop to ITwinTile and IModelTile components
arome db2e174
Merge branch 'main' into omar/imodel-recent
arome 5e83f1e
Add "remove iModel from recents" functionality when in recents mode
arome 8765c0a
Merge branch 'main' into omar/imodel-recent
arome 859429a
Use css for hover behavior instead of javascript
arome 72946fd
Refactor: Update onThumbnailClick documentation to clarify recents be…
arome File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
common/changes/@itwin/imodel-browser-react/omar-imodel-recent_2025-10-16-20-04.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "packageName": "@itwin/imodel-browser-react", | ||
| "comment": "Feat: Add iModel recents and favorites functionality", | ||
| "type": "minor" | ||
| } | ||
| ], | ||
| "packageName": "@itwin/imodel-browser-react" | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,5 +20,6 @@ export const Primary = Template.bind({}); | |
| Primary.args = { | ||
| iTwin: { | ||
| id: "1", | ||
| displayName: "iTwin Name", | ||
| }, | ||
| }; | ||
16 changes: 16 additions & 0 deletions
16
packages/modules/imodel-browser/src/components/tileFavoriteIcon/TileFavoriteIcon.module.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Bentley Systems, Incorporated. All rights reserved. | ||
| * See LICENSE.md in the project root for license terms and full copyright notice. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
| .favoriteIconButton { | ||
| padding-inline: var(--iui-button-padding-block); | ||
| background-color: rgb(from var(--iui-color-background-hover) r g b / 0.7); | ||
|
|
||
| &:hover { | ||
| background-color: var(--iui-color-background-hover); | ||
| } | ||
|
|
||
| &:active { | ||
| background-color: var(--iui-color-background); | ||
| } | ||
| } |
55 changes: 55 additions & 0 deletions
55
packages/modules/imodel-browser/src/components/tileFavoriteIcon/TileFavoriteIcon.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Bentley Systems, Incorporated. All rights reserved. | ||
| * See LICENSE.md in the project root for license terms and full copyright notice. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
| import { SvgStar, SvgStarHollow } from "@itwin/itwinui-icons-react"; | ||
| import { IconButton } from "@itwin/itwinui-react"; | ||
| import React from "react"; | ||
|
|
||
| import styles from "./TileFavoriteIcon.module.scss"; | ||
|
|
||
| export interface TileFavoriteIconProps { | ||
| /** Whether the item is currently favorited */ | ||
| isFavorite: boolean; | ||
| /** Callback to add the item to favorites */ | ||
| onAddToFavorites: () => Promise<void>; | ||
| /** Callback to remove the item from favorites */ | ||
| onRemoveFromFavorites: () => Promise<void>; | ||
| /** Accessible label for adding to favorites */ | ||
| addLabel: string; | ||
| /** Accessible label for removing from favorites */ | ||
| removeLabel: string; | ||
| /** Whether to hide the icon (will not hide if the item is favorited) */ | ||
| hide?: boolean; | ||
| } | ||
|
|
||
| /** | ||
| * Reusable favorite icon button for Tile components | ||
| * Shows a star icon that can be clicked to add/remove from favorites | ||
| */ | ||
| export const TileFavoriteIcon = ({ | ||
| isFavorite, | ||
| onAddToFavorites, | ||
| onRemoveFromFavorites, | ||
| addLabel, | ||
| removeLabel, | ||
| hide, | ||
| }: TileFavoriteIconProps) => { | ||
| // Don't render if hide is true and not favorited | ||
| if (hide && !isFavorite) { | ||
| return null; | ||
| } | ||
|
|
||
| return ( | ||
| <IconButton | ||
| aria-label={isFavorite ? removeLabel : addLabel} | ||
| onClick={async () => { | ||
| isFavorite ? await onRemoveFromFavorites() : await onAddToFavorites(); | ||
| }} | ||
| className={styles.favoriteIconButton} | ||
| styleType="borderless" | ||
| > | ||
| {isFavorite ? <SvgStar /> : <SvgStarHollow />} | ||
| </IconButton> | ||
| ); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.