-
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.
Merge remote-tracking branch 'origin/main' into NNS1-3480/export-menu…
…-button-to-account-menu
- Loading branch information
Showing
20 changed files
with
625 additions
and
34 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
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,133 @@ | ||
<script lang="ts"> | ||
import IC_LOGO_ROUNDED from "$lib/assets/icp-rounded.svg"; | ||
import TooltipIcon from "$lib/components/ui/TooltipIcon.svelte"; | ||
import { LEDGER_CANISTER_ID } from "$lib/constants/canister-ids.constants"; | ||
import { icpSwapUsdPricesStore } from "$lib/derived/icp-swap.derived"; | ||
import { i18n } from "$lib/stores/i18n"; | ||
import { formatNumber } from "$lib/utils/format.utils"; | ||
import { nonNullish } from "@dfinity/utils"; | ||
export let usdAmount: number | undefined; | ||
const absentValue = "-/-"; | ||
let usdAmountFormatted: string; | ||
$: usdAmountFormatted = nonNullish(usdAmount) | ||
? formatNumber(usdAmount) | ||
: absentValue; | ||
let icpPrice: number | undefined; | ||
$: icpPrice = $icpSwapUsdPricesStore?.[LEDGER_CANISTER_ID.toText()]; | ||
let icpPriceFormatted: string; | ||
$: icpPriceFormatted = nonNullish(icpPrice) | ||
? formatNumber(icpPrice) | ||
: absentValue; | ||
let icpAmount: number | undefined; | ||
$: icpAmount = icpPrice && usdAmount && usdAmount / icpPrice; | ||
let icpAmountFormatted: string; | ||
$: icpAmountFormatted = nonNullish(icpAmount) | ||
? formatNumber(icpAmount) | ||
: absentValue; | ||
</script> | ||
|
||
<div class="wrapper" data-tid="usd-value-banner-component"> | ||
<div class="table-banner-icon"> | ||
<slot name="icon" /> | ||
</div> | ||
<div class="text-content"> | ||
<div class="totals"> | ||
<h1 class="primary-amount" data-tid="primary-amount"> | ||
${usdAmountFormatted} | ||
</h1> | ||
<div class="secondary-amount" data-tid="secondary-amount"> | ||
{icpAmountFormatted} | ||
{$i18n.core.icp} | ||
</div> | ||
</div> | ||
<div class="exchange-rate"> | ||
<img | ||
src={IC_LOGO_ROUNDED} | ||
alt={$i18n.auth.ic_logo} | ||
class="icp-icon desktop-only" | ||
/> | ||
<span class="desktop-only"> | ||
1 {$i18n.core.icp} = $<span data-tid="icp-price" | ||
>{icpPriceFormatted}</span | ||
> | ||
</span> | ||
<TooltipIcon> | ||
<div class="mobile-only"> | ||
1 {$i18n.core.icp} = ${icpPriceFormatted} | ||
</div> | ||
<div> | ||
{$i18n.accounts.token_price_source} | ||
</div> | ||
</TooltipIcon> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<style lang="scss"> | ||
@use "@dfinity/gix-components/dist/styles/mixins/media"; | ||
.wrapper { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
gap: var(--padding-2x); | ||
background-color: var(--card-background-tint); | ||
padding: var(--padding-2x); | ||
border-radius: var(--padding); | ||
border: 1.5px solid var(--card-border); | ||
.table-banner-icon { | ||
display: flex; | ||
width: 72px; | ||
} | ||
.text-content { | ||
flex-grow: 1; | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
justify-content: space-between; | ||
.totals { | ||
.primary-amount { | ||
margin: 0; | ||
} | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
.exchange-rate { | ||
display: flex; | ||
align-items: center; | ||
gap: var(--padding-0_5x); | ||
.icp-icon { | ||
width: 20px; | ||
height: 20px; | ||
} | ||
} | ||
} | ||
} | ||
.desktop-only { | ||
display: none; | ||
} | ||
@include media.min-width(medium) { | ||
.desktop-only { | ||
display: initial; | ||
} | ||
.mobile-only { | ||
display: none; | ||
} | ||
} | ||
</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
79 changes: 79 additions & 0 deletions
79
frontend/src/lib/modals/neurons/LosingRewardNeuronsModal.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,79 @@ | ||
<script lang="ts"> | ||
import { i18n } from "$lib/stores/i18n"; | ||
import { Modal } from "@dfinity/gix-components"; | ||
import { createEventDispatcher, onMount } from "svelte"; | ||
import { secondsToDissolveDelayDuration } from "$lib/utils/date.utils"; | ||
import { START_REDUCING_VOTING_POWER_AFTER_SECONDS } from "$lib/constants/neurons.constants"; | ||
import { replacePlaceholders } from "$lib/utils/i18n.utils"; | ||
import { soonLosingRewardNeuronsStore } from "$lib/derived/neurons.derived"; | ||
import NnsLosingRewardsNeuronCard from "$lib/components/neurons/NnsLosingRewardsNeuronCard.svelte"; | ||
import { listKnownNeurons } from "$lib/services/known-neurons.services"; | ||
const dispatcher = createEventDispatcher(); | ||
// Load KnownNeurons which are used in the FollowNnsTopicSections | ||
onMount(() => listKnownNeurons()); | ||
const confirm = () => { | ||
// TBD | ||
}; | ||
</script> | ||
|
||
<Modal on:nnsClose testId="losing-reward-neurons-modal-component"> | ||
<svelte:fragment slot="title"> | ||
{$i18n.losing_rewards_modal.title} | ||
</svelte:fragment> | ||
|
||
<div class="wrapper"> | ||
<p class="description"> | ||
{replacePlaceholders($i18n.losing_rewards_modal.description, { | ||
$period: secondsToDissolveDelayDuration( | ||
BigInt(START_REDUCING_VOTING_POWER_AFTER_SECONDS) | ||
), | ||
})} | ||
</p> | ||
|
||
<h3 class="label">{$i18n.losing_rewards_modal.label}</h3> | ||
<ul class="cards"> | ||
{#each $soonLosingRewardNeuronsStore as neuron (neuron.neuronId)} | ||
<li> | ||
<NnsLosingRewardsNeuronCard {neuron} /> | ||
</li> | ||
{/each} | ||
</ul> | ||
<div class="toolbar"> | ||
<button | ||
on:click={() => dispatcher("nnsClose")} | ||
class="secondary" | ||
data-tid="cancel-button">{$i18n.core.cancel}</button | ||
> | ||
<button on:click={confirm} class="primary" data-tid="confirm-button" | ||
>{$i18n.losing_rewards_modal.confirm}</button | ||
> | ||
</div> | ||
</div> | ||
</Modal> | ||
|
||
<style lang="scss"> | ||
@use "@dfinity/gix-components/dist/styles/mixins/fonts"; | ||
.description { | ||
margin: 0 0 var(--padding-3x); | ||
} | ||
.label { | ||
margin-bottom: var(--padding); | ||
@include fonts.standard(false); | ||
color: var(--description-color); | ||
} | ||
.cards { | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--padding); | ||
margin-bottom: var(--padding-3x); | ||
padding: 0; | ||
list-style-type: none; | ||
} | ||
</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
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
Oops, something went wrong.