mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(subplebbit stats): stats box appeared even if stats are undefined
This commit is contained in:
@@ -15,16 +15,16 @@ const SubplebbitStats = () => {
|
|||||||
const subplebbit = useSubplebbit({ subplebbitAddress });
|
const subplebbit = useSubplebbit({ subplebbitAddress });
|
||||||
const { address, createdAt } = subplebbit || {};
|
const { address, createdAt } = subplebbit || {};
|
||||||
|
|
||||||
|
const stats = useSubplebbitStats({ subplebbitAddress: address });
|
||||||
|
const [showStats, setShowStats] = useState(true);
|
||||||
|
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const isInDescriptionView = isDescriptionView(location.pathname, params);
|
const isInDescriptionView = isDescriptionView(location.pathname, params);
|
||||||
const isInRulesView = isRulesView(location.pathname, params);
|
const isInRulesView = isRulesView(location.pathname, params);
|
||||||
|
|
||||||
const comment = useComment({ commentCid: params?.commentCid });
|
const comment = useComment({ commentCid: params?.commentCid });
|
||||||
const { deleted, locked, removed } = comment || {};
|
const { deleted, locked, removed } = comment || {};
|
||||||
const hideStats = deleted || locked || removed || isInDescriptionView || isInRulesView;
|
const hideStats = !stats.allPostCount || deleted || locked || removed || isInDescriptionView || isInRulesView;
|
||||||
|
|
||||||
const stats = useSubplebbitStats({ subplebbitAddress: address });
|
|
||||||
const [showStats, setShowStats] = useState(true);
|
|
||||||
|
|
||||||
const unixToMMDDYYYY = (timestamp: number) => {
|
const unixToMMDDYYYY = (timestamp: number) => {
|
||||||
const date = new Date(timestamp * 1000);
|
const date = new Date(timestamp * 1000);
|
||||||
|
|||||||
Reference in New Issue
Block a user