From 06f9aef6ec8f7e074d3b590e52a3cf90e32c23ee Mon Sep 17 00:00:00 2001 From: apporc Date: Sat, 29 Jun 2024 11:17:38 +0800 Subject: [PATCH] Apply design change --- src/pages/earn/index.svelte | 2 + src/pages/earn/step/bootstrap.svelte | 28 +++++++---- src/pages/earn/step/confirm.svelte | 8 +++- src/pages/earn/step/overview.svelte | 45 ++++++++++-------- src/pages/earn/step/stake.svelte | 71 +++++++++++++++++++++++++--- src/pages/earn/step/unstake.svelte | 69 +++++++++++++++++++++++++-- 6 files changed, 179 insertions(+), 44 deletions(-) diff --git a/src/pages/earn/index.svelte b/src/pages/earn/index.svelte index 7a68b8a0..fc0eb5e4 100644 --- a/src/pages/earn/index.svelte +++ b/src/pages/earn/index.svelte @@ -274,6 +274,7 @@ {:else if $step === Step.Stake} toStakeConfirm(Step.Stake)} @@ -281,6 +282,7 @@ {:else if $step === Step.Unstake} toStakeConfirm(Step.Unstake)} diff --git a/src/pages/earn/step/bootstrap.svelte b/src/pages/earn/step/bootstrap.svelte index a8e4d548..1a9a3122 100644 --- a/src/pages/earn/step/bootstrap.svelte +++ b/src/pages/earn/step/bootstrap.svelte @@ -16,18 +16,26 @@ let amountValid = false function onAmountChanged(event: CustomEvent) { - let newAmount = Asset.from(Number(event.detail.value), availableTokens.symbol).value - amount = String(newAmount) - percent = Math.floor((newAmount / availableTokens.value) * 100) + try { + let newAmount = Asset.from(Number(event.detail.value), availableTokens.symbol).value + amount = String(newAmount) + percent = Math.floor((newAmount / availableTokens.value) * 100) + } catch (error) { + console.log('failed to apply amount change', error) + } } function onPercentChanged(event: any) { - let newPercent = Number(event.detail.value) - percent = newPercent - let newAmount = Asset.from( - (newPercent / 100) * availableTokens.value, - availableTokens.symbol - ).value - amount = String(newAmount) + try { + let newPercent = Number(event.detail.value) + percent = newPercent + let newAmount = Asset.from( + (newPercent / 100) * availableTokens.value, + availableTokens.symbol + ).value + amount = String(newAmount) + } catch (error) { + console.log('failed to apply percent change', error) + } } function onConfirm() { nextStep() diff --git a/src/pages/earn/step/confirm.svelte b/src/pages/earn/step/confirm.svelte index 3af52a39..88132818 100644 --- a/src/pages/earn/step/confirm.svelte +++ b/src/pages/earn/step/confirm.svelte @@ -40,7 +40,7 @@ .middle-section { margin: 0 auto; max-width: 28rem; - margin-bottom: 84px; + margin-bottom: 62px; } .bottom-section { margin: 0 auto; @@ -99,12 +99,16 @@ {action} + + 72 hours + +
- {amount.value} + {amount}
{#if usd}
≈ $ {usd} USD
diff --git a/src/pages/earn/step/overview.svelte b/src/pages/earn/step/overview.svelte index 866c8c63..a9a3451f 100644 --- a/src/pages/earn/step/overview.svelte +++ b/src/pages/earn/step/overview.svelte @@ -1,5 +1,5 @@ @@ -34,9 +46,6 @@ border: 1px solid var(--divider-grey); border-radius: 20px; padding: 26px; - :global(.button) { - margin-top: 31px; - } } .top-section { margin-bottom: 42px; @@ -44,7 +53,7 @@ .middle-section { margin: 0 auto; max-width: 28rem; - margin-bottom: 84px; + margin-bottom: 31px; } .bottom-section { margin: 0 auto; @@ -72,8 +81,47 @@ letter-spacing: -0.18px; } .token-selector { + margin-bottom: 10px; + } + .label { + color: var(--dark-grey); + font-weight: 600; + font-size: 10px; + line-height: 12px; + letter-spacing: 0.1px; + text-transform: uppercase; + margin-bottom: 12px; + text-align: start; margin-bottom: 32px; } + .controls { + margin-top: 31px; + text-align: center; + :global(.button) { + background: none; + color: var(--main-blue); + font-size: 10px; + text-transform: uppercase; + } + } + .actions { + padding: 13px; + cursor: pointer; + font-family: Inter; + font-style: normal; + font-weight: bold; + font-size: 10px; + line-height: 12px; + display: flex; + justify-content: end; + align-items: center; + text-align: center; + letter-spacing: 0.1px; + text-transform: uppercase; + color: var(--main-blue); + user-select: none; + -webkit-user-select: none; + }
@@ -88,6 +136,10 @@
{}} />
+
+ currently staked {rexBalance} +
+ +
+ Entire Balance +
@@ -112,5 +167,9 @@ > Stake tokens + +
+ +
diff --git a/src/pages/earn/step/unstake.svelte b/src/pages/earn/step/unstake.svelte index ec947b5a..1d7c5773 100644 --- a/src/pages/earn/step/unstake.svelte +++ b/src/pages/earn/step/unstake.svelte @@ -13,6 +13,7 @@ export let amount: string export let token: Token | undefined + export let rexBalance: Asset export let availableTokens: Asset export let nextStep: () => void @@ -26,13 +27,24 @@ } let amountValid = false + function maxBalance() { + if (availableTokens) { + amount = String(availableTokens.value) + amountValid = true + } + } + function onConfirm() { nextStep() } function onAmountChanged(event: CustomEvent) { - let newAmount = Asset.from(Number(event.detail.value), availableTokens.symbol).value - amount = String(newAmount) + try { + let newAmount = Asset.from(Number(event.detail.value), availableTokens.symbol).value + amount = String(newAmount) + } catch (error) { + console.log('failed to apply amount change', error) + } } @@ -41,9 +53,6 @@ border: 1px solid var(--divider-grey); border-radius: 20px; padding: 26px; - :global(.button) { - margin-top: 31px; - } } .top-section { margin-bottom: 42px; @@ -79,8 +88,47 @@ letter-spacing: -0.18px; } .token-selector { + margin-bottom: 10px; + } + .label { + color: var(--dark-grey); + font-weight: 600; + font-size: 10px; + line-height: 12px; + letter-spacing: 0.1px; + text-transform: uppercase; + margin-bottom: 12px; + text-align: start; margin-bottom: 32px; } + .controls { + margin-top: 31px; + text-align: center; + :global(.button) { + background: none; + color: var(--main-blue); + font-size: 10px; + text-transform: uppercase; + } + } + .actions { + padding: 13px; + cursor: pointer; + font-family: Inter; + font-style: normal; + font-weight: bold; + font-size: 10px; + line-height: 12px; + display: flex; + justify-content: end; + align-items: center; + text-align: center; + letter-spacing: 0.1px; + text-transform: uppercase; + color: var(--main-blue); + user-select: none; + -webkit-user-select: none; + }
@@ -100,6 +148,10 @@ onTokenSelect={() => {}} />
+
+ total staked {rexBalance} +
+ +
+ Entire Balance +
@@ -124,5 +179,9 @@ > Unstake tokens + +
+ +