From def68685888e3a6195fbdebeaf7d84b1a2eab21b Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Tue, 26 Jul 2022 02:32:26 +0200 Subject: [PATCH] Add locations --- src/App.svelte | 15 +++++++++------ src/calendar.js | 24 +++++++++++++----------- src/static-ens-locations.json | 25 ++++++++++++++++++------- 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/src/App.svelte b/src/App.svelte index c78c4fa..7f8a24f 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -75,11 +75,13 @@ headerContent: 'Salle' } ], - resources: Object.entries(ENSLocations).flatMap(([building, rooms]) => rooms.map(room => ({ - id: `${building}-${room}`, - building, - room - }))), + resources: Object.entries(ENSLocations).flatMap(([building, rooms]) => + rooms.map(room => ({ + id: `${building}-${room}`, + building, + room + })) + ), height: '100%', schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives', nowIndicator: true, @@ -97,7 +99,8 @@ eventSources: [], themeSystem: 'bootstrap5', nextDayThreshold: '05:00:00', - progressiveEventRendering: true + progressiveEventRendering: true, + expandRows: true }); const flatten = d => { diff --git a/src/calendar.js b/src/calendar.js index 236aeb8..d46907e 100644 --- a/src/calendar.js +++ b/src/calendar.js @@ -1,4 +1,4 @@ -import STATIC_LOCATIONS from './static-ens-locations.json'; +import STATIC_LOCATIONS from './static-ens-locations.json' // https://stackoverflow.com/a/35970186 function invertColor(hex) { @@ -94,7 +94,7 @@ const calendars = { color: null, initial: false }, - 'Ekjb4kDqMMqwJXZF': { + Ekjb4kDqMMqwJXZF: { cloud: clouds.ELEVES_ENS, name: 'Rentrée des départements', short_name: 'Dpt', @@ -106,20 +106,20 @@ const calendars = { short_name: 'Conf', color: null }, - 'PnRXqeq4SsSC33FM': { + PnRXqeq4SsSC33FM: { cloud: clouds.ELEVES_ENS, name: 'Visites de bibliothèques', short_name: 'Bibli', initial: false, color: null }, - 'NWPtiEiz62LTtjo2': { + NWPtiEiz62LTtjo2: { cloud: clouds.ELEVES_ENS, name: 'Amphis de rentrée', short_name: 'Prés. de rentrée', color: null }, - 'JiRt58aJXay9kfyk': { + JiRt58aJXay9kfyk: { cloud: clouds.ELEVES_ENS, name: 'Réunions de rentrée des Masters', short_name: 'Masters', @@ -173,7 +173,7 @@ export const calendarTree = { 'Réunions de rentrée des Masters': {}, 'Activités pour les étudiants internationaux': {} }, - 'Divers': {} + Divers: {} } export function getSubCalendars(name, tree = calendarTree) { @@ -238,11 +238,13 @@ function findLocationId(location) { // Strip '(Jourdan)' // Relocate room number - const result = Object.entries(STATIC_LOCATIONS).find(([building, rooms]) => rooms.includes(location)); + const result = Object.entries(STATIC_LOCATIONS).find(([building, rooms]) => + rooms.includes(location) + ) - if (result === undefined) return undefined; - const [building, _] = result; - return `${building}-${location}`; + if (result === undefined) return undefined + const [building, _] = result + return `${building}-${location}` } function fcEventFromjCalEvent(cal) { @@ -264,7 +266,7 @@ function fcEventFromjCalEvent(cal) { fcEvent.location = evt.location || cal.default_location if (fcEvent.location) { - fcEvent.resourceId = findLocationId(fcEvent.location); + fcEvent.resourceId = findLocationId(fcEvent.location) } if (evt.status) { diff --git a/src/static-ens-locations.json b/src/static-ens-locations.json index b514479..831defb 100644 --- a/src/static-ens-locations.json +++ b/src/static-ens-locations.json @@ -1,16 +1,27 @@ -{ "45 rue d'Ulm": - [ +{ + "45 rue d'Ulm": [ "Amphithéâtre Galois", + "Bibliothèque Lettres", "Salle Histoire", "Salle Cavaillès", "Salle Dussane", "Salle des Actes", - "Cour aux Ernest", - "Salle Jaurès" - ], - "29 rue d'Ulm": [ - "Bibliothèque des sciences expérimentales" + "Salle des Résistants", + "Salle Cavaillès", + "Salle Cartan", + "Salle Noether", + "Salle Bourbaki", + "Cour aux Ernests", + "Cour du NIR", + "Cour Pasteur", + "Pôt", + "Petit pôt", + "Canopée", + "K-Fêt", + "Cave d'hackENS", + "Gymnase" ], + "29 rue d'Ulm": ["Bibliothèque des sciences expérimentales", "Salle Jaurès"], "Jourdan": [ "Bibliothèque de Jourdan", "Salle Marcel Roncayolo (R2-05)",