feat(home): redesigned home to be more similar to 4chan, with boards box listing all boards and thread box showing recent threads

This commit is contained in:
plebeius.eth
2023-10-02 21:40:47 +02:00
parent be8bed74ef
commit 685cbb3c17
5 changed files with 368 additions and 175 deletions
+27 -2
View File
@@ -28,8 +28,18 @@ import packageJson from '../package.json';
const commitRef = process?.env?.REACT_APP_COMMIT_REF || '';
export default function App() {
const { bodyStyle, setBodyStyle, setDefaultSubplebbits, isCaptchaOpen, setIsCaptchaOpen, setIsSettingsOpen, selectedStyle, setShowPostForm, setShowPostFormLink } =
useGeneralStore((state) => state);
const {
bodyStyle,
setBodyStyle,
setDefaultSubplebbits,
setDefaultNsfwSubplebbits,
isCaptchaOpen,
setIsCaptchaOpen,
setIsSettingsOpen,
selectedStyle,
setShowPostForm,
setShowPostFormLink,
} = useGeneralStore((state) => state);
const location = useLocation();
const isElectron = window.electron && window.electron.isElectron;
@@ -116,6 +126,21 @@ export default function App() {
};
}, [setDefaultSubplebbits]);
// fetch default NSFW subplebbits
useEffect(() => {
let didCancel = false;
fetch('https://raw.githubusercontent.com/plebbit/temporary-default-subplebbits/master/subplebbits-nsfw.json', { cache: 'no-cache' })
.then((res) => res.json())
.then((res) => {
if (!didCancel) {
setDefaultNsfwSubplebbits(res);
}
});
return () => {
didCancel = true;
};
}, [setDefaultNsfwSubplebbits]);
// handle nested routes
useEffect(() => {
const path = location.pathname;