From 4d4be14bbb4e9328ee56c1651201351b69b34ebd Mon Sep 17 00:00:00 2001 From: Jean Ribeiro Date: Wed, 14 Feb 2024 20:24:56 -0300 Subject: [PATCH 1/3] refactor: rebrand ProposalStatusTimelineTooltip fix: eventProgress condition fix: move directory --- .../components/ProposalStatusInfo.svelte | 2 +- .../ProposalStatusTimelineTooltip.svelte | 50 +++++-------- packages/desktop/components/index.ts | 1 - .../ProposalStatusTimelineTooltip.svelte | 75 +++++++++++++++++++ .../views/governance/components/index.ts | 1 + packages/desktop/views/governance/index.ts | 1 + 6 files changed, 97 insertions(+), 33 deletions(-) create mode 100644 packages/desktop/views/governance/components/ProposalStatusTimelineTooltip.svelte create mode 100644 packages/desktop/views/governance/components/index.ts create mode 100644 packages/desktop/views/governance/index.ts diff --git a/packages/desktop/components/ProposalStatusInfo.svelte b/packages/desktop/components/ProposalStatusInfo.svelte index f6bb847c1d..fab452fdff 100644 --- a/packages/desktop/components/ProposalStatusInfo.svelte +++ b/packages/desktop/components/ProposalStatusInfo.svelte @@ -1,5 +1,5 @@ - +
    {#each Object.keys(EventStatus) as status, index} -
  • = index}> - + {@const hasProgressed = eventProgress >= index} +
  • + {formatDate( milestoneToDate($networkStatus.currentMilestone, milestones[EventStatus[status]]), DATE_FORMAT )} - + {localize(`views.governance.statusTimeline.${EventStatus[status]}`)}
  • {/each}
