From 46a23318afe5cba478b0b5807bf4181d44b67c3d Mon Sep 17 00:00:00 2001 From: jeffvli Date: Thu, 29 Dec 2022 18:46:09 -0800 Subject: [PATCH] Remove recently played carousel for jellyfin --- .../features/home/routes/home-route.tsx | 74 +++++++++++-------- 1 file changed, 42 insertions(+), 32 deletions(-) diff --git a/src/renderer/features/home/routes/home-route.tsx b/src/renderer/features/home/routes/home-route.tsx index 26fac3d2..ff3aa771 100644 --- a/src/renderer/features/home/routes/home-route.tsx +++ b/src/renderer/features/home/routes/home-route.tsx @@ -1,16 +1,18 @@ import { useCallback, useMemo } from 'react'; import { Box, Stack } from '@mantine/core'; import { useSetState } from '@mantine/hooks'; -import { AlbumListSort, SortOrder } from '/@/renderer/api/types'; +import { AlbumListSort, ServerType, SortOrder } from '/@/renderer/api/types'; import { TextTitle, PageHeader, FeatureCarousel, GridCarousel } 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 { 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 server = useCurrentServer(); const cq = useContainerQuery(); const itemsPerPage = cq.isXl ? 9 : cq.isLg ? 7 : cq.isMd ? 5 : cq.isSm ? 4 : 3; @@ -223,39 +225,47 @@ const HomeRoute = () => { }} > - - {carousels.map((carousel, index) => ( - + {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} + + ))}