mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(mod multiboard): show account import empty state
This commit is contained in:
@@ -909,6 +909,22 @@ describe('Catalog', () => {
|
||||
expect(container.querySelector('[data-testid="catalog-first-row"]')?.textContent).toBe('music-posting.eth');
|
||||
});
|
||||
|
||||
it('shows mod empty state with settings link in mod catalog', async () => {
|
||||
testState.accountCommunityAddresses = [];
|
||||
|
||||
await renderCatalog({
|
||||
catalogProps: { viewType: 'mod' },
|
||||
initialEntry: '/mod/catalog',
|
||||
routePath: '/mod/*',
|
||||
});
|
||||
|
||||
expect(container.textContent).toContain('not_mod_of_any_board');
|
||||
expect(container.textContent).toContain('go_to_settings_to_import_mod_account');
|
||||
expect(container.querySelector('[role="status"]')?.className).toContain('modEmptyState');
|
||||
expect(container.querySelector('a')?.getAttribute('href')).toBe('/mod/settings#account-settings');
|
||||
expect(container.querySelectorAll('[data-testid="catalog-row"]')).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('shows centered nothing found when catalog search has no matches', async () => {
|
||||
testState.feed = [{ cid: 'network-post', title: 'cats on stage', communityAddress: 'music-posting.eth' }];
|
||||
testState.searchText = 'asddasd';
|
||||
|
||||
@@ -30,6 +30,7 @@ import { ReturnButton, ArchiveButton, TopButton, RefreshButton } from '../../com
|
||||
import mobileFooterStyles from '../../components/footer/footer.module.css';
|
||||
import LoadingEllipsis from '../../components/loading-ellipsis';
|
||||
import ErrorDisplay from '../../components/error-display/error-display';
|
||||
import { ModEmptyState } from '../../components/mod-empty-state';
|
||||
import styles from './catalog.module.css';
|
||||
import { commentMatchesPattern } from '../../lib/utils/pattern-utils';
|
||||
import { isCommentArchived } from '../../lib/utils/comment-moderation-utils';
|
||||
@@ -695,8 +696,14 @@ const Catalog = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp,
|
||||
);
|
||||
const isFeedLoaded = feed.length > 0 || hiddenThreadsCount > 0 || state === 'failed';
|
||||
const hasActiveSearch = searchText.trim().length > 0;
|
||||
const showModEmptyState = isInModView && accountCommunityAddresses.length === 0;
|
||||
const showSearchNothingFound =
|
||||
hasActiveSearch && !footerHasMore && footerCombinedFeedLength === 0 && state !== 'failed' && !(isInSubscriptionsView && (subscriptions?.length || 0) === 0);
|
||||
hasActiveSearch &&
|
||||
!footerHasMore &&
|
||||
footerCombinedFeedLength === 0 &&
|
||||
state !== 'failed' &&
|
||||
!(isInSubscriptionsView && (subscriptions?.length || 0) === 0) &&
|
||||
!showModEmptyState;
|
||||
|
||||
// Process the feed to move "top" posts to the top (applied after display sort)
|
||||
const processedFeed = useMemo(() => {
|
||||
@@ -901,6 +908,21 @@ const Catalog = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp,
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
) : showModEmptyState ? (
|
||||
<>
|
||||
<ModEmptyState />
|
||||
<hr />
|
||||
{catalogFooterFirstRow}
|
||||
<PageFooterDesktop variant='catalog' styleRow={catalogFooterStyleRow} />
|
||||
<PageFooterMobile>
|
||||
<div className={mobileFooterStyles.mobileFooterButtons}>
|
||||
<ReturnButton address={communityAddress} isInAllView={isInAllView} isInSubscriptionsView={isInSubscriptionsView} isInModView={isInModView} />
|
||||
<ArchiveButton address={communityAddress} isInAllView={isInAllView} isInSubscriptionsView={isInSubscriptionsView} isInModView={isInModView} />
|
||||
<TopButton />
|
||||
<RefreshButton />
|
||||
</div>
|
||||
</PageFooterMobile>
|
||||
</>
|
||||
) : showSearchNothingFound ? (
|
||||
<>
|
||||
<CatalogSearchNothingFound />
|
||||
|
||||
Reference in New Issue
Block a user