-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(project): support live channel without tv guide
- Loading branch information
1 parent
6e6b2d6
commit 92564d4
Showing
1 changed file
with
9 additions
and
8 deletions.
There are no files selected for viewing
17 changes: 9 additions & 8 deletions
17
packages/ui-react/src/pages/ScreenRouting/mediaScreens/MediaLiveChannel/MediaLiveChannel.tsx
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 |
---|---|---|
@@ -1,24 +1,25 @@ | ||
import { Navigate } from 'react-router-dom'; | ||
import type { PlaylistItem } from '@jwp/ott-common/types/playlist'; | ||
import { isLiveChannel } from '@jwp/ott-common/src/utils/media'; | ||
import { liveChannelsURL } from '@jwp/ott-common/src/utils/urlFormatting'; | ||
|
||
import type { ScreenComponent } from '../../../../../types/screens'; | ||
import ErrorPage from '../../../../components/ErrorPage/ErrorPage'; | ||
import Loading from '../../../Loading/Loading'; | ||
import MediaMovie from '../MediaMovie/MediaMovie'; | ||
|
||
const MediaLiveChannel: ScreenComponent<PlaylistItem> = ({ data, isLoading }) => { | ||
const liveChannelsId = isLiveChannel(data) ? data.liveChannelsId : undefined; | ||
const liveChannelsId = data.liveChannelsId; | ||
|
||
if (data && !isLoading && liveChannelsId) { | ||
return <Navigate to={liveChannelsURL(liveChannelsId, data.mediaid)} replace={true}></Navigate>; | ||
if (isLoading) { | ||
return <Loading />; | ||
} | ||
|
||
if (!liveChannelsId) { | ||
return <ErrorPage title="Live channel not found" />; | ||
// this live channel is part of a live channels (TV Guide) page | ||
if (liveChannelsId) { | ||
return <Navigate to={liveChannelsURL(liveChannelsId, data.mediaid)} replace={true}></Navigate>; | ||
} | ||
|
||
return <Loading />; | ||
// this live channel is "just" a media item | ||
return <MediaMovie data={data} isLoading={isLoading} />; | ||
}; | ||
|
||
export default MediaLiveChannel; |