diff --git a/README.md b/README.md index 67c01afb8f344573c778d008e314161dcdb63a2e..a8b65ad753727e8cd68d4a718d04c989e74a424e 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,9 @@ To ensure code quality, this repo is automatically evaluated by a SonarQube inst [](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 diff --git a/favicon.png b/favicon.png deleted file mode 100644 index a694960094e795631e2af505c157c336d5804c2e..0000000000000000000000000000000000000000 Binary files a/favicon.png and /dev/null differ diff --git a/public/index.html b/public/index.html index aa069f27cbd9d53394428171c3989fd03db73c76..fb5db29e8dccc52bad98398611148f3ad1024779 100644 --- a/public/index.html +++ b/public/index.html @@ -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> diff --git a/src/panels/MensaJetzt/MensaJetztPanel.tsx b/src/panels/MensaJetzt/MensaJetztPanel.tsx index 5bbd2181085b2833943fa6b4f1ff4d83a0614ff3..fd6c238c0acc46df7dc537a8b258cec59decd981 100644 --- a/src/panels/MensaJetzt/MensaJetztPanel.tsx +++ b/src/panels/MensaJetzt/MensaJetztPanel.tsx @@ -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 :("); } } diff --git a/src/panels/Nextbike/NextbikePanel.tsx b/src/panels/Nextbike/NextbikePanel.tsx index 400886e9c70fb72d23c812fedfad0fa21c023d50..eae87f0817ebd4082042b385f822d427337dc50e 100644 --- a/src/panels/Nextbike/NextbikePanel.tsx +++ b/src/panels/Nextbike/NextbikePanel.tsx @@ -73,7 +73,7 @@ const NextbikePanel = (props: {definition: NextbikePanelDefinition}) => { return () => { clearInterval(interval); } - }); + }, [props]); return ( <PanelWrapper> @@ -104,4 +104,4 @@ const NextbikePanel = (props: {definition: NextbikePanelDefinition}) => { ) } -export default NextbikePanel; \ No newline at end of file +export default NextbikePanel;