2023-02-04 22:10:54 +01:00
|
|
|
import React, { useState, useEffect } from 'react';
|
|
|
|
|
import { Link } from 'react-router-dom';
|
|
|
|
|
import { Container } from './styled/Home.styled'
|
|
|
|
|
import { NavBar, Header, Break, PostForm } from './styled/Board.styled';
|
|
|
|
|
import { useFeed } from '@plebbit/plebbit-react-hooks';
|
2023-01-31 23:08:57 +01:00
|
|
|
|
2023-02-02 21:58:02 +01:00
|
|
|
const Board = () => {
|
2023-02-04 22:10:54 +01:00
|
|
|
// eslint-disable-next-line
|
|
|
|
|
const { feed, hasMore, loadMore } = useFeed(['news.eth'], 'new');
|
|
|
|
|
const [defaultSubplebbits, setDefaultSubplebbits] = useState([]);
|
|
|
|
|
|
|
|
|
|
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 => (
|
|
|
|
|
<span className="boardList">[
|
|
|
|
|
<a href="/board" key={subplebbit.address}>{subplebbit.title}</a>
|
|
|
|
|
]
|
|
|
|
|
</span>
|
|
|
|
|
))}
|
|
|
|
|
<span className="nav">[
|
|
|
|
|
<Link to="/">Home</Link>]
|
|
|
|
|
</span>
|
|
|
|
|
</>
|
|
|
|
|
</NavBar>
|
|
|
|
|
<Header>
|
|
|
|
|
<>
|
|
|
|
|
<div className="banner">
|
|
|
|
|
<img alt="plebchan" src="/banner.jpg"/>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="board-title">Plebs Helping Plebs</div>
|
|
|
|
|
<div className="board-address">p/plebshelpingplebs.eth</div>
|
|
|
|
|
</>
|
|
|
|
|
</Header>
|
|
|
|
|
<Break />
|
|
|
|
|
<PostForm>
|
|
|
|
|
{/* <div id="post-form-link">
|
|
|
|
|
[
|
|
|
|
|
<a href="#">Start a New Thread</a>
|
|
|
|
|
]
|
|
|
|
|
</div>
|
|
|
|
|
<table id="post-form"></table> */}
|
|
|
|
|
</PostForm>
|
|
|
|
|
</Container>
|
2023-02-02 21:58:02 +01:00
|
|
|
)
|
2023-01-31 23:08:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default Board;
|