Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: polish governance #2009

Merged
merged 7 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { Answer, EventStatus } from '@iota/sdk/out/types'
import { Icon, IconName, Indicator, Text, TooltipIcon } from '@bloomwalletio/ui'
import { Icon, IconName, Text, TooltipIcon } from '@bloomwalletio/ui'

export let onAnswerClick: () => void

Expand Down Expand Up @@ -53,17 +53,7 @@
>
<div class="flex space-x-3 items-center w-full min-w-0">
{#if answerIndex !== undefined}
{#if isVotedFor}
<status-icon class="flex justify-center items-center shrink-0 w-5 h-5">
{#if proposalStatus === EventStatus.Ended || proposalStatus === EventStatus.Commencing}
<Icon name={IconName.ReceiptCheck} size="sm" textColor={isWinner ? 'invert' : 'brand'} />
{:else if proposalStatus === EventStatus.Holding}
<Indicator size="sm" ping />
{/if}
</status-icon>
{:else}
<answer-index>{answerIndex + 1}</answer-index>
{/if}
<answer-index>{answerIndex + 1}</answer-index>
{/if}
<Text
align="left"
Expand All @@ -74,6 +64,9 @@
</Text>
</div>
<div class="flex items-center space-x-1.5">
{#if isVotedFor}
<Icon name={IconName.ReceiptCheck} textColor="brand" size="xs" />
{/if}
{#if isWinner}
<Icon name={IconName.Trophy} size="xs" />
{/if}
Expand Down Expand Up @@ -120,16 +113,6 @@
}
}

&.voted {
&:hover {
@apply bg-blue-50;
}

&::after {
@apply bg-blue-100;
}
}

&.winner {
@apply bg-text-brand-dark border-brand;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

let hasVoted = false

$: $participationOverviewForSelectedAccount, setHasVoted()
$: $participationOverviewForSelectedAccount, proposal, setHasVoted()

function setHasVoted(): void {
hasVoted = isVotingForProposal(proposal?.id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</script>

{#if status}
<Pill color={STATUS_COLORS[status]}>
<Pill color={error ? 'danger' : STATUS_COLORS[status]}>
<div class="flex flex-row space-x-1 items-center">
{#if error}
<Icon name={IconName.CrossClose} textColor="danger" size="xs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
const { metadata } = $visibleSelectedAccountTokens?.[$activeProfile?.network?.id]?.baseCoin ?? {}

let totalVotes = BigInt(0)
const hasMounted = false

$: selectedProposalOverview = $participationOverviewForSelectedAccount?.participations?.[$selectedProposal?.id]
$: trackedParticipations = Object.values(selectedProposalOverview ?? {})
$: currentMilestone = $networkStatus.currentMilestone

// Reactively start updating votes once component has mounted and participation overview is available.
$: hasMounted && $selectedParticipationEventStatus && trackedParticipations && currentMilestone && setTotalVotes()
$: $selectedParticipationEventStatus && trackedParticipations && currentMilestone && setTotalVotes()

function setTotalVotes(): void {
switch ($selectedParticipationEventStatus?.status) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function getActivityTileAction(activity: Activity): string | undefined {
} else if (activity.governanceAction === GovernanceAction.DecreaseVotingPower) {
return isConfirmed ? 'general.decreased' : 'general.decreasing'
} else if (activity.governanceAction === GovernanceAction.StartVoting) {
return isConfirmed ? 'general.voteStarted' : 'general.voteStarting'
return isConfirmed ? 'general.votedOn' : 'general.votingOn'
} else if (activity.governanceAction === GovernanceAction.StopVoting) {
return isConfirmed ? 'general.unvoted' : 'general.unvoting'
} else if (activity.governanceAction === GovernanceAction.ChangedVote) {
Expand Down
22 changes: 12 additions & 10 deletions packages/shared/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1085,19 +1085,19 @@
"Conflicting": "Failed to decrease voting power"
},
"startVoting": {
"Pending": "Voting for {proposalName}",
"Confirmed": "Voted for {proposalName}",
"Conflicting": "Failed to vote for"
"Pending": "Voting on {proposalName}",
"Confirmed": "Voted on {proposalName}",
"Conflicting": "Failed to vote on"
},
"stopVoting": {
"Pending": "Stopping voting for {proposalName}",
"Confirmed": "Stopped voting for {proposalName}",
"Conflicting": "Failed to stop voting for"
"Pending": "Stopping voting on {proposalName}",
"Confirmed": "Stopped voting on {proposalName}",
"Conflicting": "Failed to stop voting on"
},
"changedVote": {
"Pending": "Changing vote for {proposalName}",
"Confirmed": "Changed vote for {proposalName}",
"Conflicting": "Failed to change vote for"
"Pending": "Changing vote on {proposalName}",
"Confirmed": "Changed vote on {proposalName}",
"Conflicting": "Failed to change vote on"
},
"revote": {
"Pending": "Revoting",
Expand Down Expand Up @@ -1219,7 +1219,7 @@
"revote": {
"title": "Revote on proposals",
"body": "Changing your voting power temporarily stops your votes for all proposals from being counted. Simply click \"Revote\" to resume voting.",
"hint": "Bloom remembers all of the proposals and answer options you previously voted for."
"hint": "Bloom remembers all the proposals and answer options you previously voted for."
},
"removeProposal": {
"title": "Remove proposal",
Expand Down Expand Up @@ -1404,6 +1404,8 @@
"decreasing": "Decreasing voting",
"voted": "Voted",
"voting": "Voting",
"votingOn": "Voting on",
"votedOn": "Voted on",
"changedVote": "Changed vote",
"changingVote": "Changing vote",
"revoted": "Revoted",
Expand Down
Loading