Skip to content

Commit

Permalink
fix: proposal status enums
Browse files Browse the repository at this point in the history
  • Loading branch information
jeeanribeiro committed Dec 15, 2022
1 parent 4314b04 commit 18cf68c
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 29 deletions.
Expand Up @@ -41,8 +41,8 @@
selectedIndices = Array<number>(questions?.length)
}
$: isVotingDisabled =
$selectedProposal?.status === ProposalStatus.Announcement ||
$selectedProposal?.status === ProposalStatus.Closed ||
$selectedProposal?.status === ProposalStatus.Upcoming ||
$selectedProposal?.status === ProposalStatus.Ended ||
selectedIndices?.length === 0 ||
selectedIndices?.includes(undefined)
Expand Down
Expand Up @@ -12,16 +12,16 @@
let eventProgress: number
switch (status) {
case ProposalStatus.Announcement:
case ProposalStatus.Upcoming:
eventProgress = 0
break
case ProposalStatus.VotingOpen:
case ProposalStatus.Commencing:
eventProgress = 1
break
case ProposalStatus.Counting:
case ProposalStatus.Holding:
eventProgress = 2
break
case ProposalStatus.Closed:
case ProposalStatus.Ended:
eventProgress = 3
break
default:
Expand Down
Expand Up @@ -6,10 +6,10 @@
export let status: ProposalStatus
const STATUS_COLORS: Record<ProposalStatus, string> = {
[ProposalStatus.Announcement]: 'purple-200',
[ProposalStatus.VotingOpen]: 'blue-200',
[ProposalStatus.Counting]: 'green-300',
[ProposalStatus.Closed]: 'gray-200',
[ProposalStatus.Upcoming]: 'purple-200',
[ProposalStatus.Commencing]: 'blue-200',
[ProposalStatus.Holding]: 'green-300',
[ProposalStatus.Ended]: 'gray-200',
}
</script>

Expand Down
2 changes: 1 addition & 1 deletion packages/shared/components/organisms/ProposalCard.svelte
Expand Up @@ -20,7 +20,7 @@
<proposal-card
on:click={handleProposalClick}
class="flex flex-col p-6 border border-solid border-gray-200 rounded-xl cursor-pointer h-32
{proposal.status === ProposalStatus.Closed ? 'bg-transparent' : 'bg-white'}"
{proposal.status === ProposalStatus.Ended ? 'bg-transparent' : 'bg-white'}"
>
<div class="flex items-center gap-1.5 mb-5">
{#if proposal.organization}
Expand Down
Expand Up @@ -7,7 +7,7 @@
const proposalInformation = {
countingEnds: formatDate(
milestoneToDate($networkStatus.currentMilestone, $selectedProposal.milestones?.closed),
milestoneToDate($networkStatus.currentMilestone, $selectedProposal.milestones?.ended),
DATE_FORMAT
),
eventId: truncateString($selectedProposal?.id, 9, 9),
Expand Down
@@ -1,6 +1,6 @@
export enum ProposalStatus {
Announcement = 'announcement',
VotingOpen = 'votingOpen',
Counting = 'counting',
Closed = 'closed',
Upcoming = 'upcoming',
Commencing = 'commencing',
Holding = 'holding',
Ended = 'ended',
}
Expand Up @@ -12,12 +12,12 @@ export function createProposalsFromEvents(events: Event[]): IProposal[] {
const proposal = {
id,
title: data.name,
status: ProposalStatus.Announcement,
status: ProposalStatus.Upcoming,
milestones: {
[ProposalStatus.Announcement]: 0, // TODO: fix this
[ProposalStatus.VotingOpen]: data.milestoneIndexCommence,
[ProposalStatus.Counting]: data.milestoneIndexStart,
[ProposalStatus.Closed]: data.milestoneIndexEnd,
[ProposalStatus.Upcoming]: 0, // TODO: fix this
[ProposalStatus.Commencing]: data.milestoneIndexCommence,
[ProposalStatus.Holding]: data.milestoneIndexStart,
[ProposalStatus.Ended]: data.milestoneIndexEnd,
},
// TODO: figure out a better way to get the node URLs
nodeUrls: get(activeProfile)?.clientOptions?.nodes,
Expand Down
16 changes: 8 additions & 8 deletions packages/shared/locales/en.json
Expand Up @@ -583,10 +583,10 @@
"successRemove": "Proposal successfully removed"
},
"statusTimeline": {
"announcement": "Announcement",
"votingOpen": "Voting open",
"counting": "Counting starts",
"closed": "Counting stops"
"upcoming": "Announcement",
"commencing": "Voting open",
"holding": "Counting starts",
"ended": "Counting stops"
},
"details": {
"fullProposal": "Read the full proposal",
Expand Down Expand Up @@ -1983,10 +1983,10 @@
"locked": "locked",
"smartContract": "smart contract",
"proposalStatus": {
"announcement": "Announcement",
"votingOpen": "Voting open",
"counting": "Counting",
"closed": "Closed"
"upcoming": "Announcement",
"commencing": "Voting open",
"holding": "Counting",
"ended": "Closed"
}
},
"menus": {
Expand Down

0 comments on commit 18cf68c

Please sign in to comment.