forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
explorer: support for nft standard (MystenLabs#9700)
## Description * shows all nfts in address page even if display does not exist to allow listing all owned objects for an address * removes existing handling of displaying nfts meta - only objects with display will show images and other display related fields https://user-images.githubusercontent.com/10210143/226921696-7188c326-4ad6-4fb5-9220-cac4c3bc6ac6.mov ## Test Plan manually - mint an nft that has display nft standard and check it's display in object and address details view closes APPS-654
- Loading branch information
1 parent
91c6fd0
commit f249d2f
Showing
8 changed files
with
177 additions
and
108 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
41 changes: 41 additions & 0 deletions
41
apps/explorer/src/pages/object-result/LinkOrTextDescriptionItem.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,41 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { type ReactNode } from 'react'; | ||
|
||
import { DescriptionItem } from '~/ui/DescriptionList'; | ||
import { Link } from '~/ui/Link'; | ||
import { Text } from '~/ui/Text'; | ||
import { getDisplayUrl } from '~/utils/objectUtils'; | ||
|
||
export type LinkOrTextDescriptionItemProps = { | ||
title: ReactNode; | ||
value: ReactNode; | ||
parseUrl?: boolean; | ||
}; | ||
|
||
export function LinkOrTextDescriptionItem({ | ||
title, | ||
value, | ||
parseUrl = false, | ||
}: LinkOrTextDescriptionItemProps) { | ||
let urlData = null; | ||
if (parseUrl && typeof value === 'string') { | ||
urlData = getDisplayUrl(value); | ||
} | ||
return value ? ( | ||
<DescriptionItem title={title}> | ||
{urlData && typeof urlData === 'object' ? ( | ||
<Link href={urlData.href} variant="textHeroDark"> | ||
{urlData.display} | ||
</Link> | ||
) : typeof value === 'string' ? ( | ||
<Text variant="p1/medium" color="steel-darker"> | ||
{value} | ||
</Text> | ||
) : ( | ||
value | ||
)} | ||
</DescriptionItem> | ||
) : null; | ||
} |
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
Oops, something went wrong.