Merge branch 'feat/new-catalogue' of github.com:hydralauncher/hydra into feat/new-catalogue

This commit is contained in:
Chubby Granny Chaser 2024-12-23 21:54:25 +00:00
commit cbfe831e0c
No known key found for this signature in database
2 changed files with 10 additions and 2 deletions

View File

@ -1,11 +1,13 @@
@use "../../scss/globals.scss";
.catalogue {
overflow-y: auto;
display: flex;
flex-direction: column;
gap: calc(globals.$spacing-unit * 2);
width: 100%;
padding: 16px;
scroll-behavior: smooth;
&__filters-container {
width: 270px;

View File

@ -33,6 +33,7 @@ const PAGE_SIZE = 20;
export default function Catalogue() {
const abortControllerRef = useRef<AbortController | null>(null);
const cataloguePageRef = useRef<HTMLDivElement>(null);
const { steamDevelopers, steamPublishers } = useCatalogue();
@ -217,7 +218,7 @@ export default function Catalogue() {
]);
return (
<div className="catalogue">
<div className="catalogue" ref={cataloguePageRef}>
<div
style={{
display: "flex",
@ -310,7 +311,12 @@ export default function Catalogue() {
<Pagination
page={page}
totalPages={Math.ceil(itemsCount / PAGE_SIZE)}
onPageChange={(page) => dispatch(setPage(page))}
onPageChange={(page) => {
dispatch(setPage(page));
if (cataloguePageRef.current) {
cataloguePageRef.current.scrollTop = 0;
}
}}
/>
</div>
</div>