2023-02-12 21:20:08 +01:00
|
|
|
|
import React, { useState, useEffect, useContext } from 'react';
|
|
|
|
|
|
import { Link, useNavigate } from 'react-router-dom';
|
2023-02-20 22:17:04 +01:00
|
|
|
|
import { Container, NavBar, Header, Break, PostForm, BoardForm } from './styles/Board.styled';
|
2023-02-21 14:49:00 +01:00
|
|
|
|
import { ReplyFormTable, ReplyFormLink, TopBar, BottomBar } from './styles/Thread.styled';
|
2023-02-12 21:20:08 +01:00
|
|
|
|
import { BoardContext } from '../App';
|
2023-02-27 12:35:23 +01:00
|
|
|
|
import { useComment } from '@plebbit/plebbit-react-hooks';
|
2023-02-12 21:20:08 +01:00
|
|
|
|
import ImageBanner from './ImageBanner';
|
|
|
|
|
|
|
|
|
|
|
|
const Thread = ({ setBodyStyle }) => {
|
|
|
|
|
|
const [defaultSubplebbits, setDefaultSubplebbits] = useState([]);
|
2023-02-27 12:35:23 +01:00
|
|
|
|
const { selectedTitle, setSelectedTitle, selectedAddress, setSelectedAddress, selectedThread, selectedStyle, setSelectedStyle } = useContext(BoardContext);
|
2023-02-12 21:20:08 +01:00
|
|
|
|
const [showReplyFormLink, setShowReplyFormLink] = useState(true);
|
|
|
|
|
|
const [showReplyForm, setShowReplyForm] = useState(false);
|
|
|
|
|
|
const navigate = useNavigate();
|
2023-02-24 20:57:51 +01:00
|
|
|
|
const [prevScrollPos, setPrevScrollPos] = useState(0);
|
|
|
|
|
|
const [visible, setVisible] = useState(true);
|
2023-02-20 22:17:04 +01:00
|
|
|
|
|
|
|
|
|
|
const comment = useComment(`${selectedThread}`);
|
2023-02-12 21:20:08 +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-02-24 20:57:51 +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-02-12 21:20:08 +01:00
|
|
|
|
const handleVoidClick = () => {}
|
|
|
|
|
|
|
2023-02-27 15:32:16 +01:00
|
|
|
|
const handleClickTitle = (title, address) => {
|
2023-02-12 21:20:08 +01:00
|
|
|
|
setSelectedTitle(title);
|
|
|
|
|
|
setSelectedAddress(address);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const handleClickHelp = () => {
|
|
|
|
|
|
alert("- The CAPTCHA loads after you click \"Post\" \n- The CAPTCHA is case-sensitive. \n- Make sure to not block any cookies set by plebchan.");
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const handleClickForm = () => {
|
|
|
|
|
|
setShowReplyFormLink(false);
|
|
|
|
|
|
setShowReplyForm(true);
|
2023-02-20 22:17:04 +01:00
|
|
|
|
navigate(`/${selectedAddress}/thread/${selectedThread}/post`);
|
2023-02-12 21:20:08 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const handleStyleChange = (event) => {
|
|
|
|
|
|
switch (event.target.value) {
|
|
|
|
|
|
case "Yotsuba":
|
|
|
|
|
|
setBodyStyle({
|
2023-02-16 14:05:48 +01:00
|
|
|
|
background: "#ffe url(/assets/fade.png) top repeat-x",
|
2023-02-12 21:20:08 +01:00
|
|
|
|
color: "maroon",
|
|
|
|
|
|
fontFamily: "Arial, Helvetica, sans-serif"
|
|
|
|
|
|
});
|
|
|
|
|
|
setSelectedStyle("Yotsuba");
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case "Yotsuba B":
|
|
|
|
|
|
setBodyStyle({
|
2023-02-16 14:05:48 +01:00
|
|
|
|
background: "#eef2ff url(/assets/fade-blue.png) top center repeat-x",
|
2023-02-12 21:20:08 +01:00
|
|
|
|
color: "#000",
|
|
|
|
|
|
fontFamily: "Arial, Helvetica, sans-serif"
|
|
|
|
|
|
});
|
|
|
|
|
|
setSelectedStyle("Yotsuba B");
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case "Futaba":
|
|
|
|
|
|
setBodyStyle({
|
|
|
|
|
|
background: "#ffe",
|
|
|
|
|
|
color: "maroon",
|
|
|
|
|
|
fontFamily: "times new roman, serif"
|
|
|
|
|
|
});
|
|
|
|
|
|
setSelectedStyle("Futaba");
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case "Burichan":
|
|
|
|
|
|
setBodyStyle({
|
|
|
|
|
|
background: "#eef2ff",
|
|
|
|
|
|
color: "#000",
|
|
|
|
|
|
fontFamily: "times new roman, serif"
|
|
|
|
|
|
});
|
|
|
|
|
|
setSelectedStyle("Burichan");
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case "Tomorrow":
|
|
|
|
|
|
setBodyStyle({
|
|
|
|
|
|
background: "#1d1f21 none",
|
|
|
|
|
|
color: "#c5c8c6",
|
|
|
|
|
|
fontFamily: "Arial, Helvetica, sans-serif"
|
|
|
|
|
|
});
|
|
|
|
|
|
setSelectedStyle("Tomorrow");
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case "Photon":
|
|
|
|
|
|
setBodyStyle({
|
|
|
|
|
|
background: "#eee none",
|
|
|
|
|
|
color: "#333",
|
|
|
|
|
|
fontFamily: "Arial, Helvetica, sans-serif"
|
|
|
|
|
|
});
|
|
|
|
|
|
setSelectedStyle("Photon");
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
setBodyStyle({
|
2023-02-16 14:05:48 +01:00
|
|
|
|
background: "#ffe url(/assets/fade.png) top repeat-x",
|
2023-02-12 21:20:08 +01:00
|
|
|
|
color: "maroon",
|
|
|
|
|
|
fontFamily: "Arial, Helvetica, sans-serif"
|
|
|
|
|
|
});
|
|
|
|
|
|
setSelectedStyle("Yotsuba");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-02-21 14:49:00 +01:00
|
|
|
|
const handleClickTop = () => {
|
|
|
|
|
|
window.scrollTo(0, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-02-21 22:12:12 +01:00
|
|
|
|
const handleClickBottom = () => {
|
|
|
|
|
|
window.scrollTo(0, document.body.scrollHeight);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-02-20 22:17:04 +01:00
|
|
|
|
function renderComments(comments) {
|
2023-02-21 22:12:12 +01:00
|
|
|
|
const commentKeys = Object.keys(comments);
|
|
|
|
|
|
const renderedComments = commentKeys.map(key => {
|
|
|
|
|
|
const comment = comments[key];
|
|
|
|
|
|
const { replies: { pages: { topAll: { comments: nestedComments } } } } = comment;
|
|
|
|
|
|
if (comment.replyCount > 0 && nestedComments) {
|
2023-02-20 22:17:04 +01:00
|
|
|
|
const renderedNestedComments = renderComments(nestedComments);
|
|
|
|
|
|
return [comment, ...renderedNestedComments];
|
|
|
|
|
|
}
|
|
|
|
|
|
return [comment];
|
|
|
|
|
|
}).flat();
|
2023-02-21 22:12:12 +01:00
|
|
|
|
return renderedComments;
|
2023-02-20 22:17:04 +01:00
|
|
|
|
}
|
2023-02-21 22:12:12 +01:00
|
|
|
|
|
2023-02-20 22:17:04 +01:00
|
|
|
|
|
2023-02-12 21:20:08 +01:00
|
|
|
|
return (
|
|
|
|
|
|
<Container>
|
|
|
|
|
|
<NavBar selectedStyle={selectedStyle}>
|
|
|
|
|
|
<>
|
|
|
|
|
|
{defaultSubplebbits.map(subplebbit => (
|
|
|
|
|
|
<span className="boardList" key={`span-${subplebbit.address}`}>
|
|
|
|
|
|
[
|
2023-02-27 15:32:16 +01:00
|
|
|
|
<Link key={`a-${subplebbit.address}`}
|
|
|
|
|
|
to={`/${subplebbit.address}`}
|
|
|
|
|
|
onClick={() => handleClickTitle(subplebbit.title, subplebbit.address)}
|
2023-02-19 22:08:18 +01:00
|
|
|
|
>{subplebbit.title}</Link>
|
2023-02-12 21:20:08 +01:00
|
|
|
|
]
|
|
|
|
|
|
</span>
|
|
|
|
|
|
))}
|
2023-02-23 16:45:29 +01:00
|
|
|
|
<span className="nav">
|
|
|
|
|
|
[
|
|
|
|
|
|
<a href={handleVoidClick}>Settings</a>
|
|
|
|
|
|
]
|
|
|
|
|
|
[
|
2023-02-12 21:20:08 +01:00
|
|
|
|
<Link to="/" onClick={() => handleStyleChange({target: {value: "Yotsuba"}}
|
2023-02-23 16:45:29 +01:00
|
|
|
|
)}>Home</Link>
|
|
|
|
|
|
]
|
2023-02-12 21:20:08 +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>
|
|
|
|
|
|
|
2023-02-27 15:32:16 +01:00
|
|
|
|
<select id="board-select-mobile" value={selectedAddress}>
|
2023-02-23 16:45:29 +01:00
|
|
|
|
{defaultSubplebbits.map(subplebbit => (
|
2023-02-27 15:32:16 +01:00
|
|
|
|
<option key={`option-${subplebbit.address}`}
|
|
|
|
|
|
value={subplebbit.address}
|
|
|
|
|
|
onClick={() => {handleClickTitle(subplebbit.title, subplebbit.address); navigate(`/${subplebbit.address}`)}}
|
2023-02-27 17:44:02 +01:00
|
|
|
|
onTouchStart={() => {handleClickTitle(subplebbit.title, subplebbit.address); navigate(`/${subplebbit.address}`)}}
|
2023-02-27 15:32:16 +01:00
|
|
|
|
>{subplebbit.title}</option>
|
|
|
|
|
|
))}
|
2023-02-23 16:45:29 +01:00
|
|
|
|
</select>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="page-jump">
|
|
|
|
|
|
<a href={handleVoidClick}>Settings</a>
|
|
|
|
|
|
|
|
|
|
|
|
<Link to="/" onClick={() => handleStyleChange({target: {value: "Yotsuba"}}
|
|
|
|
|
|
)}>Home</Link>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div id="separator-mobile"> </div>
|
|
|
|
|
|
<div id="separator-mobile"> </div>
|
2023-02-12 21:20:08 +01:00
|
|
|
|
</>
|
|
|
|
|
|
</NavBar>
|
|
|
|
|
|
<Header selectedStyle={selectedStyle}>
|
|
|
|
|
|
<>
|
|
|
|
|
|
<div className="banner">
|
|
|
|
|
|
<ImageBanner />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<>
|
|
|
|
|
|
<div className="board-title">{selectedTitle}</div>
|
|
|
|
|
|
<div className="board-address">p/{selectedAddress}</div>
|
|
|
|
|
|
</>
|
|
|
|
|
|
</>
|
|
|
|
|
|
</Header>
|
|
|
|
|
|
<Break selectedStyle={selectedStyle} />
|
|
|
|
|
|
<PostForm selectedStyle={selectedStyle} name="post" action="" method="post" enctype="multipart/form-data">
|
2023-02-24 18:13:02 +01:00
|
|
|
|
<ReplyFormLink id="post-form-link" showReplyFormLink={showReplyFormLink} selectedStyle={selectedStyle} >
|
|
|
|
|
|
<div id="return-button-mobile">
|
|
|
|
|
|
<span className="btn-wrap">
|
|
|
|
|
|
<Link to={`/${selectedAddress}`}>Return</Link>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div id="catalog-button-mobile">
|
|
|
|
|
|
<span className="btn-wrap">
|
|
|
|
|
|
<Link to={`/${selectedAddress}/catalog`}>Catalog</Link>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div id="bottom-button-mobile">
|
|
|
|
|
|
<span className="btn-wrap">
|
|
|
|
|
|
<a onClick={handleClickBottom} onMouseOver={(event) => event.target.style.cursor='pointer'}>Bottom</a>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div id="post-form-link-desktop">
|
2023-02-12 21:20:08 +01:00
|
|
|
|
[
|
2023-02-21 14:49:00 +01:00
|
|
|
|
<a onClick={handleClickForm} onMouseOver={(event) => event.target.style.cursor='pointer'}>Post a Reply</a>
|
2023-02-12 21:20:08 +01:00
|
|
|
|
]
|
2023-02-24 18:13:02 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
<div id="post-form-link-mobile">
|
|
|
|
|
|
<span className="btn-wrap">
|
|
|
|
|
|
<a onClick={handleClickForm} onMouseOver={(event) => event.target.style.cursor='pointer'}>Post a Reply</a>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
2023-02-12 21:20:08 +01:00
|
|
|
|
</ReplyFormLink>
|
|
|
|
|
|
<ReplyFormTable id="post-form" showReplyForm={showReplyForm} selectedStyle={selectedStyle} className="post-form">
|
|
|
|
|
|
<tbody>
|
|
|
|
|
|
<tr data-type="Subject">
|
|
|
|
|
|
<td>Name</td>
|
|
|
|
|
|
<td>
|
|
|
|
|
|
<input name="sub" type="text" placeholder='Anonymous' tabIndex={3} />
|
|
|
|
|
|
<input id="post-button" type="submit" value="Post" tabIndex={6} />
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
<tr data-type="Comment">
|
|
|
|
|
|
<td>Comment</td>
|
|
|
|
|
|
<td>
|
|
|
|
|
|
<textarea name="com" cols="48" rows="4" tabIndex={4} wrap="soft"></textarea>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
<tr id="captchaFormPart">
|
|
|
|
|
|
<td>Verification</td>
|
|
|
|
|
|
<td colSpan={2}>
|
|
|
|
|
|
<div id="t-root">
|
|
|
|
|
|
<input id="t-resp" name="t-response" placeholder="Type the CAPTCHA here" autoComplete='off' type="text" />
|
|
|
|
|
|
<button id="t-help" type="button" onClick={handleClickHelp} data-tip="Help" tabIndex={-1}>?</button>
|
|
|
|
|
|
<div id="t-cnt">
|
|
|
|
|
|
<div id="t-bg"></div>
|
|
|
|
|
|
<div id="t-fg"></div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div id="t-msg"></div>
|
|
|
|
|
|
<input name="t-challenge" type="hidden"/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
<tr data-type="File">
|
|
|
|
|
|
<td>Embed File</td>
|
|
|
|
|
|
<td>
|
|
|
|
|
|
<input name="embed" type="text" tabIndex={7} placeholder="Paste link" />
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
<tr></tr>
|
|
|
|
|
|
</tbody>
|
|
|
|
|
|
</ReplyFormTable>
|
|
|
|
|
|
</PostForm>
|
|
|
|
|
|
<TopBar selectedStyle={selectedStyle}>
|
|
|
|
|
|
<hr />
|
|
|
|
|
|
<span className="style-changer">
|
|
|
|
|
|
Style:
|
|
|
|
|
|
|
2023-02-13 12:05:10 +01:00
|
|
|
|
<select id="style-selector" onChange={handleStyleChange} value={selectedStyle}>
|
2023-02-12 21:20:08 +01:00
|
|
|
|
<option value="Yotsuba">Yotsuba</option>
|
|
|
|
|
|
<option value="Yotsuba B">Yotsuba B</option>
|
|
|
|
|
|
<option value="Futaba">Futaba</option>
|
|
|
|
|
|
<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
|
|
|
|
<span className="return-button" id="return-button-desktop">
|
2023-02-13 13:01:10 +01:00
|
|
|
|
[
|
2023-02-19 22:08:18 +01:00
|
|
|
|
<Link to={`/${selectedAddress}`}>Return</Link>
|
2023-02-13 13:01:10 +01:00
|
|
|
|
]
|
|
|
|
|
|
</span>
|
2023-02-24 18:13:02 +01:00
|
|
|
|
<span className="return-button catalog-button" id="catalog-button-desktop">
|
2023-02-21 22:12:12 +01:00
|
|
|
|
[
|
|
|
|
|
|
<Link to={`/${selectedAddress}/catalog`}>Catalog</Link>
|
|
|
|
|
|
]
|
|
|
|
|
|
</span>
|
2023-02-24 18:13:02 +01:00
|
|
|
|
<span className="return-button catalog-button" id="bottom-button-desktop">
|
2023-02-21 22:12:12 +01:00
|
|
|
|
[
|
2023-02-22 11:22:36 +01:00
|
|
|
|
<a href={handleVoidClick} onClick={handleClickBottom} onMouseOver={(event) => event.target.style.cursor='pointer'} onTouchStart={handleClickBottom}>Bottom</a>
|
2023-02-21 22:12:12 +01:00
|
|
|
|
]
|
|
|
|
|
|
</span>
|
2023-02-21 14:49:00 +01:00
|
|
|
|
{comment ? (
|
|
|
|
|
|
comment.replyCount > 0 ? (
|
|
|
|
|
|
<span className="reply-stat">{comment.replyCount} replies</span>
|
|
|
|
|
|
) : (
|
|
|
|
|
|
<span className="reply-stat">No replies yet</span>
|
|
|
|
|
|
)) : (
|
|
|
|
|
|
null
|
|
|
|
|
|
)}
|
2023-02-12 21:20:08 +01:00
|
|
|
|
<hr />
|
|
|
|
|
|
</TopBar>
|
2023-02-20 22:17:04 +01:00
|
|
|
|
<BoardForm selectedStyle={selectedStyle}>
|
|
|
|
|
|
{comment ? (
|
|
|
|
|
|
<>
|
|
|
|
|
|
<div className="thread">
|
2023-02-27 12:35:23 +01:00
|
|
|
|
<div className="op-container">
|
2023-02-20 22:17:04 +01:00
|
|
|
|
<div className="post op">
|
|
|
|
|
|
<div className="post-info">
|
2023-02-22 16:31:45 +01:00
|
|
|
|
<div key={`f-${comment.cid}`} className="file">
|
|
|
|
|
|
<div key={`ft-${comment.cid}`} className="file-text">
|
|
|
|
|
|
File:
|
|
|
|
|
|
<a key={`fa-${comment.cid}`} href={`${comment.link}`} target="_blank">filename.something</a> (metadata)
|
|
|
|
|
|
</div>
|
2023-02-23 16:45:29 +01:00
|
|
|
|
<a key={`fta-${comment.cid}`} href={handleVoidClick} target="_blank" className="file-thumb">
|
2023-02-22 16:31:45 +01:00
|
|
|
|
<img key={`fti-${comment.cid}`} src="/assets/plebchan-psycho.png" alt="filename.something" />
|
|
|
|
|
|
</a>
|
|
|
|
|
|
</div>
|
2023-02-20 22:17:04 +01:00
|
|
|
|
<span className="name-block">
|
2023-02-22 11:22:36 +01:00
|
|
|
|
<span key={`q-${comment.cid}`} className="title">{comment.title}</span>
|
|
|
|
|
|
|
2023-02-20 22:17:04 +01:00
|
|
|
|
<span className="name">{comment.author.displayName || "Anonymous"}</span>
|
|
|
|
|
|
|
|
|
|
|
|
<span className="poster-address">
|
|
|
|
|
|
(User: {comment.author.address})
|
|
|
|
|
|
</span>
|
2023-02-22 11:22:36 +01:00
|
|
|
|
|
|
|
|
|
|
<span className="date-time" data-utc="data">2 weeks ago</span>
|
|
|
|
|
|
|
|
|
|
|
|
<span className="post-number">
|
|
|
|
|
|
<a href={handleVoidClick} title="Link to this post">No.</a>
|
|
|
|
|
|
<a href={handleVoidClick} title="Reply to this post">00000001</a>
|
2023-02-20 22:17:04 +01:00
|
|
|
|
</span>
|
2023-02-22 11:22:36 +01:00
|
|
|
|
<a key={`pmb-${comment.cid}`} className="post-menu-button" href={handleVoidClick} title="Post menu" data-cmd="post-menu">▶</a>
|
|
|
|
|
|
<div id="backlink-id" className="backlink">
|
|
|
|
|
|
<span>
|
|
|
|
|
|
<a className="quote-link" href={handleVoidClick}>{'>>'}00000002</a>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</span>
|
2023-02-20 22:17:04 +01:00
|
|
|
|
<blockquote>
|
2023-02-22 11:22:36 +01:00
|
|
|
|
{comment.content}
|
2023-02-20 22:17:04 +01:00
|
|
|
|
</blockquote>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2023-02-21 22:12:12 +01:00
|
|
|
|
{comment.replyCount > 0 &&
|
|
|
|
|
|
Object.keys(comment.replies.pages.topAll.comments).map(() => {
|
|
|
|
|
|
const renderedComments = renderComments(comment.replies.pages.topAll.comments);
|
|
|
|
|
|
return renderedComments.map(reply => {
|
2023-02-20 22:17:04 +01:00
|
|
|
|
let counter = 1;
|
2023-02-21 22:12:12 +01:00
|
|
|
|
counter++;
|
|
|
|
|
|
const counterString = counter.toString().padStart(8, '0');
|
2023-02-20 22:17:04 +01:00
|
|
|
|
return (
|
2023-02-27 12:35:23 +01:00
|
|
|
|
<div key={`pc-${reply.cid}`} className="reply-container">
|
2023-02-21 22:12:12 +01:00
|
|
|
|
<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">
|
|
|
|
|
|
<span key={`n-${reply.cid}`} className="name">{reply.author.displayName || "Anonymous"}</span>
|
2023-02-20 22:17:04 +01:00
|
|
|
|
|
2023-02-21 22:12:12 +01:00
|
|
|
|
<span key={`pa-${reply.cid}`} className="poster-address">
|
|
|
|
|
|
(User: {reply.author.address})
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
<span key={`dt-${reply.cid}`} className="date-time" data-utc="data">2 weeks ago</span>
|
|
|
|
|
|
|
|
|
|
|
|
<span key={`pn-${reply.cid}`} className="post-number">
|
|
|
|
|
|
<a key={`pl1-${reply.cid}`} href={handleVoidClick} title="Link to this post">No.</a>
|
|
|
|
|
|
<a key={`pl2-${reply.cid}`} href={handleVoidClick} title="Reply to this post">{counterString}</a>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<a key={`pmb-${reply.cid}`} className="post-menu-button" href={handleVoidClick} title="Post menu" data-cmd="post-menu">▶</a>
|
2023-02-20 22:17:04 +01:00
|
|
|
|
</div>
|
2023-02-21 22:12:12 +01:00
|
|
|
|
<blockquote key={`pm-${reply.cid}`} className="post-message">
|
|
|
|
|
|
<a className="quotelink" href={handleVoidClick}>
|
|
|
|
|
|
{`>>${counterString}`}{<br />}
|
|
|
|
|
|
</a>
|
|
|
|
|
|
{reply.content}
|
|
|
|
|
|
</blockquote>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2023-02-20 22:17:04 +01:00
|
|
|
|
)
|
|
|
|
|
|
})
|
2023-02-21 22:12:12 +01:00
|
|
|
|
})}
|
2023-02-27 12:35:23 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
<div className="thread-mobile">
|
|
|
|
|
|
<hr />
|
|
|
|
|
|
<div className="op-container">
|
|
|
|
|
|
<div key={`mob-po-${comment.cid}`} className="post op">
|
|
|
|
|
|
<div key={`mob-pi-${comment.cid}`} className="post-info-mobile">
|
|
|
|
|
|
<a key={`mob-pb-${comment.cid}`} className="post-menu-button-mobile" href={handleVoidClick}>...</a>
|
|
|
|
|
|
<span className="name-block-mobile">
|
|
|
|
|
|
<span key={`mob-n-${comment.cid}`} className="name-mobile">LongName (...)</span>
|
|
|
|
|
|
|
|
|
|
|
|
<span key={`mob-pa-${comment.cid}`} className="poster-address-mobile">
|
|
|
|
|
|
(User:
|
|
|
|
|
|
<span key={`mob-ha-${comment.cid}`} className="highlight-address-mobile" title="Highlight posts by this address">CCxfJWFT...</span>
|
|
|
|
|
|
)
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<br key={`mob-br1-${comment.cid}`} />
|
|
|
|
|
|
<span key={`mob-s-${comment.cid}`} className="subject-mobile">
|
|
|
|
|
|
{/* {thread.title ? `${thread.title}` : null} */}
|
|
|
|
|
|
Sometimes titles can be very lon (…)
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span key={`mob-dt-${comment.cid}`} className="date-time-mobile">
|
|
|
|
|
|
2 weeks ago
|
|
|
|
|
|
|
|
|
|
|
|
<a key={`mob-no-${comment.cid}`} href={handleVoidClick} title="Link to this post">No.</a>
|
|
|
|
|
|
<a key={`mob-no2-${comment.cid}`} href={handleVoidClick} title="Reply to this post">00000001</a>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div key={`mob-f-${comment.cid}`} className="file-mobile">
|
|
|
|
|
|
<a key={`mob-ft${comment.cid}`} className="file-thumb-mobile" href={handleVoidClick} target="_blank">
|
|
|
|
|
|
<img key={`mob-img-${comment.cid}`} src="/assets/plebchan-psycho.png" alt="" />
|
|
|
|
|
|
<div key={`mob-fi-${comment.cid}`} className="file-info-mobile">58 KB JPG</div>
|
|
|
|
|
|
</a>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<blockquote key={`mob-bq-${comment.cid}`} className="post-message-mobile">
|
|
|
|
|
|
{comment.content ? (
|
|
|
|
|
|
<>
|
|
|
|
|
|
{comment.content}
|
|
|
|
|
|
</>
|
|
|
|
|
|
) : null}
|
|
|
|
|
|
</blockquote>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
{comment.replyCount > 0 &&
|
|
|
|
|
|
Object.keys(comment.replies.pages.topAll.comments).map(() => {
|
|
|
|
|
|
const renderedComments = renderComments(comment.replies.pages.topAll.comments);
|
|
|
|
|
|
return renderedComments.map(reply => {
|
|
|
|
|
|
let counter = 1;
|
|
|
|
|
|
counter++;
|
|
|
|
|
|
const counterString = counter.toString().padStart(8, '0');
|
|
|
|
|
|
return (
|
|
|
|
|
|
<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 className="post-menu-button-mobile" title="Post menu">...</a>
|
|
|
|
|
|
<span key={`mob-nb-${reply.cid}`} className="name-block-mobile">
|
|
|
|
|
|
<span key={`mob-n-${reply.cid}`} className="name-mobile">{reply.author.displayName || "Anonymous"}</span>
|
|
|
|
|
|
|
|
|
|
|
|
<span key={`mob-pa-${reply.cid}`} className="poster-address-mobile">
|
|
|
|
|
|
(User:
|
|
|
|
|
|
<span key={`mob-ha-${reply.cid}`} className="highlight-address-mobile" title="Highlight posts by this address">CCxfJWFT...</span>
|
|
|
|
|
|
)
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<br key={`mob-br-${reply.cid}`} />
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span key={`mob-dt-${reply.cid}`} className="date-time-mobile">
|
|
|
|
|
|
2 weeks ago
|
|
|
|
|
|
<a key={`mob-pl1-${reply.cid}`} href={handleVoidClick} title="Link to this post">No.</a>
|
|
|
|
|
|
<a key={`mob-pl2-${reply.cid}`} href={handleVoidClick} title="Reply to this post">{counterString}</a>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<blockquote key={`mob-pm-${reply.cid}`} className="post-message-mobile">
|
|
|
|
|
|
<a key={`mob-ql-${reply.cid}`} className="quotelink-mobile" href={handleVoidClick}>
|
|
|
|
|
|
{`>>${counterString}`}{<br />}
|
|
|
|
|
|
</a>
|
|
|
|
|
|
{reply.content}
|
|
|
|
|
|
</blockquote>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
)
|
|
|
|
|
|
})
|
|
|
|
|
|
})}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<BottomBar selectedStyle={selectedStyle}>
|
2023-02-24 18:13:02 +01:00
|
|
|
|
<div id="bottombar-desktop">
|
|
|
|
|
|
<hr />
|
|
|
|
|
|
<span className="bottom-bar-return">
|
|
|
|
|
|
[
|
|
|
|
|
|
<Link to={`/${selectedAddress}`}>Return</Link>
|
|
|
|
|
|
]
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span className="bottom-bar-catalog">
|
|
|
|
|
|
[
|
|
|
|
|
|
<Link to={`/${selectedAddress}/catalog`}>Catalog</Link>
|
|
|
|
|
|
]
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span className="bottom-bar-top">
|
|
|
|
|
|
[
|
|
|
|
|
|
<a href={handleVoidClick} onClick={handleClickTop} onMouseOver={(event) => event.target.style.cursor='pointer'} onTouchStart={handleClickTop}>Top</a>
|
|
|
|
|
|
]
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span className="quickreply-button">
|
2023-02-21 22:12:12 +01:00
|
|
|
|
[
|
2023-02-24 18:13:02 +01:00
|
|
|
|
<a href={handleVoidClick} onMouseOver={(event) => event.target.style.cursor='pointer'}>Post a Reply</a>
|
2023-02-21 22:12:12 +01:00
|
|
|
|
]
|
2023-02-24 18:13:02 +01:00
|
|
|
|
</span>
|
|
|
|
|
|
{comment.replyCount > 0 ? (
|
|
|
|
|
|
<span className="reply-stat">{comment.replyCount} replies</span>
|
|
|
|
|
|
) : (
|
|
|
|
|
|
<span className="reply-stat">No replies yet</span>
|
|
|
|
|
|
)}
|
|
|
|
|
|
<hr />
|
|
|
|
|
|
</div>
|
2023-02-21 22:12:12 +01:00
|
|
|
|
</BottomBar>
|
2023-02-27 12:35:23 +01:00
|
|
|
|
<div id="bottombar-mobile">
|
|
|
|
|
|
<TopBar selectedStyle={selectedStyle}>
|
|
|
|
|
|
<hr />
|
|
|
|
|
|
<span className="style-changer">
|
|
|
|
|
|
Style:
|
|
|
|
|
|
|
|
|
|
|
|
<select id="style-selector" onChange={handleStyleChange} value={selectedStyle}>
|
|
|
|
|
|
<option value="Yotsuba">Yotsuba</option>
|
|
|
|
|
|
<option value="Yotsuba B">Yotsuba B</option>
|
|
|
|
|
|
<option value="Futaba">Futaba</option>
|
|
|
|
|
|
<option value="Burichan">Burichan</option>
|
|
|
|
|
|
<option value="Tomorrow">Tomorrow</option>
|
|
|
|
|
|
<option value="Photon">Photon</option>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
{comment ? (
|
|
|
|
|
|
comment.replyCount > 0 ? (
|
|
|
|
|
|
<span className="reply-stat">{comment.replyCount} replies</span>
|
|
|
|
|
|
) : (
|
|
|
|
|
|
<span className="reply-stat">No replies yet</span>
|
|
|
|
|
|
)) : (
|
|
|
|
|
|
null
|
|
|
|
|
|
)}
|
|
|
|
|
|
<hr />
|
|
|
|
|
|
</TopBar>
|
|
|
|
|
|
<ReplyFormLink id="post-form-link" showReplyFormLink={showReplyFormLink} selectedStyle={selectedStyle} >
|
|
|
|
|
|
<div id="post-form-link-mobile" className="post-button-mobile">
|
|
|
|
|
|
<span className="btn-wrap">
|
|
|
|
|
|
<a onClick={handleClickForm} onMouseOver={(event) => event.target.style.cursor='pointer'}>Post a Reply</a>
|
2023-02-24 18:13:02 +01:00
|
|
|
|
</span>
|
2023-02-27 12:35:23 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
<div id="btns-container">
|
|
|
|
|
|
<div id="return-button-mobile">
|
2023-02-24 18:13:02 +01:00
|
|
|
|
<span className="btn-wrap">
|
2023-02-27 12:35:23 +01:00
|
|
|
|
<Link to={`/${selectedAddress}`}>Return</Link>
|
2023-02-24 18:13:02 +01:00
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
2023-02-27 12:35:23 +01:00
|
|
|
|
<div id="catalog-button-mobile">
|
|
|
|
|
|
<span className="btn-wrap">
|
|
|
|
|
|
<Link to={`/${selectedAddress}/catalog`}>Catalog</Link>
|
2023-02-24 18:13:02 +01:00
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
2023-02-27 12:35:23 +01:00
|
|
|
|
<span className="bottom-bar-top">
|
|
|
|
|
|
<span className="btn-wrap">
|
|
|
|
|
|
<a href={handleVoidClick} onClick={handleClickTop} onMouseOver={(event) => event.target.style.cursor='pointer'} onTouchStart={handleClickTop}>Top</a>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</ReplyFormLink>
|
2023-02-20 22:17:04 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
</>
|
|
|
|
|
|
) : (
|
|
|
|
|
|
<div>Loading...</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</BoardForm>
|
2023-02-12 21:20:08 +01:00
|
|
|
|
</Container>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default Thread;
|