-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wallet-dashboard): show kiosk NFTs (#4610)
* refactor(wallet): move notification to separate component. * feat(wallet): enhance hidden asset functionality with undo option and notifications * feat(wallet): add undo functionality for showing hidden assets with notifications * feat(core): move HiddenAssetsProvider. * feat(core): move useGetNFTs. * feat(core): update useGetNFTs to accept filter and improve asset fetching * refactor(dashboard): remove 'Hidden' asset category and related logic * refactor(wallet-dashboard): remove 'Hidden' asset category from layout * refactor(dashboard): remove HiddenAssets context, update default select asset logic. * feat(core): add refetch capability to useGetNFTs hook * refactor(core): improve hide/show logic * refactor(core): remove undo functionality and streamline asset visibility management * refactor(core): simplify asset visibility management and improve error handling * refactor(wallet): rename MoveAssetNotification to MovedAssetNotification * refactor(dashboard): adapt logic to useGetNFTs hook. * feat(wallet-dashboard): add KioskTile component and integrate with AssetTileLink * feat(dashboard): move KioskTile component to core and update references * feat(dashboard): add KioskDetailsView and integrate with asset dialog flow * feat(core, wallet): move NftImage component to core and update references in KioskDetailsView * feat(dashboard): enhance AssetDialog and KioskDetailsView with selected asset handling * fix(wallet-dashboard): improve asset loading logic and conditional rendering * feat(wallet-dashboard): move logic for page to the hook * refactor(dashboard): add back button for kiosk item details, fix send kiosk item. * refactor(core): cleanup * feat(wallet-dashboard): enhance KioskDetailsView layout and add item count badge
- Loading branch information
1 parent
f1c1906
commit 4e8d968
Showing
14 changed files
with
223 additions
and
71 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
export * from './KioskTile'; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
export * from './NftImage'; |
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
85 changes: 85 additions & 0 deletions
85
apps/wallet-dashboard/components/dialogs/assets/views/KioskDetailsView.tsx
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,85 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { | ||
useGetKioskContents, | ||
getKioskIdFromOwnerCap, | ||
useNftDetails, | ||
NftImage, | ||
ExplorerLinkType, | ||
ViewTxnOnExplorerButton, | ||
} from '@iota/core'; | ||
import { Badge, BadgeType, Header, LoadingIndicator } from '@iota/apps-ui-kit'; | ||
import { DialogLayoutBody, DialogLayoutFooter } from '../../layout'; | ||
import { IotaObjectData } from '@iota/iota-sdk/client'; | ||
import { useCurrentAccount } from '@iota/dapp-kit'; | ||
import { ExplorerLink } from '@/components/ExplorerLink'; | ||
|
||
interface DetailsViewProps { | ||
asset: IotaObjectData; | ||
onClose: () => void; | ||
onItemClick: (asset: IotaObjectData) => void; | ||
} | ||
|
||
export function KioskDetailsView({ onClose, asset, onItemClick }: DetailsViewProps) { | ||
const account = useCurrentAccount(); | ||
const senderAddress = account?.address ?? ''; | ||
const objectId = getKioskIdFromOwnerCap(asset); | ||
const { data: kioskData, isPending } = useGetKioskContents(account?.address); | ||
const kiosk = kioskData?.kiosks.get(objectId); | ||
const items = kiosk?.items; | ||
|
||
if (isPending) { | ||
return ( | ||
<div className="flex h-full items-center justify-center"> | ||
<LoadingIndicator /> | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<> | ||
<Header title="Kiosk" onClose={onClose} titleCentered /> | ||
<DialogLayoutBody> | ||
<div className="flex flex-col gap-md"> | ||
<div className="flex flex-row gap-x-sm"> | ||
<span className="text-title-lg text-neutral-10 dark:text-neutral-92"> | ||
Kiosk items | ||
</span> | ||
<Badge type={BadgeType.Neutral} label={items?.length.toString() ?? '0'} /> | ||
</div> | ||
<div className="grid grid-cols-3 items-center justify-center gap-sm"> | ||
{items?.map((item) => { | ||
return item.data?.objectId ? ( | ||
<div | ||
onClick={() => { | ||
item.data && onItemClick(item.data); | ||
}} | ||
key={item.data?.objectId} | ||
> | ||
<KioskItem object={item.data} address={senderAddress} /> | ||
</div> | ||
) : null; | ||
})} | ||
</div> | ||
</div> | ||
</DialogLayoutBody> | ||
<DialogLayoutFooter> | ||
<ExplorerLink objectID={objectId} type={ExplorerLinkType.Object}> | ||
<ViewTxnOnExplorerButton digest={objectId} /> | ||
</ExplorerLink> | ||
</DialogLayoutFooter> | ||
</> | ||
); | ||
} | ||
|
||
interface KioskItemProps { | ||
object: IotaObjectData; | ||
address: string; | ||
} | ||
|
||
function KioskItem({ object, address }: KioskItemProps) { | ||
const { nftName, nftImageUrl } = useNftDetails(object.objectId, address); | ||
|
||
return <NftImage title={nftName} src={nftImageUrl} isHoverable />; | ||
} |
33 changes: 7 additions & 26 deletions
33
apps/wallet-dashboard/components/dialogs/assets/views/SendView.tsx
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
Oops, something went wrong.