2024-02-28 22:47:36 +03:00
|
|
|
import React, { type FC } from 'react';
|
2023-10-26 02:05:08 +03:00
|
|
|
import { useGetGroupsUpcomingEpisodes } from 'hooks/useFetchItems';
|
|
|
|
import Loading from 'components/loading/LoadingComponent';
|
2024-09-23 02:53:44 +03:00
|
|
|
import NoItemsMessage from 'components/common/NoItemsMessage';
|
|
|
|
import SectionContainer from 'components/common/SectionContainer';
|
2024-02-28 22:47:36 +03:00
|
|
|
import { CardShape } from 'utils/card';
|
|
|
|
import type { LibraryViewProps } from 'types/library';
|
2023-10-26 02:05:08 +03:00
|
|
|
|
|
|
|
const UpcomingView: FC<LibraryViewProps> = ({ parentId }) => {
|
2024-09-23 02:53:44 +03:00
|
|
|
const { isLoading, data: groupsUpcomingEpisodes } =
|
|
|
|
useGetGroupsUpcomingEpisodes(parentId);
|
2023-10-26 02:05:08 +03:00
|
|
|
|
|
|
|
if (isLoading) return <Loading />;
|
|
|
|
|
2024-09-23 02:53:44 +03:00
|
|
|
if (!groupsUpcomingEpisodes?.length) {
|
|
|
|
return <NoItemsMessage message='MessagePleaseEnsureInternetMetadata' />;
|
|
|
|
}
|
|
|
|
|
|
|
|
return groupsUpcomingEpisodes?.map((group) => (
|
|
|
|
<SectionContainer
|
|
|
|
key={group.name}
|
|
|
|
sectionHeaderProps={{
|
|
|
|
title: group.name
|
|
|
|
}}
|
|
|
|
itemsContainerProps={{
|
|
|
|
queryKey: ['GroupsUpcomingEpisodes']
|
|
|
|
}}
|
|
|
|
items={group.items}
|
|
|
|
cardOptions={{
|
|
|
|
shape: CardShape.BackdropOverflow,
|
|
|
|
showLocationTypeIndicator: false,
|
|
|
|
showParentTitle: true,
|
|
|
|
preferThumb: true,
|
|
|
|
lazy: true,
|
|
|
|
showDetailsMenu: true,
|
|
|
|
missingIndicator: false,
|
|
|
|
cardLayout: false,
|
|
|
|
queryKey: ['GroupsUpcomingEpisodes']
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
));
|
2023-10-26 02:05:08 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
export default UpcomingView;
|