mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
feat: finalize pretext feed sizing rollout (#1120)
* feat(feeds): add pretext-backed item sizing across board, catalog, and thread replies * feat: finalize pretext feed sizing rollout * fix(catalog): raise multiboard viewport buffer * fix(board): preserve pretext query overrides
This commit is contained in:
@@ -79,8 +79,8 @@ describe('BoardPagination', () => {
|
||||
buttons[1]?.dispatchEvent(new MouseEvent('click', { bubbles: true }));
|
||||
});
|
||||
|
||||
expect(testState.navigateMock).toHaveBeenNthCalledWith(1, '/mu');
|
||||
expect(testState.navigateMock).toHaveBeenNthCalledWith(2, '/mu/3');
|
||||
expect(testState.navigateMock).toHaveBeenNthCalledWith(1, { pathname: '/mu', search: '' });
|
||||
expect(testState.navigateMock).toHaveBeenNthCalledWith(2, { pathname: '/mu/3', search: '' });
|
||||
});
|
||||
|
||||
it('shows the footer pagelist, catalog links, and enables infinite scroll from the all shortcut', async () => {
|
||||
@@ -104,7 +104,7 @@ describe('BoardPagination', () => {
|
||||
nextButton?.dispatchEvent(new MouseEvent('click', { bubbles: true }));
|
||||
});
|
||||
|
||||
expect(testState.navigateMock).toHaveBeenCalledWith('/mu/2');
|
||||
expect(testState.navigateMock).toHaveBeenCalledWith({ pathname: '/mu/2', search: '' });
|
||||
});
|
||||
|
||||
it('hides the footer pagelist for multiboards or when infinite scroll is already enabled', () => {
|
||||
|
||||
@@ -8,6 +8,7 @@ import styles from './board-pagination.module.css';
|
||||
interface BoardPaginationProps {
|
||||
basePath: string;
|
||||
currentPage: number;
|
||||
search?: string;
|
||||
totalPages: number;
|
||||
/** When true, renders pagelist: [All] [1] [2] ... [10] Catalog Archive + Style select */
|
||||
footerStyle?: boolean;
|
||||
@@ -15,14 +16,14 @@ interface BoardPaginationProps {
|
||||
isMultiboard?: boolean;
|
||||
}
|
||||
|
||||
const BoardPagination = ({ basePath, currentPage, totalPages, footerStyle = false, isMultiboard = false }: BoardPaginationProps) => {
|
||||
const BoardPagination = ({ basePath, currentPage, search = '', totalPages, footerStyle = false, isMultiboard = false }: BoardPaginationProps) => {
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
const enableInfiniteScroll = useFeedViewSettingsStore((state) => state.enableInfiniteScroll);
|
||||
const setEnableInfiniteScroll = useFeedViewSettingsStore((state) => state.setEnableInfiniteScroll);
|
||||
|
||||
const pageHref = (page: number) => (page === 1 ? basePath : `${basePath}/${page}`);
|
||||
const catalogHref = `${basePath}/catalog`;
|
||||
const pageHref = (page: number) => ({ pathname: page === 1 ? basePath : `${basePath}/${page}`, search });
|
||||
const catalogHref = { pathname: `${basePath}/catalog`, search };
|
||||
|
||||
if (totalPages <= 1 && !footerStyle) {
|
||||
return null;
|
||||
@@ -30,7 +31,7 @@ const BoardPagination = ({ basePath, currentPage, totalPages, footerStyle = fals
|
||||
|
||||
if (footerStyle) {
|
||||
const pageNumbers = Array.from({ length: totalPages }, (_, i) => i + 1);
|
||||
const archiveHref = `${basePath}/archive`;
|
||||
const archiveHref = { pathname: `${basePath}/archive`, search };
|
||||
|
||||
return (
|
||||
<div className={`${footerStyles.footerRow} ${isMultiboard ? footerStyles.footerRowRightOnly : ''}`}>
|
||||
|
||||
Reference in New Issue
Block a user