mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
feat(popular-threads): show actual feed state string instead of generic loading
This commit is contained in:
@@ -4,6 +4,7 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { Comment, Subplebbit } from '@bitsocialhq/bitsocial-react-hooks';
|
import { Comment, Subplebbit } from '@bitsocialhq/bitsocial-react-hooks';
|
||||||
import styles from '../home.module.css';
|
import styles from '../home.module.css';
|
||||||
import usePopularPosts from '../../../hooks/use-popular-posts';
|
import usePopularPosts from '../../../hooks/use-popular-posts';
|
||||||
|
import { useFeedStateString } from '../../../hooks/use-state-string';
|
||||||
import usePopularThreadsOptionsStore from '../../../stores/use-popular-threads-options-store';
|
import usePopularThreadsOptionsStore from '../../../stores/use-popular-threads-options-store';
|
||||||
import { getCommentMediaInfo } from '../../../lib/utils/media-utils';
|
import { getCommentMediaInfo } from '../../../lib/utils/media-utils';
|
||||||
import { CatalogPostMedia } from '../../../components/catalog-row';
|
import { CatalogPostMedia } from '../../../components/catalog-row';
|
||||||
@@ -86,6 +87,7 @@ const PopularThreadsBox = ({
|
|||||||
}, [directories, directoryAddresses, showNsfwContentOnly, showWorksafeContentOnly, subplebbits]);
|
}, [directories, directoryAddresses, showNsfwContentOnly, showWorksafeContentOnly, subplebbits]);
|
||||||
|
|
||||||
const { popularPosts, isLoading } = usePopularPosts(filteredSubplebbits, filteredBoardAddresses);
|
const { popularPosts, isLoading } = usePopularPosts(filteredSubplebbits, filteredBoardAddresses);
|
||||||
|
const loadingStateString = useFeedStateString(filteredBoardAddresses) || t('loading');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.box}>
|
<div className={styles.box}>
|
||||||
@@ -95,7 +97,7 @@ const PopularThreadsBox = ({
|
|||||||
</div>
|
</div>
|
||||||
<div className={`${styles.boxContent} ${styles.popularThreads} ${isLoading ? styles.popularThreadsLoading : ''}`}>
|
<div className={`${styles.boxContent} ${styles.popularThreads} ${isLoading ? styles.popularThreadsLoading : ''}`}>
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<LoadingEllipsis string={t('loading')} />
|
<LoadingEllipsis string={loadingStateString} />
|
||||||
) : (
|
) : (
|
||||||
popularPosts.map((post: Comment) => {
|
popularPosts.map((post: Comment) => {
|
||||||
const directoryEntry = findDirectoryByAddress(directories, post.subplebbitAddress);
|
const directoryEntry = findDirectoryByAddress(directories, post.subplebbitAddress);
|
||||||
|
|||||||
Reference in New Issue
Block a user