2021-10-11 13:50:24 +00:00
|
|
|
/* eslint-disable react/prop-types */
|
|
|
|
import { h, Fragment } from 'preact'
|
2021-10-20 14:33:06 +00:00
|
|
|
import { useEffect } from 'preact/hooks'
|
2021-11-11 16:05:25 +00:00
|
|
|
import enGB from 'date-fns/locale/en-GB'
|
2021-10-11 13:50:24 +00:00
|
|
|
|
2021-11-01 22:34:29 +00:00
|
|
|
import { H1, Label } from '../../components/Text'
|
2021-10-11 13:50:24 +00:00
|
|
|
import Markdown from '../../components/Markdown'
|
2021-10-11 17:15:09 +00:00
|
|
|
import translations from '../../data/strings'
|
2021-10-12 12:45:52 +00:00
|
|
|
import InfoLayout from '../../layouts/InfoLayout'
|
2021-10-11 13:50:24 +00:00
|
|
|
import VideoEmbed from '../../components/VideoEmbed'
|
|
|
|
import {
|
2021-10-11 17:15:09 +00:00
|
|
|
EpisodeCard,
|
2021-10-11 13:50:24 +00:00
|
|
|
Title,
|
|
|
|
InfoContent,
|
|
|
|
Row,
|
2021-11-01 22:34:29 +00:00
|
|
|
LogosRow,
|
2022-09-27 12:29:09 +00:00
|
|
|
FooterImage,
|
2021-10-11 13:50:24 +00:00
|
|
|
ActionButton as Button,
|
2021-10-12 12:45:52 +00:00
|
|
|
TrailerContainer,
|
2021-10-11 13:50:24 +00:00
|
|
|
} from './styles'
|
|
|
|
|
2021-10-12 12:45:52 +00:00
|
|
|
import Page from '../../layouts/Page'
|
2021-10-15 13:37:54 +00:00
|
|
|
import { splitArray } from '../../helpers/utils'
|
2021-10-20 14:33:06 +00:00
|
|
|
import { defaultTheme } from '../../assets/theme'
|
2021-10-11 13:50:24 +00:00
|
|
|
|
|
|
|
const SeriesPage = ({ data }) => {
|
2021-10-20 14:33:06 +00:00
|
|
|
const theme = data.theme || defaultTheme
|
2021-11-01 22:34:29 +00:00
|
|
|
const { orgs } = data
|
2021-10-20 14:33:06 +00:00
|
|
|
|
2022-09-07 12:37:49 +00:00
|
|
|
const credits = data.credits
|
|
|
|
? `
|
2021-10-11 17:15:09 +00:00
|
|
|
## Credits
|
|
|
|
${data.credits}
|
2022-09-07 12:37:49 +00:00
|
|
|
`
|
|
|
|
: null
|
2021-10-11 13:50:24 +00:00
|
|
|
|
2021-11-01 22:34:29 +00:00
|
|
|
const orgsList = Object.values(orgs || {})
|
|
|
|
|
2022-09-27 12:29:09 +00:00
|
|
|
const footerImages = data?.resources?.filter(({ title }) =>
|
|
|
|
title.includes('FOOTER_IMG')
|
|
|
|
)
|
2021-10-15 13:37:54 +00:00
|
|
|
|
2022-09-27 12:29:09 +00:00
|
|
|
const links = data.links.length ? splitArray(data.links, 2) : null
|
2021-10-15 13:37:54 +00:00
|
|
|
|
2021-10-11 13:50:24 +00:00
|
|
|
return (
|
2021-10-15 13:37:54 +00:00
|
|
|
<Page title={data.title} theme={data.theme} withHeader={false}>
|
2022-09-07 12:37:49 +00:00
|
|
|
<InfoLayout
|
|
|
|
title={data.title}
|
|
|
|
subtitle={data.subtitle}
|
|
|
|
image={data.image}
|
|
|
|
theme={theme}
|
|
|
|
>
|
2021-10-12 12:45:52 +00:00
|
|
|
<Fragment>
|
|
|
|
<InfoContent>
|
|
|
|
<H1>{data.title}:</H1>
|
|
|
|
<H1>{data.subtitle}</H1>
|
2022-09-07 12:37:49 +00:00
|
|
|
{data.description ? (
|
|
|
|
<Markdown withLinebreaks theme={theme}>
|
|
|
|
{data.description}
|
|
|
|
</Markdown>
|
|
|
|
) : null}
|
2021-10-11 13:50:24 +00:00
|
|
|
|
2021-10-12 12:45:52 +00:00
|
|
|
{data.trailer ? (
|
|
|
|
<TrailerContainer>
|
|
|
|
<VideoEmbed url={data.trailer} />
|
|
|
|
</TrailerContainer>
|
|
|
|
) : null}
|
2021-10-11 13:50:24 +00:00
|
|
|
|
2022-09-07 12:37:49 +00:00
|
|
|
{links
|
|
|
|
? links.map(linkRow => (
|
|
|
|
<Row>
|
|
|
|
{linkRow.map(link => (
|
|
|
|
<a
|
|
|
|
href={link.resourceUrl}
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
>
|
|
|
|
<Button>{link.summary}</Button>
|
|
|
|
</a>
|
|
|
|
))}
|
|
|
|
</Row>
|
|
|
|
))
|
|
|
|
: null}
|
2021-10-12 12:45:52 +00:00
|
|
|
</InfoContent>
|
|
|
|
{data.episodes.future.length ? (
|
|
|
|
<Fragment>
|
2021-10-15 13:37:54 +00:00
|
|
|
<Title>{translations.en.program}:</Title>
|
2021-10-12 12:45:52 +00:00
|
|
|
{data.episodes.future.map(feeditem => (
|
2022-09-07 12:37:49 +00:00
|
|
|
<EpisodeCard theme={theme} key={feeditem.start} {...feeditem} />
|
2021-10-12 12:45:52 +00:00
|
|
|
))}
|
|
|
|
</Fragment>
|
|
|
|
) : null}
|
|
|
|
{data.episodes.past.length ? (
|
|
|
|
<Fragment>
|
|
|
|
<Title>Past streams:</Title>
|
|
|
|
{data.episodes.past.map(feeditem => (
|
|
|
|
<EpisodeCard
|
2021-10-20 14:33:06 +00:00
|
|
|
theme={theme}
|
2021-10-12 12:45:52 +00:00
|
|
|
key={feeditem.beginsOn}
|
|
|
|
hasPassed
|
2021-10-15 13:37:54 +00:00
|
|
|
onClickButton={() => null} // todo: fix this
|
2021-10-12 12:45:52 +00:00
|
|
|
{...feeditem}
|
|
|
|
/>
|
|
|
|
))}
|
|
|
|
</Fragment>
|
|
|
|
) : null}
|
2022-09-07 12:37:49 +00:00
|
|
|
{credits ? (
|
|
|
|
<InfoContent>
|
|
|
|
<Markdown theme={theme}>{credits}</Markdown>
|
|
|
|
</InfoContent>
|
|
|
|
) : null}
|
2021-10-12 12:45:52 +00:00
|
|
|
</Fragment>
|
2021-11-11 11:48:27 +00:00
|
|
|
{orgsList.length ? (
|
|
|
|
<LogosRow $wrap>
|
|
|
|
{orgsList.map((org, index) => (
|
|
|
|
<Fragment>
|
2022-09-07 12:37:49 +00:00
|
|
|
<img src={org.logoUrl} alt={`${org.orgName} logo`} />
|
|
|
|
{orgsList.length < 4 !== 1 &&
|
|
|
|
orgsList.length < 4 &&
|
|
|
|
index + 1 !== orgsList.length ? (
|
|
|
|
<Label colour={theme.foreground}>{'//'}</Label>
|
|
|
|
) : null}
|
2021-11-11 11:48:27 +00:00
|
|
|
</Fragment>
|
|
|
|
))}
|
|
|
|
</LogosRow>
|
|
|
|
) : null}
|
2022-09-27 12:29:09 +00:00
|
|
|
{footerImages.length
|
|
|
|
? footerImages.map(image => (
|
|
|
|
<FooterImage
|
|
|
|
src={image.resourceUrl}
|
|
|
|
alt={`${image.orgName} logo`}
|
|
|
|
/>
|
|
|
|
))
|
|
|
|
: null}
|
2021-10-12 12:45:52 +00:00
|
|
|
</InfoLayout>
|
|
|
|
</Page>
|
2021-10-11 13:50:24 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default SeriesPage
|