diff --git a/src/renderer/features/home/routes/home-route.tsx b/src/renderer/features/home/routes/home-route.tsx index 23920095..0526d881 100644 --- a/src/renderer/features/home/routes/home-route.tsx +++ b/src/renderer/features/home/routes/home-route.tsx @@ -1,17 +1,17 @@ -import { useCallback, useMemo } from 'react'; +import { useCallback, useMemo, useRef } from 'react'; import { Box, Stack } from '@mantine/core'; import { useSetState } from '@mantine/hooks'; import { AlbumListSort, ServerType, SortOrder } from '/@/renderer/api/types'; -import { TextTitle, PageHeader, FeatureCarousel, GridCarousel } from '/@/renderer/components'; +import { TextTitle, FeatureCarousel, GridCarousel, NativeScrollArea } from '/@/renderer/components'; import { useAlbumList } from '/@/renderer/features/albums'; import { useRecentlyPlayed } from '/@/renderer/features/home/queries/recently-played-query'; -import { AnimatedPage } from '/@/renderer/features/shared'; +import { AnimatedPage, LibraryHeaderBar } from '/@/renderer/features/shared'; import { useContainerQuery } from '/@/renderer/hooks'; import { AppRoute } from '/@/renderer/router/routes'; import { useCurrentServer } from '/@/renderer/store'; const HomeRoute = () => { - // const rootElement = document.querySelector(':root') as HTMLElement; + const scrollAreaRef = useRef(null); const server = useCurrentServer(); const cq = useContainerQuery(); const itemsPerPage = cq.isXl ? 9 : cq.isLg ? 7 : cq.isMd ? 5 : cq.isSm ? 4 : 3; @@ -111,16 +111,6 @@ const HomeRoute = () => { [pagination, setPagination], ); - // const handleScroll = (position: { x: number; y: number }) => { - // if (position.y <= 15) { - // return rootElement?.style?.setProperty('--header-opacity', '0'); - // } - - // return rootElement?.style?.setProperty('--header-opacity', '1'); - // }; - - // const throttledScroll = throttle(handleScroll, 200); - const carousels = [ { data: random?.data?.items, @@ -202,74 +192,73 @@ const HomeRoute = () => { return ( - - + + Home + + ), + offset: ['0px', '200px'], + }} + > - - - - {carousels - .filter((carousel) => { - if ( - server?.type === ServerType.JELLYFIN && - carousel.uniqueId === 'recentlyPlayed' - ) { - return null; - } + + + {carousels + .filter((carousel) => { + if ( + server?.type === ServerType.JELLYFIN && + carousel.uniqueId === 'recentlyPlayed' + ) { + return null; + } - return carousel; - }) - .map((carousel, index) => ( - ( + - {carousel.title} - - ))} - - + }, + ]} + containerWidth={cq.width} + data={carousel.data} + loading={carousel.loading} + pagination={carousel.pagination} + uniqueId={carousel.uniqueId} + > + {carousel.title} + + ))} + - + ); };