Skip to content

Commit f35309e

Browse files
author
cpl121
committed
refactor: login WIP
1 parent f7cfffb commit f35309e

File tree

66 files changed

+269
-283
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+269
-283
lines changed

packages/desktop/components/modals/WalletActionsMenu.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// $selectedWallet?.id === $activeWallets?.length - 1 && $visibleActiveWallets?.length > 1
2121
2222
function onCustomiseAccountClick(): void {
23-
openPopup({ id: PopupId.ManageAccount })
23+
openPopup({ id: PopupId.ManageWallet })
2424
modal?.close()
2525
}
2626

packages/desktop/components/popups/AddNodePopup.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import { showAppNotification } from '@auxiliary/notification'
66
import { closePopup } from '@auxiliary/popup'
77
import { Platform } from '@core/app'
8-
import { activeAccounts, activeProfile } from '@core/profile'
8+
import { activeWallets, activeProfile } from '@core/profile'
99
import { registerProposalsForAccounts } from '@contexts/governance'
1010
1111
export let node: INode = structuredClone(EMPTY_NODE)
@@ -33,7 +33,7 @@
3333
}
3434
3535
if (Platform.isFeatureFlagEnabled('governance')) {
36-
await registerProposalsForAccounts({ node }, $activeAccounts)
36+
await registerProposalsForAccounts({ node }, $activeWallets)
3737
}
3838
3939
onSuccess()

