Skip to content

Commit

Permalink
Onboarding page (#1373)
Browse files Browse the repository at this point in the history
* feat: add draft of onboarding page

* chore: update t&c links

* feat: add guided tour through app

* fix: typos and eslint warnings

* restrict width of onboarding cards

* feat: replace  UI faucet with discord link

* feat: improve CTA

* feat: add link to onboarding page

---------

Co-authored-by: Thomas Jeatt <[email protected]>
  • Loading branch information
nud3l and tomjeatt authored Jun 30, 2023
1 parent 6f8afd8 commit 503736a
Show file tree
Hide file tree
Showing 13 changed files with 436 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ REACT_APP_PARACHAIN_ID="2092"
DOCKER_RELAY_CHAIN_CURRENCY="KSM"
REACT_APP_SQUID_URL="https://api-kusama.interlay.io/graphql/graphql"
REACT_APP_MARKET_DATA_URL="https://api.coingecko.com/api/v3/simple/price?vs_currencies=usd"
REACT_APP_SIGNER_API_URL="https://interbtc-ui-kintsugi-testnet-git-api-terms-interlay.vercel.app/terms"
REACT_APP_SIGNER_API_URL="https://interbtc-ui-kintsugi-git-api-terms-interlay.vercel.app/terms"

// Interlay mainnet

Expand All @@ -72,4 +72,4 @@ REACT_APP_PARACHAIN_ID="2032"
DOCKER_RELAY_CHAIN_CURRENCY="DOT"
REACT_APP_SQUID_URL="https://api.interlay.io/graphql/graphql"
REACT_APP_MARKET_DATA_URL="https://api.coingecko.com/api/v3/simple/price?vs_currencies=usd"
REACT_APP_SIGNER_API_URL="https://interbtc-ui-kintsugi-testnet-git-api-terms-interlay.vercel.app/terms"
REACT_APP_SIGNER_API_URL="https://interbtc-ui-interlay-git-api-terms-interlay.vercel.app/terms"
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"react-hook-form": "^7.33.1",
"react-i18next": "^11.7.4",
"react-icons": "^3.10.0",
"react-joyride": "^2.5.4",
"react-paginate": "^7.1.3",
"react-query": "^3.19.6",
"react-redux": "^7.2.1",
Expand Down
4 changes: 4 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const Loans = React.lazy(() => import(/* webpackChunkName: 'loans' */ '@/pages/L
const Swap = React.lazy(() => import(/* webpackChunkName: 'amm' */ '@/pages/AMM'));
const Pools = React.lazy(() => import(/* webpackChunkName: 'amm/pools' */ '@/pages/AMM/Pools'));
const Wallet = React.lazy(() => import(/* webpackChunkName: 'wallet' */ '@/pages/Wallet'));
const Onboarding = React.lazy(() => import(/* webpackChunkName: 'onboarding' */ '@/pages/Onboarding'));
const Actions = React.lazy(() => import(/* webpackChunkName: 'actions' */ '@/pages/Actions'));
const NoMatch = React.lazy(() => import(/* webpackChunkName: 'no-match' */ '@/pages/NoMatch'));

Expand Down Expand Up @@ -216,6 +217,9 @@ const App = (): JSX.Element => {
<Strategies />
</Route>
)}
<Route path={PAGES.ONBOARDING}>
<Onboarding />
</Route>
<Route path={PAGES.ACTIONS}>
<Actions />
</Route>
Expand Down
5 changes: 3 additions & 2 deletions src/assets/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"receive": "You will receive",
"confirm": "Confirm",
"connect_wallet": "Connect Wallet",
"install_wallet": "Install Wallet",
"next": "Next",
"loading_ellipsis": "Loading...",
"note": "Note",
Expand Down Expand Up @@ -91,6 +92,7 @@
"nav_use_wrapped": "Use {{wrappedTokenSymbol}}",
"nav_governance": "Governance",
"nav_wallet": "Wallet",
"nav_onboarding": "Onboarding",
"report_bug": "Report a bug:",
"request_funds": "Faucet",
"request_btc": "BTC Faucet",
Expand Down Expand Up @@ -561,7 +563,6 @@
"no_account": "You don't have an account. Create one",
"install_supported_wallets": "Please install one of the currently supported wallets. By connecting the wallet you accept the ",
"select_account": "Please select an account",
"install_wallet": "Please install supported wallet",
"select_wallet": "Please select a wallet",
"exclude_us_citizens": "By proceeding you confirm that you have read and accepted the <1>terms and conditions</1>, and represent and warrant that you are not a Resident of the United States or a \"U.S. person\" within the meaning of Rule 902(k) under the United States Securities Act of 1933 (the \"Securities Act\").",
"sign_terms": "Please sign the terms and conditions using your account's digital signature. This is required for each account that you connect to this website.",
Expand All @@ -570,7 +571,7 @@
"change_wallet": "Change Wallet",
"disconnect": "Disconnect",
"please_select_an_account": "Please select an account",
"please_install_supported_wallet": "Please install supported wallet",
"please_install_supported_wallet": "Please install a supported wallet",
"please_select_a_wallet": "Please select a wallet"
},
"loans": {
Expand Down
130 changes: 130 additions & 0 deletions src/components/Tutorial/Tutorial.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
import { useState } from 'react';
import Joyride, { CallBackProps, STATUS, Step } from 'react-joyride';

import { CTA, theme } from '@/component-library';

type Props = {
disabled?: boolean;
label?: string;
}

type TutorialProps = Props;

const steps: Step[] = [
{
target: 'body',
placement: 'center',
title: 'Welcome to the Interlay app!',
content: 'Step through this tutorial to understand the different parts of the app.',
},
{
target: '[href="/wallet"]',
title: 'Wallet',
content: 'You can find an overview of your assets and positions in the DeFi hub on the wallet page.',
},
{
target: '[href="/bridge"]',
title: 'IBTC',
content: 'On the IBTC page you can bridge BTC from and to Interlay.'
},
{
target: '[href="/transfer"]',
title: 'Transfer and Bridge',
content: 'You can transfer assets on Interlay and you can also...'
},
{
target: '[href="/transfer"]',
title: 'Transfer and Bridge',
content: '...bridge assets from other chains like Polkadot, Polkadot Asset Hub, Astar, HydraDX, and many more from and to Interlay.'
},
{
target: '[href="/lending"]',
title: 'Lending',
content: 'Onwards to DeFi! On the lending page you can lend IBTC, DOT, USDT and others to earn interest.'
},
{
target: '[href="/lending"]',
title: 'Lending',
content: 'You can also borrow assets like IBTC, DOT, USDT and others.',
},
{
target: '[href="/swap"]',
title: 'Swap',
content: 'On the swap page you can swap assets like IBTC, DOT, USDT and others.',
},
{
target: '[href="/pools"]',
title: 'Pools',
content: 'On the pools page you can provide liquidity to earn rewards.',
},
{
target: '[href="/staking"]',
title: 'Staking',
content: 'Here you can stake INTR to enable you to participate in Interlay governance.',
},
{
target: '[data-key="info"]',
title: 'Onboarding',
content: 'All done! You can always redo this tutorial under "More" and "Onboarding".',
},
{
target: '[href="/wallet"]',
title: 'Wallet',
content: 'As a first step, click on the wallet page and check the guide to get assets onto Interlay to join the DeFi hub.',
disableOverlayClose: true,
hideCloseButton: true,
hideFooter: true,
spotlightClicks: true,
},
];

const Tutorial = ({
disabled = false,
label = 'Start Tutorial',
}: TutorialProps): JSX.Element => {
const [run, setRun] = useState(false);

const handleStartTutorial = () => {
console.log('Starting tutorial...');
setRun(true);
};

const handleJoyrideCallback = (data: CallBackProps) => {
const { action, status } = data;
const finishedStatuses: string[] = [STATUS.FINISHED, STATUS.SKIPPED];

if (finishedStatuses.includes(status as string) || (action === 'close')) {
setRun(false);
}
};

return (
<>
<CTA
onPress={handleStartTutorial}
variant='primary'
disabled={disabled}
id='start-tutorial'
>
{label}
</CTA>
<Joyride
callback={handleJoyrideCallback}
continuous={true}
scrollToFirstStep={true}
showProgress={true}
showSkipButton={true}
steps={steps}
run={run}
styles={{
options: {
primaryColor: theme.cta.primary.bg,
}
}}
/>
</>
);
};

export { Tutorial };
export type { TutorialProps };
1 change: 1 addition & 0 deletions src/components/Tutorial/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Tutorial } from './Tutorial';
11 changes: 11 additions & 0 deletions src/pages/Onboarding/Onboarding.style.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import styled from 'styled-components';

import { Flex } from '@/component-library';

const StyledWrapper = styled(Flex)`
max-width: 540px;
width: 100%;
margin: 0 auto;
`;

export { StyledWrapper };
Loading

2 comments on commit 503736a

@vercel
Copy link

@vercel vercel bot commented on 503736a Jun 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 503736a Jun 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.