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
10 changes: 7 additions & 3 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
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'
Expand All @@ -27,6 +27,10 @@
loadRoute();
catchLinks((path) => navigateTo(path));

if (!getUserSetting('hasSeenWelcome')) {
showModal('Welcome');
}

// For back button functionality
window.onpopstate = () => loadRoute();

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

<svelte:component this={$component}/>
<svelte:component this={$component}/>
10 changes: 9 additions & 1 deletion 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 { showModal } from '@lib/ui'
import { TROPHY_ICON, BULLET_LIST_ICON } from '@lib/icons'

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

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


Expand Down Expand Up @@ -121,6 +127,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>
<a href='#welcome' on:click|preventDefault|stopPropagation={openWelcome}>Help</a>
<a on:click|stopPropagation={toggleMobileNav} class:active={$showMobileNav}>…</a>
</div>

Expand All @@ -132,6 +139,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>
<a href='#welcome' on:click|preventDefault|stopPropagation={openWelcome}>Help</a>
<a on:click={toggleMobileNav} href='https://docs.cap.io' target='_blank' class='display-desktop'>Docs</a>
</div>
{/if}
Expand All @@ -140,4 +148,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,9 +14,14 @@
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 == 'Welcome'}
<Welcome />
{/if}

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

{#if $activeModal && $activeModal.name == 'MarketInfo'}
<MarketInfo data={$activeModal.data} />
{/if}
{/if}
121 changes: 121 additions & 0 deletions src/components/modals/Welcome.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<script>

import Modal from './Modal.svelte'

import { hideModal } from '@lib/ui'
import { saveUserSetting } from '@lib/utils'

function finish() {
saveUserSetting('hasSeenWelcome', true);
hideModal();
}

</script>

<style>

.content {
padding: var(--base-padding);
}

.lead {
color: var(--text200);
line-height: 1.45;
margin-bottom: var(--base-padding);
}

.steps {
display: grid;
gap: 10px;
margin-bottom: var(--base-padding);
}

.step {
padding: 14px;
border: 1px solid var(--layer100);
border-radius: var(--base-radius);
background-color: var(--layer50);
}

.step-title {
font-weight: 600;
margin-bottom: 5px;
}

.step-body {
color: var(--text300);
font-size: 90%;
line-height: 1.4;
}

.actions {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-bottom: var(--base-padding);
}

.actions a,
button {
height: 38px;
padding: 0 14px;
border-radius: var(--base-radius);
font-weight: 600;
text-decoration: none;
display: inline-flex;
align-items: center;
justify-content: center;
}

.actions a {
color: var(--primary);
background-color: var(--primary-highlighted);
}

button {
color: var(--primary-darkest);
background-color: var(--primary);
width: auto;
}

.note {
color: var(--text400);
font-size: 85%;
line-height: 1.4;
}

</style>

<Modal title='Welcome to CAP' width={460}>
<div class='content'>
<div class='lead'>
CAP is a decentralized trading dashboard for perpetual markets and liquidity pools on Arbitrum.
</div>

<div class='steps'>
<div class='step'>
<div class='step-title'>1. Connect a wallet</div>
<div class='step-body'>Use an Arbitrum wallet to trade, provide liquidity, stake CAP, and view account activity.</div>
</div>
<div class='step'>
<div class='step-title'>2. Bridge funds to Arbitrum</div>
<div class='step-body'>Bridge ETH or supported collateral before trading. Keep ETH available for gas.</div>
</div>
<div class='step'>
<div class='step-title'>3. Start from the dashboard</div>
<div class='step-body'>Trade opens markets, Pool manages liquidity, and Stake manages CAP staking.</div>
</div>
</div>

<div class='actions'>
<a href='https://bridge.arbitrum.io/' target='_blank' rel='noreferrer'>Arbitrum Bridge</a>
<a href='https://docs.cap.io/trade' target='_blank' rel='noreferrer'>Trading Docs</a>
<a href='https://docs.cap.io/pool' target='_blank' rel='noreferrer'>Pool Docs</a>
<button type='button' on:click={finish}>Got it</button>
</div>

<div class='note'>
You can reopen this guide from Help in the navigation.
</div>
</div>
</Modal>