refactor(core): remove legacy plebbit terminology

This commit is contained in:
Tommaso Casaburi
2026-04-17 10:48:27 +07:00
parent e366dac25c
commit ee7a5b5778
158 changed files with 626 additions and 836 deletions
+7 -7
View File
@@ -23,8 +23,8 @@ const testState = vi.hoisted(() => ({
hasMore: false,
isMobile: false,
loadMoreMock: vi.fn(),
resolvedSubplebbitAddress: 'music-posting.eth' as string | undefined,
subplebbit: {
resolvedCommunityAddress: 'music-posting.eth' as string | undefined,
community: {
error: undefined as Error | undefined,
title: '/mu/ - Music',
},
@@ -53,7 +53,7 @@ vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
loadMore: testState.loadMoreMock,
reset: vi.fn(),
}),
useCommunity: () => testState.subplebbit,
useCommunity: () => testState.community,
}));
vi.mock('../../../hooks/use-directories', () => ({
@@ -62,8 +62,8 @@ vi.mock('../../../hooks/use-directories', () => ({
directories.find((entry) => entry.address === address || entry.directoryCode === address || entry.title === address),
}));
vi.mock('../../../hooks/use-resolved-subplebbit-address', () => ({
useResolvedSubplebbitAddress: () => testState.resolvedSubplebbitAddress,
vi.mock('../../../hooks/use-resolved-community-address', () => ({
useResolvedCommunityAddress: () => testState.resolvedCommunityAddress,
}));
vi.mock('../../../hooks/use-state-string', () => ({
@@ -71,7 +71,7 @@ vi.mock('../../../hooks/use-state-string', () => ({
}));
vi.mock('../../../hooks/use-stable-community', () => ({
useCommunityField: (_address: string | undefined, selector: (value: typeof testState.subplebbit) => unknown) => selector(testState.subplebbit),
useCommunityField: (_address: string | undefined, selector: (value: typeof testState.community) => unknown) => selector(testState.community),
}));
vi.mock('../../../hooks/use-is-mobile', () => ({
@@ -126,7 +126,7 @@ describe('Archive', () => {
testState.feed = [];
testState.hasMore = false;
testState.isMobile = false;
testState.subplebbit = {
testState.community = {
error: undefined,
title: '/mu/ - Music',
};
+31 -31
View File
@@ -7,10 +7,10 @@ import { BottomButton, CatalogButton, ReturnButton, TopButton } from '../../comp
import ErrorDisplay from '../../components/error-display/error-display';
import { PageFooterDesktop, PageFooterMobile, ThreadFooterStyleRow } from '../../components/footer';
import LoadingEllipsis from '../../components/loading-ellipsis';
import { useResolvedSubplebbitAddress } from '../../hooks/use-resolved-subplebbit-address';
import { useResolvedCommunityAddress } from '../../hooks/use-resolved-community-address';
import { useCommunityField } from '../../hooks/use-stable-community';
import { useFeedStateString } from '../../hooks/use-state-string';
import { getSubplebbitAddress, getBoardPath } from '../../lib/utils/route-utils';
import { getCommunityAddress, getBoardPath } from '../../lib/utils/route-utils';
import { isCommentArchived } from '../../lib/utils/comment-moderation-utils';
import { removeMarkdown } from '../../lib/utils/post-utils';
import { useDirectories } from '../../hooks/use-directories';
@@ -101,13 +101,13 @@ const ArchiveFooter = ({ hasMore, loadingState, onLoadMore }: { hasMore: boolean
);
};
const ArchiveDesktopTopControls = ({ subplebbitAddress }: { subplebbitAddress: string | undefined }) => (
const ArchiveDesktopTopControls = ({ communityAddress }: { communityAddress: string | undefined }) => (
<div className={styles.desktopNavLinks}>
<span>
[<ReturnButton address={subplebbitAddress} />]
[<ReturnButton address={communityAddress} />]
</span>
<span>
[<CatalogButton address={subplebbitAddress} />]
[<CatalogButton address={communityAddress} />]
</span>
<span>
[<BottomButton />]
@@ -115,13 +115,13 @@ const ArchiveDesktopTopControls = ({ subplebbitAddress }: { subplebbitAddress: s
</div>
);
const ArchiveDesktopFooterControls = ({ subplebbitAddress }: { subplebbitAddress: string | undefined }) => (
const ArchiveDesktopFooterControls = ({ communityAddress }: { communityAddress: string | undefined }) => (
<div className={styles.desktopFooterButtons}>
<span>
[<ReturnButton address={subplebbitAddress} />]
[<ReturnButton address={communityAddress} />]
</span>
<span>
[<CatalogButton address={subplebbitAddress} />]
[<CatalogButton address={communityAddress} />]
</span>
<span>
[<TopButton />]
@@ -129,18 +129,18 @@ const ArchiveDesktopFooterControls = ({ subplebbitAddress }: { subplebbitAddress
</div>
);
const ArchiveMobileTopControls = ({ subplebbitAddress }: { subplebbitAddress: string | undefined }) => (
const ArchiveMobileTopControls = ({ communityAddress }: { communityAddress: string | undefined }) => (
<div className={styles.mobileNavLinks}>
<ReturnButton address={subplebbitAddress} />
<CatalogButton address={subplebbitAddress} />
<ReturnButton address={communityAddress} />
<CatalogButton address={communityAddress} />
<BottomButton />
</div>
);
const ArchiveMobileFooterControls = ({ subplebbitAddress }: { subplebbitAddress: string | undefined }) => (
const ArchiveMobileFooterControls = ({ communityAddress }: { communityAddress: string | undefined }) => (
<div className={styles.mobileFooterButtons}>
<ReturnButton address={subplebbitAddress} />
<CatalogButton address={subplebbitAddress} />
<ReturnButton address={communityAddress} />
<CatalogButton address={communityAddress} />
<TopButton />
</div>
);
@@ -151,22 +151,22 @@ const Archive = () => {
const boardIdentifier = params.boardIdentifier;
const directories = useDirectories();
const resolvedAddressFromUrl = useResolvedSubplebbitAddress();
const subplebbitAddress = useMemo(() => {
const resolvedAddressFromUrl = useResolvedCommunityAddress();
const communityAddress = useMemo(() => {
if (boardIdentifier) {
return getSubplebbitAddress(boardIdentifier, directories);
return getCommunityAddress(boardIdentifier, directories);
}
return resolvedAddressFromUrl;
}, [boardIdentifier, directories, resolvedAddressFromUrl]);
const boardPath = useMemo(() => {
if (!subplebbitAddress) {
if (!communityAddress) {
return boardIdentifier;
}
return getBoardPath(subplebbitAddress, directories);
}, [boardIdentifier, directories, subplebbitAddress]);
return getBoardPath(communityAddress, directories);
}, [boardIdentifier, directories, communityAddress]);
const boardTitle = useCommunityField(subplebbitAddress, (community) => community?.title) || `/${boardIdentifier || subplebbitAddress || t('archive')}/`;
const boardTitle = useCommunityField(communityAddress, (community) => community?.title) || `/${boardIdentifier || communityAddress || t('archive')}/`;
const archiveFilter = useMemo(
() => ({
@@ -176,9 +176,9 @@ const Archive = () => {
[],
);
const communityAddresses = useMemo(() => (subplebbitAddress ? [subplebbitAddress] : []), [subplebbitAddress]);
const communityAddresses = useMemo(() => (communityAddress ? [communityAddress] : []), [communityAddress]);
const communities = useCommunityIdentifiers(communityAddresses);
const communityIdentifier = useCommunityIdentifier(subplebbitAddress);
const communityIdentifier = useCommunityIdentifier(communityAddress);
const feedOptions = useMemo(
() => ({
@@ -212,14 +212,14 @@ const Archive = () => {
if (isLoading) {
return (
<div id='top' className={`${styles.page} ${shouldShowSnow() ? styles.garland : ''}`}>
<ArchiveMobileTopControls subplebbitAddress={subplebbitAddress} />
<ArchiveMobileTopControls communityAddress={communityAddress} />
<hr className={styles.desktopDivider} />
<ArchiveDesktopTopControls subplebbitAddress={subplebbitAddress} />
<ArchiveDesktopTopControls communityAddress={communityAddress} />
<hr className={styles.divider} />
<h4 className={styles.archiveSummary}>{t('loading_archive')}</h4>
<PageFooterDesktop firstRow={<ArchiveDesktopFooterControls subplebbitAddress={subplebbitAddress} />} styleRow={<ThreadFooterStyleRow />} />
<PageFooterDesktop firstRow={<ArchiveDesktopFooterControls communityAddress={communityAddress} />} styleRow={<ThreadFooterStyleRow />} />
<PageFooterMobile>
<ArchiveMobileFooterControls subplebbitAddress={subplebbitAddress} />
<ArchiveMobileFooterControls communityAddress={communityAddress} />
</PageFooterMobile>
</div>
);
@@ -227,9 +227,9 @@ const Archive = () => {
return (
<div id='top' className={`${styles.page} ${shouldShowSnow() ? styles.garland : ''}`}>
<ArchiveMobileTopControls subplebbitAddress={subplebbitAddress} />
<ArchiveMobileTopControls communityAddress={communityAddress} />
<hr className={styles.desktopDivider} />
<ArchiveDesktopTopControls subplebbitAddress={subplebbitAddress} />
<ArchiveDesktopTopControls communityAddress={communityAddress} />
<hr className={styles.divider} />
<h4 className={styles.archiveSummary}>{summaryText}</h4>
@@ -290,9 +290,9 @@ const Archive = () => {
<ArchiveFooter hasMore={hasMore} loadingState={loadingState} onLoadMore={loadMore} />
<PageFooterDesktop firstRow={<ArchiveDesktopFooterControls subplebbitAddress={subplebbitAddress} />} styleRow={<ThreadFooterStyleRow />} />
<PageFooterDesktop firstRow={<ArchiveDesktopFooterControls communityAddress={communityAddress} />} styleRow={<ThreadFooterStyleRow />} />
<PageFooterMobile>
<ArchiveMobileFooterControls subplebbitAddress={subplebbitAddress} />
<ArchiveMobileFooterControls communityAddress={communityAddress} />
</PageFooterMobile>
</div>
);