mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +02:00
fix various issues on home page
This commit is contained in:
@@ -8,7 +8,6 @@ import { albumQueries } from '/@/renderer/features/albums/api/album-api';
|
|||||||
import { AlbumInfiniteCarousel } from '/@/renderer/features/albums/components/album-infinite-carousel';
|
import { AlbumInfiniteCarousel } from '/@/renderer/features/albums/components/album-infinite-carousel';
|
||||||
import { AnimatedPage } from '/@/renderer/features/shared/components/animated-page';
|
import { AnimatedPage } from '/@/renderer/features/shared/components/animated-page';
|
||||||
import { LibraryHeaderBar } from '/@/renderer/features/shared/components/library-header-bar';
|
import { LibraryHeaderBar } from '/@/renderer/features/shared/components/library-header-bar';
|
||||||
import { songsQueries } from '/@/renderer/features/songs/api/songs-api';
|
|
||||||
import {
|
import {
|
||||||
HomeItem,
|
HomeItem,
|
||||||
useCurrentServer,
|
useCurrentServer,
|
||||||
@@ -17,13 +16,7 @@ import {
|
|||||||
} from '/@/renderer/store';
|
} from '/@/renderer/store';
|
||||||
import { Spinner } from '/@/shared/components/spinner/spinner';
|
import { Spinner } from '/@/shared/components/spinner/spinner';
|
||||||
import { Stack } from '/@/shared/components/stack/stack';
|
import { Stack } from '/@/shared/components/stack/stack';
|
||||||
import {
|
import { AlbumListSort, LibraryItem, ServerType, SortOrder } from '/@/shared/types/domain-types';
|
||||||
AlbumListSort,
|
|
||||||
LibraryItem,
|
|
||||||
ServerType,
|
|
||||||
SongListSort,
|
|
||||||
SortOrder,
|
|
||||||
} from '/@/shared/types/domain-types';
|
|
||||||
import { Platform } from '/@/shared/types/types';
|
import { Platform } from '/@/shared/types/types';
|
||||||
|
|
||||||
const HomeRoute = () => {
|
const HomeRoute = () => {
|
||||||
@@ -35,7 +28,6 @@ const HomeRoute = () => {
|
|||||||
|
|
||||||
const isJellyfin = server?.type === ServerType.JELLYFIN;
|
const isJellyfin = server?.type === ServerType.JELLYFIN;
|
||||||
|
|
||||||
// Only keep queries for FeatureCarousel and songs carousel (which still uses old carousel)
|
|
||||||
const feature = useQuery(
|
const feature = useQuery(
|
||||||
albumQueries.list({
|
albumQueries.list({
|
||||||
options: {
|
options: {
|
||||||
@@ -53,25 +45,6 @@ const HomeRoute = () => {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
const mostPlayedSongs = useQuery(
|
|
||||||
songsQueries.list(
|
|
||||||
{
|
|
||||||
options: {
|
|
||||||
enabled: isJellyfin,
|
|
||||||
staleTime: 1000 * 60 * 5,
|
|
||||||
},
|
|
||||||
query: {
|
|
||||||
limit: 15,
|
|
||||||
sortBy: SongListSort.PLAY_COUNT,
|
|
||||||
sortOrder: SortOrder.DESC,
|
|
||||||
startIndex: 0,
|
|
||||||
},
|
|
||||||
serverId: server?.id,
|
|
||||||
},
|
|
||||||
300,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
const featureItemsWithImage = useMemo(() => {
|
const featureItemsWithImage = useMemo(() => {
|
||||||
return feature.data?.items?.filter((item) => item.imageUrl) ?? [];
|
return feature.data?.items?.filter((item) => item.imageUrl) ?? [];
|
||||||
}, [feature.data?.items]);
|
}, [feature.data?.items]);
|
||||||
@@ -79,9 +52,7 @@ const HomeRoute = () => {
|
|||||||
// Carousel configuration - queries are now handled inside AlbumInfiniteCarousel
|
// Carousel configuration - queries are now handled inside AlbumInfiniteCarousel
|
||||||
const carousels = {
|
const carousels = {
|
||||||
[HomeItem.MOST_PLAYED]: {
|
[HomeItem.MOST_PLAYED]: {
|
||||||
data: mostPlayedSongs?.data?.items,
|
|
||||||
itemType: isJellyfin ? LibraryItem.SONG : LibraryItem.ALBUM,
|
itemType: isJellyfin ? LibraryItem.SONG : LibraryItem.ALBUM,
|
||||||
query: mostPlayedSongs,
|
|
||||||
sortBy: AlbumListSort.PLAY_COUNT,
|
sortBy: AlbumListSort.PLAY_COUNT,
|
||||||
sortOrder: SortOrder.DESC,
|
sortOrder: SortOrder.DESC,
|
||||||
title: t('page.home.mostPlayed', { postProcess: 'sentenceCase' }),
|
title: t('page.home.mostPlayed', { postProcess: 'sentenceCase' }),
|
||||||
@@ -167,7 +138,6 @@ const HomeRoute = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Songs carousel (only for Jellyfin most played) - keep using old carousel for now
|
|
||||||
if ('data' in carousel && 'query' in carousel) {
|
if ('data' in carousel && 'query' in carousel) {
|
||||||
// TODO: Create SongInfiniteCarousel
|
// TODO: Create SongInfiniteCarousel
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user