23
23
<template>
24
24
<!-- reactions buttons and popover with details -->
25
25
<div class="reactions-wrapper">
26
- <!-- all reactions button -->
27
- <NcButton class="reaction-button"
28
- :title="t('spreed', 'Show all reactions')"
29
- @click="showAllReactions = true">
30
- <HeartOutlineIcon :size="15" />
31
- </NcButton>
32
26
<NcPopover v-for="reaction in reactionsSorted"
33
27
:key="reaction"
34
28
:delay="200"
44
38
</NcButton>
45
39
</template>
46
40
47
- <div v-if="hasReactions " class="reaction-details">
41
+ <div v-if="hasReactionsLoaded " class="reaction-details">
48
42
<span>{{ getReactionSummary(reaction) }}</span>
49
43
<NcButton v-if="reactionsCount(reaction) > 3"
50
44
type="tertiary-no-background"
57
51
</div>
58
52
</NcPopover>
59
53
54
+ <!-- all reactions button -->
55
+ <NcButton v-if="showControls"
56
+ class="reaction-button"
57
+ :title="t('spreed', 'Show all reactions')"
58
+ @click="showAllReactions = true">
59
+ <HeartOutlineIcon :size="15" />
60
+ </NcButton>
61
+
60
62
<!-- More reactions picker -->
61
- <NcEmojiPicker v-if="canReact && hasReactions "
63
+ <NcEmojiPicker v-if="canReact && showControls "
62
64
:per-line="5"
63
65
:container="`#message_${id}`"
64
66
@select="handleReactionClick"
73
75
</NcButton>
74
76
</NcEmojiPicker>
75
77
76
- <!-- all reactions -->
78
+ <!-- all reactions modal -->
77
79
<ReactionsList v-if="showAllReactions"
78
80
:token="token"
79
81
:detailed-reactions="detailedReactions"
@@ -131,6 +133,11 @@ export default {
131
133
type: [String, Number],
132
134
required: true,
133
135
},
136
+
137
+ showControls: {
138
+ type: Boolean,
139
+ default: false,
140
+ },
134
141
},
135
142
136
143
emits: ['emoji-picker-toggled'],
@@ -151,7 +158,7 @@ export default {
151
158
},
152
159
153
160
computed: {
154
- hasReactions () {
161
+ hasReactionsLoaded () {
155
162
return Object.keys(Object(this.detailedReactions)).length !== 0
156
163
},
157
164
@@ -184,14 +191,14 @@ export default {
184
191
.sort() // Plain reactions come sorted
185
192
.map(([key, value]) => [key, value.length])
186
193
)
187
- return this.hasReactions
194
+ return this.hasReactionsLoaded
188
195
&& JSON.stringify(this.plainReactions) !== JSON.stringify(detailedReactionsSimplified)
189
196
},
190
197
},
191
198
192
199
methods: {
193
200
fetchReactions() {
194
- if (!this.hasReactions || this.hasOutdatedDetails) {
201
+ if (!this.hasReactionsLoaded || this.hasOutdatedDetails) {
195
202
this.reactionsStore.fetchReactions(this.token, this.id)
196
203
}
197
204
},
@@ -243,7 +250,7 @@ export default {
243
250
244
251
getReactionSummary(reaction) {
245
252
// Check if the reaction details are loaded
246
- if (!this.hasReactions ) {
253
+ if (!this.hasReactionsLoaded ) {
247
254
return ''
248
255
}
249
256
const list = this.detailedReactions[reaction].slice(0, 3)
0 commit comments