Skip to content

Commit

Permalink
sort counters by url
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Aug 16, 2024
1 parent efbcd63 commit 9414a49
Showing 1 changed file with 39 additions and 2 deletions.
41 changes: 39 additions & 2 deletions src/components/SettingsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -719,15 +719,33 @@
</q-item-label>
</row>
<row class="q-pa-sm">
<q-btn
<row
class="q-px-sm"
v-for="(mintCounter, mintUrl) in keysetCountersByMint"
:key="mintUrl"
>
<q-item-label class="q-px-xs" caption>
{{ shortUrl(mintUrl) }}
</q-item-label>
<q-btn
dense
v-for="(counter, id) in mintCounter"
:key="id"
flat
click
@click="increaseKeysetCounter(counter.id, 1)"
>{{ counter.id }} - counter: {{ counter.counter }}
</q-btn>
</row>
<!-- <q-btn
v-for="(counter, id) in keysetCounters"
:key="id"
dense
flat
click
@click="increaseKeysetCounter(counter.id, 1)"
>{{ counter.id }} - {{ counter.counter }}</q-btn
>
> -->
</row>
</q-item-section>
</q-item>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
},
Expand Down

0 comments on commit 9414a49

Please sign in to comment.