-
Notifications
You must be signed in to change notification settings - Fork 9
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
Display type in tokens table #685
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f45ff6b
Display type in tokens table
csillag 6936bff
Consistently use the same token type names
csillag 91cf1ca
Don't repeat "token" on token type card
csillag e63e943
Add new colors designed for token type tags
csillag 3985b5b
Implement token type tabs
csillag 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Display type in tokens table |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { EvmTokenType } from '../oasis-nexus/api' | ||
import { TFunction } from 'i18next' | ||
import { exhaustedTypeWarning } from './errors' | ||
import { COLORS } from '../styles/theme/colors' | ||
|
||
export const getTokenTypeDescription = (t: TFunction, tokenType: EvmTokenType): string => { | ||
switch (tokenType) { | ||
case 'ERC20': | ||
return t('common.token') | ||
case 'ERC721': | ||
return t('common.nft') | ||
default: | ||
exhaustedTypeWarning('Unknown token type', tokenType) | ||
return '???' | ||
} | ||
} | ||
|
||
export const tokenBackgroundColor: Record<EvmTokenType, string> = { | ||
ERC20: COLORS.brandMedium15, | ||
ERC721: COLORS.pink15, | ||
} | ||
|
||
export const tokenBorderColor: Record<EvmTokenType, string> = { | ||
ERC20: COLORS.brandMedium, | ||
ERC721: COLORS.pink, | ||
} | ||
|
||
export const getTokenTypePluralDescription = (t: TFunction, tokenType: EvmTokenType): string => { | ||
switch (tokenType) { | ||
case 'ERC20': | ||
return t('common.tokens') | ||
case 'ERC721': | ||
return t('common.nfts') | ||
default: | ||
exhaustedTypeWarning('Unknown token type', tokenType) | ||
return '???' | ||
} | ||
} | ||
|
||
export const getTokenTypeStrictName = (t: TFunction, tokenType: EvmTokenType): string => { | ||
switch (tokenType) { | ||
case 'ERC20': | ||
return t('account.ERC20') | ||
case 'ERC721': | ||
return t('account.ERC721') | ||
default: | ||
exhaustedTypeWarning('Unknown token type', tokenType) | ||
return tokenType | ||
} | ||
} | ||
|
||
export const getTokenTypeName = (t: TFunction, tokenType: EvmTokenType): string => | ||
t('tokens.typeDescription', { | ||
spec: getTokenTypeStrictName(t, tokenType), | ||
description: getTokenTypeDescription(t, tokenType), | ||
}) | ||
|
||
export const getTokenTypePluralName = (t: TFunction, tokenType: EvmTokenType): string => | ||
t('tokens.typeDescription', { | ||
spec: getTokenTypeStrictName(t, tokenType), | ||
description: getTokenTypePluralDescription(t, tokenType), | ||
}) |
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.
This is similar to
TokenPills
that wraps around mui'sChip
.We should choose more consistent names for "the background rounded label thing"
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.
How about
DogTag
?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 mean for a common ancestor, with common sizing and fond settings, and then create or descendants from that, with consistent names, either Tag or Pill)