Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort counters by URL #218

Merged
merged 2 commits into from
Aug 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 32 additions & 8 deletions src/components/SettingsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -719,15 +719,24 @@
</q-item-label>
</row>
<row class="q-pa-sm">
<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
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>
</row>
</q-item-section>
</q-item>
Expand Down Expand Up @@ -863,6 +872,18 @@ export default defineComponent({
"showRemoveMintDialog",
]),
...mapWritableState(useNWCStore, ["nwcEnabled", "connections"]),
keysetCountersByMint() {
const mints = this.mints;
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 +961,9 @@ export default defineComponent({
await this.initSigner();
await this.generateNPCConnection();
},
shortUrl: function (url) {
return getShortUrl(url);
},
toggleMnemonicVisibility: function () {
this.hideMnemonic = !this.hideMnemonic;
},
Expand Down
Loading