From 2f383c2c0197b94b30fdc4c5e0c742c7e104be20 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 8 Jun 2021 14:34:47 +0300 Subject: [PATCH] moved mentions into a separate component - MentionLine, added collapsing of mentions when there's too many of 'em --- src/components/mention_link/mention_link.scss | 10 ++-- src/components/mention_link/mention_link.vue | 3 +- src/components/mentions_line/mentions_line.js | 51 +++++++++++++++++++ .../mentions_line/mentions_line.scss | 15 ++++++ .../mentions_line/mentions_line.vue | 42 +++++++++++++++ src/components/status/status.js | 10 ++-- src/components/status/status.vue | 10 ++-- src/components/status_body/status_body.js | 10 +++- src/components/status_body/status_body.vue | 25 ++++++--- src/i18n/en.json | 3 +- 10 files changed, 151 insertions(+), 28 deletions(-) create mode 100644 src/components/mentions_line/mentions_line.js create mode 100644 src/components/mentions_line/mentions_line.scss create mode 100644 src/components/mentions_line/mentions_line.vue diff --git a/src/components/mention_link/mention_link.scss b/src/components/mention_link/mention_link.scss index 5b5218f7..eed4d5be 100644 --- a/src/components/mention_link/mention_link.scss +++ b/src/components/mention_link/mention_link.scss @@ -40,6 +40,10 @@ .new { margin-right: 0.25em; + &.-firstMention { + display: none; + } + &.-you { & .shortName, & .full { @@ -115,12 +119,6 @@ } } - &:not(.-oldPlace) { - .new.-firstMention { - display: none; - } - } - &:hover .new .full { opacity: 1; pointer-events: initial; diff --git a/src/components/mention_link/mention_link.vue b/src/components/mention_link/mention_link.vue index 0dae1f53..d2f4129d 100644 --- a/src/components/mention_link/mention_link.vue +++ b/src/components/mention_link/mention_link.vue @@ -23,7 +23,8 @@ @click.prevent="onClick" > - {{ $t('status.you')}} + + {{ $t('status.you') }} ({ expanded: false }), + components: { + MentionLink + }, + computed: { + oldStyle () { + return this.mergedConfig.mentionsOldStyle + }, + limit () { + return 1 + }, + mentions () { + return this.attentions.slice(0, this.limit) + }, + extraMentions () { + return this.attentions.slice(this.limit) + }, + manyMentions () { + return this.extraMentions.length > 0 + }, + buttonClasses () { + return [ + this.oldStyle + ? 'button-unstyled' + : 'button-default -sublime', + this.oldStyle + ? '-oldStyle' + : '-newStyle' + ] + }, + ...mapGetters(['mergedConfig']), + }, + methods: { + toggleShowMore () { + this.expanded = !this.expanded + } + } +} + +export default MentionsLine diff --git a/src/components/mentions_line/mentions_line.scss b/src/components/mentions_line/mentions_line.scss new file mode 100644 index 00000000..735502de --- /dev/null +++ b/src/components/mentions_line/mentions_line.scss @@ -0,0 +1,15 @@ +.MentionsLine { + .showMoreLess { + &.-newStyle { + line-height: 1.5; + font-size: inherit; + display: inline-block; + padding-top: 0; + padding-bottom: 0; + } + + &.-oldStyle { + color: var(--link); + } + } +} diff --git a/src/components/mentions_line/mentions_line.vue b/src/components/mentions_line/mentions_line.vue new file mode 100644 index 00000000..6d114f2d --- /dev/null +++ b/src/components/mentions_line/mentions_line.vue @@ -0,0 +1,42 @@ + + +