Add locations

This commit is contained in:
Tom Hubrecht 2022-07-26 02:32:26 +02:00
parent 433568751c
commit def6868588
3 changed files with 40 additions and 24 deletions

View file

@ -75,11 +75,13 @@
headerContent: 'Salle' headerContent: 'Salle'
} }
], ],
resources: Object.entries(ENSLocations).flatMap(([building, rooms]) => rooms.map(room => ({ resources: Object.entries(ENSLocations).flatMap(([building, rooms]) =>
rooms.map(room => ({
id: `${building}-${room}`, id: `${building}-${room}`,
building, building,
room room
}))), }))
),
height: '100%', height: '100%',
schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives', schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
nowIndicator: true, nowIndicator: true,
@ -97,7 +99,8 @@
eventSources: [], eventSources: [],
themeSystem: 'bootstrap5', themeSystem: 'bootstrap5',
nextDayThreshold: '05:00:00', nextDayThreshold: '05:00:00',
progressiveEventRendering: true progressiveEventRendering: true,
expandRows: true
}); });
const flatten = d => { const flatten = d => {

View file

@ -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 // https://stackoverflow.com/a/35970186
function invertColor(hex) { function invertColor(hex) {
@ -94,7 +94,7 @@ const calendars = {
color: null, color: null,
initial: false initial: false
}, },
'Ekjb4kDqMMqwJXZF': { Ekjb4kDqMMqwJXZF: {
cloud: clouds.ELEVES_ENS, cloud: clouds.ELEVES_ENS,
name: 'Rentrée des départements', name: 'Rentrée des départements',
short_name: 'Dpt', short_name: 'Dpt',
@ -106,20 +106,20 @@ const calendars = {
short_name: 'Conf', short_name: 'Conf',
color: null color: null
}, },
'PnRXqeq4SsSC33FM': { PnRXqeq4SsSC33FM: {
cloud: clouds.ELEVES_ENS, cloud: clouds.ELEVES_ENS,
name: 'Visites de bibliothèques', name: 'Visites de bibliothèques',
short_name: 'Bibli', short_name: 'Bibli',
initial: false, initial: false,
color: null color: null
}, },
'NWPtiEiz62LTtjo2': { NWPtiEiz62LTtjo2: {
cloud: clouds.ELEVES_ENS, cloud: clouds.ELEVES_ENS,
name: 'Amphis de rentrée', name: 'Amphis de rentrée',
short_name: 'Prés. de rentrée', short_name: 'Prés. de rentrée',
color: null color: null
}, },
'JiRt58aJXay9kfyk': { JiRt58aJXay9kfyk: {
cloud: clouds.ELEVES_ENS, cloud: clouds.ELEVES_ENS,
name: 'Réunions de rentrée des Masters', name: 'Réunions de rentrée des Masters',
short_name: 'Masters', short_name: 'Masters',
@ -173,7 +173,7 @@ export const calendarTree = {
'Réunions de rentrée des Masters': {}, 'Réunions de rentrée des Masters': {},
'Activités pour les étudiants internationaux': {} 'Activités pour les étudiants internationaux': {}
}, },
'Divers': {} Divers: {}
} }
export function getSubCalendars(name, tree = calendarTree) { export function getSubCalendars(name, tree = calendarTree) {
@ -238,11 +238,13 @@ function findLocationId(location) {
// Strip '(Jourdan)' // Strip '(Jourdan)'
// Relocate room number // 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; if (result === undefined) return undefined
const [building, _] = result; const [building, _] = result
return `${building}-${location}`; return `${building}-${location}`
} }
function fcEventFromjCalEvent(cal) { function fcEventFromjCalEvent(cal) {
@ -264,7 +266,7 @@ function fcEventFromjCalEvent(cal) {
fcEvent.location = evt.location || cal.default_location fcEvent.location = evt.location || cal.default_location
if (fcEvent.location) { if (fcEvent.location) {
fcEvent.resourceId = findLocationId(fcEvent.location); fcEvent.resourceId = findLocationId(fcEvent.location)
} }
if (evt.status) { if (evt.status) {

View file

@ -1,16 +1,27 @@
{ "45 rue d'Ulm": {
[ "45 rue d'Ulm": [
"Amphithéâtre Galois", "Amphithéâtre Galois",
"Bibliothèque Lettres",
"Salle Histoire", "Salle Histoire",
"Salle Cavaillès", "Salle Cavaillès",
"Salle Dussane", "Salle Dussane",
"Salle des Actes", "Salle des Actes",
"Cour aux Ernest", "Salle des Résistants",
"Salle Jaurès" "Salle Cavaillès",
], "Salle Cartan",
"29 rue d'Ulm": [ "Salle Noether",
"Bibliothèque des sciences expérimentales" "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": [ "Jourdan": [
"Bibliothèque de Jourdan", "Bibliothèque de Jourdan",
"Salle Marcel Roncayolo (R2-05)", "Salle Marcel Roncayolo (R2-05)",