Skip to content
Merged
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
8 changes: 6 additions & 2 deletions packages/shared/components/Idle.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@
function handleEvent() {
clearTimeout(timeout)

timeout = setTimeout(lock, $activeProfile.settings.lockScreenTimeout * 60 * 1000)
if ($activeProfile) {
timeout = setTimeout(lock, $activeProfile.settings.lockScreenTimeout * 60 * 1000)
}
}

function lock() {
api.lockStronghold({
onSuccess() {
destroyActor($activeProfile.id)
if ($activeProfile) {
destroyActor($activeProfile.id)
}
resetWallet()
resetRouter()
},
Expand Down
18 changes: 18 additions & 0 deletions packages/shared/components/Spinner.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<script lang="typescript">
import { Icon, Text } from 'shared/components'

export let busy = false
export let message = ''
export let classes = ''
</script>

{#if busy || message}
<div class={`flex flex-row items-center ${classes}`}>
{#if busy}
<Icon icon="refresh" classes="animate-spin text-gray-500 dark:text-white" />
{/if}
{#if message}
<Text type="p" classes="ml-2" secondary>{message}</Text>
{/if}
</div>
{/if}
1 change: 1 addition & 0 deletions packages/shared/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export { default as SecurityTile } from './SecurityTile.svelte'
export { default as Idle } from './Idle.svelte'
export { default as ToastContainer } from './ToastContainer.svelte'
export { default as ProgressBar } from './ProgressBar.svelte'
export { default as Spinner } from './Spinner.svelte'

export * from './modals'
// Charts
Expand Down
1 change: 1 addition & 0 deletions packages/shared/components/inputs/Checkbox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<button
data-label="checkbox-input"
class={`flex items-center cursor-pointer ${classes}`}
type="button"
{disabled}
on:click={() => {
checked = !checked
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/components/inputs/Password.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
placeholder={placeholder || locale('general.password')}
{submitHandler}
/>
{#if showRevealToggle === true}
{#if showRevealToggle === true && !disabled}
<button type="button" on:click={() => revealToggle()} tabindex="-1" class="absolute top-3">
<Icon icon={revealed ? 'view' : 'hide'} classes="text-blue-500" />
</button>
Expand Down
60 changes: 60 additions & 0 deletions packages/shared/components/popups/DeleteProfile.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<script lang="typescript">
import { Button, Text } from 'shared/components'
import { Electron } from 'shared/lib/electron'
import { showAppNotification } from 'shared/lib/notifications'
import { closePopup } from 'shared/lib/popup'
import { activeProfile, removeProfile } from 'shared/lib/profile'
import { resetRouter } from 'shared/lib/router'
import { api, destroyActor, resetWallet } from 'shared/lib/wallet'
import { get } from 'svelte/store'

export let locale

let isBusy = false

function deleteProfile() {
isBusy = true
Electron.PincodeManager.remove(get(activeProfile).id).then((isRemoved) => {
if (!isRemoved) {
throw new Error('Something went wrong removing pincode entry.')
}

// Remove storage
api.removeStorage({
onSuccess(res) {
// Destroy wallet.rs actor for this profile
destroyActor($activeProfile.id)

resetWallet()
resetRouter()

// Remove profile from (local) storage
// Note: This should be the last step in the reset process.
// It should be done after the router is set back to default.
// Otherwise, parts of the application referencing $activeProfile will create an exception.
removeProfile($activeProfile.id)

isBusy = false
closePopup()
},
onError(err) {
isBusy = false
closePopup()
showAppNotification({
type: 'error',
message: locale(err.error),
})
},
})
})
}
</script>

<Text type="h4" classes="mb-5">{locale('popups.deleteProfile.title')}</Text>
<div class="w-full h-full mb-5">
<Text>{locale('popups.deleteProfile.confirmation')}</Text>
</div>
<div class="flex flex-row justify-between space-x-4 w-full px-8 ">
<Button secondary classes="w-1/2" onClick={() => closePopup()} disabled={isBusy}>{locale('actions.no')}</Button>
<Button disabled={isBusy} classes="w-1/2" onClick={() => deleteProfile()} warning>{locale('actions.yes')}</Button>
</div>
4 changes: 3 additions & 1 deletion packages/shared/components/popups/Index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import RemoveNode from './RemoveNode.svelte'
import Busy from './Busy.svelte'
import ErrorLog from './ErrorLog.svelte'
import DeleteProfile from './DeleteProfile.svelte'

export let locale = 'en'
export let type = undefined
Expand All @@ -30,7 +31,8 @@
addNode: AddNode,
removeNode: RemoveNode,
busy: Busy,
errorLog: ErrorLog
errorLog: ErrorLog,
deleteProfile: DeleteProfile
}

const onkey = (e) => {
Expand Down
17 changes: 16 additions & 1 deletion packages/shared/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,10 @@
"errorLog": {
"title": "Error Log",
"empty": "The error log is empty."
},
"deleteProfile": {
"title": "Delete profile",
"confirmation": "Are you sure you want to delete this profile, this operation cannot be undone?"
}
},
"charts": {
Expand Down Expand Up @@ -490,7 +494,18 @@
"transferBroadcasting": "Broadcasting transaction",
"transferComplete": "Transfer complete",
"creatingAccount": "Creating account, please wait...",
"updatingAccount": "Updating account, please wait..."
"updatingAccount": "Updating account, please wait...",
"accountSyncing": "Account is syncing",
"accountSyncComplete": "Account sync complete",
"passwordUpdating": "Updating password...",
"passwordSuccess": "Updated password successfully",
"passwordFailed": "Updating password failed",
"exportingStronghold": "Exporting stronghold...",
"exportingStrongholdSuccess": "Exported stronghold successfully",
"exportingStrongholdFailed": "Exported stronghold failed",
"pinCodeUpdating": "Updating PIN code...",
"pinCodeSuccess": "Updated PIN code successfully",
"pinCodeFailed": "Updating PIN code failed"
},
"dates": {
"today": "Today",
Expand Down
Loading