fix: link mod empty state to account import

This commit is contained in:
Tommaso Casaburi
2026-04-27 15:02:51 +07:00
parent e8efd14e72
commit e54e8802c3
37 changed files with 52 additions and 36 deletions
+13
View File
@@ -515,6 +515,19 @@ describe('Board', () => {
expect(container.textContent).toContain('not_subscribed_to_any_board');
});
it('links empty mod feeds to account import settings', async () => {
testState.accountCommunityAddresses = [];
await renderBoard({
boardProps: { viewType: 'mod' },
initialEntry: '/mod',
routePath: '/mod/*',
});
expect(container.textContent).toContain('not_mod_of_any_board');
expect(container.querySelector('a')?.getAttribute('href')).toBe('/mod/settings#account-settings');
});
it('passes multiboard time filters to useFeed and honors cached overrides', async () => {
testState.feed = [{ cid: 'all-post', communityAddress: 'music-posting.eth' }];
+4 -1
View File
@@ -41,6 +41,9 @@ const MONTH_IN_SECONDS = 30 * 24 * 60 * 60;
const YEAR_IN_SECONDS = 365 * 24 * 60 * 60;
// Keep the hook on its indexed fast path when this view should not inject local posts.
const EMPTY_ACCOUNT_COMMENT_LOOKUP = { commentIndices: [-1] };
const MOD_ACCOUNT_IMPORT_LINK_COMPONENTS = {
1: <Link to='/mod/settings#account-settings' />,
};
/** Board feed always uses 'active' sort; catalog dropdown does not affect board ordering. */
const BOARD_SORT_TYPE = 'active' as const;
@@ -134,7 +137,7 @@ const BoardFooter = ({
) : isInSubscriptionsView && subscriptionsLength === 0 ? (
<span className='red'>{t('not_subscribed_to_any_board')}</span>
) : isInModView && accountCommunityAddressesLength === 0 ? (
<span className='red'>{t('not_mod_of_any_board')}</span>
<Trans i18nKey='not_mod_of_any_board' components={MOD_ACCOUNT_IMPORT_LINK_COMPONENTS} />
) : (
showLoadingEllipsis && (hasMore || isEmptyBoardLoading) && <LoadingEllipsis string={loadingStateString} />
)}