-
+ diff --git a/packages/desktop/views/governance/components/index.ts b/packages/desktop/views/governance/components/index.ts new file mode 100644 index 0000000000..57c3fb94d7 --- /dev/null +++ b/packages/desktop/views/governance/components/index.ts @@ -0,0 +1 @@ +export { default as ProposalStatusTimelineTooltip } from './ProposalStatusTimelineTooltip.svelte' diff --git a/packages/desktop/views/governance/index.ts b/packages/desktop/views/governance/index.ts new file mode 100644 index 0000000000..cb64ac1b52 --- /dev/null +++ b/packages/desktop/views/governance/index.ts @@ -0,0 +1 @@ +export * from './components' From 7a8696e1a5f8071d4a1f98dce0080562fc5b876c Mon Sep 17 00:00:00 2001 From: Jean Ribeiro Date: Mon, 19 Feb 2024 12:00:56 -0300 Subject: [PATCH 2/3] fix: design changes --- .../ProposalStatusTimelineTooltip.svelte | 75 ------------------- .../ProposalStatusTimelineTooltip.svelte | 32 +++++--- 2 files changed, 23 insertions(+), 84 deletions(-) delete mode 100644 packages/desktop/components/ProposalStatusTimelineTooltip.svelte diff --git a/packages/desktop/components/ProposalStatusTimelineTooltip.svelte b/packages/desktop/components/ProposalStatusTimelineTooltip.svelte deleted file mode 100644 index 7163741a13..0000000000 --- a/packages/desktop/components/ProposalStatusTimelineTooltip.svelte +++ /dev/null @@ -1,75 +0,0 @@ - - - -
    - {#each Object.keys(EventStatus) as status, index} - {@const hasProgressed = eventProgress >= index} -
  • - - {formatDate( - milestoneToDate($networkStatus.currentMilestone, milestones[EventStatus[status]]), - DATE_FORMAT - )} - - - {localize(`views.governance.statusTimeline.${EventStatus[status]}`)} - -
  • - {/each} -
-
- - diff --git a/packages/desktop/views/governance/components/ProposalStatusTimelineTooltip.svelte b/packages/desktop/views/governance/components/ProposalStatusTimelineTooltip.svelte index 7163741a13..72ae9a209f 100644 --- a/packages/desktop/views/governance/components/ProposalStatusTimelineTooltip.svelte +++ b/packages/desktop/views/governance/components/ProposalStatusTimelineTooltip.svelte @@ -7,7 +7,8 @@ import { DATE_FORMAT, milestoneToDate } from '@core/utils' export let milestones: Record - export let status: EventStatus + // export let status: EventStatus + const status = EventStatus.Holding export let anchor: HTMLElement export let placement: 'top' | 'bottom' | 'left' | 'right' = 'right' @@ -34,23 +35,32 @@
    {#each Object.keys(EventStatus) as status, index} {@const hasProgressed = eventProgress >= index} + {@const currentProgress = eventProgress === index}
  • - - {formatDate( - milestoneToDate($networkStatus.currentMilestone, milestones[EventStatus[status]]), - DATE_FORMAT - )} - - + {localize(`views.governance.statusTimeline.${EventStatus[status]}`)} + + {formatDate(milestoneToDate($networkStatus.currentMilestone, milestones[EventStatus[status]]), { + ...DATE_FORMAT, + timeZoneName: undefined, + })} +
  • {/each}
@@ -64,6 +74,10 @@ content: '●'; } + &.has-progressed:not(:first-child)::after { + @apply border-text-brand dark:border-text-brand-dark; + } + &:not(:first-child)::after { @apply absolute block border-r border-text-secondary dark:border-text-secondary-dark border-solid bottom-4; content: ''; From 4dd1af6884e626bfda1382bb7fc773ef7564175c Mon Sep 17 00:00:00 2001 From: Jean Ribeiro Date: Mon, 19 Feb 2024 14:20:30 -0300 Subject: [PATCH 3/3] fix: text vertical positioning and adds status dynamic tense functionality --- .../desktop/features/governance.features.ts | 2 +- .../ProposalStatusTimelineTooltip.svelte | 21 ++++++++++++---- packages/shared/src/locales/en.json | 24 +++++++++++++++---- 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/packages/desktop/features/governance.features.ts b/packages/desktop/features/governance.features.ts index d826ba74c2..3f72fa5ea6 100644 --- a/packages/desktop/features/governance.features.ts +++ b/packages/desktop/features/governance.features.ts @@ -1,7 +1,7 @@ import { IGovernanceFeatures } from '@lib/features/interfaces' const governanceFeatures: IGovernanceFeatures = { - enabled: false, + enabled: true, removeProposals: { enabled: true, }, diff --git a/packages/desktop/views/governance/components/ProposalStatusTimelineTooltip.svelte b/packages/desktop/views/governance/components/ProposalStatusTimelineTooltip.svelte index 72ae9a209f..df8c41ce03 100644 --- a/packages/desktop/views/governance/components/ProposalStatusTimelineTooltip.svelte +++ b/packages/desktop/views/governance/components/ProposalStatusTimelineTooltip.svelte @@ -7,8 +7,7 @@ import { DATE_FORMAT, milestoneToDate } from '@core/utils' export let milestones: Record - // export let status: EventStatus - const status = EventStatus.Holding + export let status: EventStatus export let anchor: HTMLElement export let placement: 'top' | 'bottom' | 'left' | 'right' = 'right' @@ -29,6 +28,20 @@ default: break } + + function getLocaleTenseKey(index: number): 'past' | 'present' | 'future' { + if (index < eventProgress) { + return 'past' + } + + if (index === eventProgress) { + return 'present' + } + + if (index > eventProgress) { + return 'future' + } + } @@ -38,7 +51,7 @@ {@const currentProgress = eventProgress === index}
  • - {localize(`views.governance.statusTimeline.${EventStatus[status]}`)} + {localize(`views.governance.statusTimeline.${EventStatus[status]}.${getLocaleTenseKey(index)}`)} {formatDate(milestoneToDate($networkStatus.currentMilestone, milestones[EventStatus[status]]), { diff --git a/packages/shared/src/locales/en.json b/packages/shared/src/locales/en.json index 1fcf8df979..119d996f38 100644 --- a/packages/shared/src/locales/en.json +++ b/packages/shared/src/locales/en.json @@ -651,10 +651,26 @@ "emptyDescription": "You can subscribe to a proposal on a node with its URL and an optional event ID." }, "statusTimeline": { - "upcoming": "Announcement", - "commencing": "Voting open", - "holding": "Counting starts", - "ended": "Counting stops" + "upcoming": { + "past": "Announced", + "present": "Announcement", + "future": "Announcement" + }, + "commencing": { + "past": "Voting opened", + "present": "Voting open", + "future": "Voting opens" + }, + "holding": { + "past": "Counting started", + "present": "Counting started", + "future": "Counting starts" + }, + "ended": { + "past": "Counting stopped", + "present": "Counting stopped", + "future": "Counting stops" + } }, "details": { "yourVote": {