From 3b770c776a22d3f12e404417970be5305b5400f8 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Mon, 1 Aug 2022 10:55:24 +0200 Subject: [PATCH] Collapse long notes (#8990) * Revert "Revert option to collapse long notes (#8561)" This reverts commit 71150f21cd91df7bdd78a8f708db092418e85baa and reinstates the option to collapse long notes again after they were expanded. * fix(client): wrongly collapsed posts * fix: don't use ref * tweak style Co-authored-by: syuilo --- locales/ja-JP.yml | 1 + packages/client/src/components/note.vue | 28 ++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 03c1fac68..f8895bd99 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 3c9d36170..0279f014c 100644 --- a/packages/client/src/components/note.vue +++ b/packages/client/src/components/note.vue @@ -41,7 +41,7 @@

-
+
({{ i18n.ts.private }}) @@ -61,9 +61,12 @@
- +
{{ appearNote.channel.name }}
@@ -162,10 +165,11 @@ 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 isLong = (appearNote.cw == null && appearNote.text != null && ( (appearNote.text.split('\n').length > 9) || (appearNote.text.length > 500) )); +const collapsed = ref(appearNote.cw == null && isLong); const isDeleted = ref(false); const muted = ref(checkWordMute(appearNote, $i, defaultStore.state.mutedWords)); const translation = ref(null); @@ -442,6 +446,24 @@ function readPromo() { } > .content { + &.isLong { + > .showLess { + width: 100%; + margin-top: 1em; + position: sticky; + bottom: 1em; + + > span { + display: inline-block; + background: var(--popup); + padding: 6px 10px; + font-size: 0.8em; + border-radius: 999px; + box-shadow: 0 2px 6px rgb(0 0 0 / 20%); + } + } + } + &.collapsed { position: relative; max-height: 9em;