From 02662209263176bde3af3c721f33d4ec72eb46ce Mon Sep 17 00:00:00 2001 From: plebbitor Date: Wed, 1 Mar 2023 17:55:35 +0100 Subject: [PATCH] shortened mobile text and Thread --- src/components/Board.jsx | 56 +++++++++++++++++++-------- src/components/Thread.jsx | 79 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 115 insertions(+), 20 deletions(-) diff --git a/src/components/Board.jsx b/src/components/Board.jsx index fb88d114..d349b6c5 100644 --- a/src/components/Board.jsx +++ b/src/components/Board.jsx @@ -486,7 +486,8 @@ const Board = ({ setBodyStyle }) => { <>
{thread.content.slice(0, 2000)} - (...) Thread content too long.  +

+ (...) Thread too long.  handleClickThread(thread.cid)} className="ttl-link">Click here  to view.
@@ -646,13 +647,22 @@ const Board = ({ setBodyStyle }) => {
58 KB JPG
-
- {thread.content ? ( + {thread.content ? ( + thread.content.length > 1500 ? <> - {thread.content} +
+ {thread.content.slice(0, 1500)} + (...) +

+ Thread too long.  + handleClickThread(thread.cid)} className="ttl-link">Click here +  to view.
+
- ) : null} -
+ :
+ {thread.content} +
) + : null}
{thread.replyCount} Replies / ? Images @@ -686,20 +696,20 @@ const Board = ({ setBodyStyle }) => {   (User:  - {reply.author.address.length > 12 ? + {reply.author.address.length > 10 ? <> - {reply.author.address.slice(0, 12) + "..."} + {reply.author.address.slice(0, 10) + "..."} : {reply.author.address} } - ) + ) 
@@ -709,12 +719,28 @@ const Board = ({ setBodyStyle }) => { {counterString}
-
- - {`>>${counterString}`}{
} -
- {reply.content} -
+ {reply.content ? ( + reply.content.length > 1000 ? + <> +
+ + {`>>${counterString}`}{
} +
+ {reply.content.slice(0, 1000)} + (...) +

+ Comment too long.  + handleClickThread(thread.cid)} className="ttl-link">Click here +  to view.
+
+ + :
+ + {`>>${counterString}`}{
} +
+ {reply.content} +
) + : null} )})} diff --git a/src/components/Thread.jsx b/src/components/Thread.jsx index 48afa880..d7d64ba8 100644 --- a/src/components/Thread.jsx +++ b/src/components/Thread.jsx @@ -343,12 +343,54 @@ const Thread = ({ setBodyStyle }) => { - {comment.title} + {comment.title ? ( + comment.title.length > 75 ? + <> + + + {comment.title.slice(0, 75) + " (...)"} + + + : + {comment.title} + ) + : null}   - {comment.author.displayName || "Anonymous"} + {comment.author.displayName + ? comment.author.displayName.length > 20 + ? <> + + + {comment.author.displayName.slice(0, 20) + " (...)"} + + + : + {comment.author.displayName} + : + Anonymous} +     - (User: {comment.author.address}) + (User:  + {comment.author.address.length > 20 ? + <> + + + {comment.author.address.slice(0, 20) + "..."} + + + : + {comment.author.address} + })   2 weeks ago @@ -384,10 +426,37 @@ const Thread = ({ setBodyStyle }) => {
  - {reply.author.displayName || "Anonymous"} + {reply.author.displayName + ? reply.author.displayName.length > 20 + ? <> + + + {reply.author.displayName.slice(0, 20) + " (...)"} + + + : + {reply.author.displayName} + : + Anonymous}   - (User: {reply.author.address}) + (User:  + {reply.author.address.length > 20 ? + <> + + + {reply.author.address.slice(0, 20) + "..."} + + + : + {reply.author.address} + })