Files
5chan/src/components/Board.jsx
T

901 lines
41 KiB
React
Raw Normal View History

2023-03-07 13:07:36 +01:00
import React, { useState, useEffect, useContext, Fragment } from 'react';
2023-03-06 14:33:31 +01:00
import { Link, useNavigate, useParams, useLocation } from 'react-router-dom';
2023-02-09 19:08:15 +01:00
import { BoardContext } from '../App';
2023-02-14 11:29:53 +01:00
import { Container, NavBar, Header, Break, PostFormLink, PostFormTable, PostForm, TopBar, BoardForm } from './styles/Board.styled';
import ImageBanner from './ImageBanner';
2023-03-02 21:51:06 +01:00
import { useFeed, useAccountsActions } from '@plebbit/plebbit-react-hooks';
2023-02-16 21:01:21 +01:00
import InfiniteScroll from 'react-infinite-scroller';
2023-02-28 16:34:33 +01:00
import { Tooltip } from 'react-tooltip';
2023-03-05 14:15:51 +01:00
import getDate from '../utils/getDate';
import renderComments from '../utils/renderComments';
2023-02-14 21:13:15 +01:00
2023-02-05 18:44:16 +01:00
const Board = ({ setBodyStyle }) => {
2023-02-04 22:10:54 +01:00
const [defaultSubplebbits, setDefaultSubplebbits] = useState([]);
2023-03-09 17:51:56 +01:00
const { selectedTitle, setSelectedTitle, selectedAddress, setSelectedAddress, setSelectedThread, selectedStyle, setSelectedStyle, setIsCaptchaOpen } = useContext(BoardContext);
2023-02-11 22:00:13 +01:00
const [showPostFormLink, setShowPostFormLink] = useState(true);
const [showPostForm, setShowPostForm] = useState(false);
2023-02-15 16:48:21 +01:00
const [name, setName] = useState('');
const [subject, setSubject] = useState('');
const [comment, setComment] = useState('');
2023-03-02 11:09:03 +01:00
const { publishComment } = useAccountsActions();
2023-02-11 22:00:13 +01:00
const navigate = useNavigate();
2023-03-06 14:33:31 +01:00
const location = useLocation();
2023-02-24 20:57:51 +01:00
const [prevScrollPos, setPrevScrollPos] = useState(0);
const [visible, setVisible] = useState(true);
2023-03-02 11:09:03 +01:00
const [endIndex, setEndIndex] = useState(2);
const { feed, hasMore, loadMore } = useFeed([`${selectedAddress}`], 'new');
const [selectedFeed, setSelectedFeed] = useState(feed);
2023-03-03 14:02:46 +01:00
const renderedFeed = selectedFeed.slice(0, endIndex);
2023-03-02 18:19:08 +01:00
const { subplebbitAddress } = useParams();
2023-03-11 17:27:46 +01:00
// const [cookies, setCookie] = useCookies(['selectedStyle']);
2023-03-01 22:26:25 +01:00
2023-03-02 21:51:06 +01:00
2023-03-03 14:02:46 +01:00
// temporary title from JSON, gets subplebbitAddress from URL
2023-03-02 18:19:08 +01:00
useEffect(() => {
setSelectedAddress(subplebbitAddress);
const selectedSubplebbit = defaultSubplebbits.find((subplebbit) => subplebbit.address === subplebbitAddress);
if (selectedSubplebbit) {
setSelectedTitle(selectedSubplebbit.title);
}
}, [subplebbitAddress, setSelectedAddress, setSelectedTitle, defaultSubplebbits]);
2023-03-03 14:02:46 +01:00
// sets useFeed to address from URL
2023-03-02 11:09:03 +01:00
useEffect(() => {
setSelectedFeed(feed);
}, [feed]);
2023-02-17 18:03:05 +01:00
2023-03-03 14:02:46 +01:00
// fetches default subplebbits from JSON
2023-03-02 13:42:26 +01:00
useEffect(() => {
let didCancel = false;
fetch(
"https://raw.githubusercontent.com/plebbit/temporary-default-subplebbits/master/subplebbits.json",
{ cache: "no-cache" }
)
.then((res) => res.json())
.then(res => {
if (!didCancel) {
setDefaultSubplebbits(res);
}
});
return () => {
didCancel = true;
};
}, []);
2023-03-03 14:02:46 +01:00
// mobile navbar scroll effect
2023-03-02 13:42:26 +01:00
useEffect(() => {
const handleScroll = () => {
const currentScrollPos = window.pageYOffset;
setVisible(prevScrollPos > currentScrollPos || currentScrollPos < 10);
setPrevScrollPos(currentScrollPos);
};
window.addEventListener('scroll', handleScroll);
return () => window.removeEventListener('scroll', handleScroll);
}, [prevScrollPos, visible]);
2023-03-03 14:02:46 +01:00
// reset endIndex whenever selectedAddress changes
useEffect(() => {
setEndIndex(2);
}, [selectedAddress]);
2023-03-06 14:33:31 +01:00
// post route handling
useEffect(() => {
const path = location.pathname;
if (path.endsWith('/post')) {
setShowPostFormLink(false);
setShowPostForm(true);
} else {
setShowPostFormLink(true);
setShowPostForm(false);
}
}, [location.pathname]);
2023-03-08 13:13:55 +01:00
// automatic dark mode without interefering with user's selected style
useEffect(() => {
const darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
const isDarkMode = darkModeMediaQuery.matches;
if (isDarkMode) {
setSelectedStyle('Tomorrow');
setBodyStyle({
background: '#1d1f21 none',
color: '#c5c8c6',
fontFamily: 'Arial, Helvetica, sans-serif'
});
2023-03-11 17:27:46 +01:00
localStorage.setItem('selectedStyle', 'Tomorrow');
2023-03-08 13:13:55 +01:00
}
const darkModeListener = (e) => {
if (e.matches) {
setSelectedStyle('Tomorrow');
setBodyStyle({
background: '#1d1f21 none',
color: '#c5c8c6',
fontFamily: 'Arial, Helvetica, sans-serif'
});
2023-03-11 17:27:46 +01:00
localStorage.setItem('selectedStyle', 'Tomorrow');
2023-03-08 13:13:55 +01:00
}
};
darkModeMediaQuery.addEventListener('change', darkModeListener);
return () => {
darkModeMediaQuery.removeEventListener('change', darkModeListener);
};
}, []);
2023-03-02 13:42:26 +01:00
2023-03-02 21:51:06 +01:00
2023-02-16 21:01:21 +01:00
const tryLoadMore = async () => {
2023-03-01 22:26:25 +01:00
try {
2023-03-02 11:09:03 +01:00
loadMore();
2023-03-03 14:02:46 +01:00
const newFeed = [...selectedFeed, ...feed];
setSelectedFeed(newFeed);
2023-03-02 11:09:03 +01:00
setEndIndex(endIndex + 2);
2023-03-01 22:26:25 +01:00
} catch (e) {
await new Promise(resolve => setTimeout(resolve, 1000));
}
2023-03-03 14:02:46 +01:00
};
2023-02-16 21:01:21 +01:00
2023-03-02 21:51:06 +01:00
2023-02-15 16:48:21 +01:00
const onChallengeVerification = (challengeVerification) => {
if (challengeVerification.challengeSuccess === true) {
console.log('challenge success', {publishedCid: challengeVerification.publication.cid})
}
else if (challengeVerification.challengeSuccess === false) {
console.error('challenge failed', {reason: challengeVerification.reason, errors: challengeVerification.errors});
alert("Error: You seem to have mistyped the CAPTCHA. Please try again.");
}
}
2023-03-02 21:51:06 +01:00
2023-02-15 16:48:21 +01:00
const onChallenge = async (challenges, comment) => {
let challengeAnswers = [];
try {
challengeAnswers = await getChallengeAnswersFromUser(challenges)
}
catch (error) {
console.log(error);
}
if (challengeAnswers) {
await comment.publishChallengeAnswers(challengeAnswers)
}
}
2023-03-02 21:51:06 +01:00
2023-02-15 16:48:21 +01:00
const onError = (error) => console.error(error)
2023-03-02 21:51:06 +01:00
2023-02-15 16:48:21 +01:00
const getChallengeAnswersFromUser = async (challenges) => {
return new Promise((resolve, reject) => {
const imageString = challenges?.challenges[0].challenge;
const imageSource = `data:image/png;base64,${imageString}`;
const challengeImg = new Image();
challengeImg.src = imageSource;
challengeImg.onload = () => {
const inputEl = document.getElementById('t-resp');
const cntEl = document.getElementById('t-cnt');
cntEl.appendChild(challengeImg);
inputEl.focus();
const handleKeyDown = (event) => {
if (event.key === 'Enter') {
const challengeResponse = inputEl.value;
inputEl.value = '';
if (cntEl.contains(challengeImg)) {
cntEl.removeChild(challengeImg);
}
document.removeEventListener('keydown', handleKeyDown);
resolve(challengeResponse);
}
};
document.addEventListener('keydown', handleKeyDown);
};
challengeImg.onerror = () => {
reject(new Error('Could not load challenge image'));
};
});
};
2023-02-12 21:20:08 +01:00
2023-02-24 20:57:51 +01:00
2023-03-02 21:51:06 +01:00
2023-03-02 13:42:26 +01:00
const handleScroll = (event) => {
const { scrollTop, scrollHeight, clientHeight } = event.currentTarget;
if (scrollTop + clientHeight >= scrollHeight) {
setEndIndex(endIndex + 5);
}
};
2023-03-02 21:51:06 +01:00
2023-03-03 14:02:46 +01:00
const handleVoidClick = () => {};
2023-03-02 21:51:06 +01:00
2023-03-03 14:02:46 +01:00
// desktop navbar board select functionality
2023-02-27 15:32:16 +01:00
const handleClickTitle = (title, address) => {
2023-02-07 22:55:00 +01:00
setSelectedTitle(title);
setSelectedAddress(address);
2023-03-02 11:09:03 +01:00
setSelectedFeed(feed.filter(feed => feed.title === title));
2023-02-07 22:55:00 +01:00
};
2023-03-03 14:02:46 +01:00
// mobile navbar board select functionality
const handleSelectChange = (event) => {
const selected = event.target.value;
const selectedTitle = defaultSubplebbits.find((subplebbit) => subplebbit.address === selected).title;
setSelectedTitle(selectedTitle);
setSelectedAddress(selected);
navigate(`/${selected}`);
}
2023-03-02 21:51:06 +01:00
2023-02-11 22:00:13 +01:00
const handleClickHelp = () => {
2023-03-12 10:27:59 +01:00
alert("- Embedding media is optional, posts can be text-only. \n- A CAPTCHA challenge will appear after posting. \n- The CAPTCHA is case-sensitive.");
2023-02-11 22:00:13 +01:00
};
2023-03-02 21:51:06 +01:00
2023-02-11 22:00:13 +01:00
const handleClickForm = () => {
setShowPostFormLink(false);
setShowPostForm(true);
2023-03-02 21:51:06 +01:00
navigate(`/${selectedAddress}/post`);
2023-02-11 22:00:13 +01:00
};
2023-03-02 21:51:06 +01:00
const handleClickThread = (thread) => {
setSelectedThread(thread);
}
2023-02-15 16:48:21 +01:00
2023-03-02 21:51:06 +01:00
2023-02-15 16:48:21 +01:00
const handlePublishComment = async () => {
try {
const pendingComment = await publishComment({
content: comment,
title: subject,
subplebbitAddress: selectedAddress,
onChallengeVerification,
onChallenge,
onError,
});
console.log(`Comment pending with index: ${pendingComment.index}`);
setName('');
setSubject('');
setComment('');
} catch (error) {
console.error(error);
}
};
2023-02-11 22:00:13 +01:00
2023-03-08 09:49:42 +01:00
// scroll to post when quote is clicked
function handleQuoteClick(reply, event) {
event.preventDefault();
const cid = reply.cid.slice(0, 8);
const targetElement = [...document.querySelectorAll('.post-reply')]
.find(el => el.innerHTML.includes(cid));
if (targetElement) {
targetElement.scrollIntoView({ behavior: "instant" });
}
}
2023-03-02 21:51:06 +01:00
2023-02-08 21:49:36 +01:00
const handleStyleChange = (event) => {
switch (event.target.value) {
case "Yotsuba":
2023-03-11 17:27:46 +01:00
const yotsubaBodyStyle = {
2023-02-16 14:05:48 +01:00
background: "#ffe url(/assets/fade.png) top repeat-x",
2023-02-08 21:49:36 +01:00
color: "maroon",
fontFamily: "Arial, Helvetica, sans-serif"
2023-03-11 17:27:46 +01:00
};
setBodyStyle(yotsubaBodyStyle);
2023-02-08 21:49:36 +01:00
setSelectedStyle("Yotsuba");
2023-03-11 17:27:46 +01:00
localStorage.setItem("selectedStyle", "Yotsuba");
localStorage.setItem("bodyStyle", JSON.stringify(yotsubaBodyStyle));
2023-02-08 21:49:36 +01:00
break;
2023-03-11 17:27:46 +01:00
2023-03-08 12:49:44 +01:00
case "Yotsuba-B":
2023-03-11 17:27:46 +01:00
const yotsubaBBodyStyle = {
2023-02-16 14:05:48 +01:00
background: "#eef2ff url(/assets/fade-blue.png) top center repeat-x",
2023-02-08 21:49:36 +01:00
color: "#000",
fontFamily: "Arial, Helvetica, sans-serif"
2023-03-11 17:27:46 +01:00
};
setBodyStyle(yotsubaBBodyStyle);
2023-03-08 12:49:44 +01:00
setSelectedStyle("Yotsuba-B");
2023-03-11 17:27:46 +01:00
localStorage.setItem("selectedStyle", "Yotsuba-B");
localStorage.setItem("bodyStyle", JSON.stringify(yotsubaBBodyStyle));
2023-02-08 21:49:36 +01:00
break;
2023-03-11 17:27:46 +01:00
2023-02-08 21:49:36 +01:00
case "Futaba":
2023-03-11 17:27:46 +01:00
const futabaBodyStyle = {
2023-02-08 21:49:36 +01:00
background: "#ffe",
color: "maroon",
fontFamily: "times new roman, serif"
2023-03-11 17:27:46 +01:00
};
setBodyStyle(futabaBodyStyle);
2023-02-08 21:49:36 +01:00
setSelectedStyle("Futaba");
2023-03-11 17:27:46 +01:00
localStorage.setItem("selectedStyle", "Futaba");
localStorage.setItem("bodyStyle", JSON.stringify(futabaBodyStyle));
2023-02-08 21:49:36 +01:00
break;
2023-03-11 17:27:46 +01:00
2023-02-08 21:49:36 +01:00
case "Burichan":
2023-03-11 17:27:46 +01:00
const burichanBodyStyle = {
2023-02-08 21:49:36 +01:00
background: "#eef2ff",
color: "#000",
fontFamily: "times new roman, serif"
2023-03-11 17:27:46 +01:00
};
setBodyStyle(burichanBodyStyle);
2023-02-08 21:49:36 +01:00
setSelectedStyle("Burichan");
2023-03-11 17:27:46 +01:00
localStorage.setItem("selectedStyle", "Burichan");
localStorage.setItem("bodyStyle", JSON.stringify(burichanBodyStyle));
2023-02-08 21:49:36 +01:00
break;
2023-03-11 17:27:46 +01:00
2023-02-08 21:49:36 +01:00
case "Tomorrow":
2023-03-11 17:27:46 +01:00
const tomorrowBodyStyle = {
2023-02-08 21:49:36 +01:00
background: "#1d1f21 none",
color: "#c5c8c6",
fontFamily: "Arial, Helvetica, sans-serif"
2023-03-11 17:27:46 +01:00
};
setBodyStyle(tomorrowBodyStyle);
2023-02-08 21:49:36 +01:00
setSelectedStyle("Tomorrow");
2023-03-11 17:27:46 +01:00
localStorage.setItem("selectedStyle", "Tomorrow");
localStorage.setItem("bodyStyle", JSON.stringify(tomorrowBodyStyle));
2023-02-08 21:49:36 +01:00
break;
2023-03-11 17:27:46 +01:00
2023-02-08 21:49:36 +01:00
case "Photon":
2023-03-11 17:27:46 +01:00
const photonBodyStyle = {
2023-02-08 21:49:36 +01:00
background: "#eee none",
color: "#333",
fontFamily: "Arial, Helvetica, sans-serif"
2023-03-11 17:27:46 +01:00
};
setBodyStyle(photonBodyStyle);
2023-02-08 21:49:36 +01:00
setSelectedStyle("Photon");
2023-03-11 17:27:46 +01:00
localStorage.setItem("selectedStyle", "Photon");
localStorage.setItem("bodyStyle", JSON.stringify(photonBodyStyle));
2023-02-08 21:49:36 +01:00
break;
2023-03-11 17:27:46 +01:00
2023-02-08 21:49:36 +01:00
default:
2023-03-11 17:27:46 +01:00
const defaultBodyStyle = {
2023-02-16 14:05:48 +01:00
background: "#ffe url(/assets/fade.png) top repeat-x",
2023-02-08 21:49:36 +01:00
color: "maroon",
fontFamily: "Arial, Helvetica, sans-serif"
2023-03-11 17:27:46 +01:00
};
setBodyStyle(defaultBodyStyle);
2023-02-08 21:49:36 +01:00
setSelectedStyle("Yotsuba");
2023-03-11 17:27:46 +01:00
localStorage.setItem("selectedStyle", "Yotsuba");
localStorage.setItem("bodyStyle", JSON.stringify(defaultBodyStyle));
2023-02-08 21:49:36 +01:00
}
}
2023-03-02 13:42:26 +01:00
2023-03-02 21:51:06 +01:00
2023-02-02 21:58:02 +01:00
return (
2023-02-04 22:10:54 +01:00
<Container>
2023-02-08 21:49:36 +01:00
<NavBar selectedStyle={selectedStyle}>
2023-02-04 22:10:54 +01:00
<>
{defaultSubplebbits.map(subplebbit => (
2023-02-11 22:00:13 +01:00
<span className="boardList" key={`span-${subplebbit.address}`}>
2023-02-07 22:55:00 +01:00
[
2023-03-10 12:42:26 +01:00
<Link to={`/${subplebbit.address}`} key={`a-${subplebbit.address}`} onClick={() => handleClickTitle(subplebbit.title, subplebbit.address)}
2023-02-19 22:08:18 +01:00
>{subplebbit.title}</Link>
2023-02-04 22:10:54 +01:00
]&nbsp;
</span>
))}
2023-02-23 16:45:29 +01:00
<span className="nav">
[
2023-03-10 12:42:26 +01:00
<Link to="" onClick={handleVoidClick}>Settings</Link>
2023-02-23 16:45:29 +01:00
]
[
2023-03-10 12:42:26 +01:00
<Link to="/" onClick={() => handleStyleChange({target: {value: "Yotsuba"}}
2023-02-23 16:45:29 +01:00
)}>Home</Link>
]
2023-02-04 22:10:54 +01:00
</span>
2023-02-24 20:57:51 +01:00
<div id="board-nav-mobile" style={{ top: visible ? 0 : '-23px' }}>
2023-02-23 16:45:29 +01:00
<div className="board-select">
<strong>Board</strong>
&nbsp;
2023-02-27 18:16:47 +01:00
<select id="board-select-mobile" value={selectedAddress} onChange={handleSelectChange}>
2023-02-23 16:45:29 +01:00
{defaultSubplebbits.map(subplebbit => (
2023-02-27 18:16:47 +01:00
<option key={`option-${subplebbit.address}`} value={subplebbit.address}
>{subplebbit.title}</option>
2023-02-27 15:32:16 +01:00
))}
2023-02-23 16:45:29 +01:00
</select>
</div>
<div className="page-jump">
2023-03-10 12:42:26 +01:00
<Link to="" onClick={handleVoidClick}>Settings</Link>
2023-02-23 16:45:29 +01:00
&nbsp;
2023-03-10 12:42:26 +01:00
<Link to="/" onClick={() => handleStyleChange({target: {value: "Yotsuba"}}
2023-02-23 16:45:29 +01:00
)}>Home</Link>
</div>
</div>
<div id="separator-mobile">&nbsp;</div>
<div id="separator-mobile">&nbsp;</div>
2023-02-04 22:10:54 +01:00
</>
</NavBar>
2023-02-08 21:49:36 +01:00
<Header selectedStyle={selectedStyle}>
2023-02-04 22:10:54 +01:00
<>
<div className="banner">
2023-02-05 18:44:16 +01:00
<ImageBanner />
2023-02-04 22:10:54 +01:00
</div>
2023-02-07 13:23:14 +01:00
<>
2023-02-07 22:55:00 +01:00
<div className="board-title">{selectedTitle}</div>
<div className="board-address">p/{selectedAddress}</div>
2023-02-07 13:23:14 +01:00
</>
2023-02-04 22:10:54 +01:00
</>
</Header>
2023-02-08 21:49:36 +01:00
<Break selectedStyle={selectedStyle} />
2023-02-15 16:48:21 +01:00
<PostForm selectedStyle={selectedStyle}>
2023-02-24 18:13:02 +01:00
<PostFormLink id="post-form-link" showPostFormLink={showPostFormLink} selectedStyle={selectedStyle} >
<div id="post-form-link-desktop">
[
<a onClick={handleClickForm} onMouseOver={(event) => event.target.style.cursor='pointer'}>Start a New Thread</a>
]
</div>
<div id="post-form-link-mobile">
<span className="btn-wrap">
<a onClick={handleClickForm} onMouseOver={(event) => event.target.style.cursor='pointer'}>Start a New Thread</a>
</span>
</div>
2023-02-11 22:00:13 +01:00
</PostFormLink>
<PostFormTable id="post-form" showPostForm={showPostForm} selectedStyle={selectedStyle} className="post-form">
<tbody>
<tr data-type="Name">
<td id="td-name">Name</td>
<td>
2023-02-15 16:48:21 +01:00
<input name="name" type="text" tabIndex={1} placeholder="Anonymous" value={name} onChange={(event) => setName(event.target.value)} />
2023-02-11 22:00:13 +01:00
</td>
</tr>
<tr data-type="Subject">
<td>Subject</td>
<td>
2023-02-15 16:48:21 +01:00
<input name="sub" type="text" tabIndex={3} value={subject} onChange={(event) => setSubject(event.target.value)} />
<input id="post-button" type="submit" value="Post" tabIndex={6} onClick={handlePublishComment} />
2023-02-11 22:00:13 +01:00
</td>
</tr>
<tr data-type="Comment">
<td>Comment</td>
<td>
2023-02-15 16:48:21 +01:00
<textarea name="com" cols="48" rows="4" tabIndex={4} wrap="soft" value={comment} onChange={(event) => setComment(event.target.value)}></textarea>
2023-02-11 22:00:13 +01:00
</td>
</tr>
<tr data-type="File">
<td>Embed File</td>
<td>
<input name="embed" type="text" tabIndex={7} placeholder="Paste link" />
2023-03-09 17:51:56 +01:00
<button id="t-help" type="button" onClick={handleClickHelp} data-tip="Help">?</button>
2023-02-11 22:00:13 +01:00
</td>
</tr>
2023-03-11 12:22:37 +01:00
<tr>
<td>
<button onClick={() => setIsCaptchaOpen(true)}>Show Captcha</button>
</td>
</tr>
2023-02-11 22:00:13 +01:00
</tbody>
</PostFormTable>
2023-02-04 22:10:54 +01:00
</PostForm>
2023-02-08 21:49:36 +01:00
<TopBar selectedStyle={selectedStyle}>
2023-02-05 18:44:16 +01:00
<hr />
2023-02-07 13:23:14 +01:00
<span className="style-changer">
Style:
 
2023-02-13 12:05:10 +01:00
<select id="style-selector" onChange={handleStyleChange} value={selectedStyle}>
2023-02-08 21:49:36 +01:00
<option value="Yotsuba">Yotsuba</option>
2023-03-08 12:49:44 +01:00
<option value="Yotsuba-B">Yotsuba B</option>
2023-02-08 21:49:36 +01:00
<option value="Futaba">Futaba</option>
2023-02-07 13:23:14 +01:00
<option value="Burichan">Burichan</option>
<option value="Tomorrow">Tomorrow</option>
<option value="Photon">Photon</option>
</select>
</span>
2023-02-24 18:13:02 +01:00
<div id="catalog-button-desktop">
[
2023-03-10 12:42:26 +01:00
<Link to={`/${selectedAddress}/catalog`}>Catalog</Link>
2023-02-24 18:13:02 +01:00
]
</div>
<div id="catalog-button-mobile">
<span className="btn-wrap">
2023-03-10 12:42:26 +01:00
<Link to={`/${selectedAddress}/catalog`}>Catalog</Link>
2023-02-24 18:13:02 +01:00
</span>
</div>
2023-02-05 18:44:16 +01:00
</TopBar>
2023-02-15 16:48:21 +01:00
<BoardForm selectedStyle={selectedStyle}>
2023-03-01 22:26:25 +01:00
<div onScroll={handleScroll} className="board">
2023-02-16 21:01:21 +01:00
<InfiniteScroll
2023-02-14 11:29:53 +01:00
pageStart={0}
2023-02-16 21:01:21 +01:00
loadMore={tryLoadMore}
2023-02-14 11:29:53 +01:00
hasMore={hasMore}
2023-03-11 12:32:42 +01:00
loader={<div key="loader">Loading...</div>}
2023-02-16 21:01:21 +01:00
>
2023-03-01 22:26:25 +01:00
{renderedFeed.map(thread => {
const { replies: { pages: { topAll: { comments } } } } = thread;
const { renderedComments, omittedCount } = renderComments(comments);
return (
2023-03-11 12:32:42 +01:00
<Fragment key={`fragment1-${thread.cid}`}>
<div key={`t-${thread.cid}`} className="thread">
<div key={`c-${thread.cid}`} className="op-container">
<div key={`po-${thread.cid}`} className="post op">
<hr key={`hr-${thread.cid}`} />
<div key={`pi-${thread.cid}`} className="post-info">
<div key={`f-${thread.cid}`} className="file">
<div key={`ft-${thread.cid}`} className="file-text">
2023-02-26 19:13:46 +01:00
File:&nbsp;
2023-03-11 12:32:42 +01:00
<a key={`fa-${thread.cid}`} href={`${thread.link}`} target="_blank">filename.something</a>&nbsp;(metadata)
2023-02-26 19:13:46 +01:00
</div>
2023-03-11 12:32:42 +01:00
<Link to="" key={`fta-${thread.cid}`} onClick={handleVoidClick} target="_blank" className="file-thumb">
<img key={`fti-${thread.cid}`} src="/assets/plebchan-psycho.png" alt="filename.something" />
2023-03-07 13:54:14 +01:00
</Link>
2023-02-22 16:31:45 +01:00
</div>
2023-03-11 12:32:42 +01:00
<span key={`nb-${thread.cid}`} className="name-block">
2023-03-01 16:51:30 +01:00
{thread.title ? (
thread.title.length > 75 ?
2023-03-11 12:32:42 +01:00
<Fragment key={`fragment2-${thread.cid}`}>
<Tooltip key={`mob-tt-tm-${thread.cid}`} id="tt-title-mobile" className="tooltip" />
<span key={`q-${thread.cid}`} className="title"
2023-03-01 16:51:30 +01:00
data-tooltip-id="tt-title-mobile"
data-tooltip-content={thread.title}
data-tooltip-place="top">
{thread.title.slice(0, 75) + " (...)"}
</span>
2023-03-07 13:07:36 +01:00
</Fragment>
2023-03-11 12:32:42 +01:00
: <span key={`q-${thread.cid}`} className="title">
2023-03-01 16:51:30 +01:00
{thread.title}
</span>)
: null}&nbsp;
{thread.author.displayName
? thread.author.displayName.length > 20
2023-03-11 12:32:42 +01:00
? <Fragment key={`fragment3-${thread.cid}`}>
<Tooltip key={`mob-tt-nm-${thread.cid}`} id="tt-name-mobile" className="tooltip" />
<span key={`n-${thread.cid}`} className="name"
2023-03-01 16:51:30 +01:00
data-tooltip-id="tt-name-mobile"
data-tooltip-content={thread.author.displayName}
data-tooltip-place="top">
{thread.author.displayName.slice(0, 20) + " (...)"}
</span>
2023-03-07 13:07:36 +01:00
</Fragment>
2023-03-11 12:32:42 +01:00
: <span key={`n-${thread.cid}`} className="name">
2023-03-01 16:51:30 +01:00
{thread.author.displayName}</span>
2023-03-11 12:32:42 +01:00
: <span key={`n-${thread.cid}`} className="name">
2023-03-01 16:51:30 +01:00
Anonymous</span>}
2023-02-26 19:13:46 +01:00
&nbsp;
2023-03-05 14:15:51 +01:00
(u/
2023-03-01 16:51:30 +01:00
{thread.author.address.length > 15 ?
2023-03-11 12:32:42 +01:00
<Fragment key={`fragment4-${thread.cid}`}>
<Tooltip key={`mob-tt-am-${thread.cid}`} id="tt-address-mobile" className="tooltip" />
<span key={`pa-${thread.cid}`} className="poster-address"
2023-03-01 16:51:30 +01:00
data-tooltip-id="tt-address-mobile"
data-tooltip-content={thread.author.address}
data-tooltip-place="top">
{thread.author.address.slice(0, 15) + "..."}
</span>
2023-03-07 13:07:36 +01:00
</Fragment>
2023-03-11 12:32:42 +01:00
: <span key={`pa-${thread.cid}`} className="poster-address">
2023-03-01 16:51:30 +01:00
{thread.author.address}
</span>})
2023-02-26 19:13:46 +01:00
&nbsp;
2023-03-11 12:32:42 +01:00
<span key={`dt-${thread.cid}`} className="date-time" data-utc="data">{getDate(thread.timestamp)}</span>
2023-02-26 19:13:46 +01:00
&nbsp;
2023-03-11 12:32:42 +01:00
<span key={`pn-${thread.cid}`} className="post-number">
<Link to="" key={`pl1-${thread.cid}`} onClick={handleVoidClick} title="Link to this post">c/</Link>
<Link to="" key={`pl2-${thread.cid}`} onClick={handleVoidClick} title="Reply to this post">{thread.cid.slice(0, 8)}</Link>
2023-02-26 19:13:46 +01:00
&nbsp;
2023-03-11 12:32:42 +01:00
<span key={`rl1-${thread.cid}`}>
2023-02-26 19:13:46 +01:00
[
2023-03-11 12:32:42 +01:00
<Link key={`rl2-${thread.cid}`} to={`/${selectedAddress}/thread/${thread.cid}`} onClick={() => handleClickThread(thread.cid)} className="reply-link" >Reply</Link>
2023-02-26 19:13:46 +01:00
]
</span>
</span>
2023-03-11 12:32:42 +01:00
<Link to="" key={`pmb-${thread.cid}`} className="post-menu-button" onClick={handleVoidClick} title="Post menu" data-cmd="post-menu"></Link>
<div key={`bi-${thread.cid}`} id="backlink-id" className="backlink">
2023-03-07 18:00:00 +01:00
{thread.replies?.pages.topAll.comments
.sort((a, b) => a.timestamp - b.timestamp)
.map((reply) => (
2023-03-11 12:32:42 +01:00
<div key={`div-${reply.cid}`} style={{display: 'inline-block'}}>
<Link key={`ql-${reply.cid}`}
2023-03-08 09:49:42 +01:00
to={handleVoidClick} className="quote-link"
onClick={(event) => handleQuoteClick(reply, event)}>
2023-03-07 18:00:00 +01:00
c/{reply.cid.slice(0, 8)}</Link>
&nbsp;
</div>
))
}
2023-02-26 19:13:46 +01:00
</div>
</span>
2023-03-01 16:51:30 +01:00
{thread.content ? (
thread.content.length > 2000 ?
2023-03-11 12:32:42 +01:00
<Fragment key={`fragment5-${thread.cid}`}>
<blockquote key={`bq-${thread.cid}`}>
2023-03-01 16:51:30 +01:00
{thread.content.slice(0, 2000)}
2023-03-11 12:32:42 +01:00
<span key={`ttl-s-${thread.cid}`} className="ttl"> (...)
<br key={`ttl-s-br1-${thread.cid}`} /><br key={`ttl-s-br2${thread.cid}`} />
2023-03-02 11:09:03 +01:00
Post too long.&nbsp;
2023-03-11 12:32:42 +01:00
<Link key={`ttl-l-${thread.cid}`} to={`/${selectedAddress}/thread/${thread.cid}`} onClick={() => handleClickThread(thread.cid)} className="ttl-link">Click here</Link>
2023-03-01 16:51:30 +01:00
&nbsp;to view. </span>
</blockquote>
2023-03-07 13:07:36 +01:00
</Fragment>
2023-03-11 12:32:42 +01:00
: <blockquote key={`bq-${thread.cid}`}>
2023-03-01 16:51:30 +01:00
{thread.content}
</blockquote>)
: null}
2023-02-26 19:13:46 +01:00
</div>
</div>
</div>
2023-03-11 12:32:42 +01:00
<span key={`summary-${thread.cid}`} className="summary">
2023-03-05 15:58:29 +01:00
{omittedCount > 0 ? (
2023-03-11 12:32:42 +01:00
<span key={`oc-${thread.cid}`} className="ttl">
<span key={`oc1-${thread.cid}`}>
2023-03-05 15:58:29 +01:00
{omittedCount} post{omittedCount > 1 ? "s" : ""} omitted. Click&nbsp;
2023-03-11 12:32:42 +01:00
<Link key={`oc2-${thread.cid}`} to={`/${selectedAddress}/thread/${thread.cid}`} onClick={() => handleClickThread(thread.cid)} className="ttl-link">here</Link>
2023-03-05 15:58:29 +01:00
&nbsp;to view.
</span>
</span>) : null}
</span>
2023-02-26 19:13:46 +01:00
{renderedComments.map(reply => {
return (
2023-03-11 12:32:42 +01:00
<div key={`pc-${reply.cid}`} className="reply-container">
<div key={`sa-${reply.cid}`} className="side-arrows">{'>>'}</div>
<div key={`pr-${reply.cid}`} className="post-reply">
<div key={`pi-${reply.cid}`} className="post-info">
<span key={`nb-${reply.cid}`} className="nameblock">
2023-03-01 16:51:30 +01:00
{reply.author.displayName
? reply.author.displayName.length > 12
2023-03-11 12:32:42 +01:00
? <Fragment key={`fragment6-${reply.cid}`}>
<Tooltip key={`mob-tt-nm-${reply.cid}`} id="tt-name" className="tooltip" />
<span key={`mob-n-${reply.cid}`} className="name"
2023-03-01 16:51:30 +01:00
data-tooltip-id="tt-name"
data-tooltip-content={reply.author.displayName}
data-tooltip-place="top">
{reply.author.displayName.slice(0, 12) + " (...)"}
</span>
2023-03-07 13:07:36 +01:00
</Fragment>
2023-03-11 12:32:42 +01:00
: <span key={`mob-n-${reply.cid}`} className="name">
2023-03-01 16:51:30 +01:00
{reply.author.displayName}</span>
2023-03-11 12:32:42 +01:00
: <span key={`mob-n-${reply.cid}`} className="name">
2023-03-01 16:51:30 +01:00
Anonymous</span>}
2023-02-26 19:13:46 +01:00
&nbsp;
2023-03-11 12:32:42 +01:00
<span key={`pa-${reply.cid}`} className="poster-address">
2023-03-05 14:15:51 +01:00
(u/
2023-03-01 16:51:30 +01:00
{reply.author.address.length > 12 ?
2023-03-11 12:32:42 +01:00
<Fragment key={`fragment7-${reply.cid}`}>
<Tooltip key={`mob-tt-am-${reply.cid}`} id="tt-address" className="tooltip" />
<span key={`mob-ha-${reply.cid}`}
2023-03-01 16:51:30 +01:00
data-tooltip-id="tt-address"
data-tooltip-content={reply.author.address}
data-tooltip-place="top">
{reply.author.address.slice(0, 12) + "..."}
</span>
2023-03-07 13:07:36 +01:00
</Fragment>
2023-03-11 12:32:42 +01:00
: <span key={`mob-ha-${reply.cid}`}>
2023-03-01 16:51:30 +01:00
{reply.author.address}
</span>}
)
2023-02-26 19:13:46 +01:00
</span>
</span>
&nbsp;
2023-03-11 12:32:42 +01:00
<span key={`dt-${reply.cid}`} className="date-time" data-utc="data">{getDate(reply.timestamp)}</span>
2023-02-26 19:13:46 +01:00
&nbsp;
2023-03-11 12:32:42 +01:00
<span key={`pn-${reply.cid}`} className="post-number">
<Link to="" key={`pl1-${reply.cid}`} onClick={handleVoidClick} title="Link to this post">c/</Link>
<Link to="" key={`pl2-${reply.cid}`} onClick={handleVoidClick} title="Reply to this post">{reply.cid.slice(0, 8)}</Link>
2023-02-26 19:13:46 +01:00
</span>
2023-03-11 12:32:42 +01:00
<Link to="" key={`pmb-${reply.cid}`} className="post-menu-button" onClick={handleVoidClick} title="Post menu" data-cmd="post-menu"></Link>
2023-03-08 09:49:42 +01:00
<div id="backlink-id" className="backlink">
{reply.replies?.pages.topAll.comments
.sort((a, b) => a.timestamp - b.timestamp)
.map((reply) => (
2023-03-11 12:32:42 +01:00
<div key={`div-${reply.cid}`} style={{display: 'inline-block'}}>
<Link to={handleVoidClick} key={`ql-${reply.cid}`}
2023-03-08 09:49:42 +01:00
className="quote-link"
onClick={(event) => handleQuoteClick(reply, event)}>
c/{reply.cid.slice(0, 8)}</Link>
&nbsp;
</div>
))
}
</div>
2023-02-26 19:13:46 +01:00
</div>
2023-03-01 16:51:30 +01:00
{reply.content ? (
reply.content.length > 1000 ?
2023-03-11 12:32:42 +01:00
<Fragment key={`fragment8-${reply.cid}`}>
<blockquote key={`pm-${reply.cid}`} className="post-message">
<Link to="" key={`r-pm-${reply.cid}`} className="quotelink" onClick={handleVoidClick}>
2023-03-06 14:49:59 +01:00
{`c/${reply.parentCid.slice(0, 8)}`}{<br />}
2023-03-07 13:54:14 +01:00
</Link>
2023-03-01 16:51:30 +01:00
{reply.content.slice(0, 1000)}
2023-03-11 12:32:42 +01:00
<span key={`ttl-s-${reply.cid}`} className="ttl"> (...)
<br key={`ttl-s-br1-${reply.cid}`} /><br key={`ttl-s-br2${reply.cid}`} />
2023-03-01 16:51:30 +01:00
Comment too long.&nbsp;
2023-03-11 12:32:42 +01:00
<Link key={`ttl-l-${reply.cid}`} to={`/${selectedAddress}/thread/${thread.cid}`} onClick={() => handleClickThread(thread.cid)} className="ttl-link">Click here</Link>
2023-03-01 16:51:30 +01:00
&nbsp;to view. </span>
</blockquote>
2023-03-07 13:07:36 +01:00
</Fragment>
2023-03-11 12:32:42 +01:00
: <blockquote key={`pm-${reply.cid}`} className="post-message">
<Link to={handleVoidClick} key={`r-pm-${reply.cid}`} className="quotelink" onClick={(event) => handleQuoteClick(reply, event)}>
2023-03-06 14:49:59 +01:00
{`c/${reply.parentCid.slice(0, 8)}`}{<br />}
2023-03-07 13:54:14 +01:00
</Link>
2023-03-01 16:51:30 +01:00
{reply.content}
</blockquote>)
: null}
2023-02-26 19:13:46 +01:00
</div>
</div>
)})}
</div>
2023-03-11 12:32:42 +01:00
<div key={`mob-t-${thread.cid}`} className="thread-mobile">
<hr key={`mob-hr-${thread.cid}`} />
<div key={`mob-c-${thread.cid}`} className="op-container">
<div key={`mob-po-${thread.cid}`} className="post op">
<div key={`mob-pi-${thread.cid}`} className="post-info-mobile">
<Link to="" key={`mob-pb-${thread.cid}`} className="post-menu-button-mobile" onClick={handleVoidClick}>...</Link>
<span key={`mob-nbm-${thread.cid}`} className="name-block-mobile">
2023-02-28 16:34:33 +01:00
{thread.author.displayName
? thread.author.displayName.length > 15
2023-03-11 12:32:42 +01:00
? <Fragment key={`fragment9-${thread.cid}`}>
<Tooltip key={`mob-tt-nm-${thread.cid}`} id="tt-name-mobile" className="tooltip" />
<span key={`mob-n-${thread.cid}`} className="name-mobile"
2023-02-28 16:34:33 +01:00
data-tooltip-id="tt-name-mobile"
data-tooltip-content={thread.author.displayName}
data-tooltip-place="top">
{thread.author.displayName.slice(0, 15) + " (...)"}
</span>
2023-03-07 13:07:36 +01:00
</Fragment>
2023-03-11 12:32:42 +01:00
: <span key={`mob-n-${thread.cid}`} className="name-mobile">
2023-02-28 16:34:33 +01:00
{thread.author.displayName}</span>
2023-03-11 12:32:42 +01:00
: <span key={`mob-n-${thread.cid}`} className="name-mobile">
2023-02-28 16:34:33 +01:00
Anonymous</span>}
2023-02-26 19:13:46 +01:00
&nbsp;
2023-03-11 12:32:42 +01:00
<span key={`mob-pa-${thread.cid}`} className="poster-address-mobile">
2023-03-05 14:15:51 +01:00
(u/
2023-02-28 16:34:33 +01:00
{thread.author.address.length > 15 ?
2023-03-11 12:32:42 +01:00
<Fragment key={`fragment10-${thread.cid}`}>
<Tooltip key={`mob-tt-am-${thread.cid}`} id="tt-address-mobile" className="tooltip" />
<span key={`mob-ha-${thread.cid}`} className="highlight-address-mobile"
2023-02-28 16:34:33 +01:00
data-tooltip-id="tt-address-mobile"
data-tooltip-content={thread.author.address}
data-tooltip-place="top">
{thread.author.address.slice(0, 15) + "..."}
</span>
2023-03-07 13:07:36 +01:00
</Fragment>
2023-03-11 12:32:42 +01:00
: <span key={`mob-ha-${thread.cid}`} className="highlight-address-mobile">
2023-02-28 16:34:33 +01:00
{thread.author.address}
</span>}
)&nbsp;
2023-02-26 19:13:46 +01:00
</span>
2023-03-11 12:32:42 +01:00
<br key={`mob-br1-${thread.cid}`} />
2023-02-28 16:34:33 +01:00
{thread.title ? (
thread.title.length > 30 ?
2023-03-11 12:32:42 +01:00
<Fragment key={`fragment11-${thread.cid}`}>
<Tooltip key={`mob-tt-tm-${thread.cid}`} id="tt-title-mobile" className="tooltip" />
<span key={`mob-t-${thread.cid}`} className="subject-mobile"
2023-02-28 16:34:33 +01:00
data-tooltip-id="tt-title-mobile"
data-tooltip-content={thread.title}
data-tooltip-place="top">
{thread.title.slice(0, 30) + " (...)"}
</span>
2023-03-07 13:07:36 +01:00
</Fragment>
2023-03-11 12:32:42 +01:00
: <span key={`mob-t-${thread.cid}`} className="subject-mobile">
2023-02-28 16:34:33 +01:00
{thread.title}
</span>)
: null}
2023-02-26 19:13:46 +01:00
</span>
2023-03-11 12:32:42 +01:00
<span key={`mob-dt-${thread.cid}`} className="date-time-mobile">
2023-03-05 14:15:51 +01:00
{getDate(thread.timestamp)}
2023-02-26 19:13:46 +01:00
&nbsp;
2023-03-11 12:32:42 +01:00
<Link to="" key={`mob-no-${thread.cid}`} onClick={handleVoidClick} title="Link to this post">c/</Link>
<Link to="" key={`mob-no2-${thread.cid}`} onClick={handleVoidClick} title="Reply to this post">{thread.cid.slice(0, 8)}</Link>
2023-02-26 19:13:46 +01:00
</span>
</div>
2023-03-11 12:32:42 +01:00
<div key={`mob-f-${thread.cid}`} className="file-mobile">
<Link to="" key={`mob-ft${thread.cid}`} className="file-thumb-mobile" onClick={handleVoidClick} target="_blank">
<img key={`mob-img-${thread.cid}`} src="/assets/plebchan-psycho.png" alt="" />
<div key={`mob-fi-${thread.cid}`} className="file-info-mobile">58 KB JPG</div>
2023-03-07 13:54:14 +01:00
</Link>
2023-02-22 16:31:45 +01:00
</div>
2023-03-01 17:55:35 +01:00
{thread.content ? (
thread.content.length > 1500 ?
2023-03-11 12:32:42 +01:00
<Fragment key={`fragment12-${thread.cid}`}>
<blockquote key={`mob-bq-${thread.cid}`} className="post-message-mobile">
2023-03-01 17:55:35 +01:00
{thread.content.slice(0, 1500)}
2023-03-11 12:32:42 +01:00
<span key={`mob-ttl-s-${thread.cid}`} className="ttl"> (...)
<br key={`mob-ttl-s-br1-${thread.cid}`} /><br key={`mob-ttl-s-br2${thread.cid}`} />
2023-03-02 11:09:03 +01:00
Post too long.&nbsp;
2023-03-11 12:32:42 +01:00
<Link key={`mob-ttl-l-${thread.cid}`} to={`/${selectedAddress}/thread/${thread.cid}`} onClick={() => handleClickThread(thread.cid)} className="ttl-link">Click here</Link>
2023-03-01 17:55:35 +01:00
&nbsp;to view. </span>
</blockquote>
2023-03-07 13:07:36 +01:00
</Fragment>
2023-03-11 12:32:42 +01:00
: <blockquote key={`mob-bq-${thread.cid}`} className="post-message-mobile">
2023-03-01 17:55:35 +01:00
{thread.content}
</blockquote>)
: null}
2023-02-05 22:15:38 +01:00
</div>
2023-03-11 12:32:42 +01:00
<div key={`mob-pl-${thread.cid}`} className="post-link-mobile">
<span key={`mob-info-${thread.cid}`} className="info-mobile">{thread.replyCount} Replies / ? Images</span>
<Link key={`rl2-${thread.cid}`} to={`/${selectedAddress}/thread/${thread.cid}`} onClick={() => handleClickThread(thread.cid)} className="button-mobile" >View Thread</Link>
</div>
</div>
2023-02-26 19:13:46 +01:00
{renderedComments.map(reply => {
return (
2023-03-11 12:32:42 +01:00
<div key={`mob-rc-${reply.cid}`} className="reply-container">
<div key={`mob-pr-${reply.cid}`} className="post-reply">
<div key={`mob-pi-${reply.cid}`} className="post-info-mobile">
<a key={`pmbm-${reply.cid}`} className="post-menu-button-mobile" title="Post menu">...</a>
<span key={`mob-nb-${reply.cid}`} className="name-block-mobile">
2023-02-28 16:34:33 +01:00
{reply.author.displayName
? reply.author.displayName.length > 12
2023-03-11 12:32:42 +01:00
? <Fragment key={`fragment13-${reply.cid}`}>
<Tooltip key={`mob-tt-nm-${reply.cid}`} id="tt-name-mobile" className="tooltip" />
<span key={`mob-n-${reply.cid}`} className="name-mobile"
2023-02-28 16:34:33 +01:00
data-tooltip-id="tt-name-mobile"
data-tooltip-content={reply.author.displayName}
data-tooltip-place="top">
{reply.author.displayName.slice(0, 12) + " (...)"}
</span>
2023-03-07 13:07:36 +01:00
</Fragment>
2023-03-11 12:32:42 +01:00
: <span key={`mob-n-${reply.cid}`} className="name-mobile">
2023-02-28 16:34:33 +01:00
{reply.author.displayName}</span>
2023-03-11 12:32:42 +01:00
: <span key={`mob-n-${reply.cid}`} className="name-mobile">
2023-02-28 16:34:33 +01:00
Anonymous</span>}
2023-02-26 19:13:46 +01:00
&nbsp;
2023-03-11 12:32:42 +01:00
<span key={`mob-pa-${reply.cid}`} className="poster-address-mobile">
2023-03-05 14:15:51 +01:00
(u/
2023-03-01 17:55:35 +01:00
{reply.author.address.length > 10 ?
2023-03-11 12:32:42 +01:00
<Fragment key={`fragment14-${reply.cid}`}>
<Tooltip key={`mob-tt-am-${reply.cid}`} id="tt-address-mobile" className="tooltip" />
<span key={`mob-ha-${reply.cid}`} className="highlight-address-mobile"
2023-02-28 16:34:33 +01:00
data-tooltip-id="tt-address-mobile"
data-tooltip-content={reply.author.address}
data-tooltip-place="top">
2023-03-01 17:55:35 +01:00
{reply.author.address.slice(0, 10) + "..."}
2023-02-28 16:34:33 +01:00
</span>
2023-03-07 13:07:36 +01:00
</Fragment>
2023-03-11 12:32:42 +01:00
: <span key={`mob-ha-${reply.cid}`} className="highlight-address-mobile">
2023-02-28 16:34:33 +01:00
{reply.author.address}
</span>}
2023-03-01 17:55:35 +01:00
)&nbsp;
2023-02-26 19:13:46 +01:00
</span>
2023-03-11 12:32:42 +01:00
<br key={`mob-br-${reply.cid}`} />
2023-02-26 19:13:46 +01:00
</span>
2023-03-11 12:32:42 +01:00
<span key={`mob-dt-${reply.cid}`} className="date-time-mobile">
2023-03-05 14:15:51 +01:00
{getDate(reply.timestamp)}&nbsp;
2023-03-11 12:32:42 +01:00
<Link to="" key={`mob-pl1-${reply.cid}`} onClick={handleVoidClick} title="Link to this post">c/</Link>
<Link to="" key={`mob-pl2-${reply.cid}`} onClick={handleVoidClick} title="Reply to this post">{reply.cid.slice(0, 8)}</Link>
2023-02-26 19:13:46 +01:00
</span>
</div>
2023-03-01 17:55:35 +01:00
{reply.content ? (
reply.content.length > 1000 ?
2023-03-11 12:32:42 +01:00
<Fragment key={`fragment15-${reply.cid}`}>
<blockquote key={`mob-pm-${reply.cid}`} className="post-message">
<Link to="" key={`mob-r-pm-${reply.cid}`} className="quotelink" onClick={handleVoidClick}>
2023-03-06 14:49:59 +01:00
{`c/${reply.parentCid.slice(0, 8)}`}{<br />}
2023-03-07 13:54:14 +01:00
</Link>
2023-03-01 17:55:35 +01:00
{reply.content.slice(0, 1000)}
2023-03-11 12:32:42 +01:00
<span key={`mob-ttl-s-${reply.cid}`} className="ttl"> (...)
<br key={`mob-ttl-s-br1-${reply.cid}`} /><br key={`mob-ttl-s-br2${reply.cid}`} />
2023-03-01 17:55:35 +01:00
Comment too long.&nbsp;
2023-03-11 12:32:42 +01:00
<Link key={`mob-ttl-l-${reply.cid}`} to={`/${selectedAddress}/thread/${thread.cid}`} onClick={() => handleClickThread(thread.cid)} className="ttl-link">Click here</Link>
2023-03-01 17:55:35 +01:00
&nbsp;to view. </span>
</blockquote>
2023-03-07 13:07:36 +01:00
</Fragment>
2023-03-11 12:32:42 +01:00
: <blockquote key={`mob-pm-${reply.cid}`} className="post-message">
<Link to={handleVoidClick} key={`mob-r-pm-${reply.cid}`} className="quotelink" onClick={(event) => handleQuoteClick(reply, event)}>
2023-03-06 14:49:59 +01:00
{`c/${reply.parentCid.slice(0, 8)}`}{<br />}
2023-03-07 13:54:14 +01:00
</Link>
2023-03-01 17:55:35 +01:00
{reply.content}
</blockquote>)
: null}
2023-02-26 19:13:46 +01:00
</div>
</div>
)})}
</div>
2023-03-07 13:07:36 +01:00
</Fragment>
)})}
2023-02-16 21:01:21 +01:00
</InfiniteScroll>
</div>
2023-02-05 22:15:38 +01:00
</BoardForm>
2023-02-04 22:10:54 +01:00
</Container>
2023-02-07 22:55:00 +01:00
);
2023-01-31 23:08:57 +01:00
}
export default Board;