-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: hook logic in implicit account creation step 1 #7894
Merged
begonaalvarezd
merged 43 commits into
develop-iota2.0
from
feat/hook-implicit-account-logic-step1
Jan 18, 2024
Merged
Changes from 20 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
e7fb493
feat: add account to routes
evavirseda f59e885
feat: add to analytics featureflag
evavirseda d8318ab
feat: add account view and multistep
evavirseda ba6be6b
style: refinements
evavirseda 9de9319
feat: rename files and add locale
evavirseda 8cea0a2
feat: prepare UI step 1
evavirseda 4a19372
feat: add locales
evavirseda 0705215
fix: update naming
evavirseda 30a4b81
Merge branch 'feat/add-implicit-account-router' into feat/add-implici…
evavirseda af504e3
feat: update naming and improve code
evavirseda 8bf649d
Merge branch 'feat/add-implicit-account-creation-view' into feat/prep…
evavirseda 45b0306
fix: move comment
evavirseda 3390dc2
fix import
evavirseda ab1919a
Merge branch 'feat/add-implicit-account-router' into feat/add-implici…
evavirseda b796a74
feat: hook logic
evavirseda bf15770
fix: remove accountImplicit route and add to wallet tab
evavirseda 2d7273d
fix: improve naming
evavirseda 45a5ce6
Merge branch 'feat/add-implicit-account-router' into feat/add-implici…
evavirseda 607a1ac
Merge branch 'feat/add-implicit-account-creation-view' into feat/prep…
evavirseda 850562f
Merge branch 'feat/prepare-ui-step1' into feat/hook-implicit-account-…
evavirseda 784014c
Update packages/desktop/views/dashboard/wallet/Wallet.svelte
begonaalvarezd 3f0ab3c
Update packages/desktop/views/dashboard/wallet/Wallet.svelte
begonaalvarezd 1347de2
Merge branch 'feat/add-implicit-account-router' into feat/add-implici…
evavirseda 669d0af
Merge branch 'develop-iota2.0' into feat/add-implicit-account-creatio…
evavirseda 1970e9e
fix: add router
evavirseda 057c9f5
minor fixes
evavirseda ff906bf
Merge branch 'feat/add-implicit-account-creation-view' into feat/prep…
evavirseda e0e09c8
ix: add missing dots
evavirseda cba69c8
Merge branch 'feat/add-implicit-account-creation-view' into feat/prep…
evavirseda 84a527c
fix: colors
evavirseda 1016b96
fix: remove unnecessary function
evavirseda 3171553
fix: rename files
evavirseda f4a90f5
fix: move if/else and key block
evavirseda 9272310
fix: reset after finish
evavirseda e71e891
Merge branch 'feat/add-implicit-account-creation-view' into feat/prep…
evavirseda 98e9435
Merge branch 'develop-iota2.0' into feat/prepare-ui-step1
evavirseda 28912db
Merge branch 'feat/prepare-ui-step1' into feat/hook-implicit-account-…
evavirseda e1860d2
fix: undo changes
evavirseda f6758cb
feat: use implicitAccountCreationAddress
evavirseda af96600
fix: rename and remove onmount
evavirseda 74116e1
Merge branch 'develop-iota2.0' into feat/hook-implicit-account-logic-…
evavirseda 3f8c0ee
Merge branch 'develop-iota2.0' into feat/hook-implicit-account-logic-…
evavirseda d06b70e
Merge branch 'develop-iota2.0' into feat/hook-implicit-account-logic-…
evavirseda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,11 @@ | ||
<script lang="ts"> | ||
import { AssetList, Overflow, Pane, ReceiveAddressButton } from '@ui' | ||
import { AccountSummary, AccountActivity, SendButton } from '@components' | ||
import { selectedWalletAssets } from '@core/wallet' | ||
import { selectedWallet } from '@core/wallet/stores' | ||
import features from '@features/features' | ||
import { WalletImplicitAccountView, WalletMainView } from './views' | ||
|
||
const hasImplicitAccount: boolean = false | ||
</script> | ||
|
||
{#if $selectedWallet} | ||
<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" | ||
> | ||
{#key $selectedWallet?.index} | ||
<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> | ||
{/key} | ||
</wallet-container> | ||
{#if hasImplicitAccount} | ||
<WalletMainView /> | ||
{:else} | ||
<WalletImplicitAccountView /> | ||
{/if} |
63 changes: 63 additions & 0 deletions
63
packages/desktop/views/dashboard/wallet/views/WalletImplicitAccountView.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,63 @@ | ||
<script lang="ts"> | ||
import { Button, FontWeight, Text, TextType } from 'shared/components' | ||
import { MultiStep } from './multi-step' | ||
import { localize } from '@core/i18n' | ||
|
||
interface IStep { | ||
title: string | ||
description: string | ||
image: string | ||
} | ||
|
||
const NUMBER_OF_STEPS = Object.keys(localize('views.implicit-account-creation.steps')).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`, | ||
} | ||
}) | ||
|
||
let startProccess = false | ||
|
||
function startMultiStepProccess(): void { | ||
startProccess = true | ||
} | ||
</script> | ||
|
||
<section 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 items-center justify-between rounded-2xl"> | ||
<Text type={TextType.h2}>{localize('views.implicit-account-creation.title')}</Text> | ||
{#if !startProccess} | ||
<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={startMultiStepProccess} classes="mb-12" | ||
>{localize('views.implicit-account-creation.action')}</Button | ||
> | ||
{:else} | ||
<MultiStep /> | ||
{/if} | ||
</box-content> | ||
</section> | ||
|
||
<style lang="scss"> | ||
box-content { | ||
box-shadow: 0px 1px 4px 0px rgba(23, 27, 37, 0.04); | ||
} | ||
</style> |
44 changes: 44 additions & 0 deletions
44
packages/desktop/views/dashboard/wallet/views/WalletMainView.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 { AssetList, Overflow, Pane, ReceiveAddressButton } from '@ui' | ||
import { AccountSummary, AccountActivity, SendButton } from '@components' | ||
import { selectedWalletAssets } from '@core/wallet' | ||
import { selectedWallet } from '@core/wallet/stores' | ||
import features from '@features/features' | ||
</script> | ||
|
||
{#if $selectedWallet} | ||
<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" | ||
> | ||
{#key $selectedWallet?.index} | ||
<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> | ||
{/key} | ||
</wallet-container> | ||
{/if} |
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,2 @@ | ||
export { default as WalletMainView } from './WalletMainView.svelte' | ||
export { default as WalletImplicitAccountView } from './WalletImplicitAccountView.svelte' |
1 change: 1 addition & 0 deletions
1
packages/desktop/views/dashboard/wallet/views/multi-step/AccountCreation.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
packages/desktop/views/dashboard/wallet/views/multi-step/FundConfirmation.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> |
37 changes: 37 additions & 0 deletions
37
packages/desktop/views/dashboard/wallet/views/multi-step/MultiStep.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,37 @@ | ||
<script lang="ts"> | ||
import { ImplicitAccountCreationState } from '@contexts/implicit-account-creation' | ||
|
||
const IMPLICIT_ACCOUNT_STEPS: ImplicitAccountCreationState[] = Object.values(ImplicitAccountCreationState) | ||
|
||
let activeState: ImplicitAccountCreationState | null = null | ||
let onNext: () => Promise<boolean> | ||
let currentStep: number = 0 | ||
let activeComponent | ||
|
||
async function loadComponent() { | ||
activeState = IMPLICIT_ACCOUNT_STEPS[currentStep] | ||
const component = await import(`./${activeState}.svelte`) | ||
activeComponent = component.default | ||
} | ||
|
||
async function handleNext() { | ||
currentStep += 1 | ||
await loadComponent() | ||
} | ||
|
||
$: loadComponent() | ||
</script> | ||
|
||
{#if activeComponent} | ||
<svelte:component this={activeComponent} {activeState} {onNext} /> | ||
<!-- TODO: Remove this button, it's just to allow go to next step --> | ||
{#if currentStep < IMPLICIT_ACCOUNT_STEPS.length - 1} | ||
<button on:click={handleNext}>Next</button> | ||
{/if} | ||
<!-- Dots to show progress --> | ||
<div class="flex flex-row justify-center space-x-2.5"> | ||
{#each IMPLICIT_ACCOUNT_STEPS as step, index} | ||
<div class="w-2.5 h-2.5 rounded-full {activeState === step ? 'bg-blue-500' : 'bg-blue-200'}" /> | ||
{/each} | ||
</div> | ||
{/if} |
70 changes: 70 additions & 0 deletions
70
packages/desktop/views/dashboard/wallet/views/multi-step/OneTimeDeposit.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,70 @@ | ||
<script lang="ts"> | ||
import { Button, FontWeight, Text, TextType } from 'shared/components' | ||
import { localize } from '@core/i18n' | ||
import { setClipboard } from '@core/utils' | ||
import { selectedWallet } from '@core/wallet' | ||
|
||
let isAddressShown: boolean = false | ||
let depositAddress: string = '' | ||
|
||
$: depositAddress = $selectedWallet?.depositAddress | ||
|
||
function showAddress() { | ||
isAddressShown = true | ||
} | ||
|
||
function onCopyClick(): void { | ||
setClipboard(depositAddress) | ||
} | ||
</script> | ||
|
||
<step-content class="flex flex-col items-center justify-center space-y-20 h-full"> | ||
<div class="flex flex-col text-center px-4 space-y-4 max-w-md"> | ||
<div class="flex items-center justify-center"> | ||
<img | ||
src="assets/illustrations/implicit-account/show-one-time-address.svg" | ||
alt={localize('views.implicit-account-creation.steps.step1.title')} | ||
/> | ||
</div> | ||
<Text type={TextType.h3} fontWeight={FontWeight.semibold} | ||
>{localize('views.implicit-account-creation.steps.step1.view.title')}</Text | ||
> | ||
<Text type={TextType.h5} fontSize="15" color="blue-700" darkColor="blue-700" fontWeight={FontWeight.semibold} | ||
>{localize('views.implicit-account-creation.steps.step1.view.subtitle')}</Text | ||
> | ||
<Text type={TextType.h5} fontWeight={FontWeight.normal} color="gray-700" darkColor="gray-500" | ||
>{localize('views.implicit-account-creation.steps.step1.view.body')}</Text | ||
> | ||
</div> | ||
{#if !isAddressShown} | ||
<div class="flex flex-row items-center space-x-24 bg-yellow-200 rounded-lg px-6 py-7 max-w-lg mb-5"> | ||
<Text type={TextType.h4} fontWeight={FontWeight.medium} color="yellow-900" darkColor="yellow-900" | ||
>{localize('views.implicit-account-creation.steps.step1.view.hiddenAddress.description')}</Text | ||
> | ||
<Button onClick={showAddress} classes="shrink-0" | ||
>{localize('views.implicit-account-creation.steps.step1.view.hiddenAddress.action')}</Button | ||
> | ||
</div> | ||
{:else} | ||
<div class="flex flex-col justify-center items-center space-y-3"> | ||
<div | ||
class="flex flex-row items-center space-x-20 bg-gray-100 dark:bg-gray-800 rounded-lg px-6 py-4 max-w-lg" | ||
> | ||
<div class="flex flex-col space-y-1"> | ||
<Text type={TextType.h5} fontWeight={FontWeight.normal} darkColor="gray-400" | ||
>{localize('views.implicit-account-creation.steps.step1.view.oneTimeAddress.title')}</Text | ||
> | ||
<Text type={TextType.pre} fontSize="14" fontWeight={FontWeight.medium} color="gray-50" | ||
>{depositAddress}</Text | ||
> | ||
</div> | ||
<Button outline onClick={onCopyClick} classes="shrink-0" | ||
>{localize('views.implicit-account-creation.steps.step1.view.oneTimeAddress.action')}</Button | ||
> | ||
</div> | ||
<Text type={TextType.h5} fontWeight={FontWeight.normal} color="red-600" darkColor="red-600" | ||
>{localize('views.implicit-account-creation.steps.step1.view.oneTimeAddress.tip')}</Text | ||
> | ||
</div> | ||
{/if} | ||
</step-content> |
4 changes: 4 additions & 0 deletions
4
packages/desktop/views/dashboard/wallet/views/multi-step/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 OneTimeDeposit } from './OneTimeDeposit.svelte' | ||
export { default as FundConfirmation } from './FundConfirmation.svelte' | ||
export { default as AccountCreation } from './AccountCreation.svelte' | ||
export { default as MultiStep } from './MultiStep.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
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the one time deposit address is not the deposit address but the
implicit account address