/* eslint-disable react/prop-types */ import { h, Fragment } from 'preact' import { useState, useEffect } from 'preact/hooks' import { isFuture, isPast } from 'date-fns' import { H1 } from '../Text' import Markdown from '../Markdown' import translations from '../../data/strings' import InfoLayout from '../InfoLayout' import TrailerEmbed from '../VideoEmbed' import { VideoCard, Title, InfoContent, PositionedCross as CrossSvg, TopContent, } from './styles' import intro from '../../data/intro.md' import credits from '../../data/credits.md' import Button from '../Button' import PlaySvg from '../Svg/Play' import { colours } from '../../assets/theme' import config from '../../data/config' const Info = ({ data, loading, infoActive, setInfoActive, currentVideo }) => { const [trailerActive, setTrailerActive] = useState(false) const toggleTrailerActive = () => setTrailerActive(trailerState => !trailerState) const pastStreams = data && data.length ? data.filter(feeditem => isPast(new Date(feeditem.end))) : [] const futureStreams = data && data.length ? data .filter( feeditem => feeditem.id !== (currentVideo && currentVideo.id) && isFuture(new Date(feeditem.start)) ) .sort( (a, b) => // Turn your strings into dates, and then subtract them // to get a value that is either negative, positive, or zero. new Date(a.start) - new Date(b.start) ) : [] return ( {trailerActive && ( )} {infoActive && setInfoActive(false)} />} {!loading && (

The Para-Real:

Finding the Future in Unexpected Places

{intro}
{currentVideo && ( {translations.en.nowPlaying}: )} {futureStreams.length && ( {translations.en.nextStream}: {futureStreams.map(feeditem => ( ))} )} {pastStreams.length ? ( {translations.en.pastStream}: {pastStreams.map(feeditem => ( ))} ) : null} {credits}
)}
) } export default Info