Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Commit

Permalink
Move plain text to translation files
Browse files Browse the repository at this point in the history
  • Loading branch information
shelegdmitriy committed Aug 14, 2021
1 parent 72eef76 commit 204c006
Show file tree
Hide file tree
Showing 12 changed files with 486 additions and 280 deletions.
4 changes: 2 additions & 2 deletions frontend/src/components/nodes/ValidatingLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ValidatingLabel extends React.PureComponent<Props> {
color: #008d6a;
}
.validating-label.pending {
.validating-label.proposal {
background-color: #6ad1e3;
color: #11869a;
}
Expand All @@ -45,7 +45,7 @@ class ValidatingLabel extends React.PureComponent<Props> {
background-color: #dc3545;
color: #ffffff;
}
.validating-label.inactive {
.validating-label.idle {
background-color: #e5e5e6;
color: #72727a;
}
Expand Down
52 changes: 31 additions & 21 deletions frontend/src/components/nodes/ValidatorMainRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface Props {
validatorFee: string | null;
validatorDelegators: number | string | null;
stake: string;
proposedStakePerNextEpoch?: string;
proposedStakeForNextEpoch?: string;
cumulativeStake: number;
totalStakeInPersnt: number;
handleClick: React.MouseEventHandler;
Expand All @@ -41,24 +41,24 @@ class ValidatorMainRow extends PureComponent<Props> {
validatorFee,
validatorDelegators,
stake,
proposedStakePerNextEpoch,
proposedStakeForNextEpoch,
cumulativeStake,
totalStakeInPersnt,
handleClick,
} = this.props;

const stakeProposedAmount =
proposedStakePerNextEpoch &&
(new BN(stake).gt(new BN(proposedStakePerNextEpoch))
proposedStakeForNextEpoch &&
(new BN(stake).gt(new BN(proposedStakeForNextEpoch))
? {
value: new BN(stake)
.sub(new BN(proposedStakePerNextEpoch))
.sub(new BN(proposedStakeForNextEpoch))
.toString(),
increace: false,
}
: new BN(stake).lt(new BN(proposedStakePerNextEpoch))
: new BN(stake).lt(new BN(proposedStakeForNextEpoch))
? {
value: new BN(proposedStakePerNextEpoch)
value: new BN(proposedStakeForNextEpoch)
.sub(new BN(stake))
.toString(),
increace: true,
Expand Down Expand Up @@ -108,57 +108,63 @@ class ValidatorMainRow extends PureComponent<Props> {
<Col xs="2" className="validators-node-label">
{validatorStatus === "proposal" ? (
<ValidatingLabel
type="pending"
type="proposal"
text={translate(
"component.nodes.ValidatorRow.state.pending.text"
"component.nodes.ValidatorMainRow.state.proposal.text"
).toString()}
tooltipKey="nodes"
>
Proposal
{translate(
"component.nodes.ValidatorMainRow.state.proposal.title"
)}
</ValidatingLabel>
) : validatorStatus === "new" ? (
<ValidatingLabel
type="new"
text={translate(
"component.nodes.ValidatorRow.state.new.text"
"component.nodes.ValidatorMainRow.state.new.text"
).toString()}
tooltipKey="new"
>
{translate(
"component.nodes.ValidatorRow.state.new.title"
"component.nodes.ValidatorMainRow.state.new.title"
)}
</ValidatingLabel>
) : validatorStatus === "leaving" ? (
<ValidatingLabel
type="kickout"
text={translate(
"component.nodes.ValidatorRow.state.kickout.text"
"component.nodes.ValidatorMainRow.state.kickout.text"
).toString()}
tooltipKey="kickout"
>
{translate(
"component.nodes.ValidatorRow.state.kickout.title"
"component.nodes.ValidatorMainRow.state.kickout.title"
)}
</ValidatingLabel>
) : validatorStatus === "active" ? (
<ValidatingLabel
type="active"
text={translate(
"component.nodes.ValidatorRow.state.active.text"
"component.nodes.ValidatorMainRow.state.active.text"
).toString()}
tooltipKey="current"
>
{translate(
"component.nodes.ValidatorRow.state.active.title"
"component.nodes.ValidatorMainRow.state.active.title"
)}
</ValidatingLabel>
) : (
<ValidatingLabel
type="inactive"
text="inactive node"
tooltipKey="inactive"
type="idle"
text={translate(
"component.nodes.ValidatorMainRow.state.idle.text"
).toString()}
tooltipKey="idle"
>
Inactive
{translate(
"component.nodes.ValidatorMainRow.state.idle.title"
)}
</ValidatingLabel>
)}
</Col>
Expand Down Expand Up @@ -205,7 +211,11 @@ class ValidatorMainRow extends PureComponent<Props> {
<br />
<small>
{typeof stakeProposedAmount === "string" ? (
"same"
<>
{translate(
"component.nodes.ValidatorMainRow.same_proposed_stake"
)}
</>
) : (
<>
{stakeProposedAmount.increace ? "+" : "-"}
Expand Down
210 changes: 119 additions & 91 deletions frontend/src/components/nodes/ValidatorMetadataRow.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { PureComponent } from "react";

import { Row, Col } from "react-bootstrap";
import { Translate } from "react-localize-redux";

interface Props {
poolWebsite?: string;
Expand Down Expand Up @@ -28,105 +29,132 @@ class ValidatorMetadataRow extends PureComponent<Props> {
Boolean(poolDescription);

return (
<Row noGutters className="validator-nodes-content-row">
{poolDetailsAvailable ? (
<>
{poolWebsite && (
<Col className="validator-nodes-content-cell" xs="auto">
<Row noGutters>
<Col className="validator-nodes-details-title">Web</Col>
</Row>
<Row noGutters>
<Col className="validator-nodes-text">
<a
href={`http://${poolWebsite}`}
rel="noreferrer noopener"
target="_blank"
>
{poolWebsite}
</a>
<Translate>
{({ translate }) => (
<Row noGutters className="validator-nodes-content-row">
{poolDetailsAvailable ? (
<>
{poolWebsite && (
<Col className="validator-nodes-content-cell" xs="auto">
<Row noGutters>
<Col className="validator-nodes-details-title">
{translate(
"component.nodes.ValidatorMetadataRow.pool_info.website"
)}
</Col>
</Row>
<Row noGutters>
<Col className="validator-nodes-text">
<a
href={`http://${poolWebsite}`}
rel="noreferrer noopener"
target="_blank"
>
{poolWebsite}
</a>
</Col>
</Row>
</Col>
</Row>
</Col>
)}
{poolEmail && (
<Col className="validator-nodes-content-cell" xs="auto">
<Row noGutters>
<Col className="validator-nodes-details-title">Email</Col>
</Row>
<Row noGutters>
<Col className="validator-nodes-text">
<a href={`mailto:${poolEmail}`}>{poolEmail}</a>
)}
{poolEmail && (
<Col className="validator-nodes-content-cell" xs="auto">
<Row noGutters>
<Col className="validator-nodes-details-title">
{translate(
"component.nodes.ValidatorMetadataRow.pool_info.email"
)}
</Col>
</Row>
<Row noGutters>
<Col className="validator-nodes-text">
<a href={`mailto:${poolEmail}`}>{poolEmail}</a>
</Col>
</Row>
</Col>
</Row>
</Col>
)}
{poolTwitter && (
<Col className="validator-nodes-content-cell" xs="auto">
<Row noGutters>
<Col className="validator-nodes-details-title">Twitter</Col>
</Row>
<Row noGutters>
<Col className="validator-nodes-text">
<a
href={`https://twitter.com/${poolTwitter}`}
rel="noreferrer noopener"
target="_blank"
>
{poolTwitter}
</a>
)}
{poolTwitter && (
<Col className="validator-nodes-content-cell" xs="auto">
<Row noGutters>
<Col className="validator-nodes-details-title">
{translate(
"component.nodes.ValidatorMetadataRow.pool_info.twitter"
)}
</Col>
</Row>
<Row noGutters>
<Col className="validator-nodes-text">
<a
href={`https://twitter.com/${poolTwitter}`}
rel="noreferrer noopener"
target="_blank"
>
{poolTwitter}
</a>
</Col>
</Row>
</Col>
</Row>
</Col>
)}
{poolDiscord && (
<Col className="validator-nodes-content-cell" xs="auto">
<Row noGutters>
<Col className="validator-nodes-details-title">Discord</Col>
</Row>
<Row noGutters>
<Col className="validator-nodes-text">
<a
href={poolDiscord}
rel="noreferrer noopener"
target="_blank"
>
{poolDiscord}
</a>
)}
{poolDiscord && (
<Col className="validator-nodes-content-cell" xs="auto">
<Row noGutters>
<Col className="validator-nodes-details-title">
{translate(
"component.nodes.ValidatorMetadataRow.pool_info.discord"
)}
</Col>
</Row>
<Row noGutters>
<Col className="validator-nodes-text">
<a
href={poolDiscord}
rel="noreferrer noopener"
target="_blank"
>
{poolDiscord}
</a>
</Col>
</Row>
</Col>
</Row>
</Col>
)}
{poolDescription && (
<Col className="validator-nodes-content-cell">
<Row noGutters>
<Col className="validator-nodes-details-title">
Description
)}
{poolDescription && (
<Col className="validator-nodes-content-cell">
<Row noGutters>
<Col className="validator-nodes-details-title">
{translate(
"component.nodes.ValidatorMetadataRow.pool_info.description"
)}
</Col>
</Row>
<Row noGutters>
<Col className="validator-nodes-text">
<small>{poolDescription}</small>
</Col>
</Row>
</Col>
</Row>
<Row noGutters>
<Col className="validator-nodes-text">
<small>{poolDescription}</small>
</Col>
</Row>
)}
</>
) : (
<Col className="validator-nodes-content-cell">
<p className="text-center">
{translate(
"component.nodes.ValidatorMetadataRow.pool_info_tip",
{
info_tip_text: (
<a
href="https://github.com/zavodil/near-pool-details#description"
target="_blank"
>
<Translate id="button.data" />
</a>
),
}
)}
</p>
</Col>
)}
</>
) : (
<Col className="validator-nodes-content-cell">
<p className="text-center">
If you are node owner feel free to fill all{" "}
<a
href="https://github.com/zavodil/near-pool-details#description"
target="_blank"
>
data
</a>{" "}
to promote your own node!
</p>
</Col>
</Row>
)}
</Row>
</Translate>
);
}
}
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/components/nodes/ValidatorRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class ValidatorRow extends React.Component<Props, State> {
validatorFee={validatorFee}
validatorDelegators={validatorDelegators}
stake={node.stake}
proposedStakePerNextEpoch={node.stakeProposed}
proposedStakeForNextEpoch={node.stakeProposed}
cumulativeStake={cumulativeStake}
totalStakeInPersnt={totalStakeInPersnt}
handleClick={this.handleClick}
Expand Down Expand Up @@ -178,6 +178,10 @@ class ValidatorRow extends React.Component<Props, State> {
margin-right: 24px;
}
.cumulative-stake-chart {
min-width: 100px;
}
.cumulative-stake-holders-row {
background-color: #fff6ed;
}
Expand Down
Loading

0 comments on commit 204c006

Please sign in to comment.