From e04dd499dbc0b203cf8a3dd21f35d6e3afac587a Mon Sep 17 00:00:00 2001 From: Robert Eggl Date: Mon, 25 Nov 2024 14:56:21 +0100 Subject: [PATCH] refactor(events): update event organizer to use api host data --- rogue-thi-app/components/cards/EventsCard.jsx | 8 +- rogue-thi-app/data/clubs.json | 92 ------------------- rogue-thi-app/lib/backend/neuland-api.js | 7 +- rogue-thi-app/pages/events.jsx | 40 ++++---- 4 files changed, 29 insertions(+), 118 deletions(-) delete mode 100644 rogue-thi-app/data/clubs.json diff --git a/rogue-thi-app/components/cards/EventsCard.jsx b/rogue-thi-app/components/cards/EventsCard.jsx index 54f78cd9..50f12d63 100644 --- a/rogue-thi-app/components/cards/EventsCard.jsx +++ b/rogue-thi-app/components/cards/EventsCard.jsx @@ -41,9 +41,11 @@ export default function EventsCard() { {calendar.slice(0, 2).map((x, i) => (
{x.title}
-
- {t('events.organizer.attribute')} {x.organizer} -
+ {x.host?.name && ( +
+ {t('events.organizer.attribute')} {x.host.name} +
+ )}
))} diff --git a/rogue-thi-app/data/clubs.json b/rogue-thi-app/data/clubs.json deleted file mode 100644 index 6491b3f7..00000000 --- a/rogue-thi-app/data/clubs.json +++ /dev/null @@ -1,92 +0,0 @@ -[ - { - "club": "Studierendenvertretung .", - "instagram": "https://www.instagram.com/studverthi/", - "website": "https://studverthi.de" - }, - { - "club": "Hochschulband .", - "instagram": "https://www.instagram.com/studverthi/", - "website": "https://studverthi.de" - }, - { - "club": "Hochschulkino .", - "instagram": "https://www.instagram.com/hochschulkino.thi/", - "website": "https://studverthi.de/hochschulkino" - }, - { - "club": "think e. V.", - "instagram": "https://www.instagram.com/think.thi/", - "website": "https://think-thi.de/" - }, - { - "club": "Neuland Ingolstadt e. V.", - "instagram": "https://www.instagram.com/neuland_ingolstadt/", - "website": "https://neuland-ingolstadt.de/" - }, - { - "club": "Our Future e. V.", - "instagram": "https://www.instagram.com/ourfuture_ingolstadt/", - "website": "https://www.ourfuturethi.de/" - }, - { - "club": "NEWEXIST e. V.", - "instagram": "https://www.instagram.com/newexist_official/", - "website": "https://newexist.com/" - }, - { - "club": "N.I.C.E. e. V.", - "instagram": "https://www.instagram.com/niceingolstadt/", - "website": "https://www.thi.de/studium/studentisches-leben/studentische-vereine-an-der-thi/nice-network-international-culture-exchange/" - }, - { - "club": "Eta-nol e. V.", - "instagram": "https://www.instagram.com/eta_nol_in/", - "website": "https://eta-nol.de/" - }, - { - "club": "Students' Life e.V.", - "instagram": "https://www.instagram.com/studentslife.thingolstadt/", - "website": "https://students-life.de" - }, - { - "club": "consult.IN e.V.", - "instagram": "https://www.instagram.com/consult.in/", - "website": "https://consultin.net/" - }, - { - "club": "Schanzer Racing Electric e.V.", - "instagram": "https://www.instagram.com/schanzerracing/", - "website": "https://www.schanzer-racing.de/" - }, - { - "club": "UNICEF Hochschulgruppe", - "instagram": "https://www.instagram.com/unicef_hsg_in/", - "website": "https://www.unicef.de/mitmachen/ehrenamtlich-aktiv/-/hochschulgruppe-thi-ingolstadt" - }, - { - "club": "Hochschulgaming Ingolstadt", - "instagram": "https://www.instagram.com/hochschulgaming_in/", - "website": "https://hochschulgaming.de/" - }, - { - "club": "LEO Club Ingolstadt", - "instagram": "https://www.instagram.com/leoclubingolstadt/", - "website": "https://www.thi.de/studium/studentisches-leben/studentische-vereine-an-der-thi/leo-club-ingolstadt/" - }, - { - "club": "Studentischer Börsenclub Ingolstadt e. V.", - "instagram": "https://www.instagram.com/boersenclubingolstadt/", - "website": "https://www.boersenclub-ingolstadt.de/" - }, - { - "club": "Studenten Bilden Schüler e.V.", - "instagram": "https://www.instagram.com/studentenbildenschueler/", - "website": "https://studenten-bilden-schueler.de/standorte/ingolstadt" - }, - { - "club": "Nightlife Neuburg e.V.", - "instagram": "https://www.instagram.com/nightlifeneuburg/", - "website": "https://www.instagram.com/nightlifeneuburg/" - } -] diff --git a/rogue-thi-app/lib/backend/neuland-api.js b/rogue-thi-app/lib/backend/neuland-api.js index 9e469f6f..82f01ab1 100644 --- a/rogue-thi-app/lib/backend/neuland-api.js +++ b/rogue-thi-app/lib/backend/neuland-api.js @@ -126,8 +126,11 @@ class NeulandAPIClient { gql` query { clEvents { - id - organizer + host { + name + website + instagram + } title location begin diff --git a/rogue-thi-app/pages/events.jsx b/rogue-thi-app/pages/events.jsx index a97119ae..35ab5d5c 100644 --- a/rogue-thi-app/pages/events.jsx +++ b/rogue-thi-app/pages/events.jsx @@ -34,7 +34,6 @@ import SwipeableTabs, { SwipeableTab } from '../components/SwipeableTabs' import Button from 'react-bootstrap/Button' import Link from 'next/link' import Modal from 'react-bootstrap/Modal' -import clubs from '../data/clubs.json' import { serverSideTranslations } from 'next-i18next/serverSideTranslations' import { useRouter } from 'next/router' import { useTranslation } from 'next-i18next' @@ -243,9 +242,6 @@ export default function Events({ initialCampusEvents, sportsEvents }) { )} {campusLifeEvents && campusLifeEvents.map((item, idx) => { - const club = clubs.find( - (club) => club.club === item.organizer - ) return ( - {club != null && ( + {item.host != null ? ( <> - {club.website != null && ( + {item.host.name != null && ( - {` ${club.club} `} + {` ${item.host.name} `} )} - )} - {club == null && ( - <> - - {item.organizer} - + ) : ( + item.host && + item.host.name != null && ( + <> + + {item.host.name} + + ) )} @@ -326,9 +324,9 @@ export default function Events({ initialCampusEvents, sportsEvents }) { - {club != null && club.website != null && ( + {item.host != null && item.host.website != null && ( )} - {club != null && club.instagram != null && ( + {item.host != null && item.host.instagram != null && (