aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/components/LdProposition.vue
diff options
context:
space:
mode:
Diffstat (limited to 'viewer/src/components/LdProposition.vue')
-rw-r--r--viewer/src/components/LdProposition.vue46
1 files changed, 29 insertions, 17 deletions
diff --git a/viewer/src/components/LdProposition.vue b/viewer/src/components/LdProposition.vue
index 9a32e0a..02f7fe4 100644
--- a/viewer/src/components/LdProposition.vue
+++ b/viewer/src/components/LdProposition.vue
@@ -20,11 +20,17 @@
20<template> 20<template>
21 <div> 21 <div>
22 <div v-for="proposed in proposedTags" :key="proposed.rawTag" class="proposition"> 22 <div v-for="proposed in proposedTags" :key="proposed.rawTag" class="proposition">
23 <fa-icon icon="minus" @click="add(Operation.SUBSTRACTION, proposed.rawTag)" /> 23 <div class="operation-btns link" @click="add(Operation.SUBSTRACTION, proposed.rawTag)">
24 <span 24 <fa-icon icon="minus" />
25 </div>
26 <div class="operation-btns link" @click="add(Operation.ADDITION, proposed.rawTag)">
27 <fa-icon icon="plus" />
28 </div>
29 <div
30 class="operation-tag link"
25 @click="add(Operation.INTERSECTION, proposed.rawTag)" 31 @click="add(Operation.INTERSECTION, proposed.rawTag)"
26 >{{proposed.rawTag}}&nbsp;x{{proposed.count}}</span> 32 >{{proposed.rawTag}}</div>
27 <fa-icon icon="plus" @click="add(Operation.ADDITION, proposed.rawTag)" /> 33 <div class="disabled">x{{proposed.count}}</div>
28 </div> 34 </div>
29 </div> 35 </div>
30</template> 36</template>
@@ -51,13 +57,12 @@ export default class LdTagInput extends Vue {
51 .forEach(rawTag => (propositions[rawTag] = (propositions[rawTag] ?? 0) + 1)); 57 .forEach(rawTag => (propositions[rawTag] = (propositions[rawTag] ?? 0) + 1));
52 } else { 58 } else {
53 // Tags count from the whole gallery 59 // Tags count from the whole gallery
54 Object.entries(this.$galleryStore.tags) 60 Object.entries(this.$galleryStore.tags).forEach(entry => (propositions[entry[0]] = entry[1].items.length));
55 .forEach(entry => (propositions[entry[0]] = entry[1].items.length));
56 } 61 }
57 62
58 return Object.entries(propositions) 63 return Object.entries(propositions)
59 .sort((a,b) => b[1] - a[1]) 64 .sort((a, b) => b[1] - a[1])
60 .map(entry => ({rawTag: entry[0], count: entry[1]})); 65 .map(entry => ({ rawTag: entry[0], count: entry[1] }));
61 } 66 }
62 67
63 extractDistinctItems(currentTags: Tag.Search[]): Gallery.Item[] { 68 extractDistinctItems(currentTags: Tag.Search[]): Gallery.Item[] {
@@ -73,21 +78,28 @@ export default class LdTagInput extends Vue {
73 const node = this.$galleryStore.tags[rawTag]; 78 const node = this.$galleryStore.tags[rawTag];
74 const search: Tag.Search = { ...node, operation, display: `${operation}${node.tag}` }; 79 const search: Tag.Search = { ...node, operation, display: `${operation}${node.tag}` };
75 this.$uiStore.currentTags.push(search); 80 this.$uiStore.currentTags.push(search);
76 this.$uiStore.mode = "search"; 81 setTimeout(() => this.$uiStore.setModeSearch()); // Give time for the UI to display the Tag change
77 } 82 }
78} 83}
79</script> 84</script>
80 85
81<style lang="scss"> 86<style lang="scss">
87@import "@/assets/scss/theme.scss";
88
82.proposition { 89.proposition {
83 display: flex; 90 display: flex;
84 justify-content: space-between;
85 align-items: center; 91 align-items: center;
86 margin: 10px; 92 padding-right: 7px;
87 color: lightcyan; 93 .operation-tag {
88 cursor: pointer; 94 text-overflow: ellipsis;
89} 95 white-space: nowrap;
90.proposition span { 96 overflow: hidden;
91 padding: 0 10px; 97 flex-grow: 1;
98 cursor: pointer;
99 }
100 .operation-btns {
101 padding: 2px 7px;
102 cursor: pointer;
103 }
92} 104}
93</style> 105</style>