fix: update voting messages and icons

This commit is contained in:
Sebastian.Bor 2021-04-06 10:19:58 +01:00
parent a3129aaab7
commit af2969ea35
3 changed files with 45 additions and 17 deletions

View File

@ -168,8 +168,21 @@ export const depositSourceTokensAndVote = async (
), ),
); );
const [votingMsg, votedMsg, voteTokensMsg] =
yesVotingTokenAmount > 0
? [
LABELS.VOTING_YEAH,
LABELS.VOTED_YEAH,
`${yesVotingTokenAmount} ${LABELS.TOKENS_VOTED_FOR_THE_PROPOSAL}.`,
]
: [
LABELS.VOTING_NAY,
LABELS.VOTED_NAY,
`${noVotingTokenAmount} ${LABELS.TOKENS_VOTED_AGAINST_THE_PROPOSAL}.`,
];
notify({ notify({
message: LABELS.VOTING_FOR_PROPOSAL, message: votingMsg,
description: LABELS.PLEASE_WAIT, description: LABELS.PLEASE_WAIT,
type: 'warn', type: 'warn',
}); });
@ -184,12 +197,9 @@ export const depositSourceTokensAndVote = async (
); );
notify({ notify({
message: LABELS.PROPOSAL_VOTED, message: votedMsg,
type: 'success', type: 'success',
description: description: voteTokensMsg,
yesVotingTokenAmount > 0
? `${yesVotingTokenAmount} ${LABELS.TOKENS_VOTED_FOR_THE_PROPOSAL}.`
: `${noVotingTokenAmount} ${LABELS.TOKENS_VOTED_AGAINST_THE_PROPOSAL}.`,
}); });
} catch (ex) { } catch (ex) {
console.error(ex); console.error(ex);

View File

@ -10,7 +10,11 @@ import {
import { LABELS } from '../../constants'; import { LABELS } from '../../constants';
import { depositSourceTokensAndVote } from '../../actions/depositSourceTokensAndVote'; import { depositSourceTokensAndVote } from '../../actions/depositSourceTokensAndVote';
import { contexts, hooks } from '@oyster/common'; import { contexts, hooks } from '@oyster/common';
import { ExclamationCircleOutlined } from '@ant-design/icons'; import {
ExclamationCircleOutlined,
CheckOutlined,
CloseOutlined,
} from '@ant-design/icons';
import './style.less'; import './style.less';
@ -44,17 +48,28 @@ export function Vote({
userTokenAccount.info.amount.toNumber() > 0 && userTokenAccount.info.amount.toNumber() > 0 &&
state.info.status === TimelockStateStatus.Voting; state.info.status === TimelockStateStatus.Voting;
const btnLabel = yeahVote ? LABELS.VOTE_YEAH : LABELS.VOTE_NAY; const [btnLabel, title, msg, icon] = yeahVote
const title = yeahVote ? LABELS.VOTE_YEAH_QUESTION : LABELS.VOTE_NAY_QUESTION; ? [
const msg = yeahVote ? LABELS.VOTE_YEAH_MSG : LABELS.VOTE_NAY_MSG; LABELS.VOTE_YEAH,
LABELS.VOTE_YEAH_QUESTION,
LABELS.VOTE_YEAH_MSG,
<CheckOutlined />,
]
: [
LABELS.VOTE_NAY,
LABELS.VOTE_NAY_QUESTION,
LABELS.VOTE_NAY_MSG,
<CloseOutlined />,
];
return eligibleToView ? ( return eligibleToView ? (
<Button <Button
type="primary" type="primary"
icon={icon}
onClick={() => onClick={() =>
confirm({ confirm({
title: title, title: title,
icon: <ExclamationCircleOutlined />, icon: icon,
content: ( content: (
<Row> <Row>
<Col span={24}> <Col span={24}>

View File

@ -40,11 +40,6 @@ export const LABELS = {
REMOVE: 'Remove', REMOVE: 'Remove',
ADDING_OR_REMOVING: 'Type', ADDING_OR_REMOVING: 'Type',
VOTING_FOR_PROPOSAL: 'Voting for proposal.',
PROPOSAL_VOTED: 'Proposal voted.',
TOKENS_VOTED_FOR_THE_PROPOSAL: 'tokens voted for the proposal',
TOKENS_VOTED_AGAINST_THE_PROPOSAL: 'tokens voted against the proposal',
ADDING_GOVERNANCE_TOKENS: 'Adding governance tokens', ADDING_GOVERNANCE_TOKENS: 'Adding governance tokens',
PLEASE_WAIT: 'Please wait...', PLEASE_WAIT: 'Please wait...',
GOVERNANCE_TOKENS_ADDED: 'Governance tokens added.', GOVERNANCE_TOKENS_ADDED: 'Governance tokens added.',
@ -67,11 +62,19 @@ export const LABELS = {
ACTIONS: 'Actions', ACTIONS: 'Actions',
VOTE_YEAH: 'Yeah', VOTE_YEAH: 'Yeah',
VOTE_NAY: 'Nay',
VOTE_YEAH_QUESTION: 'Vote Yeah?', VOTE_YEAH_QUESTION: 'Vote Yeah?',
VOTE_YEAH_MSG: 'Vote in favour of the proposal.', VOTE_YEAH_MSG: 'Vote in favour of the proposal.',
VOTING_YEAH: 'Voting for the proposal.',
VOTED_YEAH: 'Voted for the proposal.',
VOTE_NAY: 'Nay',
VOTE_NAY_QUESTION: 'Vote Nay?', VOTE_NAY_QUESTION: 'Vote Nay?',
VOTE_NAY_MSG: 'Vote against the proposal.', VOTE_NAY_MSG: 'Vote against the proposal.',
VOTING_NAY: 'Voting against the proposal.',
VOTED_NAY: 'Voted against the proposal.',
TOKENS_VOTED_FOR_THE_PROPOSAL: 'tokens voted for the proposal',
TOKENS_VOTED_AGAINST_THE_PROPOSAL: 'tokens voted against the proposal',
EXECUTING: 'Executing...', EXECUTING: 'Executing...',
EXECUTED: 'Executed.', EXECUTED: 'Executed.',