Minor fixes
This commit is contained in:
parent
2487f53823
commit
42965ff201
@ -7,10 +7,10 @@ const DVB_REFRESH_INTERVAL = 30 * 1000
|
|||||||
|
|
||||||
const DVB = ({ stopId }: { stopId: number }) => {
|
const DVB = ({ stopId }: { stopId: number }) => {
|
||||||
const [departuresHead, setDeparturesHead] = React.useState("")
|
const [departuresHead, setDeparturesHead] = React.useState("")
|
||||||
const [departuresTable, setDeparturesTable] = React.useState([])
|
const [departuresTable, setDeparturesTable] = React.useState<JSX.Element[]>([])
|
||||||
|
|
||||||
const processDepatures = (departures: Departure[]) => {
|
const processDepatures = (departures: Departure[]) => {
|
||||||
const depTable = [];
|
const depTable: JSX.Element[] = [];
|
||||||
|
|
||||||
departures.forEach((departure, index) => {
|
departures.forEach((departure, index) => {
|
||||||
const realTime = departure.RealTime ? new Date(parseInt(departure.RealTime.replace(/\/Date\(/g, "").replace(/\-.*$/g, ""))) : undefined;
|
const realTime = departure.RealTime ? new Date(parseInt(departure.RealTime.replace(/\/Date\(/g, "").replace(/\-.*$/g, ""))) : undefined;
|
||||||
|
@ -6,17 +6,18 @@ import type { News as NewsType, PostillonNews } from "../lib/interfaces";
|
|||||||
const NEWS_REFRESH_INTERVAL = 15 * 60 * 1000;
|
const NEWS_REFRESH_INTERVAL = 15 * 60 * 1000;
|
||||||
|
|
||||||
const News = () => {
|
const News = () => {
|
||||||
const [news, setNews] = React.useState([])
|
const [news, setNews] = React.useState<JSX.Element[]>([])
|
||||||
|
|
||||||
const processNews = (news: NewsType[], postillon: PostillonNews[]) => {
|
const processNews = (news: NewsType[], postillon: PostillonNews[]) => {
|
||||||
const newsTable = []
|
const newsTable: JSX.Element[] = []
|
||||||
|
|
||||||
|
let i = 0;
|
||||||
for (const n of news) {
|
for (const n of news) {
|
||||||
if (!n.title || n.title === "") continue;
|
if (!n.title || n.title === "") continue;
|
||||||
|
|
||||||
const updated = new Date(n.updated);
|
const updated = new Date(n.updated);
|
||||||
newsTable.push(
|
newsTable.push(
|
||||||
<tr key={n.title}>
|
<tr key={++i}>
|
||||||
<td>{n.title}</td>
|
<td>{n.title}</td>
|
||||||
<td>{updated.getHours()}:{updated.getMinutes().toString().padStart(2, "0")}</td>
|
<td>{updated.getHours()}:{updated.getMinutes().toString().padStart(2, "0")}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -93,7 +93,7 @@ const WeatherAndTime = ({ secrets }: { secrets: SecretsWeather }) => {
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
{(() => {
|
{(() => {
|
||||||
const rslt = []
|
const rslt: JSX.Element[] = []
|
||||||
for (let i = 0; i < 4; i++) {
|
for (let i = 0; i < 4; i++) {
|
||||||
const day = new Date((weather.daily.data[i].time * 1000));
|
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>);
|
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>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
{(() => {
|
{(() => {
|
||||||
const rslt = []
|
const rslt: JSX.Element[] = []
|
||||||
for (let i = 0; i < 4; i++) {
|
for (let i = 0; i < 4; i++) {
|
||||||
const style = i > 0 ? { borderLeft: "1px solid var(--iconColor)" } : {}
|
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>);
|
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>
|
||||||
<tr>
|
<tr>
|
||||||
{(() => {
|
{(() => {
|
||||||
const rslt = []
|
const rslt: JSX.Element[] = []
|
||||||
for (let i = 0; i < 4; i++) {
|
for (let i = 0; i < 4; i++) {
|
||||||
rslt.push(<td key={i} className={styles.futureWeatherLowTemp}>{weather.daily.data[i].temperatureLow.toFixed(1)}°C</td>);
|
rslt.push(<td key={i} className={styles.futureWeatherLowTemp}>{weather.daily.data[i].temperatureLow.toFixed(1)}°C</td>);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user