-
Notifications
You must be signed in to change notification settings - Fork 176
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: add backup page #594
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,125 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<template> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div class="backup-detected"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<h3>Found backup</h3> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div class="backup-detected__backups"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<h4>Please choose a backup to use:</h4> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div class="backup-detected__backup-items-container"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
v-for="backup in backups" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
:key="backup" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
@click="selectBackup(backup)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
:class="[ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{ selected: selectedBackup === backup }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
'backup-detected__backup-item', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
]" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{{ backup }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</a> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+8
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Improve accessibility for backup selection The backup selection UI needs accessibility improvements:
- <a
+ <button
+ type="button"
+ role="option"
+ :aria-selected="selectedBackup === backup"
v-for="backup in backups"
:key="backup"
@click="selectBackup(backup)"
:class="[
{ selected: selectedBackup === backup },
'backup-detected__backup-item',
]"
>
{{ backup }}
- </a>
+ </button> 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<base-button title="Use backup" :disabled="disabled" :click="useBackup" /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<base-button | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
style="margin-top: 10px" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
no-background | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
title="Skip" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
:click="skip" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</template> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<script setup lang="ts"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import BaseButton from '@action/components/base-button/index.vue'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { computed, ref } from 'vue'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const selectedBackup = ref(''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const disabled = computed(() => !selectedBackup.value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const backups = ['Backup 1', 'Backup 2', 'Backup 3']; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace hardcoded backup list The backups array is hardcoded with test values. This needs to be replaced with actual backup data. -const backups = ['Backup 1', 'Backup 2', 'Backup 3'];
+// TODO: Implement actual backup retrieval
+const backups = ref<string[]>([]);
+onMounted(async () => {
+ // Add actual backup retrieval logic
+ backups.value = await getAvailableBackups();
+});
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const selectBackup = (backup: string) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (selectedBackup.value === backup) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
selectedBackup.value = ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
selectedBackup.value = backup; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const useBackup = () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// replace with actual functionality | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
window.close(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const skip = () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
window.close(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+45
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implement proper navigation instead of window.close() Using -const useBackup = () => {
- // replace with actual functionality
- window.close();
-};
-
-const skip = () => {
- window.close();
-};
+const router = useRouter();
+const useBackup = async () => {
+ try {
+ // Add actual backup restoration logic
+ await restoreFromBackup(selectedBackup.value);
+ router.push({ name: routes.walletReady.name });
+ } catch (error) {
+ // Handle backup restoration error
+ console.error('Failed to restore backup:', error);
+ }
+};
+
+const skip = () => {
+ router.push({ name: routes.walletReady.name });
+};
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</script> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<style lang="less"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
@import '@action/styles/theme.less'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.selected { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
background: @default; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
border-radius: 10px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.backup-detected { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
width: 100%; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
&__logo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
margin-bottom: 24px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
h3 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
font-style: normal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
font-weight: 700; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
font-size: 34px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
line-height: 40px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
letter-spacing: 0.25px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
color: @primaryLabel; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
margin: 0 0 24px 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
h4 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
font-style: normal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
font-weight: 400; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
font-size: 18px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
line-height: 24px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
color: @secondaryLabel; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
margin: 0 0 8px 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
&__backup-items-container { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
height: 150px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
&__backup-item { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
height: 50px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
padding: 0 16px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
display: flex; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
font-size: 16px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
align-items: center; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
justify-content: center; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
&__backups { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
margin-bottom: 24px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
h4 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
font-style: normal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
font-weight: 400; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
font-size: 16px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
line-height: 24px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
color: @secondaryLabel; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
margin: 0 0 8px 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
&-wrap { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
display: flex; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flex-direction: row; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
align-items: center; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
justify-content: flex-start; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
a { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
display: block; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
margin-right: 24px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</style> |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -45,7 +45,7 @@ const nextAction = () => { | |||||||||||||||||||||||||||||||||||||||||||||||
onboardInitializeWallets(store.mnemonic, store.password).then(() => { | ||||||||||||||||||||||||||||||||||||||||||||||||
isInitializing.value = false; | ||||||||||||||||||||||||||||||||||||||||||||||||
router.push({ | ||||||||||||||||||||||||||||||||||||||||||||||||
name: routes.walletReady.name, | ||||||||||||||||||||||||||||||||||||||||||||||||
name: routes.backupDetected.name, | ||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
46
to
50
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add error handling for wallet initialization The wallet initialization process lacks error handling. If initialization fails, the user might be stuck in a broken state. Consider this implementation: const nextAction = () => {
if (!isDisabled.value) {
isInitializing.value = true;
- onboardInitializeWallets(store.mnemonic, store.password).then(() => {
- isInitializing.value = false;
- router.push({
- name: routes.backupDetected.name,
- });
- });
+ onboardInitializeWallets(store.mnemonic, store.password)
+ .then(() => {
+ isInitializing.value = false;
+ router.push({
+ name: routes.backupDetected.name,
+ });
+ })
+ .catch((error) => {
+ isInitializing.value = false;
+ // Handle initialization error (e.g., show error message)
+ console.error('Wallet initialization failed:', error);
+ });
}
}; 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
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.
💡 Codebase verification
Confirmed: Backup detection should not have the 'ready' visual treatment
The backup detection screen is an interactive selection step where users choose from available backups, not a completion state. The 'ready' styling (no background/shadow) should be reserved for actual completion states like 'wallet-ready' which also show the "Pin the extension" instructions.
🔗 Analysis chain
Verify if backup detection should have the same visual treatment as completion states.
The
onboard__wrap--ready
class is typically used for completion states (it removes background and box-shadow). However, based on the PR description, the backup detection route is for selecting and using a backup, which seems like an intermediate step rather than a completion state.This might lead to inconsistent user experience as users might perceive it as a final step when it's actually a selection step.
Consider keeping the standard visual treatment for the backup detection step to maintain consistent UX patterns throughout the onboarding flow.
🏁 Scripts executed
The following scripts were executed for the analysis:
Error: No shell scripts found
Script:
Length of output: 229
Script:
Length of output: 1499
Script:
Length of output: 8763