Skip to content

Commit

Permalink
Display the token name and symbol (fixes #273)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpierre committed Oct 12, 2018
1 parent 0f98e3c commit 2599446
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 6 deletions.
14 changes: 10 additions & 4 deletions apps/token-manager/app/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
Button,
Badge,
SidePanel,
font,
observe,
} from '@aragon/ui'
import EmptyState from './screens/EmptyState'
Expand Down Expand Up @@ -64,6 +65,7 @@ class App extends React.Component {
render() {
const {
tokenSymbol,
tokenName,
tokenSupply,
tokenDecimalsBase,
tokenTransfersEnabled,
Expand All @@ -82,7 +84,7 @@ class App extends React.Component {
<AppBar
title={
<Title>
<span>Token</span>
<TitleLabel>Token</TitleLabel>
{tokenSymbol && <Badge.App>{tokenSymbol}</Badge.App>}
</Title>
}
Expand All @@ -103,7 +105,9 @@ class App extends React.Component {
holders={holders}
onAssignTokens={this.handleLaunchAssignTokens}
tokenDecimalsBase={tokenDecimalsBase}
tokenName={tokenName}
tokenSupply={tokenSupply}
tokenSymbol={tokenSymbol}
tokenTransfersEnabled={tokenTransfersEnabled}
userAccount={userAccount}
/>
Expand Down Expand Up @@ -133,9 +137,11 @@ class App extends React.Component {
const Title = styled.span`
display: flex;
align-items: center;
& > span:first-child {
margin-right: 10px;
}
`

const TitleLabel = styled.span`
margin-right: 10px;
${font({ size: 'xxlarge' })};
`

export default observe(
Expand Down
14 changes: 13 additions & 1 deletion apps/token-manager/app/src/components/SideBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react'
import styled from 'styled-components'
import { Text, theme } from '@aragon/ui'
import { formatBalance, stakesPercentages } from '../utils'
import TokenBadge from './TokenBadge'

const DISTRIBUTION_ITEMS_MAX = 7
const DISTRIBUTION_COLORS = [
Expand Down Expand Up @@ -38,7 +39,13 @@ class SideBar extends React.Component {
return tokenTransfersEnabled ? 'Yes' : 'No'
}
render() {
const { holders, tokenDecimalsBase, tokenSupply } = this.props
const {
holders,
tokenDecimalsBase,
tokenName,
tokenSupply,
tokenSymbol,
} = this.props
const stakes = displayedStakes(holders, tokenSupply)
return (
<Main>
Expand All @@ -59,6 +66,11 @@ class SideBar extends React.Component {
<span>:</span>
<strong>{this.transferableLabel()}</strong>
</InfoRow>
<InfoRow>
<span>Token</span>
<span>:</span>
<TokenBadge name={tokenName} symbol={tokenSymbol} />
</InfoRow>
</ul>
</Part>
<Part>
Expand Down
40 changes: 40 additions & 0 deletions apps/token-manager/app/src/components/TokenBadge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React from 'react'
import styled from 'styled-components'

class TokenBadge extends React.PureComponent {
render() {
const { name, symbol } = this.props
return (
<Main>
<Label>
<Icon src={`https://chasing-coins.com/coin/logo/${symbol}`} />
{name === symbol ? name : `${name} (${symbol})`}
</Label>
</Main>
)
}
}

const Main = styled.div`
overflow: hidden;
display: flex;
align-items: center;
height: 24px;
background: #daeaef;
border-radius: 3px;
cursor: default;
`

const Label = styled.span`
display: flex;
align-items: center;
padding: 0 8px;
white-space: nowrap;
font-size: 15px;
`

const Icon = styled.img.attrs({ alt: '', width: '16', height: '16' })`
margin-right: 10px;
`

export default TokenBadge
4 changes: 4 additions & 0 deletions apps/token-manager/app/src/screens/Holders.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ class Holders extends React.Component {
holders,
onAssignTokens,
tokenDecimalsBase,
tokenName,
tokenSupply,
tokenSymbol,
tokenTransfersEnabled,
userAccount,
} = this.props
Expand Down Expand Up @@ -55,7 +57,9 @@ class Holders extends React.Component {
groupMode={groupMode}
holders={holders}
tokenDecimalsBase={tokenDecimalsBase}
tokenName={tokenName}
tokenSupply={tokenSupply}
tokenSymbol={tokenSymbol}
tokenTransfersEnabled={tokenTransfersEnabled}
/>
</TwoPanels>
Expand Down
3 changes: 2 additions & 1 deletion apps/token-manager/app/src/token-settings.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const tokenSettings = [
['decimals', 'tokenDecimals', 'number'],
['symbol', 'tokenSymbol'],
['symbol', 'tokenSymbol', 'string'],
['name', 'tokenName', 'string'],
['totalSupply', 'tokenSupply', 'number'],
['transfersEnabled', 'tokenTransfersEnabled', 'bool'],
]
Expand Down

0 comments on commit 2599446

Please sign in to comment.