/* eslint-disable react/prop-types */ import { h, Fragment } from 'preact' import { useEffect, useRef, useState } from 'preact/hooks' import { isBefore } from 'date-fns' import { P } from '../Text' import translations from '../../data/strings' import InfoLayout from '../InfoLayout' import { VideoCard, Title, InfoContent } from './styles' const Info = ({ data, loading }) => { const now = new Date() const pastStreams = data && data.length ? data.filter(feeditem => isBefore(new Date(feeditem.end), now)) : [] const futureStreams = data && data.length ? data.filter(feeditem => isBefore(now, new Date(feeditem.start))) : [] return ( {!loading && ( {futureStreams.map(feeditem => ( ))} {pastStreams.length ? ( {translations.en.pastStream}: {pastStreams.map(feeditem => ( ))} ) : null} )} ) } export default Info