import { h, render } from 'preact'
import { useState } from 'preact/hooks'
import { ThemeProvider } from 'styled-components'
import { BrowserRouter, Route, Switch } from 'react-router-dom'
import Main from './app'
import SeriesPage from './src/pages/SeriesPage'
import { useEventApi } from './src/hooks/data'
import { useTheme } from './src/store'
import { useTimeout } from './src/hooks/timerHooks'
import LoaderLayout from './src/pages/LoaderLayout'
import FourOhFour from './src/pages/404'
import Series from './src/pages/Series'
import Program from './src/pages/Program'
const App = () => {
const { theme } = useTheme((store) => store)
const { data, loading: eventsLoading } = useEventApi()
const [minLoadTimePassed, setMinTimeUp] = useState(false)
useTimeout(() => {
setMinTimeUp(true)
}, 1500)
// console.log({ episodes: data.episodes, series: data.series })
const seriesData = data.series ? Object.values(data.series) : []
return (
{!seriesData.length || eventsLoading || !minLoadTimePassed ? (
) : (
{seriesData.length ? seriesData.map(series => (
)) : null}
)}
)
}
const appEl = document.getElementById('app')
render(, appEl)