Skip to content

Commit

Permalink
feat: add backup page
Browse files Browse the repository at this point in the history
  • Loading branch information
gamalielhere committed Jan 8, 2025
1 parent 02338bc commit d2e39c1
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/extension/src/ui/onboard/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const isShowBackButton = () => {
route.name != 'user-analytics' &&
route.name != 'create-wallet-wallet-ready' &&
route.name != 'restore-wallet-wallet-ready' &&
route.name != 'restore-wallet-backup-detected' &&
!(route.name as string).includes('hardware-wallet')
);
};
Expand All @@ -54,7 +55,8 @@ const wrapClassObject = () => {
return {
'onboard__wrap--ready':
route.name == 'create-wallet-wallet-ready' ||
route.name == 'restore-wallet-wallet-ready',
route.name == 'restore-wallet-wallet-ready' ||
route.name == 'restore-wallet-backup-detected',
'onboard__wrap--auto-height': route.path.match(/hardware-wallet/),
};
};
Expand Down
1 change: 1 addition & 0 deletions packages/extension/src/ui/onboard/create-wallet/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import CheckPhrase from './double-check-phrase.vue';
import WalletReady from './wallet-ready.vue';
import UserAnalytics from '../user-analytics.vue';
import { RouteRecordRaw } from 'vue-router';

export const routes = {
pickPassword: {
path: 'pick-password',
Expand Down
125 changes: 125 additions & 0 deletions packages/extension/src/ui/onboard/restore-wallet/backup-detected.vue
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>
</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'];
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();
};
</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>
6 changes: 6 additions & 0 deletions packages/extension/src/ui/onboard/restore-wallet/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import PickPassword from './pick-password.vue';
import TypePassword from './type-password.vue';
import WalletReady from '../create-wallet/wallet-ready.vue';
import UserAnalytics from '../user-analytics.vue';
import BackupDetected from './backup-detected.vue';
import { RouteRecordRaw } from 'vue-router';
export const routes = {
start: {
Expand Down Expand Up @@ -37,6 +38,11 @@ export const routes = {
name: 'user-analytics',
component: UserAnalytics,
},
backupDetected: {
path: 'backup-detected',
name: 'backup-detected',
component: BackupDetected,
},
walletReady: {
path: 'wallet-ready',
name: 'wallet-ready',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
});
}
Expand Down

0 comments on commit d2e39c1

Please sign in to comment.