-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat(wallet): rebrand hidden assets #2012
Merged
Merged
Changes from 6 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
85a5002
feat: kickoff assets page
evavirseda cde3525
Merge branch 'develop' into tooling-wallet/rebrand-assets-page-kickoff
evavirseda 3acd49d
Merge branch 'develop' into tooling-wallet/rebrand-assets-page-kickoff
evavirseda f65e5cc
Merge branch 'develop' into tooling-wallet/rebrand-assets-page-kickoff
evavirseda ea06f46
feat: refine hidden assets
evavirseda aa2eead
feat: fix loop
evavirseda f9b5dca
feat: determine default category based on available assets
evavirseda 675e0df
Merge branch 'develop' into tooling-wallet/rebrand-assets-page-kickoff
evavirseda 27d6de3
Merge branch 'tooling-wallet/rebrand-assets-page-kickoff' into toolin…
evavirseda eac77e4
feat: improvements
evavirseda 3049e0e
Merge branch 'develop' into tooling-wallet/rebrand-assets-page-kickoff
evavirseda e3f92da
feat: update to filled segmented button
evavirseda d377fea
Merge branch 'tooling-wallet/rebrand-assets-page-kickoff' into toolin…
evavirseda 5e3968a
Merge branch 'develop' into tooling-wallet/rebrand-hidden-assets
evavirseda 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
This file contains 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 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 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 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
138 changes: 0 additions & 138 deletions
138
apps/wallet/src/ui/app/pages/home/hidden-assets/index.tsx
This file was deleted.
Oops, something went wrong.
This file contains 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
43 changes: 0 additions & 43 deletions
43
apps/wallet/src/ui/app/pages/home/nfts/AssetsOptionsMenu.tsx
This file was deleted.
Oops, something went wrong.
This file contains 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,100 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// Modifications Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { ErrorBoundary } from '_components'; | ||
import { ampli } from '_src/shared/analytics/ampli'; | ||
import { type IotaObjectData } from '@iota/iota-sdk/client'; | ||
import { useNavigate } from 'react-router-dom'; | ||
import { useHiddenAssets } from '../assets/HiddenAssetsProvider'; | ||
import { | ||
getKioskIdFromOwnerCap, | ||
isKioskOwnerToken, | ||
useGetNFTMeta, | ||
useGetObject, | ||
useKioskClient, | ||
} from '@iota/core'; | ||
import { | ||
Card, | ||
CardAction, | ||
CardActionType, | ||
CardBody, | ||
CardImage, | ||
CardType, | ||
ImageShape, | ||
ImageType, | ||
} from '@iota/apps-ui-kit'; | ||
import { formatAddress } from '@iota/iota-sdk/utils'; | ||
import { useResolveVideo } from '_src/ui/app/hooks/useResolveVideo'; | ||
import { VisibilityOff } from '@iota/ui-icons'; | ||
|
||
export interface HiddenAssetProps { | ||
data: IotaObjectData | null | undefined; | ||
display: | ||
| { | ||
[key: string]: string; | ||
} | ||
| null | ||
| undefined; | ||
} | ||
|
||
export default function HiddenAsset(item: HiddenAssetProps) { | ||
const { showAsset } = useHiddenAssets(); | ||
const kioskClient = useKioskClient(); | ||
const navigate = useNavigate(); | ||
const { objectId, type } = item.data!; | ||
const { data: objectData } = useGetObject(objectId); | ||
const { data: nftMeta } = useGetNFTMeta(objectId); | ||
|
||
const nftName = nftMeta?.name || formatAddress(objectId); | ||
const nftImageUrl = nftMeta?.imageUrl || ''; | ||
const video = useResolveVideo(objectData); | ||
return ( | ||
<ErrorBoundary> | ||
<Card | ||
type={CardType.Default} | ||
onClick={() => { | ||
navigate( | ||
isKioskOwnerToken(kioskClient.network, item.data) | ||
? `/kiosk?${new URLSearchParams({ | ||
kioskId: getKioskIdFromOwnerCap(item.data!), | ||
})}` | ||
: `/nft-details?${new URLSearchParams({ | ||
objectId, | ||
}).toString()}`, | ||
); | ||
ampli.clickedCollectibleCard({ | ||
objectId, | ||
collectibleType: type!, | ||
}); | ||
}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, move it to separate function |
||
> | ||
<CardImage type={ImageType.BgTransparent} shape={ImageShape.SquareRounded}> | ||
{video ? ( | ||
<video | ||
className="h-full w-full object-cover" | ||
src={video} | ||
controls | ||
autoPlay | ||
muted | ||
/> | ||
) : ( | ||
<img | ||
src={nftImageUrl} | ||
alt={nftName} | ||
className="h-full w-full object-cover" | ||
/> | ||
)} | ||
</CardImage> | ||
<CardBody title={nftMeta?.name ?? 'Asset'} subtitle={formatAddress(objectId)} /> | ||
<CardAction | ||
type={CardActionType.Link} | ||
onClick={() => { | ||
showAsset(objectId); | ||
}} | ||
icon={<VisibilityOff />} | ||
/> | ||
</Card> | ||
</ErrorBoundary> | ||
); | ||
} |
This file contains 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,17 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// Modifications Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import HiddenAsset, { type HiddenAssetProps } from './HiddenAsset'; | ||
|
||
interface HiddenAssetsProps { | ||
items: HiddenAssetProps[]; | ||
} | ||
|
||
export default function HiddenAssets({ items }: HiddenAssetsProps) { | ||
return ( | ||
<div className="flex w-full flex-col overflow-y-auto"> | ||
{items?.map((object) => <HiddenAsset key={object.data!.objectId} {...object} />)} | ||
</div> | ||
); | ||
} |
Oops, something went wrong.
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.
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 know that in another file we are using an arrow function, but I’ve noticed that in many other places we use function declarations. It might be better to use the same approach for consistency.
I think
CardAction
we can remove from name, as it's inside CardAction component by default. I'd suggest to usehandleActionClick