Skip to content

Commit

Permalink
feature: remove all vote mentions on producers page for worbli
Browse files Browse the repository at this point in the history
  • Loading branch information
dafuga authored and aaroncox committed Feb 24, 2019
1 parent 0533fbb commit 37b4297
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 39 deletions.
11 changes: 5 additions & 6 deletions app/shared/components/Producers/BlockProducers/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class ProducersTable extends Component<Props> {
}
}
}
const producersVotedIn = connection.chainId !== '73647cde120091e0a4b85bced2f3cfdb3041e266cbbe95cee59b73235a1b3b6f';
return (
<Segment basic loading={loading} vertical>
<ProducersModalInfo
Expand All @@ -151,7 +152,7 @@ class ProducersTable extends Component<Props> {
/>
<Grid>
<Grid.Column width={8}>
{(activatedStakePercent < 15)
{(activatedStakePercent < 15 && producersVotedIn)
? (
<Header size="small">
{activatedStake.toLocaleString()} {t('block_producer_chain_symbol_staked', { connection: connection.chainSymbol })} ({activatedStakePercent}%)
Expand All @@ -163,8 +164,7 @@ class ProducersTable extends Component<Props> {
{t('block_producer_total_weight')}
</Header.Subheader>
</Header>
)
: (
) : (producersVotedIn) ? (
<Header size="small">
{t('producers_block_producers')}
<Header.Subheader>
Expand All @@ -175,8 +175,7 @@ class ProducersTable extends Component<Props> {
{t('block_producer_total_weight')}
</Header.Subheader>
</Header>
)
}
) : ''}
</Grid.Column>
<Grid.Column width={8} key="ProducersVotingPreview" textAlign="right">
<Input
Expand All @@ -201,7 +200,7 @@ class ProducersTable extends Component<Props> {
{t('block_producer')}
</Table.HeaderCell>
<Table.HeaderCell width={5}>
{t('block_producer_total_votes')}
{producersVotedIn ? t('block_producer_total_votes') : ''}
</Table.HeaderCell>
<Table.HeaderCell collapsing />
</Table.Row>
Expand Down
71 changes: 38 additions & 33 deletions app/shared/components/Producers/BlockProducers/Table/Row.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class ProducersTableRow extends Component<Props> {
)
: 'None';
const shouldDisplayInfoButton = connection.supportedContracts && connection.supportedContracts.includes('producerinfo');
const producersVotedIn = connection.chainId !== '73647cde120091e0a4b85bced2f3cfdb3041e266cbbe95cee59b73235a1b3b6f';

return (
<Table.Row positive={isActive} key={producer.key}>
<Table.Cell
Expand Down Expand Up @@ -78,26 +80,27 @@ class ProducersTableRow extends Component<Props> {
}
</span>
)}

<Popup
content={t('producer_vote_description', { chainSymbol: connection.chainSymbol })}
header={t('producer_vote_header', { producer: producer.owner })}
hoverable
position="right center"
trigger={(
<Button
color={isSelected ? 'blue' : 'grey'}
disabled={!isValidUser || isProxying}
icon={isSelected ? 'checkmark box' : 'minus square outline'}
onClick={
(isSelected)
? () => removeProducer(producer.owner)
: () => addProducer(producer.owner)
}
size="small"
/>
{(producersVotedIn) && (
<Popup
content={t('producer_vote_description', { chainSymbol: connection.chainSymbol })}
header={t('producer_vote_header', { producer: producer.owner })}
hoverable
position="right center"
trigger={(
<Button
color={isSelected ? 'blue' : 'grey'}
disabled={!isValidUser || isProxying}
icon={isSelected ? 'checkmark box' : 'minus square outline'}
onClick={
(isSelected)
? () => removeProducer(producer.owner)
: () => addProducer(producer.owner)
}
size="small"
/>
)}
/>
)}
/>
</Table.Cell>
<Table.Cell
singleLine
Expand All @@ -123,20 +126,22 @@ class ProducersTableRow extends Component<Props> {
<Table.Cell
singleLine
>
<Progress
color="teal"
label={(
<div className="label">
{votePercent}%
<Responsive as="span" minWidth={800}>
- {voteFormatted}
</Responsive>
</div>
)}
percent={parseFloat(votePercent * 100) / 100}
size="tiny"
style={{ minWidth: 0 }}
/>
{(producersVotedIn) && (
<Progress
color="teal"
label={(
<div className="label">
{votePercent}%
<Responsive as="span" minWidth={800}>
- {voteFormatted}
</Responsive>
</div>
)}
percent={parseFloat(votePercent * 100) / 100}
size="tiny"
style={{ minWidth: 0 }}
/>
)}
</Table.Cell>
<Table.Cell
singleLine
Expand Down

0 comments on commit 37b4297

Please sign in to comment.