-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add implicit account creation wizard and router (#7877)
* feat: add account to routes * feat: add to analytics featureflag * feat: add account view and multistep * style: refinements * feat: rename files and add locale * fix: update naming * feat: update naming and improve code * fix import * fix: remove accountImplicit route and add to wallet tab * fix: improve naming * Update packages/desktop/views/dashboard/wallet/Wallet.svelte * Update packages/desktop/views/dashboard/wallet/Wallet.svelte * fix: add router * minor fixes * ix: add missing dots * fix: remove unnecessary function * fix: rename files * fix: move if/else and key block * fix: reset after finish --------- Co-authored-by: Begoña Álvarez de la Cruz <balvarez@boxfish.studio>
- Loading branch information
1 parent
c7bc757
commit f49e87e
Showing
19 changed files
with
271 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
<script lang="ts"> | ||
import { WalletMainView } from './views' | ||
import { selectedWallet } from '@core/wallet' | ||
import { ImplicitAccountCreationView, WalletView } from './views' | ||
const hasAccount: boolean = false | ||
</script> | ||
|
||
{#if hasAccount} | ||
<WalletMainView /> | ||
{:else} | ||
<div class="flex w-full h-full p-12"> | ||
<h1>IMPLICIT ACCOUNT</h1> | ||
</div> | ||
{#if $selectedWallet} | ||
{#key $selectedWallet?.index} | ||
<wallet-container | ||
class="w-full h-full flex flex-nowrap p-8 relative flex-1 | ||
bg-gray-50 dark:bg-gray-900 justify-center items-center" | ||
> | ||
{#if hasAccount} | ||
<WalletView /> | ||
{:else} | ||
<ImplicitAccountCreationView /> | ||
{/if} | ||
</wallet-container> | ||
{/key} | ||
{/if} |
37 changes: 37 additions & 0 deletions
37
packages/desktop/views/dashboard/wallet/implicit-account-creation-router.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { get, writable } from 'svelte/store' | ||
import { Router } from '../../../../shared/lib/core/router/classes' | ||
import { ImplicitAccountCreationRoute } from './implicit-account-creation.enum' | ||
|
||
export const implicitAccountCreationRouter = writable<ImplicitAccountCreationRouter>(null) | ||
export const implicitAccountCreationRoute = writable<ImplicitAccountCreationRoute>(null) | ||
|
||
export class ImplicitAccountCreationRouter extends Router<ImplicitAccountCreationRoute> { | ||
constructor() { | ||
super(ImplicitAccountCreationRoute.Init, implicitAccountCreationRoute) | ||
} | ||
|
||
next(): void { | ||
let nextRoute: ImplicitAccountCreationRoute | ||
|
||
const currentRoute = get(this.routeStore) | ||
switch (currentRoute) { | ||
case ImplicitAccountCreationRoute.Init: { | ||
nextRoute = ImplicitAccountCreationRoute.OneTimeDeposit | ||
break | ||
} | ||
case ImplicitAccountCreationRoute.OneTimeDeposit: { | ||
nextRoute = ImplicitAccountCreationRoute.FundConfirmation | ||
break | ||
} | ||
case ImplicitAccountCreationRoute.FundConfirmation: { | ||
nextRoute = ImplicitAccountCreationRoute.AccountCreation | ||
break | ||
} | ||
case ImplicitAccountCreationRoute.AccountCreation: { | ||
get(implicitAccountCreationRouter).reset() | ||
return | ||
} | ||
} | ||
this.setNext(nextRoute) | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
packages/desktop/views/dashboard/wallet/implicit-account-creation.enum.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export enum ImplicitAccountCreationRoute { | ||
Init = 'init', | ||
OneTimeDeposit = 'OneTimeDeposit', | ||
FundConfirmation = 'FundConfirmation', | ||
AccountCreation = 'AccountCreation', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
export { default as Wallet } from './Wallet.svelte' | ||
|
||
export * from './implicit-account-creation-router' | ||
export * from './implicit-account-creation.enum' | ||
export * from './views' |
40 changes: 40 additions & 0 deletions
40
packages/desktop/views/dashboard/wallet/views/ImplicitAccountCreationView.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<script lang="ts"> | ||
import { implicitAccountCreationRoute, ImplicitAccountCreationRoute } from '../index' | ||
import { InitView, AccountCreationView, FundConfirmationView, OneTimeDepositView } from '.' | ||
import { Text, TextType } from 'shared/components' | ||
import { localize } from '@core/i18n' | ||
const IMPLICIT_ACCOUNT_STEPS = Object.keys(ImplicitAccountCreationRoute).slice(1) | ||
</script> | ||
|
||
<implicit-account-creation-view class="flex flex-col w-full h-full pt-5 px-60 pb-12 items-center justify-between"> | ||
<box-content class="flex flex-col w-full h-full pt-9 px-8 pb-12 items-center justify-between rounded-2xl"> | ||
<Text type={TextType.h2}>{localize('views.implicit-account-creation.title')}</Text> | ||
{#if $implicitAccountCreationRoute === ImplicitAccountCreationRoute.Init} | ||
<InitView /> | ||
{:else if $implicitAccountCreationRoute === ImplicitAccountCreationRoute.OneTimeDeposit} | ||
<OneTimeDepositView /> | ||
{:else if $implicitAccountCreationRoute === ImplicitAccountCreationRoute.FundConfirmation} | ||
<FundConfirmationView /> | ||
{:else if $implicitAccountCreationRoute === ImplicitAccountCreationRoute.AccountCreation} | ||
<AccountCreationView /> | ||
{/if} | ||
</box-content> | ||
{#if $implicitAccountCreationRoute !== ImplicitAccountCreationRoute.Init} | ||
<div class="flex flex-row justify-center space-x-2.5"> | ||
{#each IMPLICIT_ACCOUNT_STEPS as step} | ||
<div | ||
class="w-2.5 h-2.5 rounded-full {step === $implicitAccountCreationRoute | ||
? 'bg-blue-500' | ||
: 'bg-blue-200'}" | ||
/> | ||
{/each} | ||
</div> | ||
{/if} | ||
</implicit-account-creation-view> | ||
|
||
<style lang="scss"> | ||
box-content { | ||
box-shadow: 0px 1px 4px 0px rgba(23, 27, 37, 0.04); | ||
} | ||
</style> |
44 changes: 0 additions & 44 deletions
44
packages/desktop/views/dashboard/wallet/views/WalletMainView.svelte
This file was deleted.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
packages/desktop/views/dashboard/wallet/views/WalletView.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<script lang="ts"> | ||
import { AssetList, Overflow, Pane, ReceiveAddressButton } from '@ui' | ||
import { AccountSummary, AccountActivity, SendButton } from '@components' | ||
import { selectedWalletAssets } from '@core/wallet' | ||
import features from '@features/features' | ||
</script> | ||
|
||
<div class="h-full grid grid-cols-3 gap-x-4 min-h-0 min-w-0 max-w-7xl"> | ||
<div class="flex flex-col space-y-4"> | ||
<Pane overflow={Overflow.Visible}> | ||
{#if features?.wallet?.accountSummary?.enabled} | ||
<AccountSummary /> | ||
{/if} | ||
</Pane> | ||
<Pane> | ||
<div class="flex flex-col space-y-6"> | ||
{#if features?.wallet?.sendAndReceive?.enabled} | ||
<SendButton /> | ||
<ReceiveAddressButton /> | ||
{/if} | ||
</div> | ||
</Pane> | ||
</div> | ||
<Pane> | ||
{#if features?.wallet?.assets?.enabled} | ||
<AssetList assets={$selectedWalletAssets} /> | ||
{/if} | ||
</Pane> | ||
<Pane> | ||
{#if features?.wallet?.activityHistory?.enabled} | ||
<AccountActivity /> | ||
{/if} | ||
</Pane> | ||
</div> |
1 change: 1 addition & 0 deletions
1
...ews/dashboard/wallet/views/implicit-account-creation-multistep/AccountCreationView.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<h1>AccountCreation</h1> |
1 change: 1 addition & 0 deletions
1
...ws/dashboard/wallet/views/implicit-account-creation-multistep/FundConfirmationView.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<h1>FundConfirmation</h1> |
44 changes: 44 additions & 0 deletions
44
.../desktop/views/dashboard/wallet/views/implicit-account-creation-multistep/InitView.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<script lang="ts"> | ||
import { Button, FontWeight, Text, TextType } from 'shared/components' | ||
import { localize } from '@core/i18n' | ||
import { implicitAccountCreationRouter, ImplicitAccountCreationRoute } from '../../index' | ||
interface IStep { | ||
title: string | ||
description: string | ||
image: string | ||
} | ||
const NUMBER_OF_STEPS = Object.keys(ImplicitAccountCreationRoute).slice(1).length | ||
const MAIN_VIEW_STEPS: IStep[] = new Array(NUMBER_OF_STEPS).fill(null).map((_, index) => { | ||
const stepNumber = index + 1 | ||
return { | ||
title: localize(`views.implicit-account-creation.steps.step${stepNumber}.title`), | ||
description: localize(`views.implicit-account-creation.steps.step${stepNumber}.body`), | ||
image: `assets/illustrations/implicit-account-creation/step${stepNumber}.svg`, | ||
} | ||
}) | ||
function onContinueClick(): void { | ||
$implicitAccountCreationRouter.next() | ||
} | ||
</script> | ||
|
||
<steps-wrapper class="flex space-x-4"> | ||
{#each MAIN_VIEW_STEPS as step} | ||
<step-content class="flex flex-col items-center space-y-8"> | ||
<img src={step.image} alt={step.title} /> | ||
<div class="flex flex-col text-center px-4 space-y-2"> | ||
<Text | ||
type={TextType.h5} | ||
fontSize="15" | ||
color="blue-700" | ||
darkColor="blue-700" | ||
fontWeight={FontWeight.semibold}>{step.title}</Text | ||
> | ||
<Text type={TextType.h3} fontWeight={FontWeight.semibold}>{step.description}</Text> | ||
</div> | ||
</step-content> | ||
{/each} | ||
</steps-wrapper> | ||
<Button onClick={onContinueClick}>{localize('views.implicit-account-creation.action')}</Button> |
1 change: 1 addition & 0 deletions
1
...iews/dashboard/wallet/views/implicit-account-creation-multistep/OneTimeDepositView.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<h1>OneTimeDeposit</h1> |
4 changes: 4 additions & 0 deletions
4
packages/desktop/views/dashboard/wallet/views/implicit-account-creation-multistep/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export { default as OneTimeDepositView } from './OneTimeDepositView.svelte' | ||
export { default as FundConfirmationView } from './FundConfirmationView.svelte' | ||
export { default as AccountCreationView } from './AccountCreationView.svelte' | ||
export { default as InitView } from './InitView.svelte' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
export { default as WalletMainView } from './WalletMainView.svelte' | ||
export { default as ImplicitAccountCreationView } from './ImplicitAccountCreationView.svelte' | ||
export { default as WalletView } from './WalletView.svelte' | ||
|
||
export * from './implicit-account-creation-multistep' |
18 changes: 18 additions & 0 deletions
18
packages/shared/assets/illustrations/implicit-account-creation/step1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
packages/shared/assets/illustrations/implicit-account-creation/step2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.