@opexa/portal-components 0.0.1115 → 0.0.1117
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -37,7 +37,11 @@ export function GamesList__client(props) {
|
|
|
37
37
|
return [...topGameRows, ...rest];
|
|
38
38
|
}, [topGamesToDisplay, topGameRows, availableRows]);
|
|
39
39
|
const [currentPage, setCurrentPage] = useState(1);
|
|
40
|
-
const
|
|
40
|
+
const isFullyLoaded = !hasNextPage && !loading;
|
|
41
|
+
const displayTotalRows = isFullyLoaded
|
|
42
|
+
? sortedRows.length
|
|
43
|
+
: Math.max(totalRows, sortedRows.length);
|
|
44
|
+
const totalPages = Math.ceil(displayTotalRows / perPage);
|
|
41
45
|
useEffect(() => {
|
|
42
46
|
if (pagination === 'paginated') {
|
|
43
47
|
const requiredRows = currentPage * perPage;
|
|
@@ -69,5 +73,5 @@ export function GamesList__client(props) {
|
|
|
69
73
|
} }) }, game.id));
|
|
70
74
|
}) }), _jsx("div", { className: "mt-2xl flex flex-col items-center lg:mt-3xl", children: pagination === 'paginated' && sortedRows.length > 0 ? (_jsx(GamesPagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: (page) => {
|
|
71
75
|
setCurrentPage(page);
|
|
72
|
-
} })) : (_jsxs(_Fragment, { children: [_jsx(Progress.Root, { min: 0, max:
|
|
76
|
+
} })) : (_jsxs(_Fragment, { children: [_jsx(Progress.Root, { min: 0, max: displayTotalRows, value: sortedRows.length, onValueChange: noop, className: twMerge('w-[12.5rem]', classNames.progressRoot), children: _jsx(Progress.Track, { className: twMerge('bg-bg-tertiary', classNames.progressTrack), children: _jsx(Progress.Range, {}) }) }), _jsx("p", { className: "mt-md text-button-tertiary-fg text-sm", children: `Displaying ${sortedRows.length} of ${displayTotalRows}` }), hasNextPage && (_jsx(Button, { size: "sm", variant: "outline", fullWidth: false, onClick: next, className: twMerge('mt-lg', classNames.loadMoreButton), children: "Load More" }))] })) })] }))] }) }));
|
|
73
77
|
}
|