From 06586f8757ab04936a36ba39a9a5170f4957b472 Mon Sep 17 00:00:00 2001 From: sinavir Date: Tue, 26 Jul 2022 16:48:06 +0200 Subject: [PATCH 01/52] Don't change scrolling state when changing date --- src/App.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/src/App.svelte b/src/App.svelte index 62e9fac..dd88bb7 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -82,6 +82,7 @@ nowIndicator: true, now: now, scrollTime: scrollTo, + scrollTimeReset: false, eventClick: info => { openModal = true; event.set(info.event); -- 2.47.0 From 8279d15c045ea7692e7cdd2001de899e19df084c Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Tue, 26 Jul 2022 15:20:01 +0200 Subject: [PATCH 02/52] Add initial date selection via querystring --- src/App.svelte | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/App.svelte b/src/App.svelte index dd88bb7..f16fa35 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -37,6 +37,7 @@ })(); const params = new URL(document.location).searchParams.getAll('c'); + const date = new Date(new URL(document.location).searchParams.get('d')); const headers = mobile ? { @@ -54,6 +55,7 @@ let options = writable({ initialView: mobile ? 'listWeek' : 'timeGridWeek', + initialDate: date.toString() === 'Invalid Date' ? now : date, plugins: [ timeGridPlugin, dayGridPlugin, @@ -67,7 +69,7 @@ allDayContent: '', headerToolbar: headers, buttonText: { resourceTimelineDay: 'Salles' }, - scrollTime: "08:00:00", + scrollTime: '08:00:00', resourceGroupField: 'building', resourceAreaWidth: '27%', resources: Object.entries(ENSLocations).flatMap(([building, rooms]) => -- 2.47.0 From 9d9a1a09d9ef1c0e32eecd5b83d8223141d2c34f Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Tue, 26 Jul 2022 15:26:22 +0200 Subject: [PATCH 03/52] =?UTF-8?q?Factorise=20l'url,=20et=20rajoute=20la=20?= =?UTF-8?q?s=C3=A9lection=20de=20la=20vue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.svelte | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/App.svelte b/src/App.svelte index f16fa35..1e82ee4 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -36,8 +36,19 @@ return time.toLocaleTimeString(); })(); - const params = new URL(document.location).searchParams.getAll('c'); - const date = new Date(new URL(document.location).searchParams.get('d')); + const allowedViews = [ + 'resourceTimelineDay', + 'dayGridMonth', + 'timeGridWeek', + 'timeGridDay', + 'listWeek' + ]; + + const search = new URL(document.location).searchParams; + + const params = search.getAll('c'); + const date = new Date(search.get('d')); + const view = search.get('v'); const headers = mobile ? { @@ -54,7 +65,11 @@ let calendar; let options = writable({ - initialView: mobile ? 'listWeek' : 'timeGridWeek', + initialView: allowedViews.includes(view) + ? view + : mobile + ? 'listWeek' + : 'timeGridWeek', initialDate: date.toString() === 'Invalid Date' ? now : date, plugins: [ timeGridPlugin, -- 2.47.0 From a61d87b161fe1381b1ba2010ff31ee3516fa15a2 Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Tue, 26 Jul 2022 16:36:30 +0200 Subject: [PATCH 04/52] Add share modal --- src/App.svelte | 2 ++ src/Share.svelte | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 src/Share.svelte diff --git a/src/App.svelte b/src/App.svelte index 1e82ee4..32162df 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -14,6 +14,7 @@ import { mkSource, calendarTree, initialCalendars, getSubCalendars } from './calendar'; import { debounce } from 'lodash'; import Help from './Help.svelte'; + import Share from './Share.svelte'; import 'bootstrap/dist/css/bootstrap.css'; import 'bootstrap-icons/font/bootstrap-icons.css'; @@ -158,6 +159,7 @@

Calendrier de la vie étudiante à l'ENS

+ diff --git a/src/Share.svelte b/src/Share.svelte new file mode 100644 index 0000000..f49fddf --- /dev/null +++ b/src/Share.svelte @@ -0,0 +1,58 @@ + + + + + + + + Partage + + + +

La vue actuelle du calendrier peut être partagée avec l'URL suivante :

+ + {share} +
+ + + + Propulsé par le Club Réseau de l'ENS + +
+ + -- 2.47.0 From df1140649e5ec160da6634b88b4e310ad08a84e4 Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Tue, 26 Jul 2022 16:36:39 +0200 Subject: [PATCH 05/52] Fix date selection --- src/App.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/App.svelte b/src/App.svelte index 32162df..c676930 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -48,7 +48,7 @@ const search = new URL(document.location).searchParams; const params = search.getAll('c'); - const date = new Date(search.get('d')); + const date = search.has('d') ? new Date(search.get('d')) : now; const view = search.get('v'); const headers = mobile -- 2.47.0 From 117a5eb0b1b176cc2c5ce56152ac0105eaa57ad6 Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Tue, 26 Jul 2022 23:05:41 +0200 Subject: [PATCH 06/52] Move the share button (useful on mobile) --- src/Share.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Share.svelte b/src/Share.svelte index f49fddf..641aed2 100644 --- a/src/Share.svelte +++ b/src/Share.svelte @@ -51,8 +51,8 @@ -- 2.47.0 From 4e631121826c396b59f08a0f18c015f3db0ce470 Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Wed, 27 Jul 2022 00:13:16 +0200 Subject: [PATCH 07/52] Share as b64 and add toast w/ clipboard filling --- src/App.svelte | 7 ++++++- src/Share.svelte | 40 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/src/App.svelte b/src/App.svelte index c676930..8b31922 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -45,7 +45,12 @@ 'listWeek' ]; - const search = new URL(document.location).searchParams; + let search = new URL(document.location).searchParams; + + if (search.has('b64')) { + // On est dans le cas où les paramètres sont codés en base64 + search = new URLSearchParams(window.atob(search.get('b64'))); + } const params = search.getAll('c'); const date = search.has('d') ? new Date(search.get('d')) : now; diff --git a/src/Share.svelte b/src/Share.svelte index 641aed2..eefb174 100644 --- a/src/Share.svelte +++ b/src/Share.svelte @@ -1,5 +1,5 @@ + + @@ -39,7 +59,7 @@

La vue actuelle du calendrier peut être partagée avec l'URL suivante :

- {share} + {share}
@@ -55,4 +75,18 @@ right: 1em; cursor: pointer; } + + #share-url { + max-width: 100%; + display: block; + overflow-wrap: break-word; + cursor: pointer; + } + + .share-toast { + position: absolute; + top: 1.25em; + left: 1em; + z-index: 1100; + } -- 2.47.0 From 29bce486d21cf17e4ea12a18fef763dcf769126b Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Wed, 27 Jul 2022 00:17:50 +0200 Subject: [PATCH 08/52] Add user-select: all for easier copy when the clipboard is not available --- src/Share.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Share.svelte b/src/Share.svelte index eefb174..a061f50 100644 --- a/src/Share.svelte +++ b/src/Share.svelte @@ -35,7 +35,7 @@ navigator.clipboard .writeText(share) .then(() => (toastText = 'Lien de partage copié dans le presse-papier.')) - .catch(() => (toastText = 'Erreur de copie.')) + .catch(() => (toastText = 'Erreur de copie automatique.')) .finally((isToastOpen = true)); }; @@ -81,6 +81,7 @@ display: block; overflow-wrap: break-word; cursor: pointer; + user-select: all; } .share-toast { -- 2.47.0 From 4a7414cb115d279c1eead8d9af1b4d14e23d904d Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Wed, 27 Jul 2022 01:09:07 +0200 Subject: [PATCH 09/52] =?UTF-8?q?Permet=20de=20basculer=20du=20partage=20e?= =?UTF-8?q?n=20base64=20=C3=A0=20un=20partage=20normal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Share.svelte | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/src/Share.svelte b/src/Share.svelte index a061f50..d746673 100644 --- a/src/Share.svelte +++ b/src/Share.svelte @@ -8,12 +8,24 @@ let isOpen = false; let isToastOpen = false; + let isBinary = false; let toastText = ''; const toggle = () => { isOpen = !isOpen; + updateShareLink(); + }; + const doShare = () => { + navigator.clipboard + .writeText(share) + .then(() => (toastText = 'Lien de partage copié dans le presse-papier.')) + .catch(() => (toastText = 'Erreur de copie automatique.')) + .finally((isToastOpen = true)); + }; + + const updateShareLink = () => { const loc = document.location; const search = new URLSearchParams(); const api = calendar.getAPI(); @@ -26,18 +38,21 @@ search.append('d', api.getDate().toISOString()); } - const b64 = window.btoa(search.toString()); + if (isBinary) { + const b64 = window.btoa(search.toString()); - share = `${loc.origin}${loc.pathname}?b64=${b64}`; + share = `${loc.origin}${loc.pathname}?b64=${b64}`; + } else { + share = `${loc.origin}${loc.pathname}${search.toString()}`; + } }; - const doShare = () => { - navigator.clipboard - .writeText(share) - .then(() => (toastText = 'Lien de partage copié dans le presse-papier.')) - .catch(() => (toastText = 'Erreur de copie automatique.')) - .finally((isToastOpen = true)); + const toggleBinary = () => { + isBinary = !isBinary; + updateShareLink(); }; + + $: shareDataIcon = isBinary ? 'code-square' : 'code'; - - {#if event.allDay} + {#if event.extendedProps.simAllDay} + + {dateFormat(event.start)} ({timeFormat(event.extendedProps.realStart)}) - {dateFormat(event.end)} ({timeFormat(event.extendedProps.realEnd)}) + {:else if event.allDay} {dateFormat(event.start)} - {dateFormat(event.end)} {:else} diff --git a/src/calendar.js b/src/calendar.js index e3c0b36..ca9d2d6 100644 --- a/src/calendar.js +++ b/src/calendar.js @@ -132,13 +132,29 @@ function fcEventFromjCalEvent(cal) { return function (evt) { const start = new Date(evt.dtstart) const end = new Date(evt.dtend) + + const duration = end - start // in ms + const dayMs = 24 * 3600 * 1000 + const fcEvent = { title: `${cal.short_name ?? cal.name} : ${evt.summary}`, - start: evt.dtstart, - end: evt.dtend, + start: start, + end: end, color: cal.color, textColor: invertColor(cal.color), - duration: end - start // in ms + duration: duration + } + + if (duration > dayMs - 1) { + fcEvent.allDay = true + fcEvent.simAllDay = true + + fcEvent.realStart = new Date(start) + fcEvent.realEnd = new Date(end) + + fcEvent.start.setUTCHours(0, 0, 0) + fcEvent.end.setUTCHours(23, 59, 59) + fcEvent.duration = end - start // Update the duration } fcEvent.calendar = cal.name -- 2.47.0 From 32d9b4d60c601ef23df4444320aabfb94efb12a0 Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Tue, 25 Oct 2022 10:38:09 +0200 Subject: [PATCH 50/52] Fix display or real allDay events --- src/calendar.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/calendar.js b/src/calendar.js index ca9d2d6..c8ef67a 100644 --- a/src/calendar.js +++ b/src/calendar.js @@ -133,27 +133,29 @@ function fcEventFromjCalEvent(cal) { const start = new Date(evt.dtstart) const end = new Date(evt.dtend) + const allDay = !evt.dtstart.endsWith('Z') + const duration = end - start // in ms const dayMs = 24 * 3600 * 1000 const fcEvent = { title: `${cal.short_name ?? cal.name} : ${evt.summary}`, - start: start, - end: end, + start: evt.dtstart, + end: evt.dtend, color: cal.color, textColor: invertColor(cal.color), duration: duration } - if (duration > dayMs - 1) { + if (!allDay && (duration > dayMs - 1)) { fcEvent.allDay = true fcEvent.simAllDay = true fcEvent.realStart = new Date(start) fcEvent.realEnd = new Date(end) - fcEvent.start.setUTCHours(0, 0, 0) - fcEvent.end.setUTCHours(23, 59, 59) + fcEvent.start = start.setUTCHours(0, 0, 0) + fcEvent.end = end.setUTCHours(23, 59, 59) fcEvent.duration = end - start // Update the duration } -- 2.47.0 From 7c5df4e7904eb6c55a6578d4b5c47cb87c3a812f Mon Sep 17 00:00:00 2001 From: sinavir Date: Sun, 23 Jul 2023 13:27:12 +0200 Subject: [PATCH 51/52] =?UTF-8?q?Add=20rentr=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/calendars.json | 50 +++++++++++++++++++++++++++++++++++++++++++-- data/locations.json | 4 +++- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/data/calendars.json b/data/calendars.json index 5986545..0ef8aa9 100644 --- a/data/calendars.json +++ b/data/calendars.json @@ -1,6 +1,15 @@ { "tree": { + "Rentrée": { + "Amphis de rentrée": {}, + "Départements": {}, + "Visites de bibliothèque": {}, + "Masters": {}, + "Étudiants internationaux": {}, + "Conférences de recherche": {} + }, "COF": { + "Rentrée du COF": {}, "Évènements (COF)": {}, "Assemblées Générales (COF)": {}, "BdA": { @@ -24,7 +33,10 @@ "Ulmity": {}, "Club Inutile ☔": {} }, - "BDS": {}, + "BDS": { + "Évènements (BDS)": {}, + "Rentrée du BDS": {} + }, "Clubs BDS": { "Créneaux encadrés": {} }, @@ -123,7 +135,7 @@ "short_name": "Banda" }, "dSYCtdC6bgyWpKyt": { - "name": "BDS" + "name": "Évènements (BDS)" }, "goXLq2dQ8LgFAjkM": { "name": "Club Bouffe" @@ -144,6 +156,40 @@ }, "AYNpoC674yAjEmRy": { "name": "L'Hômonerie" + }, + "TcwNdrs6iyBRxFzk": { + "name": "Divers" + }, + "G5ZRyTkMifXC2iHj": { + "name": "Amphis de rentrée", + "short_name": "Amphis" + }, + "dJofECeczaGgNiKs": { + "name": "Rentrée du BDS", + "short_name": "BDS" + }, + "7Rwd8JERwBsso7XG": { + "name": "Rentrée du COF", + "short_name": "COF" + }, + "tiMsNcncqBxR4nL2": { + "name": "Départements", + "short_name": "Dpt" + }, + "RpP773D6e2ReLfcY": { + "name": "Visites de bibliothèque", + "short_name": "Bibli" + }, + "YRZ4A8imEEf8jnDE": { + "name": "Masters" + }, + "8EDHX6kiPYcSrXXL": { + "name": "Étudiants internationaux", + "short_name": "Internationaux" + }, + "TWgNxdri7zQSoiRf": { + "name": "Conférences de recherche", + "short_name": "Conf" } } } diff --git a/data/locations.json b/data/locations.json index 5e705d8..a90d540 100644 --- a/data/locations.json +++ b/data/locations.json @@ -1,10 +1,12 @@ { "nameMap": { "Amphi Jourdan": "Amphithéâtre Jourdan", + "Cour aux Ernest": "Cour aux Ernests", "R2-21 (Jourdan)": "R2-21", "Salle Jean Ibanes (Jourdan, R1-07)": "Salle Jean Ibanes (R1-07)", "Salle Madeleine Rebérioux (Jourdan, R2-02)": "Salle Madeleine Rebérioux (R2-02)", - "Salle Marcel Roncayolo (Jourdan, R2-05)": "Salle Marcel Roncayolo (R2-05)" + "Salle Marcel Roncayolo (Jourdan, R2-05)": "Salle Marcel Roncayolo (R2-05)", + "Cour des bibliothèques": "Cour du NIR" }, "rooms": { -- 2.47.0 From 85570af7afa4b618ee59b194191d9198b88e9627 Mon Sep 17 00:00:00 2001 From: sinavir Date: Wed, 20 Sep 2023 15:37:55 +0200 Subject: [PATCH 52/52] Add arts-pla' --- data/calendars.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/data/calendars.json b/data/calendars.json index 0ef8aa9..d4847ea 100644 --- a/data/calendars.json +++ b/data/calendars.json @@ -31,6 +31,7 @@ "BandarrêtdurgENS": {}, "L'Hômonerie": {}, "Ulmity": {}, + "Arts pla'": {}, "Club Inutile ☔": {} }, "BDS": { @@ -190,6 +191,10 @@ "TWgNxdri7zQSoiRf": { "name": "Conférences de recherche", "short_name": "Conf" + }, + "MJf2wnQafbLc2arS": { + "name": "Arts pla'", + "color": "#ffb969" } } } -- 2.47.0