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 ...@@ -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) [![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 ## 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 ## Adding Ads
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <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="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" /> <meta name="theme-color" content="#000000" />
<meta <meta
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
work correctly both with client-side routing and a non-root public URL. 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`. Learn how to configure a non-root public URL by running `npm run build`.
--> -->
<title>React App</title> <title>Infoscreen</title>
</head> </head>
<body> <body>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>
......
...@@ -6,7 +6,7 @@ import PanelContent from "../../meta/PanelContent"; ...@@ -6,7 +6,7 @@ import PanelContent from "../../meta/PanelContent";
type MensaJetztAPIResponse = { type MensaJetztAPIResponse = {
day: string, day: string,
date: string, date: string,
attendance: Attendee[] attendance: Attendee[],
} }
type Attendee = { type Attendee = {
...@@ -14,7 +14,7 @@ type Attendee = { ...@@ -14,7 +14,7 @@ type Attendee = {
"name_modifiers": string, "name_modifiers": string,
"time": string, "time": string,
"canteen": string, "canteen": string,
"color": string "color": string,
} }
type Attendance = { [time: string]: Attendee[] } type Attendance = { [time: string]: Attendee[] }
...@@ -25,11 +25,10 @@ const MensaJetztPanel = () => { ...@@ -25,11 +25,10 @@ const MensaJetztPanel = () => {
useEffect(() => { useEffect(() => {
const update = async () => { const update = async () => {
try { try {
// Request the API
const request = await fetch(`https://mensa.jetzt/api/entries/`); const request = await fetch(`https://mensa.jetzt/api/entries/`);
if (request.status !== 200) { if (request.status !== 200) {
setMarqueeContent("Niemand :(") setMarqueeContent("Niemand :(");
return; return;
} }
...@@ -42,32 +41,34 @@ const MensaJetztPanel = () => { ...@@ -42,32 +41,34 @@ const MensaJetztPanel = () => {
...accu, ...accu,
[curr.time]: [ [curr.time]: [
...accu[curr.time], ...accu[curr.time],
curr curr,
] ]
} }
} else { } else {
return { return {
...accu, ...accu,
[curr.time]: [curr] [curr.time]: [curr],
} }
} }
}, {}); }, {});
let marquee = ""; let marquee = "";
for (const time of Object.keys(attendance).sort()) { 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 !== "") { if (marquee !== "") {
marquee += " |" marquee += " |";
} }
setMarqueeContent(marquee.trim()) marquee = marquee.trim();
let marqueeContent = marquee ? marquee : 'Niemand :(';
setMarqueeContent(marqueeContent);
} }
catch (e) { catch (e) {
console.warn("mensa.jetzt not showing data because", e); console.warn("mensa.jetzt not showing data because", e);
setMarqueeContent("Niemand :(") setMarqueeContent("Niemand :(");
} }
} }
......
...@@ -73,7 +73,7 @@ const NextbikePanel = (props: {definition: NextbikePanelDefinition}) => { ...@@ -73,7 +73,7 @@ const NextbikePanel = (props: {definition: NextbikePanelDefinition}) => {
return () => { return () => {
clearInterval(interval); clearInterval(interval);
} }
}); }, [props]);
return ( return (
<PanelWrapper> <PanelWrapper>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment