1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/src/apps/experimental/components/library/GenresItemsContainer.tsx

43 lines
1.3 KiB
TypeScript
Raw Normal View History

import type { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/models/base-item-kind';
import type { CollectionType } from '@jellyfin/sdk/lib/generated-client/models/collection-type';
import React, { FC } from 'react';
import { useGetGenres } from 'hooks/useFetchItems';
2024-09-23 02:53:44 +03:00
import NoItemsMessage from 'components/common/NoItemsMessage';
import Loading from 'components/loading/LoadingComponent';
import GenresSectionContainer from './GenresSectionContainer';
import type { ParentId } from 'types/library';
interface GenresItemsContainerProps {
2023-10-04 23:14:14 +03:00
parentId: ParentId;
2023-10-26 02:05:08 +03:00
collectionType: CollectionType | undefined;
itemType: BaseItemKind[];
}
const GenresItemsContainer: FC<GenresItemsContainerProps> = ({
parentId,
collectionType,
itemType
}) => {
2023-10-23 23:14:21 +03:30
const { isLoading, data: genresResult } = useGetGenres(itemType, parentId);
if (isLoading) {
return <Loading />;
}
2023-10-23 23:14:21 +03:30
if (!genresResult?.Items?.length) {
2024-09-23 02:53:44 +03:00
return <NoItemsMessage message='MessageNoGenresAvailable' />;
2023-10-23 23:14:21 +03:30
}
2024-09-23 02:53:44 +03:00
return genresResult.Items.map((genre) => (
<GenresSectionContainer
key={genre.Id}
collectionType={collectionType}
parentId={parentId}
itemType={itemType}
genre={genre}
/>
));
};
export default GenresItemsContainer;