Skip to content
Snippets Groups Projects
Commit d77b2977 authored by Niklas Schrötler's avatar Niklas Schrötler
Browse files

Merge branch 'master' into 'master'

page title and favicon + minor housekeeping

See merge request !11
parents c171e2a3 dd4a2bcd
No related branches found
No related tags found
No related merge requests found
......@@ -9,8 +9,9 @@ To ensure code quality, this repo is automatically evaluated by a SonarQube inst
[![Quality gate](https://sonarqube.upi.li/api/project_badges/quality_gate?project=Fachschaft-Informatik-Infoscreen&token=sqb_1e0e28d3a4ad3e243d0ee76c6dc33d6694d261a2)](https://sonarqube.upi.li/dashboard?id=Fachschaft-Informatik-Infoscreen)
## Test
Before running the appliction for the first time you have to install all dependencies using `npm install`
This Website can be run locally for testing purposes with `python3 -m http.server` or any other HTTP Server
This Website can be run locally for testing purposes with `npm run start`.
## Adding Ads
......
File suppressed by a .gitattributes entry, the file's encoding is unsupported, or the file size exceeds the limit.
......@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="icon" href="https://static.fachschaften.org/icon/tight/color/fsorg-icon-color-tight.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
......@@ -24,7 +24,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>Infoscreen</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
......
......@@ -6,7 +6,7 @@ import PanelContent from "../../meta/PanelContent";
type MensaJetztAPIResponse = {
day: string,
date: string,
attendance: Attendee[]
attendance: Attendee[],
}
type Attendee = {
......@@ -14,7 +14,7 @@ type Attendee = {
"name_modifiers": string,
"time": string,
"canteen": string,
"color": string
"color": string,
}
type Attendance = { [time: string]: Attendee[] }
......@@ -25,11 +25,10 @@ const MensaJetztPanel = () => {
useEffect(() => {
const update = async () => {
try {
// Request the API
const request = await fetch(`https://mensa.jetzt/api/entries/`);
if (request.status !== 200) {
setMarqueeContent("Niemand :(")
setMarqueeContent("Niemand :(");
return;
}
......@@ -42,32 +41,34 @@ const MensaJetztPanel = () => {
...accu,
[curr.time]: [
...accu[curr.time],
curr
curr,
]
}
} else {
return {
...accu,
[curr.time]: [curr]
[curr.time]: [curr],
}
}
}, {});
let marquee = "";
for (const time of Object.keys(attendance).sort()) {
marquee += " | " + time + " : " + (attendance[time].map(a => a.name).join(", "));
marquee += " | " + time + " - " + (attendance[time].map(a => a.name).join(", "));
}
if (marquee !== "") {
marquee += " |"
marquee += " |";
}
setMarqueeContent(marquee.trim())
marquee = marquee.trim();
let marqueeContent = marquee ? marquee : 'Niemand :(';
setMarqueeContent(marqueeContent);
}
catch (e) {
console.warn("mensa.jetzt not showing data because", e);
setMarqueeContent("Niemand :(")
setMarqueeContent("Niemand :(");
}
}
......
......@@ -73,7 +73,7 @@ const NextbikePanel = (props: {definition: NextbikePanelDefinition}) => {
return () => {
clearInterval(interval);
}
});
}, [props]);
return (
<PanelWrapper>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment