diff --git a/.eslintrc b/.eslintrc index cbd3b89..6facc1b 100644 --- a/.eslintrc +++ b/.eslintrc @@ -4,6 +4,7 @@ "indent": ["error", 2], "import/prefer-default-export": 0, "react/require-default-props": 0, - "react/forbid-prop-types": 0 + "react/forbid-prop-types": 0, + "react/prop-types": 1 } } diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..382551e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,22 @@ +{ + "eslint.enable": true, + "workbench.colorCustomizations": { + "titleBar.activeBackground": "#233b4a", + "titleBar.inactiveForeground": "#F1CFCD", + "titleBar.activeForeground": "#F1CFCD", + "titleBar.inactiveBackground": "#233b4a" + }, + "files.exclude": { + // Directories + // "public/": true, + ".cache/": true, + "node_modules/": true, + // Files + // ".npmrc": true, + // "gatsby-ssr.js": true, + "LICENSE": true, + // "README.md": true, + "yarn.lock": true + // "gatsby-node.js": true + } +} \ No newline at end of file diff --git a/app.js b/app.js index df75cc2..3747590 100644 --- a/app.js +++ b/app.js @@ -1,13 +1,12 @@ import { h } from 'preact' import { useState, useEffect } from 'preact/hooks' -import { isWithinInterval, subHours } from 'date-fns' +import { isWithinInterval, subHours, addHours } from 'date-fns' import { zonedTimeToUtc, utcToZonedTime, format } from 'date-fns-tz' -import { addHours } from 'date-fns/esm' import Video from './src/components/Video' import config from './src/data/config' import Info from './src/components/Info' -import { useEventStream } from './src/hooks/data' +import { useEventCalendar, useEventApi } from './src/hooks/data' import { useTimeout } from './src/hooks/timerHooks' export default () => { @@ -15,15 +14,16 @@ export default () => { const [streamIsLive, setStreamIsLive] = useState(false) const [infoActive, setInfoActive] = useState(false) const [minLoadTimePassed, setMinTimeUp] = useState(false) - const { data, loading } = useEventStream() + const { data: calData, loading } = useEventCalendar() + const { data: eventsData, loading: eventsLoading } = useEventApi() useTimeout(() => { setMinTimeUp(true) }, 1500) useEffect(() => { - if (data && data.length) { - data.forEach((stream, index) => { + if (calData && calData.length) { + calData.forEach((stream, index) => { const utcStartDate = zonedTimeToUtc( new Date(stream.start), 'Europe/Berlin' @@ -51,7 +51,7 @@ export default () => { } }) } - }, [data]) + }, [calData, eventsData, eventsLoading]) return (
@@ -59,10 +59,9 @@ export default () => {