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
2023-06-09 01:23:27 +03:00

52 lines
1.6 KiB
TypeScript

import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/models/base-item-kind';
import React, { FC } from 'react';
import { useGetGenres } from 'hooks/useFetchItems';
import globalize from 'scripts/globalize';
import Loading from 'components/loading/LoadingComponent';
import GenresSectionContainer from './GenresSectionContainer';
import { CollectionType } from 'types/collectionType';
interface GenresItemsContainerProps {
parentId?: string | null;
collectionType?: CollectionType;
itemType: BaseItemKind;
}
const GenresItemsContainer: FC<GenresItemsContainerProps> = ({
parentId,
collectionType,
itemType
}) => {
const { isLoading, data: genresResult } = useGetGenres(
parentId,
itemType
);
if (isLoading) {
return <Loading />;
}
return (
<>
{!genresResult?.Items?.length ? (
<div className='noItemsMessage centerMessage'>
<h1>{globalize.translate('MessageNothingHere')}</h1>
<p>{globalize.translate('MessageNoGenresAvailable')}</p>
</div>
) : (
genresResult?.Items
&& genresResult?.Items.map((genre) => (
<GenresSectionContainer
key={genre.Id}
collectionType={collectionType}
parentId={parentId}
itemType={itemType}
genre={genre}
/>
))
)}
</>
);
};
export default GenresItemsContainer;