oxen-electron-gui-wallet/src/pages/wallet-select/index.vue

257 lines
6.7 KiB
Vue
Raw Normal View History

2018-09-08 23:44:19 +02:00
<template>
2020-03-03 04:16:23 +01:00
<q-page>
2020-07-30 03:27:13 +02:00
<q-list class="wallet-list" link no-border :dark="theme == 'dark'">
<template v-if="wallet_list.length">
2020-03-03 04:16:23 +01:00
<div class="header row justify-between items-center">
<div class="header-title">
{{ $t("titles.yourWallets") }}
</div>
2021-06-11 07:25:52 +02:00
<q-btn
v-if="wallets.list.length"
class="add"
icon="add"
size="md"
color="primary"
>
<q-menu class="header-popover" :content-class="'header-popover'">
<q-list separator>
<q-item
v-for="action in actions"
:key="action.name"
clickable
@click.native="action.handler"
>
<q-item-section>
{{ action.name }}
</q-item-section>
2020-03-03 04:16:23 +01:00
</q-item>
</q-list>
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
</q-menu>
2020-03-03 04:16:23 +01:00
</q-btn>
</div>
<div class="hr-separator" />
2020-07-30 03:27:13 +02:00
<!-- Hardware wallets -->
<q-list-header v-if="hardware_wallets.length">
<div class="header row justify-between items-center">
<div class="header-title">
{{ $t("strings.hardwareWallets") }}
</div>
</div>
</q-list-header>
2020-07-30 03:27:13 +02:00
<WalletListItem
v-for="wallet in hardware_wallets"
2020-03-03 04:16:23 +01:00
:key="`${wallet.address}-${wallet.name}`"
2020-07-30 03:27:13 +02:00
:wallet="wallet"
:open-wallet="openWallet"
/>
<!-- Regular wallets -->
<q-list-header v-if="hardware_wallets.length">
<div class="header row justify-between items-center">
<div class="header-title">
{{ $t("strings.regularWallets") }}
</div>
</div>
</q-list-header>
2020-07-30 03:27:13 +02:00
<WalletListItem
v-for="wallet in regular_wallets"
:key="`${wallet.address}-${wallet.name}`"
:wallet="wallet"
:open-wallet="openWallet"
/>
<q-item-separator />
2020-03-03 04:16:23 +01:00
</template>
<template v-else>
2021-01-06 06:26:42 +01:00
<q-item
v-for="action in actions"
:key="action.name"
@click.native="action.handler"
>
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
<q-item-section>
{{ action.name }}
</q-item-section>
2020-03-03 04:16:23 +01:00
</q-item>
</template>
2018-09-08 23:44:19 +02:00
</q-list>
2020-03-03 04:16:23 +01:00
</q-page>
2018-09-08 23:44:19 +02:00
</template>
<script>
2020-03-03 04:16:23 +01:00
import { mapState } from "vuex";
2020-07-30 03:27:13 +02:00
import WalletListItem from "components/wallet_list_item";
2018-09-08 23:44:19 +02:00
export default {
2020-09-03 08:22:45 +02:00
components: {
2020-07-30 03:27:13 +02:00
WalletListItem
},
2020-03-03 04:16:23 +01:00
computed: mapState({
theme: state => state.gateway.app.config.appearance.theme,
wallets: state => state.gateway.wallets,
2020-07-30 03:27:13 +02:00
wallet_list: state => state.gateway.wallets.list,
2020-03-03 04:16:23 +01:00
status: state => state.gateway.wallet.status,
2020-07-30 03:27:13 +02:00
hardware_wallets() {
return this.wallet_list.filter(w => w.hardware_wallet);
},
regular_wallets() {
return this.wallet_list.filter(w => !w.hardware_wallet);
},
2020-03-03 04:16:23 +01:00
actions() {
// TODO: Add this in once LOKI has the functionality
// <q-item @click.native="restoreViewWallet()">
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
// <q-item-label label="Restore view-only wallet" />
2020-03-03 04:16:23 +01:00
// </q-item>
const actions = [
{
name: this.$t("titles.wallet.createNew"),
handler: this.createNewWallet
2018-09-08 23:44:19 +02:00
},
2020-03-03 04:16:23 +01:00
{
name: this.$t("titles.wallet.restoreFromSeed"),
handler: this.restoreWallet
2018-09-08 23:44:19 +02:00
},
2020-03-03 04:16:23 +01:00
{
name: this.$t("titles.wallet.importFromFile"),
handler: this.importWallet
}
];
if (this.wallets.directories.length > 0) {
actions.push({
name: this.$t("titles.wallet.importFromOldGUI"),
handler: this.importOldGuiWallets
});
}
return actions;
}
}),
watch: {
status: {
handler(val, old) {
if (val.code == old.code) return;
const { code, message } = val;
switch (code) {
2020-03-03 04:16:23 +01:00
case 0: // Wallet loaded
this.$q.loading.hide();
this.$router.replace({ path: "/wallet" });
break;
case -1: // Error
case -22:
this.$q.loading.hide();
this.$q.notify({
2020-03-03 04:16:23 +01:00
type: "negative",
timeout: 1000,
message
2020-03-03 04:16:23 +01:00
});
this.$store.commit("gateway/set_wallet_data", {
status: {
code: 1 // Reset to 1 (ready for action)
}
});
break;
2018-09-08 23:44:19 +02:00
}
2020-03-03 04:16:23 +01:00
},
deep: true
}
},
created() {
this.$gateway.send("wallet", "list_wallets");
},
methods: {
openWallet(wallet) {
if (wallet.password_protected !== false) {
this.$q
.dialog({
title: this.$t("dialog.password.title"),
message: this.$t("dialog.password.message"),
prompt: {
model: "",
type: "password"
2018-09-08 23:44:19 +02:00
},
2020-03-03 04:16:23 +01:00
ok: {
2021-01-06 06:26:42 +01:00
label: this.$t("dialog.buttons.open"),
color: "primary"
2020-03-03 04:16:23 +01:00
},
cancel: {
flat: true,
2021-01-06 06:26:42 +01:00
label: this.$t("dialog.buttons.cancel")
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
},
2021-01-07 05:31:44 +01:00
color: "#1F1C47",
persistent: true
2020-03-03 04:16:23 +01:00
})
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
.onOk(password => {
2020-03-03 04:16:23 +01:00
this.$q.loading.show({
delay: 0
});
this.$gateway.send("wallet", "open_wallet", {
name: wallet.name,
password: password
});
})
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
.onCancel(() => {})
.onDismiss(() => {});
2020-03-03 04:16:23 +01:00
} else {
this.$q.loading.show({
delay: 0
});
this.$gateway.send("wallet", "open_wallet", {
name: wallet.name,
password: ""
});
}
},
createNewWallet() {
this.$router.replace({ path: "wallet-select/create" });
},
restoreWallet() {
this.$router.replace({ path: "wallet-select/restore" });
},
restoreViewWallet() {
this.$router.replace({ path: "wallet-select/import-view-only" });
2018-09-08 23:44:19 +02:00
},
2020-03-03 04:16:23 +01:00
importWallet() {
this.$router.replace({ path: "wallet-select/import" });
},
importOldGuiWallets() {
this.$router.replace({ path: "wallet-select/import-old-gui" });
},
importLegacyWallet() {
this.$router.replace({ path: "wallet-select/import-legacy" });
2018-09-08 23:44:19 +02:00
}
2020-03-03 04:16:23 +01:00
}
};
2018-09-08 23:44:19 +02:00
</script>
<style lang="scss">
.wallet-list {
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
.wallet-icon {
font-size: 3rem;
}
2020-03-03 04:16:23 +01:00
.header {
margin: 0 16px;
padding: 6px;
2020-03-03 04:16:23 +01:00
min-height: 36px;
2020-03-03 04:16:23 +01:00
.header-title {
font-size: 14px;
font-weight: 500;
}
2020-03-03 04:16:23 +01:00
.add {
width: 38px;
padding: 0;
}
2020-03-03 04:16:23 +01:00
}
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
.wallet-name {
font-size: 1.1rem;
}
2020-03-03 04:16:23 +01:00
.q-item {
margin: 10px 16px;
margin-bottom: 0px;
padding: 14px;
border-radius: 3px;
}
}
2018-09-08 23:44:19 +02:00
</style>