Skip to content

Commit

Permalink
Updated hide amounts to use the UI store instead of mints store.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjbeery24 committed Jun 26, 2024
1 parent 103863e commit 37497ac
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/boot/base.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { copyToClipboard } from "quasar";
import { useMintsStore } from "stores/mints";
import { useUiStore } from "stores/ui";

window.LOCALE = "en";
// window.EventHub = new Vue();
Expand Down Expand Up @@ -40,7 +40,7 @@ window.windowMixin = {
if (currency == undefined) {
currency = "sat";
}
if (useMintsStore().hideBalance && !showBalance) {
if (useUiStore().hideBalance && !showBalance) {
return "****"
}
if (currency == "sat") return this.formatSat(value);
Expand Down
7 changes: 3 additions & 4 deletions src/components/BalanceView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ import { mapState, mapWritableState, mapActions } from "pinia";
import { useMintsStore } from "stores/mints";
import { useSettingsStore } from "stores/settings";
import { useTokensStore } from "stores/tokens";
import { useUiStore } from "stores/ui";
import { useWalletStore } from "stores/wallet";
import ToggleUnit from "components/ToggleUnit.vue";
Expand Down Expand Up @@ -146,10 +147,8 @@ export default defineComponent({
]),
...mapState(useTokensStore, ["historyTokens"]),
...mapState(useSettingsStore, ["getBitcoinPrice"]),
...mapWritableState(useMintsStore, [
"activeUnit",
"hideBalance"
]),
...mapWritableState(useMintsStore, ["activeUnit"]),
...mapWritableState(useUiStore, ["hideBalance"]),
pendingBalance: function () {
return -this.historyTokens
.filter((t) => t.status == "pending")
Expand Down
1 change: 0 additions & 1 deletion src/stores/mints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ type BlindSignatureAudit = {
export const useMintsStore = defineStore("mints", {
state: () => {
return {
hideBalance: useLocalStorage<boolean>("cashu.hideBalance", false),
activeUnit: useLocalStorage<string>("cashu.activeUnit", "sat"),
activeMintUrl: useLocalStorage<string>("cashu.activeMintUrl", ""),
addMintData: {
Expand Down
1 change: 1 addition & 0 deletions src/stores/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const unitTickerShortMap = {

export const useUiStore = defineStore("ui", {
state: () => ({
hideBalance: useLocalStorage<boolean>("cashu.ui.hideBalance", false),
tickerLong: "Satoshis",
showInvoiceDetails: false,
showSendDialog: false,
Expand Down
7 changes: 6 additions & 1 deletion src/stores/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ type KeysetCounter = {

const receiveStore = useReceiveTokensStore();
const tokenStore = useTokensStore();
const uIStore = useUiStore();

export const useWalletStore = defineStore("wallet", {
state: () => {
Expand Down Expand Up @@ -275,6 +274,7 @@ export const useWalletStore = defineStore("wallet", {
return selectedProofs
},
spendableProofs: function (proofs: WalletProof[], amount: number) {
const uIStore = useUiStore();
const proofsStore = useProofsStore();
const mintStore = useMintsStore();
const spendableProofs = proofsStore.getUnreservedProofs(proofs);
Expand Down Expand Up @@ -358,6 +358,7 @@ export const useWalletStore = defineStore("wallet", {
/*
uses split to receive new tokens.
*/
const uIStore = useUiStore();
const mintStore = useMintsStore();
receiveStore.showReceiveTokens = false;
console.log("### receive tokens", receiveStore.receiveData.tokensBase64);
Expand Down Expand Up @@ -537,6 +538,7 @@ export const useWalletStore = defineStore("wallet", {
}
},
melt: async function () {
const uIStore = useUiStore();
const proofsStore = useProofsStore();
const mintStore = useMintsStore();
const tokenStore = useTokensStore();
Expand Down Expand Up @@ -708,6 +710,7 @@ export const useWalletStore = defineStore("wallet", {
checks whether a base64-encoded token (from the history table) has been spent already.
if it is spent, the appropraite entry in the history table is set to paid.
*/
const uIStore = useUiStore();
const mintStore = useMintsStore();
const tokenStore = useTokensStore();
const proofsStore = useProofsStore();
Expand Down Expand Up @@ -763,6 +766,7 @@ export const useWalletStore = defineStore("wallet", {
return true;
},
checkInvoice: async function (quote: string, verbose = true) {
const uIStore = useUiStore();
const mintStore = useMintsStore();
console.log("### checkInvoice.quote", quote);
const invoice = this.invoiceHistory.find((i) => i.quote === quote);
Expand All @@ -786,6 +790,7 @@ export const useWalletStore = defineStore("wallet", {
}
},
checkOutgoingInvoice: async function (quote: string, verbose = true) {
const uIStore = useUiStore();
const mintStore = useMintsStore();
const invoice = this.invoiceHistory.find((i) => i.quote === quote);
if (!invoice) {
Expand Down

0 comments on commit 37497ac

Please sign in to comment.