pleroma-fe/src/components/mentions_line/mentions_line.js

40 lines
828 B
JavaScript
Raw Normal View History

2026-02-13 14:26:39 +02:00
import { mapState } from 'pinia'
2026-01-08 17:26:52 +02:00
import MentionLink from 'src/components/mention_link/mention_link.vue'
2026-02-13 14:26:39 +02:00
import { useSyncConfigStore } from 'src/stores/sync_config.js'
export const MENTIONS_LIMIT = 5
const MentionsLine = {
name: 'MentionsLine',
props: {
mentions: {
required: true,
2026-01-06 16:22:52 +02:00
type: Array,
},
},
data: () => ({ expanded: false }),
components: {
2026-01-06 16:22:52 +02:00
MentionLink,
},
computed: {
2026-01-06 16:22:52 +02:00
mentionsComputed() {
return this.mentions.slice(0, MENTIONS_LIMIT)
},
2026-01-06 16:22:52 +02:00
extraMentions() {
return this.mentions.slice(MENTIONS_LIMIT)
},
2026-01-06 16:22:52 +02:00
manyMentions() {
return this.extraMentions.length > 0
},
2026-02-13 14:26:39 +02:00
...mapState(useSyncConfigStore, ['mergedConfig']),
},
methods: {
2026-01-06 16:22:52 +02:00
toggleShowMore() {
this.expanded = !this.expanded
2026-01-06 16:22:52 +02:00
},
},
}
export default MentionsLine