-
-
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
ec26bfb
commit 4f10928
Showing
8 changed files
with
196 additions
and
1 deletion.
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 BooksView: FC<LibraryViewProps> = ({ parentId }) => { | ||
return ( | ||
<ItemsView | ||
viewType={LibraryTab.Books} | ||
parentId={parentId} | ||
collectionType={CollectionType.Books} | ||
isBtnShuffleEnabled={true} | ||
itemType={[BaseItemKind.Book]} | ||
noItemsMessage='MessageNoItemsAvailable' | ||
/> | ||
); | ||
}; | ||
|
||
export default BooksView; |
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,38 @@ | ||
import React, { FC } from 'react'; | ||
import { useLocation, useSearchParams } from 'react-router-dom'; | ||
|
||
import { getDefaultTabIndex } from '../../components/tabs/tabRoutes'; | ||
import Page from 'components/Page'; | ||
import BooksView from './BooksView'; | ||
|
||
const Movies: 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'); | ||
} | ||
|
||
return ( | ||
<BooksView parentId={searchParamsParentId} /> | ||
); | ||
}; | ||
|
||
return ( | ||
<Page | ||
id='books' | ||
className='mainAnimatedPage libraryPage backdropPage collectionEditorPage pageWithAbsoluteTabs withTabs' | ||
backDropType='book' | ||
> | ||
{getTabComponent(currentTabIndex)} | ||
|
||
</Page> | ||
); | ||
}; | ||
|
||
export default Movies; |
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 { CollectionType } from 'types/collectionType'; | ||
import { LibraryTab } from 'types/libraryTab'; | ||
|
||
const PhotosView: FC<LibraryViewProps> = ({ parentId }) => { | ||
return ( | ||
<ItemsView | ||
viewType={LibraryTab.Photos} | ||
parentId={parentId} | ||
collectionType={CollectionType.HomeVideos} | ||
isBtnPlayAllEnabled={true} | ||
isBtnShuffleEnabled={true} | ||
itemType={[BaseItemKind.Photo]} | ||
noItemsMessage='MessageNoItemsAvailable' | ||
/> | ||
); | ||
}; | ||
|
||
export default PhotosView; |
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 VideosView: FC<LibraryViewProps> = ({ parentId }) => { | ||
return ( | ||
<ItemsView | ||
viewType={LibraryTab.Videos} | ||
parentId={parentId} | ||
collectionType={CollectionType.HomeVideos} | ||
isBtnShuffleEnabled={true} | ||
itemType={[BaseItemKind.Video]} | ||
noItemsMessage='MessageNoItemsAvailable' | ||
/> | ||
); | ||
}; | ||
|
||
export default VideosView; |
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,45 @@ | ||
import React, { FC } from 'react'; | ||
import { useLocation, useSearchParams } from 'react-router-dom'; | ||
|
||
import { getDefaultTabIndex } from '../../components/tabs/tabRoutes'; | ||
import Page from 'components/Page'; | ||
import VideosView from './VideosView'; | ||
import PhotosView from './PhotosView'; | ||
|
||
const Movies: 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'); | ||
} | ||
|
||
if (index === 1) { | ||
return ( | ||
<VideosView parentId={searchParamsParentId} /> | ||
); | ||
} | ||
|
||
return ( | ||
<PhotosView parentId={searchParamsParentId} /> | ||
); | ||
}; | ||
|
||
return ( | ||
<Page | ||
id='homevideos' | ||
className='mainAnimatedPage libraryPage backdropPage collectionEditorPage pageWithAbsoluteTabs withTabs' | ||
backDropType='video, photo' | ||
> | ||
{getTabComponent(currentTabIndex)} | ||
|
||
</Page> | ||
); | ||
}; | ||
|
||
export default Movies; |
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