Skip to content

Commit

Permalink
Apply design change
Browse files Browse the repository at this point in the history
  • Loading branch information
apporc committed Jun 29, 2024
1 parent 118fb65 commit 06f9aef
Show file tree
Hide file tree
Showing 6 changed files with 179 additions and 44 deletions.
2 changes: 2 additions & 0 deletions src/pages/earn/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,15 @@
{:else if $step === Step.Stake}
<REXStake
bind:amount={selectedAmount}
rexBalance={$rexBalance}
token={$systemToken}
availableTokens={$availableSystemTokens}
nextStep={() => toStakeConfirm(Step.Stake)}
/>
{:else if $step === Step.Unstake}
<REXUnstake
bind:amount={selectedAmount}
rexBalance={$rexBalance}
token={$rexToken}
availableTokens={$maturedBalance}
nextStep={() => toStakeConfirm(Step.Unstake)}
Expand Down
28 changes: 18 additions & 10 deletions src/pages/earn/step/bootstrap.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,26 @@
let amountValid = false
function onAmountChanged(event: CustomEvent<InputResponse>) {
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()
Expand Down
8 changes: 6 additions & 2 deletions src/pages/earn/step/confirm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
.middle-section {
margin: 0 auto;
max-width: 28rem;
margin-bottom: 84px;
margin-bottom: 62px;
}
.bottom-section {
margin: 0 auto;
Expand Down Expand Up @@ -99,12 +99,16 @@
<LabelValue header="Action">
<span>{action}</span>
</LabelValue>
<LabelValue header="Time to fully matured">
<span>72 hours</span>
</LabelValue>

<LabelValue header="Token Amount" changeStep={handleBack}>
<div class="amount">
<span class="logo-container">
<TokenImage width="18" height="18" {tokenKey} />
</span>
<span>{amount.value}</span>
<span>{amount}</span>
</div>
{#if usd}
<div class="value">≈ $ {usd} USD</div>
Expand Down
45 changes: 24 additions & 21 deletions src/pages/earn/step/overview.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import type {Asset} from 'anchor-link'
import {Asset} from 'anchor-link'
import Button from '~/components/elements/button.svelte'
Expand Down Expand Up @@ -29,6 +29,13 @@
border: 1px solid var(--divider-grey);
border-radius: 8px;
padding: 26px;
margin-bottom: 21px;
}
.bottom-section {
display: flex;
flex-direction: column;
justify-content: start;
align-items: center;
}
.header {
color: var(--black);
Expand Down Expand Up @@ -67,7 +74,7 @@
gap: 12px;
}
.label {
color: var(--main-black);
color: var(--dark-grey);
font-weight: 600;
font-size: 10px;
line-height: 12px;
Expand All @@ -88,14 +95,17 @@
margin-bottom: 2px;
}
.matured {
position: relative;
display: inline-block;
border-bottom: 1px dotted black;
color: var(--dark-grey);
font-family: Inter;
font-style: normal;
font-weight: bold;
font-size: 12px;
line-height: 29px;
text-align: center;
letter-spacing: -0.47px;
margin-bottom: 26px;
}
.matured .maturedtooltip {
visibility: hidden;
.faq {
color: var(--main-blue);
font-family: Inter;
font-style: normal;
Expand All @@ -104,16 +114,8 @@
line-height: 29px;
text-align: center;
letter-spacing: -0.47px;
background-color: var(--cultured);
padding: 0px 0;
border-radius: 6px;
position: absolute;
z-index: 1;
}
.matured:hover .maturedtooltip {
visibility: visible;
margin-bottom: 26px;
text-decoration: none;
}
</style>

Expand All @@ -129,8 +131,7 @@
{rexBalance}
</div>
<div class="matured">
{maturedBalance}
<div class="maturedtooltip">matured</div>
{maturedBalance} matured
</div>

<div class="buttons">
Expand All @@ -157,5 +158,7 @@
</div>
</div>
</div>
<div class="bottom-section" />
<div class="bottom-section">
<a href="/staking/faq" class="faq">How staking works?</a>
</div>
</div>
71 changes: 65 additions & 6 deletions src/pages/earn/step/stake.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,29 @@
export let nextStep: () => void
export let amount: string
export let token: Token | undefined
export let rexBalance: Asset
let amountValid = false
let tokenOptions = token ? [token] : []
function maxBalance() {
if (availableTokens) {
amount = String(availableTokens.value)
amountValid = true
}
}
function onConfirm() {
nextStep()
}
function onAmountChanged(event: CustomEvent<InputResponse>) {
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)
}
}
</script>

Expand All @@ -34,17 +46,14 @@
border: 1px solid var(--divider-grey);
border-radius: 20px;
padding: 26px;
:global(.button) {
margin-top: 31px;
}
}
.top-section {
margin-bottom: 42px;
}
.middle-section {
margin: 0 auto;
max-width: 28rem;
margin-bottom: 84px;
margin-bottom: 31px;
}
.bottom-section {
margin: 0 auto;
Expand Down Expand Up @@ -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;
}
</style>

<div class="container">
Expand All @@ -88,6 +136,10 @@
<div class="token-selector">
<TokenSelector defaultToken={token} {tokenOptions} onTokenSelect={() => {}} />
</div>
<div class="label">
currently staked {rexBalance}
</div>

<InputAsset
bind:valid={amountValid}
bind:value={amount}
Expand All @@ -99,6 +151,9 @@
balance={availableTokens}
on:changed={onAmountChanged}
/>
<div class="actions">
<span on:click={maxBalance}>Entire Balance</span>
</div>
</Form>
</div>
<div class="bottom-section">
Expand All @@ -112,5 +167,9 @@
>
Stake tokens
</Button>

<div class="controls">
<Button href="/" style="no-frame">Cancel</Button>
</div>
</div>
</div>
Loading

0 comments on commit 06f9aef

Please sign in to comment.