Compare commits

...

74 commits

Author SHA1 Message Date
ed6fafda45
feat(nix): Rework a bit 2024-10-24 00:08:51 +02:00
a648941bac
chore(npins): Update nixpkgs 2024-10-24 00:08:33 +02:00
f523cb1e4a
chore(data): Reformat 2024-10-24 00:08:22 +02:00
5c5e0c356b
feat: Add Valse 2024-10-23 23:32:21 +02:00
f631751da4 feat(calendars.json): ajout du calendrier DGNum
Signed-off-by: jemagius <jmg@dgnum.eu>
2024-10-12 12:31:47 +02:00
505074dfc3 feat: add DGNum's NextCloud as provider for calendars in metis
Signed-off-by: jemagius <jmg@dgnum.eu>
2024-10-12 11:12:00 +02:00
9eaa1f2897
fix(calendars.json): K-Fêt was recreated 2024-09-18 14:20:39 +02:00
sinavir
23839b284e fix(locations.json): Add some location renaming 2024-09-04 16:17:41 +02:00
sinavir
8923b8293d fix(calendars.json): fix rentrée 2024-09-04 11:05:14 +02:00
sinavir
6eeeea3654 fix(calendars.json): Add "Visites" 2024-08-28 16:54:08 +02:00
sinavir
e91154c9db feat(synoptic view): Display only occupied rooms 2024-08-13 01:45:50 +02:00
sinavir
57e9bc2474 feat(calendars.json): Rentrée 2024-08-13 01:45:14 +02:00
sinavir
505f15372d fix(calendars.json): Disable "Crémeaux encadrés" par défaut 2024-08-12 08:41:53 +02:00
sinavir
49b136a43a fix(calendars): Remove obsolete calendars 2024-06-27 21:34:15 +02:00
sinavir
3fd72124c0 fix(calendars.js): Remove unused function 2024-06-27 21:30:54 +02:00
f2bbd93c75 Merge pull request 'Nouveau calendrier pour hackENS' (#67) from ecoppens/metis:master into master
Reviewed-on: #67
2024-01-17 08:47:40 +01:00
7c256a6dcc
feat(calendars.json): Add new hackENS calendar 2024-01-16 18:35:35 +01:00
sinavir
dbfd1de2b9 fix(calendars.json): Remove failing calendars 2024-01-06 23:51:19 +01:00
a14d334c75 fix(calendars.json): Update K-Fêt url 2023-11-08 17:44:08 +01:00
sinavir
1a151d6cf4 adding providers.nix
The file providers.nix specify upstream endpoints for reverse proxy rules.
2023-10-20 17:20:46 +02:00
sinavir
b5b9941560 Add ENSelle 2023-10-05 16:37:32 +02:00
c444b702b2 Rebrand from Club Réseau to DGNum 2023-09-28 12:48:18 +02:00
d5a7f39384 Add analytics 2023-09-28 12:11:22 +02:00
f086aab2bf Merge pull request 'Add arts-pla'' (#66) from add_arts_pla into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/66
2023-09-20 15:44:48 +02:00
sinavir
85570af7af Add arts-pla' 2023-09-20 15:37:55 +02:00
1a225d10ca Merge pull request 'Add rentrée' (#65) from add_rentree into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/65
2023-07-23 16:46:26 +02:00
sinavir
7c5df4e790 Add rentrée 2023-07-23 16:44:40 +02:00
ab00fede2e Merge pull request 'thubrecht/multiday-event' (#58) from thubrecht/multiday-event into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/58
2023-07-23 16:31:03 +02:00
32d9b4d60c Fix display or real allDay events 2023-07-23 16:29:12 +02:00
642b45f018 Display events spanning more than 24h as allDay events 2023-07-23 16:29:12 +02:00
49d62aa749 Delete build output of bundle 2023-07-23 16:28:24 +02:00
ea468c2469 Merge pull request 'Modernize' (#64) from modernize into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/64
2023-07-23 16:21:57 +02:00
sinavir
8d0c245e35 Add link to source code 2023-07-23 16:21:13 +02:00
sinavir
22b5ee34d5 update deps 2023-07-23 16:21:13 +02:00
sinavir
4143cb84c2 switch to npins and buildNpmPackage 2023-07-23 16:21:13 +02:00
4f72214717 calendars: Add Créneaux Encadrés 2023-07-23 16:13:25 +02:00
cfd94cb02a calendars: Add BOcal 2023-07-23 16:13:08 +02:00
sinavir
d4254e19fd Remove compiled tarball 2023-07-22 21:41:46 +02:00
64534b2bf7 Répare l'indentation 2023-03-07 22:45:04 +01:00
871b7eaaf8 Rajoute PLS 2023-03-06 18:42:07 +01:00
7d2662d00a Merge pull request 'change_bds' (#63) from change_bds into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/63
2023-02-24 15:47:43 +01:00
sinavir
629bb480ea change_bds 2023-02-24 14:30:29 +01:00
86da9646d8 Merge pull request 'add_ulmity' (#61) from add_ulmity into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/61
2023-02-22 19:38:21 +01:00
sinavir
05c7174f5f add_ulmity 2023-02-22 19:38:01 +01:00
7ce999c365 Merge pull request 'add_club_bouffe' (#62) from add_club_bouffe into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/62
2023-02-22 19:37:46 +01:00
sinavir
985e6561b8 add_club_bouffe 2023-02-22 17:32:16 +01:00
f9ebe70653 Merge pull request 'Add psychédéliste' (#60) from add_liste_cof into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/60
2022-12-04 11:53:48 +01:00
sinavir
036ba938ae Add psychédéliste 2022-12-03 22:38:42 +01:00
4af6452003 Merge pull request 'add_homonerie' (#59) from add_homonerie into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/59
2022-11-12 22:10:34 +01:00
sinavir
0e172f5569 add_homonerie 2022-11-12 21:54:48 +01:00
aa697799bc Change things 2022-10-28 13:39:31 +02:00
58597c8076 Set timeout during loading to prevent a calendar from blocking the view 2022-10-28 13:34:43 +02:00
142b841397 Formatting 2022-10-25 10:39:28 +02:00
75e9a5c281 Merge pull request 'remove rentrée' (#57) from remove_rentree into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/57
2022-10-25 10:26:15 +02:00
sinavir
d958b817f3 remove rentrée 2022-10-25 10:23:24 +02:00
06ef17e8f5 Merge pull request 'Add ambassadeurices santé' (#56) from add_ambassadeurices_sante into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/56
2022-10-25 10:07:19 +02:00
sinavir
a5353b0c9e revert remove of "rentrée" 2022-10-25 10:04:41 +02:00
sinavir
b40b7494a4 Add ambassadeurices santé 2022-10-24 18:59:25 +02:00
26cb575a54 Don't try to show a tooltip when no title is defined 2022-10-10 18:20:54 +02:00
3e84c21e00 Merge pull request 'add club jeux' (#55) from add_club_jeux into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/55
2022-10-10 14:08:14 +02:00
sinavir
4a1e24c1d3 add club jeux 2022-10-10 13:26:24 +02:00
3a2502acbe Add Écocampus 2022-09-29 18:44:41 +02:00
7eb5ee2dfd Merge pull request 'add separate calendar for bda' (#54) from add_separate_calendar_for_bda into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/54
2022-09-29 08:52:11 +02:00
sinavir
5c415b6a04 better naming 2022-09-28 17:11:46 +02:00
sinavir
4444649136 add separate calendar for bda 2022-09-28 13:38:33 +02:00
e420cdd0b4 Move room and calendar data to a specific folder (#52)
On met tout dans /data pour décorréler les sources du calendrier de la logique au maximum

Co-authored-by: Tom Hubrecht <tom.hubrecht@ens.fr>
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/52
Co-authored-by: tomate <tom.hubrecht@ens.fr>
Co-committed-by: tomate <tom.hubrecht@ens.fr>
2022-09-12 17:46:54 +02:00
26ccb5dcc9 Rajoute la banda et DDR (#51)
Co-authored-by: Tom Hubrecht <tom.hubrecht@ens.fr>
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/51
Co-authored-by: tomate <tom.hubrecht@ens.fr>
Co-committed-by: tomate <tom.hubrecht@ens.fr>
2022-09-12 13:30:29 +02:00
a958ba4b2a Merge pull request 'add_bds' (#49) from add_bds into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/49
2022-08-27 21:20:27 +02:00
sinavir
f9a9009914 add_bds 2022-08-27 21:19:32 +02:00
6849eaed06 Add a favicon (#48)
Co-authored-by: sinavir <sinavir@sinavir.fr>
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/48
Co-authored-by: sinavir <maurice.debray@ens.fr>
Co-committed-by: sinavir <maurice.debray@ens.fr>
2022-08-15 13:49:24 +02:00
0ee44ac32a Merge pull request 'Raccourcit les liens de partage' (#47) from thubrecht/reduce-share into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/47
2022-08-04 23:32:10 +02:00
6aa3c6820c Raccourcit les liens de partage 2022-08-02 18:08:58 +02:00
30259d31bd Merge pull request 'Fix tooltip not disapearing' (#45) from thubrecht/tooltip into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/45
2022-07-28 23:29:34 +02:00
12226dcd25 Fix tooltip not disapearing 2022-07-28 21:38:33 +02:00
23 changed files with 1033 additions and 3773 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use nix

3
.gitignore vendored
View file

@ -1,2 +1,5 @@
node_modules
public/build
result
.direnv

214
data/calendars.json Normal file
View file

@ -0,0 +1,214 @@
{
"tree": {
"Rentrée": {
"Évènements pour les masteriens": {},
"Exchange and international students": {},
"Départements": {},
"Amphis de rentrée": {},
"Divers rentrée": {},
"Associatif divers": {},
"Visites": {}
},
"Délégation Générale Numérique": {},
"COF": {
"Évènements (COF)": {},
"Rentrée du COF": {},
"Assemblées Générales (COF)": {},
"BdA": {
"Évènements (BdA)": {},
"Spectacles du tirage BdA": {}
}
},
"Clubs COF": {
"PLS": {},
"HackENS": {},
"Club Bouffe": {},
"Écriv'ENS": {},
"BOcal": {},
"CinéClub": {},
"Ernestophone": {},
"Club Jeux": {},
"DDR": {},
"BandarrêtdurgENS": {},
"L'Hômonerie": {},
"Ulmity": {},
"Arts pla'": {},
"Club Inutile ☔": {}
},
"BDS": {
"Évènements (BDS)": {},
"Rentrée du BDS": {}
},
"Clubs BDS": {
"Valse": {},
"Créneaux encadrés": {},
"ENSelle": {}
},
"La Nuit de l'ENS": {},
"Délégation Générale": {},
"K-Fêt": {},
"Écocampus": {},
"La Psychédéliste": {},
"Ambassadeur·rice·s santé": {}
},
"sources": {
"dgnum-nc": {
"dmo7DgdmTnsMd8zo": {
"name": "Valse"
},
"eEPk6miCzozgPb42": {
"name": "Délégation Générale Numérique",
"short_name": "DGNum",
"color": "#27327a"
}
},
"eleves-ens": {
"qG6jpJPfK37Nw8ZC": {
"name": "PLS"
},
"caey6jt6pTgKengA": {
"name": "BOcal",
"color": "#e6973e"
},
"LLWm8qK9iC5YGrrR": {
"name": "Délégation Générale",
"short_name": "DG"
},
"2KGkWzBJGorxzyTW": {
"name": "La Nuit de l'ENS",
"short_name": "La Nuit"
},
"w442JdS5AaQ6czrP": {
"name": "Écriv'ENS"
},
"aoazRGFcjHSe4LxG": {
"name": "K-Fêt",
"color": "#c63b52",
"default_location": "K-Fêt"
},
"gsZtZK8c9EmREofn": {
"name": "Ernestophone"
},
"dTHrXnYgsEoSTjWB": {
"name": "Évènements (COF)",
"short_name": "COF"
},
"bCgRFByHLiCCNc55": {
"name": "Assemblées Générales (COF)",
"short_name": "AG COF"
},
"r4yJZDHjwNtH8wkR": {
"name": "Évènements (BdA)"
},
"83AkowSYPnYrjSFr": {
"name": "Spectacles du tirage BdA",
"short_name": "Spectacles",
"initial": false
},
"ZtWm3MYSi388k2yk": {
"name": "DDR"
},
"T5WoHbs4FT5A945Z": {
"name": "CinéClub"
},
"6SHG6cg9d7S3qqwD": {
"name": "Club Inutile ☔",
"initial": false
},
"TFjE83ASCMK9rfRi": {
"name": "BandarrêtdurgENS",
"short_name": "Banda"
},
"kR8fMzmf4ciop9Je": {
"name": "Club Jeux",
"short_name": "Jeux",
"color": "#5f9ae0"
},
"22rQF3gjjz8LifZC": {
"name": "La Psychédéliste",
"short_name": "Psychédéliste"
},
"AfHYkm3gqQ4fRRj5": {
"name": "HackENS",
"default_location": "Cave d'hackENS"
}
},
"frama-agenda": {
"qZcPZdGb5YtJHrNZ": {
"name": "ENSelle"
},
"K6iGBG47WXaKWs3Q": {
"name": "Créneaux encadrés",
"initial": false
},
"TFjE83ASCMK9rfRi": {
"name": "BandarrêtdurgENS",
"short_name": "Banda"
},
"dSYCtdC6bgyWpKyt": {
"name": "Évènements (BDS)"
},
"goXLq2dQ8LgFAjkM": {
"name": "Club Bouffe"
},
"Q8w6dw4jGLBP9ftB": {
"name": "Écocampus"
},
"T5WoHbs4FT5A945Z": {
"name": "CinéClub"
},
"zmgdYw62RatzmGDt": {
"name": "Ulmity"
},
"iXGysEGxo7EsKjwG": {
"name": "Ambassadeur·rice·s santé",
"short_name": "Amba. santé",
"color": "#f5a142"
},
"AYNpoC674yAjEmRy": {
"name": "L'Hômonerie"
},
"MJf2wnQafbLc2arS": {
"name": "Arts pla'",
"color": "#ffb969"
},
"qS7WJwyBaGRQFyX3": {
"name": "Exchange and international students",
"short_name": "Exchange"
},
"fGmpGCNZrHQkNt7L": {
"name": "Départements",
"short_name": "Dpt",
"initial": false
},
"W6qjeqEzEekNieWk": {
"name": "Évènements pour les masteriens",
"short_name": "Master"
},
"oDPMTBSma2bfo6WS": {
"name": "Amphis de rentrée",
"short_name": "Amphis",
"initial": false
},
"aPXtDmXDxmLxkERg": {
"name": "Divers rentrée",
"short_name": "Rentrée"
},
"fqK3nqqPtXLyo4Y4": {
"name": "Rentrée du COF",
"short_name": "COF"
},
"YQnfcozPDoRgNSBb": {
"name": "Rentrée du BDS",
"short_name": "BDS"
},
"tfA32kgc3GM2fH2C": {
"name": "Visites"
},
"KDNA4GrFMkkJrwNd": {
"name": "Associatif divers",
"short_name": "Asso"
}
}
}
}

65
data/locations.json Normal file
View file

@ -0,0 +1,65 @@
{
"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)",
"Cour des bibliothèques": "Cour du NIR",
"Salle Jaurès": "Amphithéâtre Jaurès",
"Jaurès": "Amphithéâtre Jaurès",
"Dussane": "Salle Dussane",
"Cour aux Ernest": "Cour aux Ernests",
"Restaurant": "Pôt",
"29 rue d'Ulm": "Bâtiment du 29",
"Gymnase": "Gymnase Jean Prévost",
"Pôt (Restaurant)": "Pôt"
},
"rooms": {
"45 rue d'Ulm": [
"Amphithéâtre Galois",
"Bibliothèque Lettres",
"Salle Histoire",
"Salle Aron",
"Salle Cavaillès",
"Salle Dussane",
"Salle des Actes",
"Salle des Résistants",
"Salle Cavaillès",
"Salle Cartan",
"Salle Noether",
"Salle Bourbaki",
"Petite salle ECLA",
"Salle Reig ECLA",
"Salle Césaire ECLA",
"Salle Beckett",
"Cour aux Ernests",
"Cour du NIR",
"Cour Pasteur",
"Pôt",
"Petit pôt",
"Canopée",
"K-Fêt",
"Cave d'hackENS",
"Gymnase Jean Prévost",
"Salle d'expression artistique (SEA)",
"Locaux des départements lettres et sciences humaines et sociales"
],
"24 rue Lhomond": ["Salle CONF IV"],
"29 rue d'Ulm": [
"Bâtiment du 29",
"Bibliothèque des sciences expérimentales",
"Amphithéâtre Jaurès"],
"Jourdan": [
"Campus de Jourdan",
"Bibliothèque de Jourdan",
"Salle Marcel Roncayolo (R2-05)",
"Salle Madeleine Rebérioux (R2-02)",
"Amphithéâtre Jourdan",
"R2-21",
"Salle Jean Ibanes"
]
}
}

View file

@ -1,9 +1,44 @@
{ pkgs ? import ./nix {} }:
{
production = pkgs.npmlock2nix.build {
src = ./.;
installPhase = "cp -r public/build $out";
buildCommands = [ "npm run build" ];
sources ? import ./npins,
pkgs ? import sources.nixpkgs { },
}:
let
inherit (pkgs.lib.fileset)
fileFilter
gitTrackedWith
intersection
toSource
;
in
{
package = pkgs.buildNpmPackage {
name = "metis";
src = toSource {
root = ./.;
fileset = intersection (gitTrackedWith { } ./.) (
fileFilter ({ name, hasExt, ... }: !(hasExt "nix") && name != "npins") ./.
);
};
npmDepsHash = "sha256-RbjWNVY8KlPP9ajQRnrsWhOZiiyyMGQSY39lmZnTC1I=";
installPhase = ''
cp -r public $out
'';
};
devShell = pkgs.mkShell {
name = "metis.dev";
packages = [ pkgs.nodejs ];
};
providers = {
eleves-ens = "cloud.eleves.ens.fr";
frama-agenda = "framagenda.org";
dgnum-nc = "cloud.dgnum.eu";
};
shell = import ./shell.nix { inherit pkgs; };
}

View file

@ -1,12 +0,0 @@
# nix/default.nix
{ pkgs ? import <nixpkgs> {} }:
let
sources = import ./sources.nix;
in
import sources.nixpkgs {
overlays = [
(self: super: {
npmlock2nix = pkgs.callPackage sources.npmlock2nix { };
})
];
}

View file

@ -1,38 +0,0 @@
{
"niv": {
"branch": "master",
"description": "Easy dependency management for Nix projects",
"homepage": "https://github.com/nmattia/niv",
"owner": "nmattia",
"repo": "niv",
"rev": "5830a4dd348d77e39a0f3c4c762ff2663b602d4c",
"sha256": "1d3lsrqvci4qz2hwjrcnd8h5vfkg8aypq3sjd4g3izbc8frwz5sm",
"type": "tarball",
"url": "https://github.com/nmattia/niv/archive/5830a4dd348d77e39a0f3c4c762ff2663b602d4c.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
"branch": "master",
"description": "Nix Packages collection",
"homepage": "",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "21.05",
"sha256": "1ckzhh24mgz6jd1xhfgx0i9mijk6xjqxwsshnvq789xsavrmsc36",
"type": "tarball",
"url": "https://github.com/nixos/nixpkgs/archive/21.05.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"npmlock2nix": {
"branch": "master",
"description": null,
"homepage": null,
"owner": "nix-community",
"repo": "npmlock2nix",
"rev": "ff17a3c59233911f776d8d462d61d82a3e41df34",
"sha256": "0l624gkkpn1r0g48b204k0wcqm9cwy5rzd5mnxwfjhyjj1wg4nl7",
"type": "tarball",
"url": "https://github.com/nix-community/npmlock2nix/archive/ff17a3c59233911f776d8d462d61d82a3e41df34.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}

View file

@ -1,174 +0,0 @@
# This file has been generated by Niv.
let
#
# The fetchers. fetch_<type> fetches specs of type <type>.
#
fetch_file = pkgs: name: spec:
let
name' = sanitizeName name + "-src";
in
if spec.builtin or true then
builtins_fetchurl { inherit (spec) url sha256; name = name'; }
else
pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
fetch_tarball = pkgs: name: spec:
let
name' = sanitizeName name + "-src";
in
if spec.builtin or true then
builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
else
pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
fetch_git = name: spec:
let
ref =
if spec ? ref then spec.ref else
if spec ? branch then "refs/heads/${spec.branch}" else
if spec ? tag then "refs/tags/${spec.tag}" else
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!";
in
builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; };
fetch_local = spec: spec.path;
fetch_builtin-tarball = name: throw
''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`.
$ niv modify ${name} -a type=tarball -a builtin=true'';
fetch_builtin-url = name: throw
''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`.
$ niv modify ${name} -a type=file -a builtin=true'';
#
# Various helpers
#
# https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695
sanitizeName = name:
(
concatMapStrings (s: if builtins.isList s then "-" else s)
(
builtins.split "[^[:alnum:]+._?=-]+"
((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name)
)
);
# The set of packages used when specs are fetched using non-builtins.
mkPkgs = sources: system:
let
sourcesNixpkgs =
import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; };
hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
in
if builtins.hasAttr "nixpkgs" sources
then sourcesNixpkgs
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
import <nixpkgs> {}
else
abort
''
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
add a package called "nixpkgs" to your sources.json.
'';
# The actual fetching function.
fetch = pkgs: name: spec:
if ! builtins.hasAttr "type" spec then
abort "ERROR: niv spec ${name} does not have a 'type' attribute"
else if spec.type == "file" then fetch_file pkgs name spec
else if spec.type == "tarball" then fetch_tarball pkgs name spec
else if spec.type == "git" then fetch_git name spec
else if spec.type == "local" then fetch_local spec
else if spec.type == "builtin-tarball" then fetch_builtin-tarball name
else if spec.type == "builtin-url" then fetch_builtin-url name
else
abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
# If the environment variable NIV_OVERRIDE_${name} is set, then use
# the path directly as opposed to the fetched source.
replace = name: drv:
let
saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name;
ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
in
if ersatz == "" then drv else
# this turns the string into an actual Nix path (for both absolute and
# relative paths)
if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}";
# Ports of functions for older nix versions
# a Nix version of mapAttrs if the built-in doesn't exist
mapAttrs = builtins.mapAttrs or (
f: set: with builtins;
listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269
stringAsChars = f: s: concatStrings (map f (stringToCharacters s));
concatMapStrings = f: list: concatStrings (map f list);
concatStrings = builtins.concatStringsSep "";
# https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331
optionalAttrs = cond: as: if cond then as else {};
# fetchTarball version that is compatible between all the versions of Nix
builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
let
inherit (builtins) lessThan nixVersion fetchTarball;
in
if lessThan nixVersion "1.12" then
fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
else
fetchTarball attrs;
# fetchurl version that is compatible between all the versions of Nix
builtins_fetchurl = { url, name ? null, sha256 }@attrs:
let
inherit (builtins) lessThan nixVersion fetchurl;
in
if lessThan nixVersion "1.12" then
fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
else
fetchurl attrs;
# Create the final "sources" from the config
mkSources = config:
mapAttrs (
name: spec:
if builtins.hasAttr "outPath" spec
then abort
"The values in sources.json should not have an 'outPath' attribute"
else
spec // { outPath = replace name (fetch config.pkgs name spec); }
) config.sources;
# The "config" used by the fetchers
mkConfig =
{ sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
, sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile)
, system ? builtins.currentSystem
, pkgs ? mkPkgs sources system
}: rec {
# The sources, i.e. the attribute set of spec name to spec
inherit sources;
# The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
inherit pkgs;
};
in
mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }

47
npins/default.nix Normal file
View file

@ -0,0 +1,47 @@
# Generated by npins. Do not modify; will be overwritten regularly
let
data = builtins.fromJSON (builtins.readFile ./sources.json);
version = data.version;
mkSource = spec:
assert spec ? type; let
path =
if spec.type == "Git" then mkGitSource spec
else if spec.type == "GitRelease" then mkGitSource spec
else if spec.type == "PyPi" then mkPyPiSource spec
else if spec.type == "Channel" then mkChannelSource spec
else builtins.throw "Unknown source type ${spec.type}";
in
spec // { outPath = path; };
mkGitSource = { repository, revision, url ? null, hash, ... }:
assert repository ? type;
# At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository
# In the latter case, there we will always be an url to the tarball
if url != null then
(builtins.fetchTarball {
inherit url;
sha256 = hash; # FIXME: check nix version & use SRI hashes
})
else assert repository.type == "Git"; builtins.fetchGit {
url = repository.url;
rev = revision;
# hash = hash;
};
mkPyPiSource = { url, hash, ... }:
builtins.fetchurl {
inherit url;
sha256 = hash;
};
mkChannelSource = { url, hash, ... }:
builtins.fetchTarball {
inherit url;
sha256 = hash;
};
in
if version == 3 then
builtins.mapAttrs (_: mkSource) data.pins
else
throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"

11
npins/sources.json Normal file
View file

@ -0,0 +1,11 @@
{
"pins": {
"nixpkgs": {
"type": "Channel",
"name": "nixpkgs-unstable",
"url": "https://releases.nixos.org/nixpkgs/nixpkgs-24.11pre696114.dfffb2e7a52d/nixexprs.tar.xz",
"hash": "15dj4hcx5wqcnxwfhh1gx2rpcwyip794bkmv0vpz4f01hibr7wd2"
}
},
"version": 3
}

3748
package-lock.json generated

File diff suppressed because it is too large Load diff

Binary file not shown.

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

135
public/favicon.svg Normal file
View file

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
viewBox="0 0 527.36377 527.36377"
version="1.1"
id="svg881"
sodipodi:docname="favicon.svg"
width="527.36377"
height="527.36377"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
inkscape:export-filename="/home/maurice/Downloads/metis-favicon.png"
inkscape:export-xdpi="5.825201"
inkscape:export-ydpi="5.825201"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs885">
<rect
x="157.84219"
y="108.54564"
width="211.10562"
height="65.459778"
id="rect14597" />
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath16">
<path
d="M 0,82 H 135 V 0 H 0 Z"
id="path18"
inkscape:connector-curvature="0" />
</clipPath>
</defs>
<sodipodi:namedview
id="namedview883"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:pageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="1.2151427"
inkscape:cx="199.56505"
inkscape:cy="263.75504"
inkscape:window-width="1916"
inkscape:window-height="1055"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg881" />
<!--! Font Awesome Pro 6.1.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. -->
<path
d="m 135.68189,39.68189 c 0,-17.67 14.3,-32.0000005 32,-32.0000005 17.7,0 32,14.3300005 32,32.0000005 v 32 h 128 v -32 c 0,-17.67 14.3,-32.0000005 32,-32.0000005 17.7,0 32,14.3300005 32,32.0000005 v 32 h 48 c 26.5,0 48,21.489996 48,48 v 48 H 39.681885 v -48 c 0,-26.510004 21.49,-48 48,-48 h 48.000005 z m 352,432 c 0,26.5 -21.5,48 -48,48 H 87.681885 c -26.51,0 -48,-21.5 -48,-48 v -272 H 487.68189 Z"
id="path879"
style="fill:#ffb100;fill-opacity:1;stroke:#000000;stroke-width:15.3638;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<g
id="g12"
transform="matrix(8.1181738,0,0,-8.1181738,-136.28135,813.9558)">
<g
id="g14"
clip-path="url(#clipPath16)"
style="stroke-width:1.00003;stroke-miterlimit:10;stroke-dasharray:none"
transform="matrix(0.90606594,0,0,0.90606594,5.1759162,5.1181535)">
<g
id="g24"
transform="translate(48.915,39.1377)"
style="stroke-width:1.00003;stroke-miterlimit:10;stroke-dasharray:none" />
<g
id="g114"
transform="matrix(1.138726,0,0,1.138726,49.836843,55.407254)"
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.00003;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1">
<path
d="m 0,0 c -1.48,-0.458 -2.619,-2.003 -3.821,-2.172 -3.179,-0.444 -6.965,2.365 -9.87,0.239 -0.486,-0.357 -1.201,-1.776 -0.24,-2.432 3.148,-2.149 7.176,-1.21 10.737,-2.169 -5.417,-4.223 -11.757,-6.894 -17.515,-10.55 0.002,3.387 2.744,5.677 3.032,9.168 0.299,3.624 -1.54,6.393 -2.115,9.584 -1.345,7.464 7.013,11.613 12.85,14.124 6.897,2.967 15.394,3.251 22.293,-0.692 -1.6,-1.249 -3.583,-1.741 -5.057,-3.357 4.232,-1.272 6.09,-4.68 8.353,-9.166 C 13.486,-1.167 8.028,-1.368 1.437,0.398 1.068,0.498 0.508,0.157 0,-0.001"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.00003;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
id="path116"
inkscape:connector-curvature="0" />
</g>
<g
id="g118"
transform="matrix(1.0533081,0,0,1.0533081,46.728724,57.977314)"
style="fill:#ffb100;fill-opacity:1;stroke-width:1.00003;stroke-miterlimit:10;stroke-dasharray:none">
<path
d="m 0,0 c 6.503,-1.201 15.339581,-3.7536631 20.604581,0.37633686 -1.034,0.594 -2.342,0.214 -3.289,1.02600004 1.183,-0.339 2.638,-0.286 3.943,-0.64600004 -1.328,3.05700004 -3.389,7.00400004 -6.98,7.90700004 C 10.505581,9.6103369 6.535,6.194 3.612,3.752 1.053,1.614 -2.884,1.998 -6.27,1.88 c 0.623,1.958 0.605,4.212 1.959,5.786 1.226,1.427 3.305,-0.265 5.013,-0.449 -1.695,-1.122 -3.6,1.522 -4.745,0.067 -1.023,-1.299 -1.11,-3.301 -1.572,-5.025 3.109,0.483 6.499,-0.064 8.828,1.989 1.16,1.023 2.181,2.211 3.494,3.266 1.455,1.169 3.387,2.175 5.018,2.569 -9.183,3.223 -19.29,2.438 -26.929,-4.006 -1.041,-0.878 -1.786,-2.02 -1.97,-3.703 -0.24,-2.207 0.623,-3.698 1.206,-5.655 3.869,4.09 10.042,4.376 15.968,3.28"
style="fill:#ffb100;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.00003;stroke-miterlimit:10;stroke-dasharray:none"
id="path120"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccccccccccc" />
</g>
<g
id="g122"
transform="translate(46.010492,54.896804)"
style="fill:#ffb100;fill-opacity:1;stroke-width:1.00003;stroke-miterlimit:10;stroke-dasharray:none">
<path
d="m 1.8278919,1.1767903 c -5.491,1.368 -12.3006309,2.2592192 -16.8369859,-1.94838701 -2.01,-2.43999999 1.236239,-7.18439019 -0.896761,-10.61139029 -0.96,-1.546 -1.61,-3.694 -2.187,-5.317 5.143,3.314 10.5119533,5.91138 15.7109533,9.3173804 -3.416,0.905 -8.6990003,-0.542 -10.7970003,2.734 -0.612,0.957 -0.513766,4.13336544 2.817794,4.52239691 3.1899999,0.477 6.1269999,-0.728 9.38699989,-0.822 0.522,-0.016 1.754,1.297 1.754,1.297"
style="fill:#ffb100;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.00003;stroke-miterlimit:10;stroke-dasharray:none"
id="path124"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccc" />
</g>
<g
id="g126"
transform="translate(57.289806,70.531922)"
style="fill:#ffb100;fill-opacity:1;stroke-width:1.00003;stroke-miterlimit:10;stroke-dasharray:none">
<path
d="M 0.76507845,-0.24497265 C 3.5610784,-1.2089727 5.3840784,0.93702735 7.3380784,2.2830273 -2.7240356,5.9072531 -12.30118,3.8886216 -22.402066,-1.7568934 -13.88871,1.5173778 -7.0659216,2.4490273 0.76507845,-0.24497265"
style="fill:#ffb100;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.00003;stroke-miterlimit:10;stroke-dasharray:none"
id="path128"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
</g>
<g
id="g134"
transform="translate(60.55138,64.731179)"
style="fill:#000000;fill-opacity:1;stroke-width:1.00003;stroke-miterlimit:10;stroke-dasharray:none">
<path
d="m 0,0 c 0.29,-0.175 0.599,-0.685 0.5,-0.882 -0.527,-1.054 -1.978,-0.497 -1.83,0.484 0.055,0.364 0.831,0.697 1.33,0.397"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.00003;stroke-miterlimit:10;stroke-dasharray:none"
id="path136"
inkscape:connector-curvature="0" />
</g>
</g>
</g>
<text
xml:space="preserve"
id="text14595"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:1.25;font-family:'Liberation Mono';-inkscape-font-specification:'Liberation Mono';text-align:center;white-space:pre;shape-inside:url(#rect14597);fill:#000000;fill-opacity:1;stroke:none"
x="38.925781"
y="0"
transform="translate(-30.329907,-19.815924)" />
</svg>

After

Width:  |  Height:  |  Size: 7.5 KiB

View file

@ -4,9 +4,9 @@
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width,initial-scale=1'>
<title>Calendrier du Club Réseau</title>
<title>Calendrier de la DGNum</title>
<link rel='icon' type='image/png' href='/favicon.png'>
<link rel='icon' href='/favicon.svg'>
<link rel='stylesheet' href='/global.css'>
<link rel='stylesheet' href='/build/bundle.css'>

View file

@ -1,5 +1 @@
{ pkgs ? import ./nix {} }:
pkgs.npmlock2nix.shell {
src = ./.;
nodejs = pkgs.nodejs-14_x;
}
(import ./. { }).devShell

View file

@ -22,7 +22,7 @@
import bootstrap5Plugin from '@fullcalendar/bootstrap5';
import { Tooltip } from 'bootstrap';
import ENSLocations from './static-ens-locations.json';
import LOCATIONS from '../data/locations.json';
const event = writable(null);
@ -95,13 +95,14 @@
scrollTime: '08:00:00',
resourceGroupField: 'building',
resourceAreaWidth: '27%',
resources: Object.entries(ENSLocations).flatMap(([building, rooms]) =>
resources: Object.entries(LOCATIONS.rooms).flatMap(([building, rooms]) =>
rooms.map(room => ({
id: `${building}-${room}`,
building,
title: room
}))
),
filterResourcesWithEvents: true,
height: '100%',
schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
nowIndicator: true,
@ -121,6 +122,11 @@
isLoading = b;
if (spinner) {
spinner.$set({ isLoading: b });
if (b) {
setTimeout(() => {
spinner.$set({ isLoading: false });
}, 3000);
}
}
},
eventSources: [],
@ -129,10 +135,14 @@
progressiveEventRendering: true,
expandRows: true,
eventDidMount: info => {
new Tooltip(info.el, {
title: info.event.extendedProps.short_name,
placement: 'top'
});
const title = info.event.extendedProps.short_name;
if (title !== undefined) {
new Tooltip(info.el, {
title: title,
trigger: 'hover',
placement: 'top'
});
}
},
viewDidMount: arg => {
spinner = new Spinner({
@ -195,6 +205,12 @@
<FullCalendar bind:this={calendar} options={$options} />
<EventModal event={$event} open={openModal} {toggle} />
<script
defer
data-domain="calendrier.dgnum.eu"
src="https://analytics.dgnum.eu/js/script.js"
></script>
</div>
<style>

View file

@ -56,7 +56,10 @@
</span>
<span>
{#if event.allDay}
{#if event.extendedProps.simAllDay}
<Icon name="calendar-range" class="text-primary" />
<span class="ms-1">{dateFormat(event.start)} ({timeFormat(event.extendedProps.realStart)}) - {dateFormat(event.end)} ({timeFormat(event.extendedProps.realEnd)})</span>
{:else if event.allDay}
<Icon name="calendar-range" class="text-primary" />
<span class="ms-1">{dateFormat(event.start)} - {dateFormat(event.end)}</span>
{:else}

View file

@ -17,7 +17,7 @@
<ModalBody>
<p>Calendrier commun de la vie étudiante de l'ENS</p>
<b>Comment rajouter son calendrier :</b>
<b>Comment rajouter son calendrier&nbsp;:</b>
<ul>
<li>
Utiliser un NextCloud, idéalement
@ -26,15 +26,18 @@
</li>
<li>Créer un calendrier dessus, créer un lien de partage public.</li>
<li>
Envoyer le lien de partage public au Club Réseau<br />
(club-reseau [at] lists [.] ens [.] psl [.] eu) pour faire une requête d'ajout.
Envoyer le lien de partage public à la DGNum<br />
(calendrier [at] dgnum [.] eu) pour faire une requête d'ajout.
</li>
</ul>
<p>Code source&nbsp;:
<a href="https://git.dgnum.eu/DGNum/metis">https://git.dgnum.eu/DGNum/metis</a>
</p>
</ModalBody>
<ModalFooter>
<Icon name="balloon-heart" class="text-danger fs-5" />
<span class="fs-7">Propulsé par le Club Réseau de l'ENS</span>
<span class="fs-7">Propulsé par la <a href="https://dgnum.eu">Délégation Générale Numérique</a></span>
</ModalFooter>
</Modal>

View file

@ -9,6 +9,8 @@
Toast
} from 'sveltestrap';
import { ancestors } from './calendar';
export let calendar = null;
export let selectedCalendars = [];
@ -33,6 +35,16 @@
.finally((isToastOpen = true));
};
const filter = calendars => {
let reduced = [];
calendars.forEach(c => {
if (!ancestors[c].some(p => calendars.includes(p))) {
reduced.push(c);
}
});
return reduced;
};
const updateShareLink = () => {
const loc = document.location;
const search = new URLSearchParams();
@ -41,7 +53,7 @@
if (calendar !== null) {
search.append('v', api.view.type);
selectedCalendars.forEach(c => search.append('c', c));
filter(selectedCalendars).forEach(c => search.append('c', c));
search.append('d', api.getDate().toISOString());
}

View file

@ -1,4 +1,5 @@
import STATIC_LOCATIONS from './static-ens-locations.json'
import CALENDARS from '../data/calendars.json'
import LOCATIONS from '../data/locations.json'
// https://stackoverflow.com/a/35970186
function invertColor(hex) {
@ -19,124 +20,19 @@ function invertColor(hex) {
return r * 0.299 + g * 0.587 + b * 0.114 > 186 ? '#000000' : '#FFFFFF'
}
const clouds = {
KLUB_RESEAU: 'klub-reseau',
ELEVES_ENS: 'eleves-ens',
FRAMA_AGENDA: 'frama-agenda'
const parseCalendars = () => {
let calendars = {};
for (const [cloud, cals] of Object.entries(CALENDARS.sources)) {
for (const [id, attrs] of Object.entries(cals)) {
calendars[id] = { cloud: cloud, ...attrs }
}
}
return calendars;
}
const calendars = {
'5WrcagPPARQ3BD87': {
cloud: clouds.KLUB_RESEAU,
name: 'Club réseau',
color: null,
default_location: "Cave d'hackENS"
},
TFEAKjAgNFQZpNjo: {
cloud: clouds.KLUB_RESEAU,
name: 'hackENS',
color: null,
default_location: "Cave d'hackENS"
},
LLWm8qK9iC5YGrrR: {
cloud: clouds.ELEVES_ENS,
name: 'Délégation Générale',
short_name: 'DG',
color: null
},
'2KGkWzBJGorxzyTW': {
cloud: clouds.ELEVES_ENS,
name: "La Nuit de l'ENS",
short_name: 'La Nuit',
color: null
},
w442JdS5AaQ6czrP: {
cloud: clouds.ELEVES_ENS,
name: "Écriv'ENS",
color: null
},
fRtjDkjrZyn6fxd8: {
cloud: clouds.ELEVES_ENS,
name: 'K-Fêt',
color: '#c63b52',
default_location: 'K-Fêt'
},
gsZtZK8c9EmREofn: {
cloud: clouds.ELEVES_ENS,
name: 'Ernestophone',
color: null
},
dTHrXnYgsEoSTjWB: {
cloud: clouds.ELEVES_ENS,
name: 'Évènements (COF)',
short_name: 'COF',
color: null
},
bCgRFByHLiCCNc55: {
cloud: clouds.ELEVES_ENS,
name: 'Assemblées Générales (COF)',
short_name: 'AG COF',
color: null
},
r4yJZDHjwNtH8wkR: {
cloud: clouds.ELEVES_ENS,
name: 'BdA',
color: null
},
T5WoHbs4FT5A945Z: {
cloud: clouds.FRAMA_AGENDA,
name: 'CinéClub',
color: null
},
'6SHG6cg9d7S3qqwD': {
cloud: clouds.ELEVES_ENS,
name: 'Club Inutile ☔',
color: null,
initial: false
},
Ekjb4kDqMMqwJXZF: {
cloud: clouds.ELEVES_ENS,
name: 'Rentrée des départements',
short_name: 'Dpt',
color: null
},
'8SKP62tQJP65K8EW': {
cloud: clouds.ELEVES_ENS,
name: 'Conférences de recherche',
short_name: 'Conf',
color: null
},
PnRXqeq4SsSC33FM: {
cloud: clouds.ELEVES_ENS,
name: 'Visites de bibliothèques',
short_name: 'Bibli',
initial: false,
color: null
},
NWPtiEiz62LTtjo2: {
cloud: clouds.ELEVES_ENS,
name: 'Amphis de rentrée',
short_name: 'Prés. de rentrée',
color: null
},
JiRt58aJXay9kfyk: {
cloud: clouds.ELEVES_ENS,
name: 'Réunions de rentrée des Masters',
short_name: 'Masters',
color: null
},
'5Rb4bRjCDcsFjDdQ': {
cloud: clouds.ELEVES_ENS,
name: 'Activités pour les étudiants internationaux',
short_name: 'Internationaux',
color: null
},
'62wKfQRrLNz2WXjt': {
cloud: clouds.ELEVES_ENS,
name: 'Divers',
color: null
}
}
const calendars = parseCalendars()
const calendarsByName = Object.fromEntries(
Object.entries(calendars).map(([id, { name }]) => [name, id])
@ -148,34 +44,21 @@ export const initialCalendars = Array.from(
.filter(cal => cal[1])
.map(cal => cal[0])
export const calendarTree = {
COF: {
BdA: {},
'Évènements (COF)': {},
'Assemblées Générales (COF)': {}
},
'Clubs COF': {
'Club réseau': {},
hackENS: {},
"Écriv'ENS": {},
CinéClub: {},
Ernestophone: {},
'Club Inutile ☔': {}
},
"La Nuit de l'ENS": {},
'Délégation Générale': {},
'K-Fêt': {},
'Rentrée académique': {
'Amphis de rentrée': {},
'Rentrée des départements': {},
'Conférences de recherche': {},
'Visites de bibliothèques': {},
'Réunions de rentrée des Masters': {},
'Activités pour les étudiants internationaux': {}
},
Divers: {}
export const calendarTree = CALENDARS.tree
const dfs = (p, t, l) => {
for (const [c, s] of Object.entries(t)) {
l[c] = p === null ? [] : [p, ...l[p]]
dfs(c, s, l)
}
}
export const ancestors = (() => {
let l = []
dfs(null, calendarTree, l)
return l
})()
export function getSubCalendars(name, tree = calendarTree) {
let ret
for (const [cal, subTree] of Object.entries(tree)) {
@ -234,17 +117,9 @@ class Calendar {
}
function findLocationId(location) {
const adhocMap = {
'Amphi Jourdan': 'Amphithéâtre Jourdan',
'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)'
}
const correctedLocation = LOCATIONS.nameMap[location] || location
const correctedLocation = adhocMap[location] || location
const result = Object.entries(STATIC_LOCATIONS).find(([building, rooms]) =>
const result = Object.entries(LOCATIONS.rooms).find(([building, rooms]) =>
rooms.includes(correctedLocation)
)
@ -257,13 +132,31 @@ function fcEventFromjCalEvent(cal) {
return function (evt) {
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: evt.dtstart,
end: evt.dtend,
color: cal.color,
textColor: invertColor(cal.color),
duration: end - start // in ms
duration: duration
}
if (!allDay && (duration > dayMs - 1)) {
fcEvent.allDay = true
fcEvent.simAllDay = true
fcEvent.realStart = new Date(start)
fcEvent.realEnd = new Date(end)
fcEvent.start = start.setUTCHours(0, 0, 0)
fcEvent.end = end.setUTCHours(23, 59, 59)
fcEvent.duration = end - start // Update the duration
}
fcEvent.calendar = cal.name
@ -297,14 +190,6 @@ function fcEventFromjCalEvent(cal) {
}
}
function mkEventsFromCalendar(id, cal) {
return fetchCalendar(id, cal).then(calendar => {
if (calendar[0] !== 'vcalendar') return
const cal = new Calendar(id, calendar)
return cal.events.map(fcEventFromjCalEvent(cal))
})
}
export function mkSource(name) {
const calendarId = calendarsByName[name]
if (!calendarId) return null

View file

@ -1,34 +0,0 @@
{
"45 rue d'Ulm": [
"Amphithéâtre Galois",
"Bibliothèque Lettres",
"Salle Histoire",
"Salle Cavaillès",
"Salle Dussane",
"Salle des Actes",
"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"
],
"24 rue Lhomond": ["Salle CONF IV"],
"29 rue d'Ulm": ["Bibliothèque des sciences expérimentales", "Salle Jaurès"],
"Jourdan": [
"Bibliothèque de Jourdan",
"Salle Marcel Roncayolo (R2-05)",
"Salle Madeleine Rebérioux (R2-02)",
"Amphithéâtre Jourdan",
"R2-21",
"Salle Jean Ibanes"
]
}