style(homepage): display '?' as title while it's loading, if there's no title display shortAddress without tld

This commit is contained in:
Tom (plebeius.eth)
2025-02-22 22:33:50 +01:00
parent cc0ba49c5f
commit 4e8dd7edb2
+6 -2
View File
@@ -14,7 +14,7 @@ import { nsfwTags } from '../home';
const Board = ({ subplebbit, isMobile }: { subplebbit: Subplebbit; isMobile: boolean }) => {
const { t } = useTranslation();
const { address, title, tags } = subplebbit || {};
const { address, tags } = subplebbit || {};
const nsfwTag = tags?.find((tag: string) => nsfwTags.includes(tag));
let stats = useSubplebbitStats({ subplebbitAddress: address });
@@ -25,6 +25,10 @@ const Board = ({ subplebbit, isMobile }: { subplebbit: Subplebbit; isMobile: boo
const displayAddress = address && Plebbit.getShortAddress(address);
const showOfflineIcon = address && (isOffline || isOnlineStatusLoading);
const title =
subplebbitData?.title ||
(subplebbitData?.updatedAt ? (displayAddress.endsWith('.eth') || displayAddress.endsWith('.sol') ? displayAddress.slice(0, -4) : displayAddress) : '?');
return (
<tr className={styles.subplebbit} key={address}>
<td className={styles.boardAddress}>
@@ -41,7 +45,7 @@ const Board = ({ subplebbit, isMobile }: { subplebbit: Subplebbit; isMobile: boo
</p>
</td>
<td className={styles.boardTitle}>
<p className={styles.boardCell}>{title || displayAddress}</p>
<p className={styles.boardCell}>{title}</p>
</td>
{!isMobile && (
<>