From 7f5eebdd5346f8b4b056d2081384f5b262e703c7 Mon Sep 17 00:00:00 2001
From: plebeius
Date: Mon, 3 Nov 2025 22:16:25 +0100
Subject: [PATCH] boards titles shouldn't include directories
---
src/views/home/boards-list/boards-list.tsx | 3 ++-
.../popular-threads-box/popular-threads-box.tsx | 17 +++++++++--------
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/views/home/boards-list/boards-list.tsx b/src/views/home/boards-list/boards-list.tsx
index 45060341..68121c2f 100644
--- a/src/views/home/boards-list/boards-list.tsx
+++ b/src/views/home/boards-list/boards-list.tsx
@@ -10,6 +10,7 @@ import styles from './boards-list.module.css';
const Board = ({ subplebbit, isMobile }: { subplebbit: MultisubSubplebbit; isMobile: boolean }) => {
const { t } = useTranslation();
const { address, title, nsfw } = subplebbit || {};
+ const boardTitle = title?.replace(/^\/[^/]+\/\s*-\s*/, '') || '';
const displayAddress = address && Plebbit.getShortAddress(address);
return (
@@ -21,7 +22,7 @@ const Board = ({ subplebbit, isMobile }: { subplebbit: MultisubSubplebbit; isMob
- {title || displayAddress}
+ {boardTitle || displayAddress}
|
);
diff --git a/src/views/home/popular-threads-box/popular-threads-box.tsx b/src/views/home/popular-threads-box/popular-threads-box.tsx
index b279e730..03effc0e 100644
--- a/src/views/home/popular-threads-box/popular-threads-box.tsx
+++ b/src/views/home/popular-threads-box/popular-threads-box.tsx
@@ -14,8 +14,7 @@ import { removeMarkdown } from '../../../lib/utils/post-utils';
interface PopularThreadProps {
post: Comment;
- boardTitle: string | undefined;
- boardShortAddress: string;
+ multisub: MultisubSubplebbit[];
}
export const ContentPreview = ({ content, maxLength = 99 }: { content: string; maxLength?: number }) => {
@@ -25,16 +24,20 @@ export const ContentPreview = ({ content, maxLength = 99 }: { content: string; m
return truncatedText;
};
-const PopularThreadCard = ({ post, boardTitle, boardShortAddress }: PopularThreadProps) => {
+const PopularThreadCard = ({ post, multisub }: PopularThreadProps) => {
const { cid, content, link, linkHeight, linkWidth, subplebbitAddress, thumbnailUrl, title } = post || {};
const commentMediaInfo = getCommentMediaInfo(link, thumbnailUrl, linkWidth, linkHeight);
+ // Find the matching MultisubSubplebbit entry and get its title
+ const multisubEntry = multisub.find((ms) => ms?.address === subplebbitAddress);
+ const boardTitle = multisubEntry?.title?.replace(/^\/[^/]+\/\s*-\s*/, '') || '';
+
return (
-
{boardTitle || boardShortAddress}
+
{boardTitle}
-
+
@@ -83,9 +86,7 @@ const PopularThreadsBox = ({ multisub, subplebbits }: { multisub: MultisubSubple
{popularPosts.length === 0 ? (
) : (
- popularPosts.map((post: any) => (
-
- ))
+ popularPosts.map((post: any) =>
)
)}