Skip to content

Commit

Permalink
add many loading spinners
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed May 19, 2024
1 parent 1601f57 commit 71de160
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/components/InvoiceDetailDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
? 'Creating invoice...'
: 'Create Invoice'
"
><q-spinner-tail
><q-spinner-hourglass
v-if="createInvoiceButtonBlocked"
color="white"
size="1em"
Expand Down
19 changes: 14 additions & 5 deletions src/components/MintSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,14 @@
class="q-px-lg q-mt-xs"
color="primary"
:disabled="addMintData.url.length == 0"
:loading="addingMint"
:loading="addMintBlocking"
@click="showAddMintDialog = true"
>
<q-icon size="xs" name="add" class="q-pr-xs" />
Add mint
<template v-slot:loading>
<q-spinner-hourglass class="on-left" />
Loading...
<q-spinner-hourglass />
Adding mint...
</template>
</q-btn>
</div>
Expand Down Expand Up @@ -386,9 +386,13 @@
v-close-popup
color="primary"
icon="check"
:loading="addingMint"
:loading="addMintBlocking"
@click="addMintInternal(addMintData, (verbose = true))"
>Add mint
<template v-slot:loading>
<q-spinner-hourglass />
Adding mint...
</template>
</q-btn>
</div>
<div class="col">
Expand Down Expand Up @@ -520,7 +524,12 @@ export default defineComponent({
"checkSentTokens",
]),
...mapState(useP2PKStore, ["p2pkKeys"]),
...mapState(useMintsStore, ["activeMintUrl", "mints", "activeProofs"]),
...mapState(useMintsStore, [
"activeMintUrl",
"mints",
"activeProofs",
"addMintBlocking",
]),
...mapState(useNostrStore, ["pubkey", "mintRecommendations"]),
...mapState(useWalletStore, ["mnemonic"]),
...mapWritableState(useMintsStore, [
Expand Down
2 changes: 1 addition & 1 deletion src/components/PayInvoiceDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"
@click="melt"
:label="!payInvoiceData.blocking ? 'Pay' : 'Processing...'"
><q-spinner-tail
><q-spinner-hourglass
v-if="payInvoiceData.blocking"
color="white"
size="1em"
Expand Down
24 changes: 20 additions & 4 deletions src/components/ReceiveTokenDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,21 @@
color="primary"
rounded
class="q-mr-sm"
:disabled="!decodeToken(receiveData.tokensBase64)"
:label="knowThisMint ? 'Receive' : 'Add mint'"
/>
:disabled="!decodeToken(receiveData.tokensBase64) || addMintBlocking"
:label="
knowThisMint
? addMintBlocking
? 'Adding mint ...'
: 'Receive'
: 'Add mint'
"
>
<!-- <q-spinner-hourglass
v-if="addMintBlocking"
size="1em"
class="q-ml-md"
/> -->
</q-btn>
<q-btn
@click="addPendingTokenToHistory(receiveData.tokensBase64)"
color="primary"
Expand Down Expand Up @@ -113,7 +125,11 @@ export default defineComponent({
"receiveData",
]),
...mapState(useUiStore, ["tickerShort"]),
...mapState(useMintsStore, ["activeProofs", "activeUnit"]),
...mapState(useMintsStore, [
"activeProofs",
"activeUnit",
"addMintBlocking",
]),
...mapWritableState(useMintsStore, ["addMintData", "showAddMintDialog"]),
...mapState(useCameraStore, ["hasCamera"]),
canPasteFromClipboard: function () {
Expand Down
12 changes: 9 additions & 3 deletions src/components/TokenInformation.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
<template>
<div class="row text-left q-py-none q-my-none">
<div class="col-12 q-px-none">
<q-chip v-if="showAmount" outline icon="toll" class="q-mr-md q-pa-md">
<q-chip v-if="showAmount" outline class="q-mr-md q-pa-md">
<q-icon name="toll" size="xs" class="q-mr-sm" />
<strong>{{ displayUnit }} </strong>
</q-chip>
<q-chip outline icon="account_balance" class="q-pa-md">
<q-chip outline class="q-pa-md">
<q-icon name="account_balance" size="xs" class="q-mr-xs" />
{{ tokenMintUrl }}
<q-spinner-hourglass v-if="addMintBlocking" size="sm" class="q-ml-sm" />
<q-icon
v-if="showMintCheck && mintKnownToUs(proofsToShow)"
v-if="
showMintCheck && mintKnownToUs(proofsToShow) && !addMintBlocking
"
name="check"
size="sm"
color="green"
Expand Down Expand Up @@ -62,6 +67,7 @@ export default defineComponent({
"mints",
"proofs",
"activeUnit",
"addMintBlocking",
]),
proofsToShow: function () {
return token.getProofs(token.decode(this.encodedToken));
Expand Down
3 changes: 3 additions & 0 deletions src/stores/mints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export const useMintsStore = defineStore("mints", {
blindSignatures: useLocalStorage("cashu.blindSignatures", [] as BlindSignatureAudit[]),
// balances: useLocalStorage("cashu.balances", {} as Balances),
showAddMintDialog: false,
addMintBlocking: false,
showRemoveMintDialog: false,
};
},
Expand Down Expand Up @@ -195,6 +196,7 @@ export const useMintsStore = defineStore("mints", {
},
addMint: async function (addMintData: { url: string, nickname: string }, verbose = false) {
let url = addMintData.url;
this.addMintBlocking = true;
try {
// sanitize url
const sanitizeUrl = (url: string): string => {
Expand Down Expand Up @@ -232,6 +234,7 @@ export const useMintsStore = defineStore("mints", {
throw error;
} finally {
this.showAddMintDialog = false;
this.addMintBlocking = false;
}
},
activateMintUrl: async function (url: string, verbose = false, force = false) {
Expand Down

0 comments on commit 71de160

Please sign in to comment.