2023-02-09 19:08:15 +01:00
|
|
|
import React, { useState, useEffect, useContext } from 'react';
|
2023-02-02 21:58:02 +01:00
|
|
|
import { Link } from 'react-router-dom';
|
2023-02-08 21:49:36 +01:00
|
|
|
import { Container, Header, Logo, Page, Search, About, AboutTitle, AboutContent, Boards, BoardsTitle, BoardsContent, Footer } from './styles/Home.styled';
|
2023-02-09 19:08:15 +01:00
|
|
|
import { BoardContext } from '../App';
|
2023-01-31 23:08:57 +01:00
|
|
|
|
2023-02-13 12:05:10 +01:00
|
|
|
const Home = ({ setBodyStyle }) => {
|
2023-02-04 11:35:46 +01:00
|
|
|
const [defaultSubplebbits, setDefaultSubplebbits] = useState([]);
|
2023-03-06 18:38:33 +01:00
|
|
|
const { setSelectedTitle, setSelectedAddress, setSelectedStyle } = useContext(BoardContext);
|
2023-02-13 12:05:10 +01:00
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setBodyStyle({
|
2023-02-16 14:05:48 +01:00
|
|
|
background: "#ffe url(/assets/fade.png) top repeat-x",
|
2023-02-13 12:05:10 +01:00
|
|
|
color: "maroon",
|
|
|
|
|
fontFamily: "Helvetica, Arial, sans-serif"
|
|
|
|
|
});
|
|
|
|
|
setSelectedStyle("Yotsuba");
|
|
|
|
|
}, [setBodyStyle, setSelectedStyle]);
|
2023-02-09 19:08:15 +01:00
|
|
|
|
|
|
|
|
const handleClick = (title, address) => {
|
|
|
|
|
setSelectedTitle(title);
|
|
|
|
|
setSelectedAddress(address);
|
|
|
|
|
}
|
2023-02-04 11:35:46 +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 (
|
|
|
|
|
<Container>
|
|
|
|
|
<Header>
|
|
|
|
|
<Logo>
|
|
|
|
|
<Link to="/">
|
2023-02-16 14:05:48 +01:00
|
|
|
<img alt="plebchan" src="/assets/logo/logo-transparent.png" />
|
2023-02-02 21:58:02 +01:00
|
|
|
</Link>
|
|
|
|
|
</Logo>
|
|
|
|
|
</Header>
|
|
|
|
|
<Page>
|
2023-02-03 13:37:41 +01:00
|
|
|
<Search>
|
|
|
|
|
<form>
|
2023-02-04 22:10:54 +01:00
|
|
|
<input type="text" placeholder='"board.eth" or "Qm..."' />
|
2023-02-10 12:57:17 +01:00
|
|
|
<input type="submit" value="Search" disabled />
|
2023-02-03 13:37:41 +01:00
|
|
|
</form>
|
|
|
|
|
</Search>
|
2023-02-02 21:58:02 +01:00
|
|
|
<About>
|
2023-02-03 11:12:36 +01:00
|
|
|
<AboutTitle>
|
|
|
|
|
<h2>What is plebchan?</h2>
|
|
|
|
|
</AboutTitle>
|
|
|
|
|
<AboutContent>
|
|
|
|
|
<div id="content">
|
2023-02-25 13:26:35 +01:00
|
|
|
<p>Plebchan is a serverless, adminless, decentralized 4chan alternative that uses the <a href="https://plebbit.com" target="_blank" rel="noreferrer">plebbit protocol</a>. Users do not need to register an account before participating in the community; anyone can post comments, share media links, and create a board. Search for any board address above, or feel free to click on a popular board below that interests you and jump right in! </p>
|
2023-02-03 11:12:36 +01:00
|
|
|
<br />
|
|
|
|
|
<p>There are no global rules, each board is completely independent and their owners decide how they should be moderated.</p>
|
|
|
|
|
</div>
|
|
|
|
|
</AboutContent>
|
2023-02-02 21:58:02 +01:00
|
|
|
</About>
|
2023-02-03 11:12:36 +01:00
|
|
|
<Boards>
|
|
|
|
|
<BoardsTitle>
|
2023-02-02 23:06:33 +01:00
|
|
|
<h2>Popular boards</h2>
|
2023-02-03 11:12:36 +01:00
|
|
|
</BoardsTitle>
|
|
|
|
|
<BoardsContent>
|
2023-02-04 11:35:46 +01:00
|
|
|
{defaultSubplebbits.map(subplebbit => (
|
2023-02-04 11:48:51 +01:00
|
|
|
<div className="board" key={subplebbit.address}>
|
2023-02-04 11:35:46 +01:00
|
|
|
<div className="board-title">{subplebbit.title}</div>
|
2023-03-02 21:51:06 +01:00
|
|
|
<Link to={`/${subplebbit.address}`} onClick={() => {
|
2023-02-09 19:08:15 +01:00
|
|
|
handleClick(subplebbit.title, subplebbit.address);
|
|
|
|
|
}} >
|
2023-02-16 14:05:48 +01:00
|
|
|
<img alt="board logo" src="/assets/plebchan.png" />
|
2023-02-04 11:35:46 +01:00
|
|
|
</Link>
|
|
|
|
|
<div className="board-text">
|
|
|
|
|
<b>{subplebbit.address}</b>
|
|
|
|
|
</div>
|
2023-02-03 19:16:12 +01:00
|
|
|
</div>
|
2023-02-04 11:35:46 +01:00
|
|
|
))}
|
2023-02-03 11:12:36 +01:00
|
|
|
</BoardsContent>
|
|
|
|
|
</Boards>
|
2023-02-02 21:58:02 +01:00
|
|
|
</Page>
|
2023-02-03 19:16:12 +01:00
|
|
|
<Footer>
|
|
|
|
|
<ul>
|
|
|
|
|
<li className="fill"></li>
|
|
|
|
|
<li className="first">
|
|
|
|
|
<a href="https://plebbitdemo.eth.limo" target="_blank" rel="noopener noreferrer">Plebbit</a>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<a href="https://gitcoin.co/grants/5515/plebbit-a-serverless-adminless-decentralized-redd" target="_blank" rel="noopener noreferrer">Donate</a>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
2023-02-14 21:13:15 +01:00
|
|
|
<a href="https://plebbit.com/whitepaper" target="_blank" rel="noopener noreferrer">Whitepaper</a>
|
2023-02-03 19:16:12 +01:00
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<a href="https://snowtrace.io/token/0x625fc9bb971bb305a2ad63252665dcfe9098bee9" target="_blank" rel="noopener noreferrer">Contract</a>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<a href="https://matrix.to/#/#plebbit:plebbitchat.org" target="_blank" rel="noopener noreferrer">Matrix</a>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<a href="https://t.me/plebbit" target="_blank" rel="noopener noreferrer">Telegram</a>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<a href="https://twitter.com/getplebbit" target="_blank" rel="noopener noreferrer">Twitter</a>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<a href="https://discord.gg/E7ejphwzGW" target="_blank" rel="noopener noreferrer">Discord</a>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</Footer>
|
2023-02-02 21:58:02 +01:00
|
|
|
</Container>
|
|
|
|
|
)
|
|
|
|
|
};
|
2023-01-31 23:08:57 +01:00
|
|
|
|
|
|
|
|
export default Home;
|