forked from DGNum/metis
Compare commits
4 commits
master
...
mdebray/at
Author | SHA1 | Date | |
---|---|---|---|
|
7cc7f811b1 | ||
|
5451f0d4cc | ||
|
385bc808a7 | ||
|
d4b4c2ba04 |
24 changed files with 3789 additions and 971 deletions
1
.envrc
1
.envrc
|
@ -1 +0,0 @@
|
|||
use nix
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,5 +1,2 @@
|
|||
node_modules
|
||||
public/build
|
||||
result
|
||||
|
||||
.direnv
|
||||
|
|
|
@ -1,198 +0,0 @@
|
|||
{
|
||||
"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": {
|
||||
"É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": {
|
||||
"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": {
|
||||
"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"
|
||||
},
|
||||
"QXGnDTA8GS6r876F": {
|
||||
"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"
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"MJf2wnQafbLc2arS": {
|
||||
"name": "Arts pla'",
|
||||
"color": "#ffb969"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
{
|
||||
"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"
|
||||
},
|
||||
|
||||
"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",
|
||||
"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"
|
||||
]
|
||||
}
|
||||
}
|
12
default.nix
12
default.nix
|
@ -1,13 +1,9 @@
|
|||
{ pkgs ? import (import ./npins).nixpkgs {} }:
|
||||
{ pkgs ? import ./nix {} }:
|
||||
{
|
||||
production = pkgs.buildNpmPackage {
|
||||
name = "metis";
|
||||
production = pkgs.npmlock2nix.build {
|
||||
src = ./.;
|
||||
npmDepsHash = "sha256-RbjWNVY8KlPP9ajQRnrsWhOZiiyyMGQSY39lmZnTC1I=";
|
||||
installPhase = ''
|
||||
cp -r public $out
|
||||
'';
|
||||
installPhase = "cp -r public/build $out";
|
||||
buildCommands = [ "npm run build" ];
|
||||
};
|
||||
shell = import ./shell.nix { inherit pkgs; };
|
||||
providers = import ./providers.nix;
|
||||
}
|
||||
|
|
12
nix/default.nix
Normal file
12
nix/default.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
# nix/default.nix
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
let
|
||||
sources = import ./sources.nix;
|
||||
in
|
||||
import sources.nixpkgs {
|
||||
overlays = [
|
||||
(self: super: {
|
||||
npmlock2nix = pkgs.callPackage sources.npmlock2nix { };
|
||||
})
|
||||
];
|
||||
}
|
38
nix/sources.json
Normal file
38
nix/sources.json
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"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"
|
||||
}
|
||||
}
|
174
nix/sources.nix
Normal file
174
nix/sources.nix
Normal file
|
@ -0,0 +1,174 @@
|
|||
# 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); }
|
|
@ -1,47 +0,0 @@
|
|||
# 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`"
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"pins": {
|
||||
"nixpkgs": {
|
||||
"type": "Channel",
|
||||
"name": "nixpkgs-unstable",
|
||||
"url": "https://releases.nixos.org/nixpkgs/nixpkgs-23.11pre506449.f465da16626/nixexprs.tar.xz",
|
||||
"hash": "14jsw1gv83qjz82384gfhn78sv9m14i1bs5l97xrab26vyi9b5ay"
|
||||
}
|
||||
},
|
||||
"version": 3
|
||||
}
|
3748
package-lock.json
generated
3748
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,7 +0,0 @@
|
|||
let
|
||||
providers = {
|
||||
eleves-ens = "cloud.eleves.ens.fr";
|
||||
frama-agenda = "framagenda.org";
|
||||
};
|
||||
in
|
||||
builtins.mapAttrs (name: value: "https://${value}/remote.php/dav/public-calendars/") providers
|
BIN
public.tar.gz
Normal file
BIN
public.tar.gz
Normal file
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 4.2 KiB |
BIN
public/favicon.png
Normal file
BIN
public/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
|
@ -1,135 +0,0 @@
|
|||
<?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>
|
Before Width: | Height: | Size: 7.5 KiB |
|
@ -4,9 +4,9 @@
|
|||
<meta charset='utf-8'>
|
||||
<meta name='viewport' content='width=device-width,initial-scale=1'>
|
||||
|
||||
<title>Calendrier de la DGNum</title>
|
||||
<title>Calendrier du Club Réseau</title>
|
||||
|
||||
<link rel='icon' href='/favicon.svg'>
|
||||
<link rel='icon' type='image/png' href='/favicon.png'>
|
||||
<link rel='stylesheet' href='/global.css'>
|
||||
<link rel='stylesheet' href='/build/bundle.css'>
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{ pkgs ? import (import ./npins).nixpkgs {} }:
|
||||
pkgs.mkShell {
|
||||
packages = [ pkgs.nodejs ];
|
||||
{ pkgs ? import ./nix {} }:
|
||||
pkgs.npmlock2nix.shell {
|
||||
src = ./.;
|
||||
nodejs = pkgs.nodejs-14_x;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
import bootstrap5Plugin from '@fullcalendar/bootstrap5';
|
||||
import { Tooltip } from 'bootstrap';
|
||||
|
||||
import LOCATIONS from '../data/locations.json';
|
||||
import ENSLocations from './static-ens-locations.json';
|
||||
|
||||
const event = writable(null);
|
||||
|
||||
|
@ -95,7 +95,7 @@
|
|||
scrollTime: '08:00:00',
|
||||
resourceGroupField: 'building',
|
||||
resourceAreaWidth: '27%',
|
||||
resources: Object.entries(LOCATIONS.rooms).flatMap(([building, rooms]) =>
|
||||
resources: Object.entries(ENSLocations).flatMap(([building, rooms]) =>
|
||||
rooms.map(room => ({
|
||||
id: `${building}-${room}`,
|
||||
building,
|
||||
|
@ -121,11 +121,6 @@
|
|||
isLoading = b;
|
||||
if (spinner) {
|
||||
spinner.$set({ isLoading: b });
|
||||
if (b) {
|
||||
setTimeout(() => {
|
||||
spinner.$set({ isLoading: false });
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
},
|
||||
eventSources: [],
|
||||
|
@ -134,14 +129,10 @@
|
|||
progressiveEventRendering: true,
|
||||
expandRows: true,
|
||||
eventDidMount: info => {
|
||||
const title = info.event.extendedProps.short_name;
|
||||
if (title !== undefined) {
|
||||
new Tooltip(info.el, {
|
||||
title: title,
|
||||
trigger: 'hover',
|
||||
placement: 'top'
|
||||
});
|
||||
}
|
||||
new Tooltip(info.el, {
|
||||
title: info.event.extendedProps.short_name,
|
||||
placement: 'top'
|
||||
});
|
||||
},
|
||||
viewDidMount: arg => {
|
||||
spinner = new Spinner({
|
||||
|
@ -204,8 +195,6 @@
|
|||
<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>
|
||||
|
|
|
@ -40,11 +40,23 @@
|
|||
</p>
|
||||
{/if}
|
||||
|
||||
<p>
|
||||
{#if event.extendedProps.description}
|
||||
{@html md.render(event.extendedProps.description)}
|
||||
{:else}
|
||||
<i class="fs-7">Pas de description</i>
|
||||
{/if}
|
||||
</p>
|
||||
{#if event.extendedProps.speakers}
|
||||
<p class="fs-7 mb-1">
|
||||
<strong>Intervenant·e{#if event.extendedProps.speakers.size > 1}·s{/if} :</strong>
|
||||
</p>
|
||||
<ul class="fs-7">
|
||||
{#each event.extendedProps.speakers as s}
|
||||
<li>{s.cn}</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
</ModalBody>
|
||||
|
||||
<ModalFooter class="justify-content-between">
|
||||
|
@ -56,10 +68,7 @@
|
|||
</span>
|
||||
|
||||
<span>
|
||||
{#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}
|
||||
{#if event.allDay}
|
||||
<Icon name="calendar-range" class="text-primary" />
|
||||
<span class="ms-1">{dateFormat(event.start)} - {dateFormat(event.end)}</span>
|
||||
{:else}
|
||||
|
|
|
@ -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 :</b>
|
||||
<ul>
|
||||
<li>
|
||||
Utiliser un NextCloud, idéalement
|
||||
|
@ -26,18 +26,15 @@
|
|||
</li>
|
||||
<li>Créer un calendrier dessus, créer un lien de partage public.</li>
|
||||
<li>
|
||||
Envoyer le lien de partage public à la DGNum<br />
|
||||
(calendrier [at] dgnum [.] eu) pour faire une requête d'ajout.
|
||||
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.
|
||||
</li>
|
||||
</ul>
|
||||
<p>Code source :
|
||||
<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 la <a href="https://dgnum.eu">Délégation Générale Numérique</a></span>
|
||||
<span class="fs-7">Propulsé par le Club Réseau de l'ENS</span>
|
||||
</ModalFooter>
|
||||
</Modal>
|
||||
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
Toast
|
||||
} from 'sveltestrap';
|
||||
|
||||
import { ancestors } from './calendar';
|
||||
|
||||
export let calendar = null;
|
||||
export let selectedCalendars = [];
|
||||
|
||||
|
@ -35,16 +33,6 @@
|
|||
.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();
|
||||
|
@ -53,7 +41,7 @@
|
|||
if (calendar !== null) {
|
||||
search.append('v', api.view.type);
|
||||
|
||||
filter(selectedCalendars).forEach(c => search.append('c', c));
|
||||
selectedCalendars.forEach(c => search.append('c', c));
|
||||
|
||||
search.append('d', api.getDate().toISOString());
|
||||
}
|
||||
|
|
217
src/calendar.js
217
src/calendar.js
|
@ -1,5 +1,4 @@
|
|||
import CALENDARS from '../data/calendars.json'
|
||||
import LOCATIONS from '../data/locations.json'
|
||||
import STATIC_LOCATIONS from './static-ens-locations.json'
|
||||
|
||||
// https://stackoverflow.com/a/35970186
|
||||
function invertColor(hex) {
|
||||
|
@ -20,19 +19,124 @@ function invertColor(hex) {
|
|||
return r * 0.299 + g * 0.587 + b * 0.114 > 186 ? '#000000' : '#FFFFFF'
|
||||
}
|
||||
|
||||
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 clouds = {
|
||||
KLUB_RESEAU: 'klub-reseau',
|
||||
ELEVES_ENS: 'eleves-ens',
|
||||
FRAMA_AGENDA: 'frama-agenda'
|
||||
}
|
||||
|
||||
const calendars = parseCalendars()
|
||||
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 calendarsByName = Object.fromEntries(
|
||||
Object.entries(calendars).map(([id, { name }]) => [name, id])
|
||||
|
@ -44,21 +148,34 @@ export const initialCalendars = Array.from(
|
|||
.filter(cal => cal[1])
|
||||
.map(cal => cal[0])
|
||||
|
||||
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 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 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)) {
|
||||
|
@ -110,16 +227,34 @@ class Calendar {
|
|||
_parse_vevent(vevent) {
|
||||
const event = {}
|
||||
vevent.forEach(elt => {
|
||||
event[elt[0]] = elt[3]
|
||||
switch (elt[0]) {
|
||||
case "attendee":
|
||||
if (event[elt[0]] === undefined) event[elt[0]] = []
|
||||
event[elt[0]].push({
|
||||
props: elt[1],
|
||||
val: elt[3]
|
||||
})
|
||||
break
|
||||
default:
|
||||
event[elt[0]] = elt[3]
|
||||
}
|
||||
})
|
||||
return event
|
||||
}
|
||||
}
|
||||
|
||||
function findLocationId(location) {
|
||||
const correctedLocation = LOCATIONS.nameMap[location] || 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 result = Object.entries(LOCATIONS.rooms).find(([building, rooms]) =>
|
||||
const correctedLocation = adhocMap[location] || location
|
||||
|
||||
const result = Object.entries(STATIC_LOCATIONS).find(([building, rooms]) =>
|
||||
rooms.includes(correctedLocation)
|
||||
)
|
||||
|
||||
|
@ -132,31 +267,13 @@ 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: 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
|
||||
duration: end - start // in ms
|
||||
}
|
||||
|
||||
fcEvent.calendar = cal.name
|
||||
|
@ -173,6 +290,10 @@ function fcEventFromjCalEvent(cal) {
|
|||
fcEvent.classNames = [`st-${evt.status.toLowerCase()}`]
|
||||
}
|
||||
|
||||
if (evt.attendee) {
|
||||
fcEvent.speakers = evt.attendee.filter(a => a.prop.cn && a.prop.role === "REQ-PARTICIPANT")
|
||||
}
|
||||
|
||||
if (evt.rrule) {
|
||||
const { freq, byday, interval } = evt.rrule
|
||||
fcEvent.rrule = {
|
||||
|
|
34
src/static-ens-locations.json
Normal file
34
src/static-ens-locations.json
Normal file
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"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"
|
||||
]
|
||||
}
|
Loading…
Reference in a new issue