-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: rebrand ProposalStatusTimelineTooltip (#1947)
fix: eventProgress condition fix: move directory
- Loading branch information
1 parent
83ac18d
commit c46fee9
Showing
7 changed files
with
127 additions
and
97 deletions.
There are no files selected for viewing
87 changes: 0 additions & 87 deletions
87
packages/desktop/components/ProposalStatusTimelineTooltip.svelte
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
packages/desktop/views/governance/components/ProposalStatusTimelineTooltip.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<script lang="ts"> | ||
import { EventStatus } from '@iota/sdk/out/types' | ||
import { Text, Popover } from '@bloomwalletio/ui' | ||
import { formatDate, localize } from '@core/i18n' | ||
import { networkStatus } from '@core/network' | ||
import { DATE_FORMAT, milestoneToDate } from '@core/utils' | ||
export let milestones: Record<EventStatus, number> | ||
export let status: EventStatus | ||
export let anchor: HTMLElement | ||
export let placement: 'top' | 'bottom' | 'left' | 'right' = 'right' | ||
let eventProgress: number | ||
switch (status) { | ||
case EventStatus.Upcoming: | ||
eventProgress = 0 | ||
break | ||
case EventStatus.Commencing: | ||
eventProgress = 1 | ||
break | ||
case EventStatus.Holding: | ||
eventProgress = 2 | ||
break | ||
case EventStatus.Ended: | ||
eventProgress = 3 | ||
break | ||
default: | ||
break | ||
} | ||
function getLocaleTenseKey(index: number): 'past' | 'present' | 'future' { | ||
if (index < eventProgress) { | ||
return 'past' | ||
} | ||
if (index === eventProgress) { | ||
return 'present' | ||
} | ||
if (index > eventProgress) { | ||
return 'future' | ||
} | ||
} | ||
</script> | ||
|
||
<Popover {anchor} {placement} showArrow event="hover" class="p-4 rounded-xl shadow-elevation-4"> | ||
<ul class="space-y-3 text-left"> | ||
{#each Object.keys(EventStatus) as status, index} | ||
{@const hasProgressed = eventProgress >= index} | ||
{@const currentProgress = eventProgress === index} | ||
<li | ||
class="grid grid-rows-2 relative | ||
before:justify-self-center before:mr-4 before:row-span-2 before:self-center | ||
{hasProgressed | ||
? currentProgress | ||
? 'before:text-2xl before:text-brand before:dark:text-brand-dark' | ||
: 'before:text-xl before:text-brand before:dark:text-brand-dark before:ml-[1px]' | ||
: 'before:text-xl before:text-secondary before:ml-[1px]'} | ||
{currentProgress | ||
? 'text-primary dark:text-primary-dark' | ||
: hasProgressed | ||
? 'text-secondary/75' | ||
: 'text-secondary'} | ||
" | ||
class:has-progressed={hasProgressed} | ||
> | ||
<Text textColor="current" fontWeight="semibold"> | ||
{localize(`views.governance.statusTimeline.${EventStatus[status]}.${getLocaleTenseKey(index)}`)} | ||
</Text> | ||
<Text textColor="current" fontWeight="medium"> | ||
{formatDate(milestoneToDate($networkStatus.currentMilestone, milestones[EventStatus[status]]), { | ||
...DATE_FORMAT, | ||
timeZoneName: undefined, | ||
})} | ||
</Text> | ||
</li> | ||
{/each} | ||
</ul> | ||
</Popover> | ||
|
||
<style lang="scss"> | ||
li { | ||
grid-template-columns: min-content 1fr; | ||
&::before { | ||
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: ''; | ||
height: 130%; | ||
left: 0.415em; | ||
z-index: -1; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { default as ProposalStatusPill } from './ProposalStatusPill.svelte' | ||
export { default as ProposalStatusInfo } from './ProposalStatusInfo.svelte' | ||
export { default as ProposalStatusPill } from './ProposalStatusPill.svelte' | ||
export { default as ProposalStatusTimelineTooltip } from './ProposalStatusTimelineTooltip.svelte' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters