Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,24 @@
import { USD_CONVERSION_MARKETS } from '@lib/config'
import { checkCountry, loadRoute, catchLinks, navigateTo } from '@lib/routing'
import { component, address, pageName, countryDisallowed } from '@lib/stores'
import { hidePopoversOnKeydown, hidePopoversOnClick } from '@lib/ui'
import { runAndInterval, hashString, getChainData } from '@lib/utils'
import { hidePopoversOnKeydown, hidePopoversOnClick, showModal } from '@lib/ui'
import { runAndInterval, hashString, getChainData, getUserSetting } from '@lib/utils'

import { getUserAssetBalances } from '@api/assets'
import { listenToEvents } from '@api/listener'
import { getMarketPrices } from '@api/prices'

let interval1;
let checkedWelcome = false;

function maybeShowWelcome() {
if (checkedWelcome || $pageName == 'Home' || getUserSetting('hasSeenWelcome')) return;

checkedWelcome = true;
setTimeout(() => {
if (!getUserSetting('hasSeenWelcome')) showModal('Welcome');
}, 500);
}

onMount(async () => {

Expand All @@ -39,6 +49,7 @@

// Listener
$: listenToEvents($address);
$: if ($pageName) maybeShowWelcome();

</script>

Expand Down Expand Up @@ -257,4 +268,4 @@
<Header />
{/if}

<svelte:component this={$component}/>
<svelte:component this={$component}/>
41 changes: 34 additions & 7 deletions src/components/header/Nav.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@
import Rewards from './Rewards.svelte'

import { pageName, showMobileNav } from '@lib/stores'
import { TROPHY_ICON, BULLET_LIST_ICON } from '@lib/icons'
import { TROPHY_ICON, BULLET_LIST_ICON, BOOK_ICON } from '@lib/icons'
import { showModal } from '@lib/ui'

function toggleMobileNav() {
showMobileNav.set(!$showMobileNav);
}

function openGuide() {
showMobileNav.set(false);
showModal('Welcome');
}
</script>


Expand All @@ -27,18 +33,25 @@
gap: 8px;
}

a {
a,
button.nav-action {
color: var(--text0);
text-decoration: none;
padding: 8px 12px;
border-radius: var(--base-radius);
transition: all 100ms ease-in-out;
font-weight: 500;
border: none;
background: transparent;
font: inherit;
cursor: pointer;
}
a:hover {
a:hover,
button.nav-action:hover {
background-color: var(--layer1);
}
a.active {
a.active,
button.nav-action.active {
color: var(--primary);
background-color: var(--primary-highlighted);
}
Expand All @@ -57,6 +70,16 @@
height: 18px;
}

button.guide-link {
display: flex;
align-items: center;
gap: 6px;
}
button.guide-link :global(svg) {
fill: currentColor;
height: 16px;
}

.mobile-nav {
display: block;
position: absolute;
Expand All @@ -78,7 +101,8 @@
fill: inherit;
}

.mobile-nav a {
.mobile-nav a,
.mobile-nav button.nav-action {
display: none;
padding: 10px 8px;
}
Expand All @@ -104,7 +128,8 @@
bottom: 0;
width: 100%;
}
.mobile-nav a {
.mobile-nav a,
.mobile-nav button.nav-action {
display: block;
font-size: 120%;
padding: 16px 8px;
Expand All @@ -121,6 +146,7 @@
<a class:active={$pageName == 'Trade'} href='/trade'>Trade</a>
<a class:active={$pageName == 'Pool'} href='/pool'>Pool</a>
<a class:active={$pageName == 'Stake'} href='/stake'>Stake</a>
<button type='button' class='nav-action guide-link' on:click|stopPropagation={openGuide}>{@html BOOK_ICON}<span>Guide</span></button>
<a on:click|stopPropagation={toggleMobileNav} class:active={$showMobileNav}>…</a>
</div>

Expand All @@ -132,6 +158,7 @@
<a on:click={toggleMobileNav} href='/trade'>Trade</a>
<a on:click={toggleMobileNav} href='/pool'>Pool</a>
<a on:click={toggleMobileNav} href='/stake'>Stake</a>
<button type='button' class='nav-action' on:click|stopPropagation={openGuide}>Guide</button>
<a on:click={toggleMobileNav} href='https://docs.cap.io' target='_blank' class='display-desktop'>Docs</a>
</div>
{/if}
Expand All @@ -140,4 +167,4 @@
{@html BULLET_LIST_ICON}
</div>

<Rewards/>
<Rewards/>
7 changes: 6 additions & 1 deletion src/components/layout/Modals.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@
import UnstakeCAP from '../modals/UnstakeCAP.svelte'
import HistoryOrderStatus from '../modals/HistoryOrderStatus.svelte'
import Settings from '../modals/Settings.svelte'
import Welcome from '../modals/Welcome.svelte'

</script>

{#if $activeModal && $activeModal.name == 'Settings'}
<Settings />
{/if}

{#if $activeModal && $activeModal.name == 'Welcome'}
<Welcome />
{/if}

{#if $activeModal && $activeModal.name == 'AssetSelect'}
<AssetSelect />
{/if}
Expand Down Expand Up @@ -67,4 +72,4 @@

{#if $activeModal && $activeModal.name == 'MarketInfo'}
<MarketInfo data={$activeModal.data} />
{/if}
{/if}
4 changes: 3 additions & 1 deletion src/components/modals/Modal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@

.modal {
width: var(--modal-width);
max-width: calc(100vw - (var(--base-padding) * 2));
box-sizing: border-box;
border-radius: var(--base-radius);
background-color: var(--layer25);
border: 1px solid var(--layer200);
Expand Down Expand Up @@ -127,4 +129,4 @@

</div>

</div>
</div>
Loading