Minor fixes

This commit is contained in:
Daniel Kluge 2022-07-11 20:38:18 +02:00
parent 2487f53823
commit 42965ff201
3 changed files with 9 additions and 8 deletions

View File

@ -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<JSX.Element[]>([])
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;

View File

@ -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<JSX.Element[]>([])
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(
<tr key={n.title}>
<tr key={++i}>
<td>{n.title}</td>
<td>{updated.getHours()}:{updated.getMinutes().toString().padStart(2, "0")}</td>
</tr>

View File

@ -93,7 +93,7 @@ const WeatherAndTime = ({ secrets }: { secrets: SecretsWeather }) => {
<thead>
<tr>
{(() => {
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(<th colSpan={2} key={i}>{dowToString(day.getDay())}, {day.getDate()}. {day.getMonth() + 1}.</th>);
@ -105,7 +105,7 @@ const WeatherAndTime = ({ secrets }: { secrets: SecretsWeather }) => {
<tbody>
<tr>
{(() => {
const rslt = []
const rslt: JSX.Element[] = []
for (let i = 0; i < 4; i++) {
const style = i > 0 ? { borderLeft: "1px solid var(--iconColor)" } : {}
rslt.push(<td key={`00${i}`} rowSpan={2} style={style}>{getWeatherIcon(weather.daily.data[i].icon)}</td>);
@ -116,7 +116,7 @@ const WeatherAndTime = ({ secrets }: { secrets: SecretsWeather }) => {
</tr>
<tr>
{(() => {
const rslt = []
const rslt: JSX.Element[] = []
for (let i = 0; i < 4; i++) {
rslt.push(<td key={i} className={styles.futureWeatherLowTemp}>{weather.daily.data[i].temperatureLow.toFixed(1)}°C</td>);
}