2023-02-04 22:10:54 +01:00
|
|
|
|
import React, { useState, useEffect } from 'react';
|
|
|
|
|
|
import { Link } from 'react-router-dom';
|
2023-02-07 13:23:14 +01:00
|
|
|
|
import { Container, NavBar, Header, Break, PostForm, TopBar, BoardForm } from './styles/Board.styled';
|
2023-02-04 22:10:54 +01:00
|
|
|
|
import { useFeed } from '@plebbit/plebbit-react-hooks';
|
2023-01-31 23:08:57 +01:00
|
|
|
|
|
2023-02-05 18:44:16 +01:00
|
|
|
|
const ImageBanner = () => {
|
|
|
|
|
|
const [currentImage, setCurrentImage] = useState(1);
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
2023-02-07 13:23:14 +01:00
|
|
|
|
setCurrentImage(Math.floor(Math.random() * 12) + 1);
|
2023-02-05 18:44:16 +01:00
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
<img id="banner-img" src={`banner-${currentImage}.jpg`} alt="banner" />
|
|
|
|
|
|
);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2023-02-02 21:58:02 +01:00
|
|
|
|
const Board = () => {
|
2023-02-04 22:10:54 +01:00
|
|
|
|
const [defaultSubplebbits, setDefaultSubplebbits] = useState([]);
|
2023-02-07 13:23:14 +01:00
|
|
|
|
const {feed, hasMore, loadMore} = useFeed(['memes.eth'], 'new');
|
|
|
|
|
|
|
|
|
|
|
|
console.log({feed});
|
2023-02-04 22:10:54 +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-02 21:58:02 +01:00
|
|
|
|
return (
|
2023-02-04 22:10:54 +01:00
|
|
|
|
<Container>
|
|
|
|
|
|
<NavBar>
|
|
|
|
|
|
<>
|
|
|
|
|
|
{defaultSubplebbits.map(subplebbit => (
|
2023-02-05 18:44:16 +01:00
|
|
|
|
<span className="boardList" key={subplebbit.address}>[
|
|
|
|
|
|
<a href="/board">{subplebbit.title}</a>
|
2023-02-04 22:10:54 +01:00
|
|
|
|
]
|
|
|
|
|
|
</span>
|
|
|
|
|
|
))}
|
|
|
|
|
|
<span className="nav">[
|
|
|
|
|
|
<Link to="/">Home</Link>]
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</>
|
|
|
|
|
|
</NavBar>
|
|
|
|
|
|
<Header>
|
|
|
|
|
|
<>
|
|
|
|
|
|
<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
|
|
|
|
<>
|
|
|
|
|
|
<div className="board-title">Crypto</div>
|
|
|
|
|
|
<div className="board-address">p/QmPjewdKya8iVkuQiiXQ5qRBsgVUAZg2LQ2m8v3LNJ7Ht8</div>
|
|
|
|
|
|
</>
|
2023-02-04 22:10:54 +01:00
|
|
|
|
</>
|
|
|
|
|
|
</Header>
|
|
|
|
|
|
<Break />
|
2023-02-05 18:44:16 +01:00
|
|
|
|
<PostForm name="post" action="" method="post" enctype="multipart/form-data">
|
|
|
|
|
|
<div id="post-form-link">
|
2023-02-04 22:10:54 +01:00
|
|
|
|
[
|
|
|
|
|
|
<a href="#">Start a New Thread</a>
|
|
|
|
|
|
]
|
|
|
|
|
|
</div>
|
2023-02-05 18:44:16 +01:00
|
|
|
|
<table id="post-form"></table>
|
2023-02-04 22:10:54 +01:00
|
|
|
|
</PostForm>
|
2023-02-05 18:44:16 +01:00
|
|
|
|
<TopBar>
|
|
|
|
|
|
<hr />
|
2023-02-07 13:23:14 +01:00
|
|
|
|
<span className="style-changer">
|
|
|
|
|
|
Style:
|
|
|
|
|
|
|
|
|
|
|
|
<select id="style-selector">
|
|
|
|
|
|
<option value="Yotsuba New">Yotsuba</option>
|
|
|
|
|
|
<option value="Yotsuba B">Yotsuba B</option>
|
|
|
|
|
|
<option value="Futaba New">Futaba New</option>
|
|
|
|
|
|
<option value="Burichan">Burichan</option>
|
|
|
|
|
|
<option value="Tomorrow">Tomorrow</option>
|
|
|
|
|
|
<option value="Photon">Photon</option>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
</span>
|
2023-02-05 18:44:16 +01:00
|
|
|
|
<hr />
|
|
|
|
|
|
</TopBar>
|
2023-02-05 22:15:38 +01:00
|
|
|
|
<BoardForm id="board-form" name="board-form" action="" method="post">
|
|
|
|
|
|
<div className="board">
|
|
|
|
|
|
<div id="t" className="thread">
|
|
|
|
|
|
<div id="pc" className="post-container op-container">
|
|
|
|
|
|
<div id="p" className="post op">
|
|
|
|
|
|
<span id="sa">
|
|
|
|
|
|
<img alt="H" className="ext-button thread-hide-button" data-cmd="hide" data-id="1-test" src="./post_expand_minus.png" title="Hide thread" />
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<div id="pi" className="post-info">
|
2023-02-06 12:48:35 +01:00
|
|
|
|
|
2023-02-05 22:15:38 +01:00
|
|
|
|
<span className="name-block">
|
|
|
|
|
|
<span className="name">Tom</span>
|
2023-02-06 12:48:35 +01:00
|
|
|
|
|
2023-02-05 22:15:38 +01:00
|
|
|
|
<span className="poster-address">
|
|
|
|
|
|
(User: plebeius.eth)
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</span>
|
2023-02-06 12:48:35 +01:00
|
|
|
|
|
2023-02-05 22:15:38 +01:00
|
|
|
|
<span className="date-time" data-utc="data">2 weeks ago</span>
|
2023-02-06 12:48:35 +01:00
|
|
|
|
|
2023-02-05 22:15:38 +01:00
|
|
|
|
<span className="post-number">
|
|
|
|
|
|
<a href="post-link" title="Link to this post">No.</a>
|
|
|
|
|
|
<a href="post-link" title="Reply to this post">00000001</a>
|
2023-02-06 12:48:35 +01:00
|
|
|
|
|
2023-02-05 22:15:38 +01:00
|
|
|
|
<span>
|
|
|
|
|
|
[
|
|
|
|
|
|
<a className="reply-link" href="post-link">Reply</a>
|
|
|
|
|
|
]
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</span>
|
2023-02-06 12:48:35 +01:00
|
|
|
|
<a className="post-menu-button" href="post-menu" title="Post menu" data-cmd="post-menu">▶</a>
|
2023-02-05 22:15:38 +01:00
|
|
|
|
<div id="backlink-id" className="backlink">
|
|
|
|
|
|
<span>
|
|
|
|
|
|
<a className="quote-link" href="post-link">{'>>'}00000002</a>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<blockquote>
|
|
|
|
|
|
<span className="quote">
|
2023-02-07 13:23:14 +01:00
|
|
|
|
{'>'}wen mvp
|
2023-02-05 22:15:38 +01:00
|
|
|
|
</span>
|
2023-02-07 13:23:14 +01:00
|
|
|
|
<br />
|
|
|
|
|
|
two more weeks
|
2023-02-05 22:15:38 +01:00
|
|
|
|
</blockquote>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2023-02-07 13:23:14 +01:00
|
|
|
|
{feed.map(post => (
|
|
|
|
|
|
<div id="pc" className="post-container reply-container">
|
|
|
|
|
|
<div className="side-arrows">{'>>'}</div>
|
|
|
|
|
|
<div className="post-reply">
|
|
|
|
|
|
<div className="post-info">
|
2023-02-06 12:48:35 +01:00
|
|
|
|
|
2023-02-07 13:23:14 +01:00
|
|
|
|
<span className="nameblock">
|
|
|
|
|
|
<span className="name">Anonymous</span>
|
|
|
|
|
|
|
|
|
|
|
|
<span className="poster-address">
|
|
|
|
|
|
(User: {post.author.address})
|
|
|
|
|
|
</span>
|
2023-02-05 22:15:38 +01:00
|
|
|
|
</span>
|
2023-02-07 13:23:14 +01:00
|
|
|
|
|
|
|
|
|
|
<span className="date-time" data-utc="data">2 weeks ago</span>
|
|
|
|
|
|
|
|
|
|
|
|
<span className="post-number">
|
|
|
|
|
|
<a href="post-link" title="Link to this post">No.</a>
|
|
|
|
|
|
<a href="post-link" title="Reply to this post">00000002</a>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<a className="post-menu-button" href="#" title="Post menu" data-cmd="post-menu">▶</a>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<blockquote className="post-message">
|
|
|
|
|
|
<span className="quote">
|
|
|
|
|
|
{'>'}{post.title}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<br />
|
|
|
|
|
|
{post.content}
|
|
|
|
|
|
</blockquote>
|
2023-02-05 22:15:38 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2023-02-07 13:23:14 +01:00
|
|
|
|
))}
|
2023-02-05 22:15:38 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2023-02-07 13:23:14 +01:00
|
|
|
|
<div className="bottom-control">
|
|
|
|
|
|
<span></span>
|
|
|
|
|
|
</div>
|
2023-02-05 22:15:38 +01:00
|
|
|
|
</BoardForm>
|
2023-02-04 22:10:54 +01:00
|
|
|
|
</Container>
|
2023-02-02 21:58:02 +01:00
|
|
|
|
)
|
2023-01-31 23:08:57 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default Board;
|