From 42965ff201f55e7d587ef75ef46a7f43e23a2549 Mon Sep 17 00:00:00 2001 From: Daniel Kluge Date: Mon, 11 Jul 2022 20:38:18 +0200 Subject: [PATCH] Minor fixes --- src/components/DVB.tsx | 4 ++-- src/components/News.tsx | 7 ++++--- src/components/WeatherAndTime.tsx | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/components/DVB.tsx b/src/components/DVB.tsx index ff76375..77b01ef 100644 --- a/src/components/DVB.tsx +++ b/src/components/DVB.tsx @@ -7,10 +7,10 @@ const DVB_REFRESH_INTERVAL = 30 * 1000 const DVB = ({ stopId }: { stopId: number }) => { const [departuresHead, setDeparturesHead] = React.useState("") - const [departuresTable, setDeparturesTable] = React.useState([]) + const [departuresTable, setDeparturesTable] = React.useState([]) const processDepatures = (departures: Departure[]) => { - const depTable = []; + const depTable: JSX.Element[] = []; departures.forEach((departure, index) => { const realTime = departure.RealTime ? new Date(parseInt(departure.RealTime.replace(/\/Date\(/g, "").replace(/\-.*$/g, ""))) : undefined; diff --git a/src/components/News.tsx b/src/components/News.tsx index 989b39f..3cc95ba 100644 --- a/src/components/News.tsx +++ b/src/components/News.tsx @@ -6,17 +6,18 @@ import type { News as NewsType, PostillonNews } from "../lib/interfaces"; const NEWS_REFRESH_INTERVAL = 15 * 60 * 1000; const News = () => { - const [news, setNews] = React.useState([]) + const [news, setNews] = React.useState([]) const processNews = (news: NewsType[], postillon: PostillonNews[]) => { - const newsTable = [] + const newsTable: JSX.Element[] = [] + let i = 0; for (const n of news) { if (!n.title || n.title === "") continue; const updated = new Date(n.updated); newsTable.push( - + {n.title} {updated.getHours()}:{updated.getMinutes().toString().padStart(2, "0")} diff --git a/src/components/WeatherAndTime.tsx b/src/components/WeatherAndTime.tsx index f983c48..f6114c0 100644 --- a/src/components/WeatherAndTime.tsx +++ b/src/components/WeatherAndTime.tsx @@ -93,7 +93,7 @@ const WeatherAndTime = ({ secrets }: { secrets: SecretsWeather }) => { {(() => { - const rslt = [] + const rslt: JSX.Element[] = [] for (let i = 0; i < 4; i++) { const day = new Date((weather.daily.data[i].time * 1000)); rslt.push({dowToString(day.getDay())}, {day.getDate()}. {day.getMonth() + 1}.); @@ -105,7 +105,7 @@ const WeatherAndTime = ({ secrets }: { secrets: SecretsWeather }) => { {(() => { - const rslt = [] + const rslt: JSX.Element[] = [] for (let i = 0; i < 4; i++) { const style = i > 0 ? { borderLeft: "1px solid var(--iconColor)" } : {} rslt.push({getWeatherIcon(weather.daily.data[i].icon)}); @@ -116,7 +116,7 @@ const WeatherAndTime = ({ secrets }: { secrets: SecretsWeather }) => { {(() => { - const rslt = [] + const rslt: JSX.Element[] = [] for (let i = 0; i < 4; i++) { rslt.push({weather.daily.data[i].temperatureLow.toFixed(1)}°C); }