Skip to content
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

Fix owner link formatting in NFT gallery #1109

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .changelog/1109.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix owner link formatting in NFT gallery
21 changes: 21 additions & 0 deletions src/app/pages/TokenDashboardPage/NFTLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { styled } from '@mui/material/styles'
import { RouteUtils } from '../../utils/route-utils'
import { SearchScope } from '../../../types/searchScope'
import { trimLongString } from '../../utils/trimLongString'
import { AccountLink } from '../../components/Account/AccountLink'

type NFTLinkProps = {
scope: SearchScope
Expand Down Expand Up @@ -61,3 +62,23 @@ export const NFTInstanceLink: FC<NFTLinkProps> = ({ scope, instance }) => {
</StyledTypography>
)
}

type NFTOwnerLinkProps = {
scope: SearchScope
owner: string
}
export const NFTOwnerLink: FC<NFTOwnerLinkProps> = ({ scope, owner }) => {
const { t } = useTranslation()

return (
<StyledTypography>
<Trans
i18nKey="nft.ownerLink"
t={t}
components={{
OwnerLink: <AccountLink scope={scope} address={owner} alwaysTrim={true} />,
}}
/>
</StyledTypography>
)
}
7 changes: 2 additions & 5 deletions src/app/pages/TokenDashboardPage/TokenInventoryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ import { ErrorBoundary } from '../../components/ErrorBoundary'
import { LinkableDiv } from '../../components/PageLayout/LinkableDiv'
import { CardEmptyState } from '../AccountDetailsPage/CardEmptyState'
import { TokenDashboardContext } from './index'
import { AccountLink } from '../../components/Account/AccountLink'
import { RouteUtils } from '../../utils/route-utils'
import { TablePagination } from '../../components/Table/TablePagination'
import { useTokenInventory } from './hook'
import { ImageListItemImage } from './ImageListItemImage'
import { NFTInstanceLink } from './NFTLinks'
import { NFTInstanceLink, NFTOwnerLink } from './NFTLinks'
import { CardHeaderWithCounter } from 'app/components/CardHeaderWithCounter'
import { EvmNft } from 'oasis-nexus/api'
import { To } from 'react-router-dom'
Expand Down Expand Up @@ -94,9 +93,7 @@ const TokenInventoryView: FC<TokenInventoryViewProps> = ({
<ImageListItemImage instance={instance} to={to} />
<ImageListItemBar
title={<NFTInstanceLink scope={scope} instance={instance} />}
subtitle={
owner ? <AccountLink scope={scope} address={owner} alwaysTrim={true} /> : undefined
}
subtitle={owner ? <NFTOwnerLink scope={scope} owner={owner} /> : undefined}
position="below"
/>
</ImageListItem>
Expand Down
1 change: 1 addition & 0 deletions src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
"noPreview": "No preview available",
"openInFullscreen": "Open in fullscreen",
"owner": "Owner",
"ownerLink": "Owner: <OwnerLink />",
"switchBackgroundColor": "Switch between dark and light background",
"transfers": "Transfers"
},
Expand Down
Loading