mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(popular threads box): default to worksafe content and show 8 posts for single subplebbit
This commit is contained in:
@@ -9,14 +9,7 @@ const usePopularPosts = (subplebbits: Subplebbit[]) => {
|
||||
const uniqueLinks: Set<string> = new Set();
|
||||
const allPosts: Comment[] = [];
|
||||
|
||||
let postsPerSub = 1;
|
||||
if (subplebbits.length === 2) {
|
||||
postsPerSub = 4;
|
||||
} else if (subplebbits.length === 3) {
|
||||
postsPerSub = 3;
|
||||
} else if (subplebbits.length >= 4 && subplebbits.length < 8) {
|
||||
postsPerSub = 2;
|
||||
}
|
||||
const postsPerSub = [0, 8, 4, 3, 2, 2, 2, 2, 1][Math.min(subplebbits.length, 8)];
|
||||
|
||||
subplebbits.forEach((subplebbit: any) => {
|
||||
let subplebbitPosts: Comment[] = [];
|
||||
|
||||
@@ -29,7 +29,7 @@ const useHomeFiltersStore = create<HomeFiltersStore>((set) => ({
|
||||
set({ useCatalog: value });
|
||||
localStorage.setItem('useCatalog', value.toString());
|
||||
},
|
||||
showWorksafeContentOnly: localStorage.getItem('showWorksafeContentOnly') === 'true' ? true : false,
|
||||
showWorksafeContentOnly: localStorage.getItem('showWorksafeContentOnly') === 'true' || localStorage.getItem('showWorksafeContentOnly') === null ? true : false,
|
||||
setShowWorksafeContentOnly: (value: boolean) => {
|
||||
set({ showWorksafeContentOnly: value });
|
||||
localStorage.setItem('showWorksafeContentOnly', value.toString());
|
||||
|
||||
@@ -60,6 +60,7 @@ const PopularThreadsBox = ({ multisub, subplebbits }: { multisub: Subplebbit[];
|
||||
const filteredSubplebbits = useMemo(getFilteredSubplebbits, [subplebbits, showWorksafeContentOnly, showNsfwContentOnly, multisub]);
|
||||
const popularPosts = usePopularPosts(filteredSubplebbits);
|
||||
|
||||
console.log(showWorksafeContentOnly, showNsfwContentOnly);
|
||||
return (
|
||||
<div className={styles.box}>
|
||||
<div className={`${styles.boxBar} ${styles.color2ColorBar}`}>
|
||||
|
||||
Reference in New Issue
Block a user