packages/desktop/components/popups/AddProposalPopup.svelte

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<script lang="ts">
22
import { showAppNotification } from '@auxiliary/notification/actions'
33
import { closePopup, openPopup, PopupId } from '@auxiliary/popup'
4-
import { registerProposalsForAccounts, registeredProposalsForSelectedWallet } from '@contexts/governance'
4+
import { registerProposalsForWallets, registeredProposalsForSelectedWallet } from '@contexts/governance'
55
import { selectedWallet } from '@core/wallet'
66
import { handleError } from '@core/error/handlers/handleError'
77
import { localize } from '@core/i18n'
8-
import { activeAccounts, updateActiveAccountPersistedData } from '@core/profile'
8+
import { activeWallets, updateActiveWalletPersistedData } from '@core/profile'
99
import { truncateString } from '@core/utils/string'
1010
import type { Auth } from '@iota/sdk/out/types'
1111
import { Button, Checkbox, NodeInput, Text, TextInput, TextType } from 'shared/components'
@@ -21,7 +21,7 @@
2121
let nodeInputError: string
2222
let isBusy = false
2323
let isRegisteringAllProposals = false
24-
let isAddingForAllAccounts = false
24+
let isAddingForAllWallets = false
2525
2626
$: isEditMode = !!initialEventId && !!initialNodeUrl
2727
$: disabled = isBusy || !nodeUrl || (!isRegisteringAllProposals && !eventId)
@@ -35,11 +35,11 @@
3535
try {
3636
isBusy = true
3737
await Promise.all([
38-
!isRegisteringAllProposals && validateEventId(!isAddingForAllAccounts && !isEditMode),
38+
!isRegisteringAllProposals && validateEventId(!isAddingForAllWallets && !isEditMode),
3939
nodeInput?.validate(),
4040
])
4141
await registerParticipationWrapper()
42-
updateActiveAccountPersistedData($selectedWallet.id, {
42+
updateActiveWalletPersistedData($selectedWallet.id, {
4343
removedProposalIds: $selectedWallet.removedProposalIds?.filter((id) => id !== inputtedEventId),
4444
})
4545
isBusy = false
@@ -82,8 +82,8 @@
8282
node: { url: nodeUrl, auth },
8383
eventsToRegister: isRegisteringAllProposals ? [] : [eventId],
8484
}
85-
const accounts = isAddingForAllAccounts ? $activeAccounts : [$selectedWallet]
86-
await registerProposalsForAccounts(options, accounts)
85+
const wallets = isAddingForAllWallets ? $activeWallets : [$selectedWallet]
86+
await registerProposalsForWallets(options, wallets)
8787
showAppNotification({
8888
type: 'success',
8989
message: generateSuccessMessage(),
@@ -96,7 +96,7 @@
9696
if (isEditMode) {
9797
return localize('views.governance.proposals.successEdit')
9898
} else {
99-
return localize(`views.governance.proposals.${isAddingForAllAccounts ? 'successAddAll' : 'successAdd'}`, {
99+
return localize(`views.governance.proposals.${isAddingForAllWallets ? 'successAddAll' : 'successAdd'}`, {
100100
values: { numberOfProposals: isRegisteringAllProposals ? 'other' : 'one' },
101101
})
102102
}
@@ -139,7 +139,7 @@
139139
label={localize('views.governance.details.proposalInformation.eventId')}
140140
/>
141141
{#if !isEditMode}
142-
<Checkbox label={localize('popups.addProposal.addToAllAccounts')} bind:checked={isAddingForAllAccounts} />
142+
<Checkbox label={localize('popups.addProposal.addToAllAccounts')} bind:checked={isAddingForAllWallets} />
143143
{/if}
144144
</div>
145145
<div class="flex w-full space-x-4 mt-6">

packages/desktop/components/popups/CreateWalletPopup.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<Input
7474
{error}
7575
bind:value={accountAlias}
76-
placeholder={localize('general.accountName')}
76+
placeholder={localize('general.walletName')}
7777
autofocus
7878
submitHandler={onCreateClick}
7979
disabled={isBusy}

packages/desktop/components/popups/ManageAccountPopup.svelte renamed to packages/desktop/components/popups/ManageWalletPopup.svelte

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
11
<script lang="ts">
22
import { closePopup } from '@auxiliary/popup'
33
import { localize } from '@core/i18n'
4-
import { updateActiveAccountPersistedData } from '@core/profile/actions'
4+
import { updateActiveWalletPersistedData } from '@core/profile/actions'
55
import { getTrimmedLength } from '@core/utils'
66
import { selectedWallet, validateWalletName } from '@core/wallet'
77
import { Button, ColorPicker, Input, Text, TextType } from '@ui'
88
99
export let error = ''
1010
1111
let isBusy = false
12-
let accountAlias = $selectedWallet.name
12+
let walletAlias = $selectedWallet.name
1313
let color = $selectedWallet.color
1414
15-
$: accountAlias, (error = '')
16-
$: trimmedAccountAlias = accountAlias.trim()
17-
$: invalidAliasUpdate = !getTrimmedLength(accountAlias) || isBusy || accountAlias === $selectedWallet.name
15+
$: walletAlias, (error = '')
16+
$: trimmedWalletAlias = walletAlias.trim()
17+
$: invalidAliasUpdate = !getTrimmedLength(walletAlias) || isBusy || walletAlias === $selectedWallet.name
1818
$: hasColorChanged = $selectedWallet.color !== color
1919
2020
async function onSaveClick(): Promise<void> {
21-
if (trimmedAccountAlias) {
21+
if (trimmedWalletAlias) {
2222
error = ''
2323
try {
24-
await validateWalletName(trimmedAccountAlias, true, trimmedAccountAlias !== $selectedWallet.name)
24+
await validateWalletName(trimmedWalletAlias, true, trimmedWalletAlias !== $selectedWallet.name)
2525
} catch ({ message }) {
2626
error = message
2727
return
2828
}
2929
3030
isBusy = true
31-
saveAccountPersistedData()
31+
saveWalletPersistedData()
3232
}
3333
}
3434
3535
function onCancelClick(): void {
3636
closePopup()
3737
}
3838
39-
function saveAccountPersistedData(): void {
39+
function saveWalletPersistedData(): void {
4040
try {
41-
if (trimmedAccountAlias || color) {
42-
updateActiveAccountPersistedData($selectedWallet?.id, { name: trimmedAccountAlias, color })
41+
if (trimmedWalletAlias || color) {
42+
updateActiveWalletPersistedData($selectedWallet?.id, { name: trimmedWalletAlias, color })
4343
closePopup()
4444
}
4545
} finally {
@@ -51,13 +51,13 @@
5151
<manage-account-popup class="flex flex-col h-full justify-between space-y-4">
5252
<div>
5353
<title-container class="flex flex-row mb-6">
54-
<Text type={TextType.h5}>{localize('general.manageAccount')}</Text>
54+
<Text type={TextType.h5}>{localize('general.manageWallet')}</Text>
5555
</title-container>
5656
<manage-account-popup-inputs class="w-full flex flex-col justify-between space-y-4">
5757
<Input
5858
{error}
59-
bind:value={accountAlias}
60-
placeholder={localize('general.accountName')}
59+
bind:value={walletAlias}
60+
placeholder={localize('general.walletName')}
6161
autofocus
6262
submitHandler={onSaveClick}
6363
disabled={isBusy}

packages/desktop/components/popups/Popup.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import LedgerAppGuidePopup from './LedgerAppGuidePopup.svelte'
3131
import LedgerConnectionGuidePopup from './LedgerConnectionGuidePopup.svelte'
3232
import LegalUpdatePopup from './LegalUpdatePopup.svelte'
33-
import ManageAccountPopup from './ManageAccountPopup.svelte'
33+
import ManageWalletPopup from './ManageWalletPopup.svelte'
3434
import ManageVotingPowerPopup from './ManageVotingPowerPopup.svelte'
3535
import MintNativeTokenConfirmationPopup from './MintNativeTokenConfirmationPopup.svelte'
3636
import MintNativeTokenFormPopup from './MintNativeTokenFormPopup.svelte'
@@ -79,7 +79,7 @@
7979
$: switch (id) {
8080
case PopupId.ConnectLedger:
8181
case PopupId.createWallet:
82-
case PopupId.ManageAccount:
82+
case PopupId.ManageWallet:
8383
size = PopupSize.Small
8484
break
8585
case PopupId.LedgerAppGuide:
@@ -116,7 +116,7 @@
116116
[PopupId.LedgerAppGuide]: LedgerAppGuidePopup,
117117
[PopupId.LedgerConnection]: LedgerConnectionGuidePopup,
118118
[PopupId.LegalUpdate]: LegalUpdatePopup,
119-
[PopupId.ManageAccount]: ManageAccountPopup,
119+
[PopupId.ManageWallet]: ManageWalletPopup,
120120
[PopupId.ManageVotingPower]: ManageVotingPowerPopup,
121121
[PopupId.MetricSystemInfo]: MetricSystemInfoPopup,
122122
[PopupId.MintNativeTokenConfirmation]: MintNativeTokenConfirmationPopup,

packages/desktop/components/popups/RemoveProposalPopup.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import { selectedWallet } from '@core/wallet/stores'
1212
import { handleError } from '@core/error/handlers'
1313
import { localize } from '@core/i18n'
14-
import { updateActiveAccountPersistedData } from '@core/profile/actions'
14+
import { updateActiveWalletPersistedData } from '@core/profile/actions'
1515
import { governanceRouter } from '@core/router'
1616
import { Button, Text, TextHint, TextType } from 'shared/components'
1717
import { ButtonVariant, TextHintVariant } from 'shared/components/enums'
@@ -23,7 +23,7 @@
2323
async function onConfirmClick(): Promise<void> {
2424
try {
2525
await $selectedWallet.deregisterParticipationEvent($selectedProposalId)
26-
updateActiveAccountPersistedData($selectedWallet.id, {
26+
updateActiveWalletPersistedData($selectedWallet.id, {
2727
removedProposalIds: [...($selectedWallet.removedProposalIds ?? []), $selectedProposalId],
2828
})
2929
$governanceRouter.previous()

packages/desktop/views/login/views/SelectProfileView.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
async function onAddProfileClick(): Promise<void> {
3232
onboardingRouter.set(new OnboardingRouter())
3333
await initialiseOnboardingProfile(shouldBeDeveloperProfile())
34-
console.log("shuld be created")
3534
$routerManager.goToAppContext(AppContext.Onboarding)
3635
}
3736

packages/desktop/views/onboarding/views/complete-onboarding/views/FinishOnboardingView.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
}
2929
3030
async function _continue(): Promise<void> {
31-
console.log($onboardingProfile)
3231
// Note: needed to cover the cases where the user has waited so long that the stronghold is locked
3332
if ($onboardingProfile?.restoreProfileType === RestoreProfileType.Stronghold) {
3433
await setStrongholdPassword($onboardingProfile.strongholdPassword)

packages/desktop/views/onboarding/views/create-profile/views/ChooseCreateProfileFlowView.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
const type = createProfileType === CreateProfileType.Ledger ? ProfileType.Ledger : ProfileType.Software
2929
const storagePath = await getStorageDirectoryOfProfile($onboardingProfile.id)
3030
const secretManagerOptions = getSecretManagerFromProfileType(type, storagePath)
31-
console.log("secretManagerOptions", secretManagerOptions)
3231
updateOnboardingProfile({ createProfileType, type, secretManagerOptions })
3332
$createProfileRouter.next()
3433
}

packages/shared/components/ColorPicker.svelte

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,28 @@
99
export let active: string = ''
1010
export let isCustomColorEnabled: boolean = false
1111
12-
const accountColors = Object.values(WalletColors).filter((c) => /[#]/.test(c as string))
13-
const activeAccountColorIndex = accountColors.findIndex((_, i) => accountColors[i] === active)
12+
const walletColors = Object.values(WalletColors).filter((c) => /[#]/.test(c as string))
13+
const activeWalletColorIndex = walletColors.findIndex((_, i) => walletColors[i] === active)
1414
15-
let indexOfActiveElement = activeAccountColorIndex >= 0 ? activeAccountColorIndex : accountColors.length
15+
let indexOfActiveElement = activeWalletColorIndex >= 0 ? activeWalletColorIndex : walletColors.length
1616
let cachedColor = '#000000'
17-
let inputValue: string = activeAccountColorIndex >= 0 ? cachedColor : active
17+
let inputValue: string = activeWalletColorIndex >= 0 ? cachedColor : active
1818
let iconColor = ''
1919
let isTooltipVisible = false
2020
let tooltipAnchor: HTMLElement
2121
2222
$: inputValue = `#${/[0-9|a-f|A-F]+/.exec(inputValue) || ''}`
23-
$: isSelectedCustomElement = indexOfActiveElement === accountColors.length
23+
$: isSelectedCustomElement = indexOfActiveElement === walletColors.length
2424
2525
$: {
26-
if (indexOfActiveElement === accountColors.length) {
26+
if (indexOfActiveElement === walletColors.length) {
2727
active === cachedColor
2828
}
2929
30-
if (indexOfActiveElement === accountColors.length) {
30+
if (indexOfActiveElement === walletColors.length) {
3131
active = inputValue.length === 7 || inputValue.length === 4 ? inputValue : cachedColor
3232
} else {
33-
active = accountColors?.[indexOfActiveElement]?.toString()
33+
active = walletColors?.[indexOfActiveElement]?.toString()
3434
}
3535
3636
if (inputValue.length) {
@@ -52,7 +52,7 @@
5252
5353
function onColorClick(index: number): void {
5454
indexOfActiveElement = index
55-
if (index !== accountColors.length) {
55+
if (index !== walletColors.length) {
5656
isTooltipVisible = false
5757
}
5858
}
@@ -68,7 +68,7 @@
6868
function activeCustomColor(event: KeyboardEvent | MouseEvent): void {
6969
const isEnterKeyPressed = event.type === 'keypress' && (event as KeyboardEvent).key === 'Enter'
7070
if (event.type === 'click' || isEnterKeyPressed) {
71-
indexOfActiveElement = accountColors.length
71+
indexOfActiveElement = walletColors.length
7272
}
7373
}
7474

packages/shared/components/menu-items/ToggleHiddenAccountMenuItem.svelte

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
<script lang="ts">
22
import { selectedWallet, setNextSelectedWallet } from '@core/wallet'
33
import { localize } from '@core/i18n'
4-
import { activeProfile, nonHiddenActiveWallets } from '@core/profile'
5-
import { updateActiveAccountPersistedData } from '@core/profile/actions'
4+
import { activeProfile, nonHiddenActiveWallets, updateActiveWalletPersistedData } from '@core/profile'
65
import { Icon } from '@lib/auxiliary/icon'
76
import { MenuItem } from '@ui'
87
98
export let onClick: () => unknown
109
1110
function onShowAccountClick(): void {
1211
if ($selectedWallet) {
13-
updateActiveAccountPersistedData($selectedWallet.id, { hidden: false })
12+
updateActiveWalletPersistedData($selectedWallet.id, { hidden: false })
1413
onClick && onClick()
1514
}
1615
}
1716
1817
function onHideAccountClick(): void {
1918
if ($nonHiddenActiveWallets.length > 1) {
2019
if ($selectedWallet) {
21-
updateActiveAccountPersistedData($selectedWallet.id, { hidden: true })
20+
updateActiveWalletPersistedData($selectedWallet.id, { hidden: true })
2221
if (!$activeProfile.showHiddenAccounts) {
2322
setNextSelectedWallet()
2423
}

packages/shared/lib/auxiliary/deep-link/handlers/handleDeepLink.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { get } from 'svelte/store'
22

33
import { closePopup, openPopup, PopupId } from '@auxiliary/popup'
4-
import { visibleActiveAccounts } from '@core/profile/stores'
4+
import { visibleActiveWallets } from '@core/profile/stores'
55
import { dashboardRouter } from '@core/router/routers'
66
import { DashboardRoute } from '@core/router/enums'
77

@@ -33,7 +33,7 @@ export function handleDeepLink(input: string): void {
3333
throw new Error(`Does not start with ${process.env.APP_PROTOCOL}://`)
3434
}
3535

36-
if (get(visibleActiveAccounts).length > 1) {
36+
if (get(visibleActiveWallets).length > 1) {
3737
openPopup({
3838
id: PopupId.AccountSwitcher,
3939
overflow: true,

packages/shared/lib/auxiliary/popup/enums/popup-id.enum.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export enum PopupId {
2222
LedgerAppGuide = 'ledgerAppGuide',
2323
LedgerConnection = 'ledgerConnection',
2424
LegalUpdate = 'legalUpdate',
25-
ManageAccount = 'manageAccount',
25+
ManageWallet = 'manageWallet',
2626
ManageVotingPower = 'manageVotingPower',
2727
MetricSystemInfo = 'metricSystemInfo',
2828
MintNativeTokenConfirmation = 'mintNativeTokenConfirmation',

packages/shared/lib/contexts/governance/actions/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export * from './initializeParticipationOverviews'
55
export * from './initializeRegisteredProposals'
66
export * from './pollParticipationEventStatus'
77
export * from './registerParticipationEvents'
8-
export * from './registerProposalsForAccounts'
8+
export * from './registerProposalsForWallets'
99
export * from './registerProposalsFromNodes'
1010
export * from './setVotingPower'
1111
export * from './stopVotingForProposal'
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import { activeAccounts } from '@core/profile'
1+
import { activeWallets } from '@core/profile'
22
import { ParticipationOverview } from '@iota/sdk/out/types'
33
import { get } from 'svelte/store'
44
import { DEFAULT_PARTICIPATION_OVERVIEW } from '../constants'
55
import { allParticipationOverviews } from '../stores'
66

77
export async function initializeParticipationOverviews(): Promise<void> {
8-
const allOverviews: { [accountId: number]: ParticipationOverview } = {}
8+
const allOverviews: { [walletId: string]: ParticipationOverview } = {}
99

10-
for (const account of get(activeAccounts)) {
11-
const overview = await account.getParticipationOverview()
12-
allOverviews[account.index] = overview ?? DEFAULT_PARTICIPATION_OVERVIEW
10+
for (const wallet of get(activeWallets)) {
11+
const overview = await wallet.getParticipationOverview()
12+
allOverviews[wallet.id] = overview ?? DEFAULT_PARTICIPATION_OVERVIEW
1313
}
1414
allParticipationOverviews.set(allOverviews)
1515
}

packages/shared/lib/contexts/governance/actions/registerProposalsForAccounts.ts renamed to packages/shared/lib/contexts/governance/actions/registerProposalsForWallets.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { IWalletState } from '@core/wallet/interfaces'
44

55
import { registerParticipationEvents } from './registerParticipationEvents'
66

7-
export async function registerProposalsForAccounts(
7+
export async function registerProposalsForWallets(
88
registrationOptions: ParticipationEventRegistrationOptions,
9-
accounts: IWalletState[]
9+
wallets: IWalletState[]
1010
): Promise<void> {
11-
await Promise.all(accounts.map((account) => registerParticipationEvents(registrationOptions, account)))
11+
await Promise.all(wallets.map((wallet) => registerParticipationEvents(registrationOptions, wallet)))
1212
}

0 commit comments

Comments
 (0)