From 4fcfd2319e322c60113045bc1c36e108072077a9 Mon Sep 17 00:00:00 2001 From: plebbitor Date: Tue, 7 Mar 2023 13:07:36 +0100 Subject: [PATCH] fix unique key prop --- src/components/Board.jsx | 310 ++++++++++++++++++------------------- src/components/Catalog.jsx | 26 ++-- src/components/Thread.jsx | 158 +++++++++---------- 3 files changed, 247 insertions(+), 247 deletions(-) diff --git a/src/components/Board.jsx b/src/components/Board.jsx index 88f96789..5a02ae25 100644 --- a/src/components/Board.jsx +++ b/src/components/Board.jsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect, useContext } from 'react'; +import React, { useState, useEffect, useContext, Fragment } from 'react'; import { Link, useNavigate, useParams, useLocation } from 'react-router-dom'; import { BoardContext } from '../App'; import { Container, NavBar, Header, Break, PostFormLink, PostFormTable, PostForm, TopBar, BoardForm } from './styles/Board.styled'; @@ -447,189 +447,189 @@ const Board = ({ setBodyStyle }) => { pageStart={0} loadMore={tryLoadMore} hasMore={hasMore} - loader={
Loading...
} + loader={
Loading...
} > {renderedFeed.map(thread => { const { replies: { pages: { topAll: { comments } } } } = thread; const { renderedComments, omittedCount } = renderComments(comments); return ( - <> -
-
-
-
-
-
-
+ +
+
+
+
+
+
+
File:  - filename.something (metadata) + filename.something (metadata)
- - filename.something + + filename.something
- + {thread.title ? ( thread.title.length > 75 ? - <> - - + + {thread.title.slice(0, 75) + " (...)"} - - : + + : {thread.title} ) : null}  {thread.author.displayName ? thread.author.displayName.length > 20 - ? <> - - + + {thread.author.displayName.slice(0, 20) + " (...)"} - - : + + : {thread.author.displayName} - : + : Anonymous}   (u/ {thread.author.address.length > 15 ? - <> - - + + {thread.author.address.slice(0, 15) + "..."} - - : + + : {thread.author.address} })   - {getDate(thread.timestamp)} + {getDate(thread.timestamp)}   - - c/ - {thread.cid.slice(0, 8)} + + c/ + {thread.cid.slice(0, 8)}   - + [ - handleClickThread(thread.cid)} className="reply-link" >Reply + handleClickThread(thread.cid)} className="reply-link" >Reply ] - -
- + {omittedCount > 0 ? ( - - + + {omittedCount} post{omittedCount > 1 ? "s" : ""} omitted. Click  - handleClickThread(thread.cid)} className="ttl-link">here + handleClickThread(thread.cid)} className="ttl-link">here  to view. ) : null} {renderedComments.map(reply => { return ( -
-
{'>>'}
-
-
- +
+
{'>>'}
+
+
+ {reply.author.displayName ? reply.author.displayName.length > 12 - ? <> - - + + {reply.author.displayName.slice(0, 12) + " (...)"} - - : + + : {reply.author.displayName} - : + : Anonymous}   - + (u/ {reply.author.address.length > 12 ? - <> - - + + {reply.author.address.slice(0, 12) + "..."} - - : + + : {reply.author.address} } )   - {getDate(reply.timestamp)} + {getDate(reply.timestamp)}   - - c/ - {reply.cid.slice(0, 8)} + + c/ + {reply.cid.slice(0, 8)} - +
{reply.content ? ( reply.content.length > 1000 ? - <> -
- + +
+ {`c/${reply.parentCid.slice(0, 8)}`}{
}
{reply.content.slice(0, 1000)} - (...) -

+ (...) +

Comment too long.  - handleClickThread(thread.cid)} className="ttl-link">Click here + handleClickThread(thread.cid)} className="ttl-link">Click here  to view.
- - :
- + + :
+ {`c/${reply.parentCid.slice(0, 8)}`}{
}
{reply.content} @@ -639,163 +639,163 @@ const Board = ({ setBodyStyle }) => {
)})}
-
-
-
-
-
- ... - +
+
+
+
+
+ ... + {thread.author.displayName ? thread.author.displayName.length > 15 - ? <> - - + + {thread.author.displayName.slice(0, 15) + " (...)"} - - : + + : {thread.author.displayName} - : + : Anonymous}   - + (u/ {thread.author.address.length > 15 ? - <> - - + + {thread.author.address.slice(0, 15) + "..."} - - : + + : {thread.author.address} } )  -
+
{thread.title ? ( thread.title.length > 30 ? - <> - - + + {thread.title.slice(0, 30) + " (...)"} - - : + + : {thread.title} ) : null} - + {getDate(thread.timestamp)}   - c/ - {thread.cid.slice(0, 8)} + c/ + {thread.cid.slice(0, 8)}
-
- - -
58 KB JPG
+
{thread.content ? ( thread.content.length > 1500 ? - <> -
+ +
{thread.content.slice(0, 1500)} - (...) -

+ (...) +

Post too long.  - handleClickThread(thread.cid)} className="ttl-link">Click here + handleClickThread(thread.cid)} className="ttl-link">Click here  to view.
- - :
+ + :
{thread.content}
) : null}
-
- {thread.replyCount} Replies / ? Images - handleClickThread(thread.cid)} className="button-mobile" >View Thread +
+ {thread.replyCount} Replies / ? Images + handleClickThread(thread.cid)} className="button-mobile" >View Thread
{renderedComments.map(reply => { return ( -
-
-
- ... - +
+
+
+ ... + {reply.author.displayName ? reply.author.displayName.length > 12 - ? <> - - + + {reply.author.displayName.slice(0, 12) + " (...)"} - - : + + : {reply.author.displayName} - : + : Anonymous}   - + (u/ {reply.author.address.length > 10 ? - <> - - + + {reply.author.address.slice(0, 10) + "..."} - - : + + : {reply.author.address} } )  -
+
- + {getDate(reply.timestamp)}  - c/ - {reply.cid.slice(0, 8)} + c/ + {reply.cid.slice(0, 8)}
{reply.content ? ( reply.content.length > 1000 ? - <> -
- + +
+ {`c/${reply.parentCid.slice(0, 8)}`}{
}
{reply.content.slice(0, 1000)} - (...) -

+ (...) +

Comment too long.  - handleClickThread(thread.cid)} className="ttl-link">Click here + handleClickThread(thread.cid)} className="ttl-link">Click here  to view.
- - :
- + + :
+ {`c/${reply.parentCid.slice(0, 8)}`}{
}
{reply.content} @@ -805,7 +805,7 @@ const Board = ({ setBodyStyle }) => {
)})}
- + )})}
diff --git a/src/components/Catalog.jsx b/src/components/Catalog.jsx index 8a531425..f10062e9 100644 --- a/src/components/Catalog.jsx +++ b/src/components/Catalog.jsx @@ -284,9 +284,9 @@ const Catalog = ({ setBodyStyle }) => { <> {defaultSubplebbits.map(subplebbit => ( - + [ - handleClickTitle(subplebbit.title, subplebbit.address)} + handleClickTitle(subplebbit.title, subplebbit.address)} >{subplebbit.title} ]  @@ -306,7 +306,7 @@ const Catalog = ({ setBodyStyle }) => {   @@ -420,23 +420,23 @@ const Catalog = ({ setBodyStyle }) => { pageStart={0} loadMore={tryLoadMore} hasMore={hasMore} - loader={
Loading...
} + loader={
Loading...
} > {feed.map(thread => { return ( -
- handleClickThread(thread.cid)}> - +
+ handleClickThread(thread.cid)}> + -
- +
+
-
+
R: - {thread.replyCount} + {thread.replyCount}
-
- {thread.title ? `${thread.title}` : null} +
+ {thread.title ? `${thread.title}` : null} {thread.content ? `: ${thread.content}` : null}
diff --git a/src/components/Thread.jsx b/src/components/Thread.jsx index 6f12fab7..2bd74b75 100644 --- a/src/components/Thread.jsx +++ b/src/components/Thread.jsx @@ -209,9 +209,9 @@ const Thread = ({ setBodyStyle }) => { <> {defaultSubplebbits.map(subplebbit => ( - + [ - handleClickTitle(subplebbit.title, subplebbit.address)} >{subplebbit.title} @@ -233,7 +233,7 @@ const Thread = ({ setBodyStyle }) => {   @@ -375,28 +375,28 @@ const Thread = ({ setBodyStyle }) => {
-
-
+
+
File:  - filename.something (metadata) + filename.something (metadata)
- - filename.something + + filename.something
{comment.title ? ( comment.title.length > 75 ? <> - - + {comment.title.slice(0, 75) + " (...)"} - : + : {comment.title} ) : null} @@ -404,17 +404,17 @@ const Thread = ({ setBodyStyle }) => { {comment.author.displayName ? comment.author.displayName.length > 20 ? <> - - + {comment.author.displayName.slice(0, 20) + " (...)"} - : + : {comment.author.displayName} - : + : Anonymous}     @@ -422,15 +422,15 @@ const Thread = ({ setBodyStyle }) => { (u/ {comment.author.address.length > 20 ? <> - - + {comment.author.address.slice(0, 20) + "..."} - : + : {comment.author.address} }) @@ -441,7 +441,7 @@ const Thread = ({ setBodyStyle }) => { c/ {comment.cid.slice(0, 8)} - +