-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
21 changed files
with
319 additions
and
36 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
79 changes: 79 additions & 0 deletions
79
packages/browser-wallet/src/popup/popupX/pages/ManageTokens/SearchTokenDetails.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,79 @@ | ||
import React from 'react'; | ||
import { useLocation, useParams } from 'react-router-dom'; | ||
import { useTranslation } from 'react-i18next'; | ||
import Page from '@popup/popupX/shared/Page'; | ||
import Card from '@popup/popupX/shared/Card'; | ||
import Img from '@popup/shared/Img'; | ||
import Text from '@popup/popupX/shared/Text'; | ||
import Button from '@popup/popupX/shared/Button'; | ||
import { TokenWithPageID } from '@popup/pages/Account/Tokens/ManageTokens/utils'; | ||
import FullscreenNotice from '@popup/popupX/shared/FullscreenNotice'; | ||
import { useCopyToClipboard } from '@popup/popupX/shared/utils/hooks'; | ||
import Copy from '@assets/svgX/copy.svg'; | ||
import Notebook from '@assets/svgX/notebook.svg'; | ||
|
||
const SUB_INDEX = 0; | ||
|
||
interface Location { | ||
state: { | ||
token: TokenWithPageID; | ||
}; | ||
} | ||
|
||
export default function SearchTokenDetails() { | ||
const { t } = useTranslation('x', { keyPrefix: 'tokenDetails' }); | ||
const [isOpen, setIsOpen] = React.useState(false); | ||
const copyToClipboard = useCopyToClipboard(); | ||
const params = useParams(); | ||
const location = useLocation() as Location; | ||
const { metadata = {}, id } = location.state.token || { metadata: {} }; | ||
const { thumbnail, display, symbol, name, description, decimals } = metadata; | ||
|
||
return ( | ||
<> | ||
<FullscreenNotice open={isOpen} onClose={() => setIsOpen(false)}> | ||
<Page> | ||
<Page.Top heading={t('rawMetadata')}> | ||
<Button.Icon | ||
icon={<Copy />} | ||
onClick={() => copyToClipboard(JSON.stringify(metadata, null, 2))} | ||
/> | ||
</Page.Top> | ||
<Page.Main> | ||
<Card> | ||
{Object.entries(metadata).map(([k, v]) => ( | ||
<Card.RowDetails key={k} title={k} value={JSON.stringify(v)} /> | ||
))} | ||
</Card> | ||
</Page.Main> | ||
</Page> | ||
</FullscreenNotice> | ||
<Page className="token-details-x"> | ||
<Page.Main> | ||
<Card> | ||
<div className="token-details-x__token"> | ||
<Img | ||
className="token-icon" | ||
src={thumbnail?.url || display?.url || ''} | ||
alt={symbol} | ||
withDefaults | ||
/> | ||
<Text.Main>{name}</Text.Main> | ||
</div> | ||
<Card.RowDetails title={t('description')} value={description} /> | ||
{decimals && <Card.RowDetails title={t('decimals')} value={`0 - ${decimals}`} />} | ||
{id && <Card.RowDetails title={t('tokenId')} value={id} />} | ||
<Card.RowDetails title={t('indexSubindex')} value={`${params.contractIndex}, ${SUB_INDEX}`} /> | ||
</Card> | ||
<Button.IconText | ||
icon={<Notebook />} | ||
label={t('showRawMetadata')} | ||
onClick={() => { | ||
setIsOpen(true); | ||
}} | ||
/> | ||
</Page.Main> | ||
</Page> | ||
</> | ||
); | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/browser-wallet/src/popup/popupX/pages/ManageTokens/i18n/en.ts
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
1 change: 1 addition & 0 deletions
1
packages/browser-wallet/src/popup/popupX/pages/ManageTokens/index.ts
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { default as ManageTokenList } from './ManageTokenList'; | ||
export { default as AddToken } from './AddToken'; | ||
export { default as SearchTokenDetails } from './SearchTokenDetails'; |
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.