perf (UI): Use display name in collections

closes #127
This commit is contained in:
QuentinHsu 2022-06-24 14:41:37 +08:00 committed by GitHub
parent 64a453c44a
commit a1df2de7e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 5 deletions

View File

@ -39,7 +39,12 @@
<v-img v-else :class="getIconClass(sub.icon)" :src="sub.icon" /> <v-img v-else :class="getIconClass(sub.icon)" :src="sub.icon" />
</v-list-item-avatar> </v-list-item-avatar>
<v-list-item-content> <v-list-item-content>
{{ sub.name }} <template v-if="sub['display-name']">
{{ sub['display-name'] }} ({{ sub.name }})
</template>
<template v-else>
{{ sub.name }}
</template>
</v-list-item-content> </v-list-item-content>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-checkbox v-model="selected" :value="sub.name" class="pr-1" /> <v-checkbox v-model="selected" :value="sub.name" class="pr-1" />

View File

@ -64,8 +64,8 @@
<v-list-item-title class="font-weight-medium" v-text="collection['display-name'] || collection.name"> <v-list-item-title class="font-weight-medium" v-text="collection['display-name'] || collection.name">
</v-list-item-title> </v-list-item-title>
<v-chip-group column> <v-chip-group column>
<v-chip v-for="subs in collection.subscriptions" :key="subs" class="ma-2 ml-0 mr-1 pa-2" label small> <v-chip v-for="subs in collection.subsInfo" :key="subs.name" class="ma-2 ml-0 mr-1 pa-2" label small>
{{ subs }} {{ subs['display-name'] || subs.name}}
</v-chip> </v-chip>
</v-chip-group> </v-chip-group>
</v-list-item-content> </v-list-item-content>
@ -175,8 +175,14 @@ export default {
}, },
collections() { collections() {
const cols = this.$store.state.collections; const cols = this.$store.state.collections;
return Object.keys(cols).map(k => cols[k]); const collections = Object.keys(cols).map(k => cols[k]);
} const subscriptions = this.$store.state.subscriptions;
collections.map(item => {
item.subsInfo = []
item.subscriptions.map(sub => item.subsInfo.push(subscriptions[sub]))
})
return collections
},
}, },
methods: { methods: {