mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
disabled mock content
This commit is contained in:
@@ -1,3 +0,0 @@
|
|||||||
REACT_APP_PLEBBIT_REACT_HOOKS_MOCK_CONTENT=1
|
|
||||||
REACT_APP_PLEBBIT_REACT_HOOKS_MOCK_CONTENT_LOADING_TIME=1000
|
|
||||||
REACT_APP_PLEBBIT_REACT_HOOKS_MOCK_CONTENT_DOUBLE_MEDIA=1
|
|
||||||
@@ -375,7 +375,7 @@ const Board = () => {
|
|||||||
hasMore={hasMore}
|
hasMore={hasMore}
|
||||||
>
|
>
|
||||||
{selectedFeed.map((thread) => {
|
{selectedFeed.map((thread) => {
|
||||||
const { replies: { pages: { topAll: { comments } } } } = thread;
|
const { replies: { pages: { topAll: { comments } = {} } = {} } = {} } = thread;
|
||||||
const { renderedComments, omittedCount } = renderComments(comments);
|
const { renderedComments, omittedCount } = renderComments(comments);
|
||||||
const commentMediaInfo = getCommentMediaInfo(thread);
|
const commentMediaInfo = getCommentMediaInfo(thread);
|
||||||
const fallbackImgUrl = "/assets/filedeleted-res.gif";
|
const fallbackImgUrl = "/assets/filedeleted-res.gif";
|
||||||
@@ -471,7 +471,7 @@ const Board = () => {
|
|||||||
</span>
|
</span>
|
||||||
<button key={`pmb-${thread.cid}`} className="post-menu-button" title="Post menu" style={{ all: 'unset', cursor: 'pointer' }} data-cmd="post-menu">▶</button>
|
<button key={`pmb-${thread.cid}`} className="post-menu-button" title="Post menu" style={{ all: 'unset', cursor: 'pointer' }} data-cmd="post-menu">▶</button>
|
||||||
<div key={`bi-${thread.cid}`} id="backlink-id" className="backlink">
|
<div key={`bi-${thread.cid}`} id="backlink-id" className="backlink">
|
||||||
{thread.replies?.pages.topAll.comments
|
{thread.replies?.pages?.topAll.comments
|
||||||
.sort((a, b) => a.timestamp - b.timestamp)
|
.sort((a, b) => a.timestamp - b.timestamp)
|
||||||
.map((reply) => (
|
.map((reply) => (
|
||||||
<div key={`div-${reply.cid}`} style={{display: 'inline-block'}}>
|
<div key={`div-${reply.cid}`} style={{display: 'inline-block'}}>
|
||||||
@@ -514,7 +514,7 @@ const Board = () => {
|
|||||||
</span>
|
</span>
|
||||||
</span>) : null}
|
</span>) : null}
|
||||||
</span>
|
</span>
|
||||||
{renderedComments.map((reply) => {
|
{renderedComments?.map((reply) => {
|
||||||
const replyMediaInfo = getCommentMediaInfo(reply);
|
const replyMediaInfo = getCommentMediaInfo(reply);
|
||||||
const fallbackImgUrl = "/assets/filedeleted-res.gif";
|
const fallbackImgUrl = "/assets/filedeleted-res.gif";
|
||||||
return (
|
return (
|
||||||
@@ -558,7 +558,7 @@ const Board = () => {
|
|||||||
</span>
|
</span>
|
||||||
<button key={`pmb-${reply.cid}`} className="post-menu-button" onClick={() => {}} title="Post menu" style={{ all: 'unset', cursor: 'pointer' }} data-cmd="post-menu">▶</button>
|
<button key={`pmb-${reply.cid}`} className="post-menu-button" onClick={() => {}} title="Post menu" style={{ all: 'unset', cursor: 'pointer' }} data-cmd="post-menu">▶</button>
|
||||||
<div id="backlink-id" className="backlink">
|
<div id="backlink-id" className="backlink">
|
||||||
{reply.replies?.pages.topAll.comments
|
{reply.replies?.pages?.topAll.comments
|
||||||
.sort((a, b) => a.timestamp - b.timestamp)
|
.sort((a, b) => a.timestamp - b.timestamp)
|
||||||
.map((reply) => (
|
.map((reply) => (
|
||||||
<div key={`div-${reply.cid}`} style={{display: 'inline-block'}}>
|
<div key={`div-${reply.cid}`} style={{display: 'inline-block'}}>
|
||||||
@@ -749,7 +749,7 @@ const Board = () => {
|
|||||||
<Link key={`rl2-${thread.cid}`} to={`/p/${selectedAddress}/c/${thread.cid}`} onClick={() => setSelectedThread(thread.cid)} className="button-mobile" >View Thread</Link>
|
<Link key={`rl2-${thread.cid}`} to={`/p/${selectedAddress}/c/${thread.cid}`} onClick={() => setSelectedThread(thread.cid)} className="button-mobile" >View Thread</Link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{renderedComments.map((reply) => {
|
{renderedComments?.map((reply) => {
|
||||||
const replyMediaInfo = getCommentMediaInfo(reply);
|
const replyMediaInfo = getCommentMediaInfo(reply);
|
||||||
return (
|
return (
|
||||||
<div key={`mob-rc-${reply.cid}`} className="reply-container">
|
<div key={`mob-rc-${reply.cid}`} className="reply-container">
|
||||||
|
|||||||
@@ -481,7 +481,7 @@ const Thread = () => {
|
|||||||
</span>
|
</span>
|
||||||
<button key={`pmb-${comment.cid}`} className="post-menu-button" onClick={() => {}} title="Post menu" style={{ all: 'unset', cursor: 'pointer' }}>▶</button>
|
<button key={`pmb-${comment.cid}`} className="post-menu-button" onClick={() => {}} title="Post menu" style={{ all: 'unset', cursor: 'pointer' }}>▶</button>
|
||||||
<div id="backlink-id" className="backlink">
|
<div id="backlink-id" className="backlink">
|
||||||
{comment.replies?.pages.topAll.comments
|
{comment?.replies?.pages?.topAll.comments
|
||||||
.sort((a, b) => a.timestamp - b.timestamp)
|
.sort((a, b) => a.timestamp - b.timestamp)
|
||||||
.map((reply) => (
|
.map((reply) => (
|
||||||
<div key={`div-${reply.cid}`} style={{display: 'inline-block'}}>
|
<div key={`div-${reply.cid}`} style={{display: 'inline-block'}}>
|
||||||
@@ -503,8 +503,8 @@ const Thread = () => {
|
|||||||
</div>
|
</div>
|
||||||
{comment.replyCount === undefined ? <PostLoader /> : null}
|
{comment.replyCount === undefined ? <PostLoader /> : null}
|
||||||
{comment.replyCount > 0 &&
|
{comment.replyCount > 0 &&
|
||||||
Object.keys(comment.replies.pages.topAll.comments).map(() => {
|
Object.keys(comment?.replies?.pages?.topAll.comments).map(() => {
|
||||||
const renderedComments = renderThreadComments(comment.replies.pages.topAll.comments);
|
const renderedComments = renderThreadComments(comment?.replies?.pages?.topAll.comments);
|
||||||
return renderedComments.map(reply => {
|
return renderedComments.map(reply => {
|
||||||
const replyMediaInfo = getCommentMediaInfo(reply);
|
const replyMediaInfo = getCommentMediaInfo(reply);
|
||||||
const fallbackImgUrl = "/assets/filedeleted-res.gif";
|
const fallbackImgUrl = "/assets/filedeleted-res.gif";
|
||||||
@@ -548,7 +548,7 @@ const Thread = () => {
|
|||||||
</span>
|
</span>
|
||||||
<button key={`pmb-${reply.cid}`} className="post-menu-button" onClick={() => {}} title="Post menu" style={{ all: 'unset', cursor: 'pointer' }}>▶</button>
|
<button key={`pmb-${reply.cid}`} className="post-menu-button" onClick={() => {}} title="Post menu" style={{ all: 'unset', cursor: 'pointer' }}>▶</button>
|
||||||
<div id="backlink-id" className="backlink">
|
<div id="backlink-id" className="backlink">
|
||||||
{reply.replies?.pages.topAll.comments
|
{reply.replies?.pages?.topAll.comments
|
||||||
.sort((a, b) => a.timestamp - b.timestamp)
|
.sort((a, b) => a.timestamp - b.timestamp)
|
||||||
.map((reply) => (
|
.map((reply) => (
|
||||||
<div key={`div-${reply.cid}`} style={{display: 'inline-block'}}>
|
<div key={`div-${reply.cid}`} style={{display: 'inline-block'}}>
|
||||||
@@ -711,8 +711,8 @@ const Thread = () => {
|
|||||||
</div>
|
</div>
|
||||||
{comment.replyCount === undefined ? <PostLoader /> : null}
|
{comment.replyCount === undefined ? <PostLoader /> : null}
|
||||||
{comment.replyCount > 0 &&
|
{comment.replyCount > 0 &&
|
||||||
Object.keys(comment.replies.pages.topAll.comments).map(() => {
|
Object.keys(comment?.replies?.pages?.topAll.comments).map(() => {
|
||||||
const renderedComments = renderThreadComments(comment.replies.pages.topAll.comments);
|
const renderedComments = renderThreadComments(comment?.replies?.pages?.topAll.comments);
|
||||||
return renderedComments.map(reply => {
|
return renderedComments.map(reply => {
|
||||||
return (
|
return (
|
||||||
<div key={`mob-rc-${reply.cid}-${Math.random()}`} className="reply-container">
|
<div key={`mob-rc-${reply.cid}-${Math.random()}`} className="reply-container">
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ const getCommentMediaInfo = (comment) => {
|
|||||||
if (!comment?.thumbnailUrl && !comment?.link) {
|
if (!comment?.thumbnailUrl && !comment?.link) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (comment?.thumbnailUrl) {
|
// if (comment?.thumbnailUrl) {
|
||||||
return {
|
// return {
|
||||||
url: comment.link,
|
// url: comment.link,
|
||||||
type: 'webpage'
|
// type: 'webpage'
|
||||||
};
|
// };
|
||||||
}
|
// }
|
||||||
if (comment?.link) {
|
if (comment?.link) {
|
||||||
try {
|
try {
|
||||||
new URL(comment.link);
|
new URL(comment.link);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ function renderComments(comments) {
|
|||||||
let omittedCount = 0;
|
let omittedCount = 0;
|
||||||
|
|
||||||
const renderComment = (comment) => {
|
const renderComment = (comment) => {
|
||||||
const { replyCount, replies: { pages: { topAll: { comments: nestedComments } } } } = comment;
|
const { replyCount, replies: { pages: { topAll: { comments: nestedComments = [] } = {} } = {} } = {} } = comment;
|
||||||
let renderedNestedComments = [];
|
let renderedNestedComments = [];
|
||||||
|
|
||||||
if (replyCount > 0 && nestedComments.length > 0) {
|
if (replyCount > 0 && nestedComments.length > 0) {
|
||||||
@@ -21,8 +21,8 @@ function renderComments(comments) {
|
|||||||
return displayedComments;
|
return displayedComments;
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderedComments = comments.flatMap(renderComment);
|
const renderedComments = comments?.flatMap(renderComment);
|
||||||
renderedComments.sort((a, b) => a.timestamp - b.timestamp);
|
renderedComments?.sort((a, b) => a.timestamp - b.timestamp);
|
||||||
|
|
||||||
return { renderedComments, omittedCount };
|
return { renderedComments, omittedCount };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ function renderThreadComments(comments) {
|
|||||||
const commentKeys = Object.keys(comments);
|
const commentKeys = Object.keys(comments);
|
||||||
const renderedComments = commentKeys.map(key => {
|
const renderedComments = commentKeys.map(key => {
|
||||||
const comment = comments[key];
|
const comment = comments[key];
|
||||||
const { replies: { pages: { topAll: { comments: nestedComments } } } } = comment;
|
const { replies: { pages: { topAll: { comments: nestedComments = [] } = {} } = {} } = {} } = comment;
|
||||||
if (comment.replyCount > 0 && nestedComments) {
|
if (comment.replyCount > 0 && nestedComments) {
|
||||||
const renderedNestedComments = renderThreadComments(nestedComments);
|
const renderedNestedComments = renderThreadComments(nestedComments);
|
||||||
return [comment, ...renderedNestedComments];
|
return [comment, ...renderedNestedComments];
|
||||||
|
|||||||
Reference in New Issue
Block a user