-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Motivation Redesign proposal detail neurons block (split in 3 groups and render in collapsibles). [design](https://www.figma.com/file/29OdZHbNaOk9RkrfESucjb/NNS-1.03-WIP?node-id=5091%3A8121&mode=dev) # Changes - update MyVotes container and it's children to render in collapsibles. - labels updated. - render user votes with color. - refactor: VotingCard to be shared between nns and sns versions. # Tests - Updated current tests to the new DOM changes. - groups visibility tests when no (votable, voted, ineligible)neurons. - voted neurons in color. - refactor to cleanup a bit the structure: ``` NnsVotingCard|NnsVotingCard VotingCard VotableNeuronList VotedNeuronList IneligibleNeuronList ``` # Todos - [x] Add entry to changelog (if necessary). # Screenshots <img width="1038" alt="Screenshot 2024-01-03 at 09 43 01" src="https://github.com/dfinity/nns-dapp/assets/98811342/26fd04b3-452f-403e-9fad-15b9ed0b0954"> <img width="381" alt="image" src="https://github.com/dfinity/nns-dapp/assets/98811342/e434c885-9df3-466f-b094-89970abf6a05"> <img width="494" alt="image" src="https://github.com/dfinity/nns-dapp/assets/98811342/5f5ad3c0-d101-4e6a-81da-02cdf9a22d6c">
- Loading branch information
1 parent
2b526ef
commit db449b9
Showing
28 changed files
with
838 additions
and
569 deletions.
There are no files selected for viewing
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
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
81 changes: 81 additions & 0 deletions
81
frontend/src/lib/components/proposal-detail/VotingCard/ExpandableProposalNeurons.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,81 @@ | ||
<script lang="ts"> | ||
import { IconExpandCircleDown, Collapsible } from "@dfinity/gix-components"; | ||
import { fade } from "svelte/transition"; | ||
export let testId: string; | ||
let toggleContent: () => void; | ||
let expanded: boolean; | ||
</script> | ||
|
||
<div class="container" in:fade> | ||
<Collapsible | ||
{testId} | ||
expandButton={false} | ||
externalToggle={true} | ||
bind:toggleContent | ||
bind:expanded | ||
wrapHeight | ||
> | ||
<div slot="header" class="header" class:expanded> | ||
<div class="header-entry"> | ||
<span class="value"> | ||
<slot name="start" /> | ||
</span> | ||
<button | ||
class="icon" | ||
class:expanded | ||
on:click|stopPropagation={toggleContent} | ||
> | ||
<IconExpandCircleDown /> | ||
</button> | ||
</div> | ||
|
||
<div class="header-entry"> | ||
<slot name="end" /> | ||
</div> | ||
</div> | ||
|
||
<slot /> | ||
</Collapsible> | ||
</div> | ||
|
||
<style lang="scss"> | ||
@use "@dfinity/gix-components/dist/styles/mixins/media"; | ||
.container { | ||
padding-bottom: var(--padding-2x); | ||
border-bottom: 1px solid var(--tertiary); | ||
} | ||
.header { | ||
display: flex; | ||
justify-content: space-between; | ||
gap: var(--padding); | ||
width: 100%; | ||
@include media.min-width(large) { | ||
padding: 0 var(--padding) 0 0; | ||
} | ||
} | ||
.header-entry { | ||
display: flex; | ||
align-items: center; | ||
gap: var(--padding); | ||
} | ||
.icon { | ||
color: var(--tertiary); | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
padding: 0; | ||
transition: transform ease-in var(--animation-time-normal); | ||
&.expanded { | ||
transform: rotate(-180deg); | ||
} | ||
} | ||
</style> |
24 changes: 24 additions & 0 deletions
24
frontend/src/lib/components/proposal-detail/VotingCard/IneligibleNeuronList.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,24 @@ | ||
<script lang="ts"> | ||
import { i18n } from "$lib/stores/i18n"; | ||
import { replacePlaceholders } from "$lib/utils/i18n.utils"; | ||
import ExpandableProposalNeurons from "$lib/components/proposal-detail/VotingCard/ExpandableProposalNeurons.svelte"; | ||
import IneligibleNeuronsCard from "$lib/components/proposal-detail/IneligibleNeuronsCard.svelte"; | ||
import type { IneligibleNeuronData } from "$lib/utils/neuron.utils"; | ||
export let ineligibleNeurons: IneligibleNeuronData[] = []; | ||
export let minSnsDissolveDelaySeconds: bigint; | ||
let ineligibleNeuronCount: number; | ||
$: ineligibleNeuronCount = ineligibleNeurons.length; | ||
</script> | ||
|
||
{#if ineligibleNeuronCount > 0} | ||
<ExpandableProposalNeurons testId="ineligible-neurons"> | ||
<svelte:fragment slot="start"> | ||
{replacePlaceholders($i18n.proposal_detail__ineligible.headline, { | ||
$count: `${ineligibleNeuronCount}`, | ||
})} | ||
</svelte:fragment> | ||
<IneligibleNeuronsCard {ineligibleNeurons} {minSnsDissolveDelaySeconds} /> | ||
</ExpandableProposalNeurons> | ||
{/if} |
Oops, something went wrong.