Skip to content

Commit

Permalink
feat: add "copy profile system location" option to login view (#8162)
Browse files Browse the repository at this point in the history
Co-authored-by: Begoña Álvarez de la Cruz <balvarez@boxfish.studio>
  • Loading branch information
cpl121 and begonaalvarezd authored Mar 7, 2024
1 parent 7a81d6c commit 777578e
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
9 changes: 8 additions & 1 deletion packages/desktop/views/login/views/EnterPinView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import { loginRouter } from '@core/router'
import { isValidPin } from '@core/utils'
import features from '@features/features'
import { Icon, PinInput, Profile, Text, TextHint } from '@ui'
import { Icon, InitProfileActionsModal, MeatballMenuButton, Modal, PinInput, Profile, Text, TextHint } from '@ui'
import { TextHintVariant } from 'shared/components/enums'
import { onDestroy } from 'svelte'
Expand All @@ -35,6 +35,7 @@
let buttonText: string = getButtonText(timeRemainingBeforeNextAttempt)
let maxAttemptsTimer: ReturnType<typeof setTimeout> = null
let shakeTimeout: ReturnType<typeof setTimeout> = null
let modal: Modal
$: if (needsToAcceptLatestPrivacyPolicy() || needsToAcceptLatestTermsOfService()) {
openPopup({
Expand Down Expand Up @@ -150,6 +151,12 @@
<enter-pin-view class="block w-full h-full bg-white dark:bg-gray-900">
<div class="flex w-full h-full justify-center items-center">
<div class="w-96 flex flex-col flex-wrap items-center mb-20">
<div class="flex justify-end w-full">
<div class="max-h-7 max-w-9 overflow-visible relative">
<MeatballMenuButton onClick={modal?.toggle} />
<InitProfileActionsModal bind:modal />
</div>
</div>
<div class="flex flex-col gap-8 w-full items-center">
<Profile profile={$activeProfile} {updateRequired} />
{#if updateRequired}
Expand Down
30 changes: 30 additions & 0 deletions packages/shared/components/modals/InitProfileActionsModal.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<script lang="ts">
import { localize } from '@core/i18n'
import { Icon } from '@lib/auxiliary/icon'
import { MenuItem, Modal } from 'shared/components'
import { showAppNotification } from '@lib/auxiliary/notification'
import { setClipboard } from '@lib/core/utils'
import { activeProfile, getStorageDirectoryOfProfile } from '@lib/core/profile'
export let modal: Modal | undefined
async function handleCopyProfileSystemLocation(): Promise<void> {
const profileDirectory = await getStorageDirectoryOfProfile($activeProfile?.id)
setClipboard(profileDirectory, false)
showAppNotification({
type: 'info',
message: localize('general.copiedToClipboard'),
})
modal?.close()
}
</script>

<Modal bind:this={modal} {...$$restProps}>
<div class="flex flex-col">
<MenuItem
icon={Icon.Copy}
title={localize('actions.copyProfileSystemLocation')}
onClick={handleCopyProfileSystemLocation}
/>
</div>
</Modal>
1 change: 1 addition & 0 deletions packages/shared/components/modals/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export { default as AssetActionsModal } from './AssetActionsModal.svelte'
export { default as CollectibleActionsModal } from './CollectibleActionsModal.svelte'
export { default as Modal } from './Modal.svelte'
export { default as ProfileActionsModal } from './ProfileActionsModal.svelte'
export { default as InitProfileActionsModal } from './InitProfileActionsModal.svelte'
3 changes: 2 additions & 1 deletion packages/shared/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,8 @@
"revote": "Revote",
"skipAndKeep": "Skip and keep old password",
"addChain": "Add chain",
"viewVestingRewardsFinder": "Find vesting rewards"
"viewVestingRewardsFinder": "Find vesting rewards",
"copyProfileSystemLocation": "Copy profile system location"
},
"general": {
"recipient": "Recipient",
Expand Down

0 comments on commit 777578e

Please sign in to comment.