Skip to content

Commit

Permalink
Adjust vote status when voted by delegate
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjurco committed Jan 16, 2025
1 parent b796a86 commit 9c388f2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
23 changes: 20 additions & 3 deletions src/pages/proposal-commons/vote-status/vote-status.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,36 @@
}
}

.votedByDelegate {
@include font-body-17;
}

.wrapperLarge {
display: flex;
justify-content: center;
align-items: center;
margin: 14px 0 48px 0;
@include font-body-11;

@media (min-width: $md) {
@include font-body-5;
}

.votedByDelegate {
@include font-body-17;
text-align: left;

@media (min-width: $md) {
@include font-body-14;
}
}
}

.icon {
margin-right: $space-sm;
height: 25px;
margin-right: 6px;
height: 26px;

@media (min-width: $md) {
margin-right: 8px;
height: 30px;
}
}
15 changes: 0 additions & 15 deletions src/pages/proposal-commons/vote-status/vote-status.test.ts

This file was deleted.

10 changes: 4 additions & 6 deletions src/pages/proposal-commons/vote-status/vote-status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ interface Props {
large?: true;
}

export const formatVoteStatus = (voterState: keyof typeof VOTER_STATES, wasDelegated: boolean) => {
if (VOTER_STATES[voterState] === 'Unvoted') return 'Unvoted';
return [VOTER_STATES[voterState], wasDelegated && '(by delegate)'].filter(Boolean).join(' ');
};

const VoteStatus = (props: Props) => {
const { voterState, wasDelegated, large } = props;

Expand All @@ -33,7 +28,10 @@ const VoteStatus = (props: Props) => {
[styles.votedFor]: VOTER_STATES[voterState] === 'Voted For',
})}
>
{formatVoteStatus(voterState, wasDelegated)}
{VOTER_STATES[voterState]}
{VOTER_STATES[voterState] !== 'Unvoted' && wasDelegated && (
<div className={styles.votedByDelegate}>(by delegate)</div>
)}
</span>
</div>
);
Expand Down

0 comments on commit 9c388f2

Please sign in to comment.