From e675ffcf38b07f5c70d00b49c171c7ab3460e810 Mon Sep 17 00:00:00 2001
From: Balazs Nadasdi
Date: Sat, 4 Jun 2022 06:57:09 +0200
Subject: [PATCH] feat: option to collapse long notes (#8561)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* feat: option to collapse long notes
Closes #8559
* do not collapse if cw exists
* use '閉じる' to close / show less.
* make it sticky
* Change style of the Show less button
---
locales/ja-JP.yml | 1 +
packages/client/src/components/note.vue | 27 ++++++++++++++++++++++---
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml
index 9cd1d1eed..57be9bfcb 100644
--- a/locales/ja-JP.yml
+++ b/locales/ja-JP.yml
@@ -52,6 +52,7 @@ searchUser: "ユーザーを検索"
reply: "返信"
loadMore: "もっと見る"
showMore: "もっと見る"
+showLess: "閉じる"
youGotNewFollower: "フォローされました"
receiveFollowRequest: "フォローリクエストされました"
followRequestAccepted: "フォローが承認されました"
diff --git a/packages/client/src/components/note.vue b/packages/client/src/components/note.vue
index bc8a0dd19..4840b0dc2 100644
--- a/packages/client/src/components/note.vue
+++ b/packages/client/src/components/note.vue
@@ -46,7 +46,7 @@
-
+
({{ i18n.ts.private }})
@@ -66,9 +66,12 @@
-
{{ appearNote.channel.name }}
@@ -166,7 +169,8 @@ const reactButton = ref
();
let appearNote = $computed(() => isRenote ? note.renote as misskey.entities.Note : note);
const isMyRenote = $i && ($i.id === note.userId);
const showContent = ref(false);
-const collapsed = ref(appearNote.cw == null && appearNote.text != null && (
+const collapsed = ref(appearNote.cw == null);
+const isLong = ref(appearNote.cw == null && appearNote.text != null && (
(appearNote.text.split('\n').length > 9) ||
(appearNote.text.length > 500)
));
@@ -452,6 +456,23 @@ function readPromo() {
}
> .content {
+ &.isLong {
+ > .showLess {
+ width: 100%;
+ margin-top: 1em;
+ position: sticky;
+ bottom: 1em;
+
+ > span {
+ display: inline-block;
+ background: var(--panel);
+ padding: 6px 10px;
+ font-size: 0.8em;
+ border-radius: 999px;
+ box-shadow: 0 0 7px 7px var(--bg);
+ }
+ }
+ }
&.collapsed {
position: relative;
max-height: 9em;