From 9414a49e3e127da8b6401677e431a7387ddc9b6b Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Fri, 16 Aug 2024 13:53:36 +0200 Subject: [PATCH] sort counters by url --- src/components/SettingsView.vue | 41 +++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/src/components/SettingsView.vue b/src/components/SettingsView.vue index d2cb2926..507289f1 100644 --- a/src/components/SettingsView.vue +++ b/src/components/SettingsView.vue @@ -719,7 +719,25 @@ - + + {{ shortUrl(mintUrl) }} + + {{ counter.id }} - counter: {{ counter.counter }} + + + @@ -863,6 +881,22 @@ export default defineComponent({ "showRemoveMintDialog", ]), ...mapWritableState(useNWCStore, ["nwcEnabled", "connections"]), + keysetCountersByMint() { + // get all keyset counter ids: + const keysetIds = map(this.keysetCounters, (counter) => counter.id); + // get all mints: + const mints = this.mints; + // get all keyset counters by mint: + const keysetCountersByMint = {}; // {mintUrl: [keysetCounter: {id: string, count: number}, ...]} + for (let mint of mints) { + const mintIds = mint.keysets.map((keyset) => keyset.id); + const keysetCounterThisMint = this.keysetCounters.filter((entry) => + mintIds.includes(entry.id) + ); + keysetCountersByMint[mint.url] = keysetCounterThisMint; + } + return keysetCountersByMint; + }, hiddenMnemonic() { if (this.hideMnemonic) { return this.mnemonic @@ -940,6 +974,9 @@ export default defineComponent({ await this.initSigner(); await this.generateNPCConnection(); }, + shortUrl: function (url) { + return getShortUrl(url); + }, toggleMnemonicVisibility: function () { this.hideMnemonic = !this.hideMnemonic; },