-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4882d9c
commit 5dd4d4f
Showing
10 changed files
with
314 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/models/base-item-kind'; | ||
import React, { FC } from 'react'; | ||
|
||
import ItemsView from '../../components/library/ItemsView'; | ||
import { LibraryViewProps } from 'types/library'; | ||
import { CollectionType } from 'types/collectionType'; | ||
import { LibraryTab } from 'types/libraryTab'; | ||
|
||
const EpisodesView: FC<LibraryViewProps> = ({ parentId }) => { | ||
return ( | ||
<ItemsView | ||
viewType={LibraryTab.Episodes} | ||
parentId={parentId} | ||
collectionType={CollectionType.TvShows} | ||
isAlphabetPickerEnabled={false} | ||
itemType={[BaseItemKind.Episode]} | ||
noItemsMessage='MessageNoEpisodesFound' | ||
/> | ||
); | ||
}; | ||
|
||
export default EpisodesView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/models/base-item-kind'; | ||
import React, { FC } from 'react'; | ||
|
||
import GenresItemsContainer from '../../components/library/GenresItemsContainer'; | ||
import { LibraryViewProps } from 'types/library'; | ||
import { CollectionType } from 'types/collectionType'; | ||
|
||
const GenresView: FC<LibraryViewProps> = ({ parentId }) => { | ||
return ( | ||
<GenresItemsContainer | ||
parentId={parentId} | ||
collectionType={CollectionType.TvShows} | ||
itemType={BaseItemKind.Series} | ||
/> | ||
); | ||
}; | ||
|
||
export default GenresView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/models/base-item-kind'; | ||
import React, { FC } from 'react'; | ||
|
||
import ItemsView from '../../components/library/ItemsView'; | ||
import { LibraryViewProps } from 'types/library'; | ||
import { CollectionType } from 'types/collectionType'; | ||
import { LibraryTab } from 'types/libraryTab'; | ||
|
||
const SeriesView: FC<LibraryViewProps> = ({ parentId }) => { | ||
return ( | ||
<ItemsView | ||
viewType={LibraryTab.Series} | ||
parentId={parentId} | ||
collectionType={CollectionType.TvShows} | ||
isBtnShuffleEnabled={true} | ||
itemType={[BaseItemKind.Series]} | ||
noItemsMessage='MessageNoItemsAvailable' | ||
/> | ||
); | ||
}; | ||
|
||
export default SeriesView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/models/base-item-kind'; | ||
import React, { FC } from 'react'; | ||
|
||
import ItemsView from '../../components/library/ItemsView'; | ||
import { LibraryViewProps } from 'types/library'; | ||
import { LibraryTab } from 'types/libraryTab'; | ||
|
||
const StudiosView: FC<LibraryViewProps> = ({ parentId }) => { | ||
return ( | ||
<ItemsView | ||
viewType={LibraryTab.Networks} | ||
parentId={parentId} | ||
isBtnFilterEnabled={false} | ||
isBtnGridListEnabled={false} | ||
isBtnSortEnabled={false} | ||
isAlphabetPickerEnabled={false} | ||
itemType={[BaseItemKind.Series]} | ||
noItemsMessage= 'MessageNoItemsAvailable' | ||
/> | ||
); | ||
}; | ||
|
||
export default StudiosView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React, { FC } from 'react'; | ||
|
||
import SuggestionsItemsContainer from '../../components/library/SuggestionsItemsContainer'; | ||
import { LibraryViewProps } from 'types/library'; | ||
import { SectionsView } from 'types/suggestionsSections'; | ||
|
||
const SuggestionsView: FC<LibraryViewProps> = ({ parentId }) => { | ||
return ( | ||
<SuggestionsItemsContainer | ||
parentId={parentId} | ||
sectionsView={[ | ||
SectionsView.ContinueWatchingEpisode, | ||
SectionsView.LatestEpisode, | ||
SectionsView.NextUp | ||
]} | ||
/> | ||
); | ||
}; | ||
|
||
export default SuggestionsView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React, { FC } from 'react'; | ||
import Box from '@mui/material/Box'; | ||
import { useGetGroupsUpcomingEpisodes } from 'hooks/useFetchItems'; | ||
import Loading from 'components/loading/LoadingComponent'; | ||
import globalize from 'scripts/globalize'; | ||
import SectionContainer from '../../components/library/SectionContainer'; | ||
import { LibraryViewProps } from 'types/library'; | ||
|
||
const UpcomingView: FC<LibraryViewProps> = ({ parentId }) => { | ||
const { isLoading, data: groupsUpcomingEpisodes } = useGetGroupsUpcomingEpisodes(parentId); | ||
|
||
if (isLoading) return <Loading />; | ||
|
||
return ( | ||
<Box> | ||
{!groupsUpcomingEpisodes?.length ? ( | ||
<div className='noItemsMessage centerMessage'> | ||
<h1>{globalize.translate('MessageNothingHere')}</h1> | ||
<p> | ||
{globalize.translate( | ||
'MessagePleaseEnsureInternetMetadata' | ||
)} | ||
</p> | ||
</div> | ||
) : ( | ||
groupsUpcomingEpisodes?.map((group) => ( | ||
<SectionContainer | ||
key={group.name} | ||
sectionTitle={group.name} | ||
items={group.items ?? []} | ||
cardOptions={{ | ||
shape: 'overflowBackdrop', | ||
showLocationTypeIndicator: false, | ||
showParentTitle: true, | ||
preferThumb: true, | ||
lazy: true, | ||
showDetailsMenu: true, | ||
missingIndicator: false, | ||
cardLayout: false | ||
}} | ||
/> | ||
)) | ||
)} | ||
</Box> | ||
); | ||
}; | ||
|
||
export default UpcomingView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import React, { FC } from 'react'; | ||
import { useLocation, useSearchParams } from 'react-router-dom'; | ||
|
||
import { getDefaultTabIndex } from '../../components/tabs/tabRoutes'; | ||
import Page from 'components/Page'; | ||
import GenresView from './GenresView'; | ||
import SuggestionsView from './SuggestionsView'; | ||
import StudiosView from './StudiosView'; | ||
import EpisodesView from './EpisodesView'; | ||
import SeriesView from './SeriesView'; | ||
import UpcomingView from './UpcomingView'; | ||
|
||
const Shows: FC = () => { | ||
const location = useLocation(); | ||
const [ searchParams ] = useSearchParams(); | ||
const searchParamsParentId = searchParams.get('topParentId'); | ||
const searchParamsTab = searchParams.get('tab'); | ||
const currentTabIndex = searchParamsTab !== null ? parseInt(searchParamsTab, 10) : | ||
getDefaultTabIndex(location.pathname, searchParamsParentId); | ||
|
||
const getTabComponent = (index: number) => { | ||
if (index == null) { | ||
throw new Error('index cannot be null'); | ||
} | ||
|
||
let component; | ||
switch (index) { | ||
case 1: | ||
component = <SuggestionsView parentId={searchParamsParentId} />; | ||
break; | ||
|
||
case 2: | ||
component = <UpcomingView parentId={searchParamsParentId} />; | ||
break; | ||
|
||
case 3: | ||
component = <GenresView parentId={searchParamsParentId} />; | ||
break; | ||
|
||
case 4: | ||
component = <StudiosView parentId={searchParamsParentId} />; | ||
break; | ||
|
||
case 5: | ||
component = <EpisodesView parentId={searchParamsParentId} />; | ||
break; | ||
|
||
default: | ||
component = <SeriesView parentId={searchParamsParentId} />; | ||
} | ||
|
||
return component; | ||
}; | ||
|
||
return ( | ||
<Page | ||
id='tvshowsPage' | ||
className='mainAnimatedPage libraryPage backdropPage collectionEditorPage pageWithAbsoluteTabs withTabs' | ||
backDropType='series' | ||
> | ||
{getTabComponent(currentTabIndex)} | ||
|
||
</Page> | ||
); | ||
}; | ||
|
||
export default Shows; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters