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({
message: LABELS.VOTING_FOR_PROPOSAL,
message: votingMsg,
description: LABELS.PLEASE_WAIT,
type: 'warn',
});
@ -184,12 +197,9 @@ export const depositSourceTokensAndVote = async (
);
notify({
message: LABELS.PROPOSAL_VOTED,
message: votedMsg,
type: 'success',
description:
yesVotingTokenAmount > 0
? `${yesVotingTokenAmount} ${LABELS.TOKENS_VOTED_FOR_THE_PROPOSAL}.`
: `${noVotingTokenAmount} ${LABELS.TOKENS_VOTED_AGAINST_THE_PROPOSAL}.`,
description: voteTokensMsg,
});
} catch (ex) {
console.error(ex);

View File

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

View File

@ -40,11 +40,6 @@ export const LABELS = {
REMOVE: 'Remove',
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',
PLEASE_WAIT: 'Please wait...',
GOVERNANCE_TOKENS_ADDED: 'Governance tokens added.',
@ -67,11 +62,19 @@ export const LABELS = {
ACTIONS: 'Actions',
VOTE_YEAH: 'Yeah',
VOTE_NAY: 'Nay',
VOTE_YEAH_QUESTION: 'Vote Yeah?',
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_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...',
EXECUTED: 'Executed.',