Compare commits

..

1 commit

Author SHA1 Message Date
c45c4e3d45 Move room and calendar data to a specific folder 2022-09-12 17:34:19 +02:00
17 changed files with 3643 additions and 736 deletions

1
.gitignore vendored
View file

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

View file

@ -1,75 +1,37 @@
{ {
"tree": { "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": { "COF": {
"BdA": {},
"Évènements (COF)": {}, "Évènements (COF)": {},
"Rentrée du COF": {}, "Assemblées Générales (COF)": {}
"Assemblées Générales (COF)": {},
"BdA": {
"Évènements (BdA)": {},
"Spectacles du tirage BdA": {}
}
}, },
"Clubs COF": { "Clubs COF": {
"PLS": {}, "Club réseau": {},
"HackENS": {}, "hackENS": {},
"Club Bouffe": {},
"Écriv'ENS": {}, "Écriv'ENS": {},
"BOcal": {},
"CinéClub": {}, "CinéClub": {},
"Ernestophone": {}, "Ernestophone": {},
"Club Jeux": {},
"DDR": {}, "DDR": {},
"BandarrêtdurgENS": {}, "BandarrêtdurgENS": {},
"L'Hômonerie": {},
"Ulmity": {},
"Arts pla'": {},
"Club Inutile ☔": {} "Club Inutile ☔": {}
}, },
"BDS": { "BDS": {},
"Évènements (BDS)": {},
"Rentrée du BDS": {}
},
"Clubs BDS": {
"Valse": {},
"Créneaux encadrés": {},
"ENSelle": {}
},
"La Nuit de l'ENS": {}, "La Nuit de l'ENS": {},
"Délégation Générale": {}, "Délégation Générale": {},
"K-Fêt": {}, "K-Fêt": {},
"Écocampus": {}, "Rentrée académique": {
"La Psychédéliste": {}, "Amphis de rentrée": {},
"Ambassadeur·rice·s santé": {} "Rentrée des départements": {},
}, "Conférences de recherche": {},
"sources": { "Visites de bibliothèques": {},
"dgnum-nc": { "Réunions de rentrée des Masters": {},
"dmo7DgdmTnsMd8zo": { "Activités pour les étudiants internationaux": {}
"name": "Valse"
},
"eEPk6miCzozgPb42": {
"name": "Délégation Générale Numérique",
"short_name": "DGNum",
"color": "#27327a"
}
}, },
"Divers": {}
},
"sources": {
"eleves-ens": { "eleves-ens": {
"qG6jpJPfK37Nw8ZC": {
"name": "PLS"
},
"caey6jt6pTgKengA": {
"name": "BOcal",
"color": "#e6973e"
},
"LLWm8qK9iC5YGrrR": { "LLWm8qK9iC5YGrrR": {
"name": "Délégation Générale", "name": "Délégation Générale",
"short_name": "DG" "short_name": "DG"
@ -81,7 +43,7 @@
"w442JdS5AaQ6czrP": { "w442JdS5AaQ6czrP": {
"name": "Écriv'ENS" "name": "Écriv'ENS"
}, },
"aoazRGFcjHSe4LxG": { "fRtjDkjrZyn6fxd8": {
"name": "K-Fêt", "name": "K-Fêt",
"color": "#c63b52", "color": "#c63b52",
"default_location": "K-Fêt" "default_location": "K-Fêt"
@ -98,12 +60,7 @@
"short_name": "AG COF" "short_name": "AG COF"
}, },
"r4yJZDHjwNtH8wkR": { "r4yJZDHjwNtH8wkR": {
"name": "Évènements (BdA)" "name": "BdA"
},
"83AkowSYPnYrjSFr": {
"name": "Spectacles du tirage BdA",
"short_name": "Spectacles",
"initial": false
}, },
"ZtWm3MYSi388k2yk": { "ZtWm3MYSi388k2yk": {
"name": "DDR" "name": "DDR"
@ -115,99 +72,59 @@
"name": "Club Inutile ☔", "name": "Club Inutile ☔",
"initial": false "initial": false
}, },
"Ekjb4kDqMMqwJXZF": {
"name": "Rentrée des départements",
"short_name": "Dpt"
},
"8SKP62tQJP65K8EW": {
"name": "Conférences de recherche",
"short_name": "Conf"
},
"PnRXqeq4SsSC33FM": {
"name": "Visites de bibliothèques",
"short_name": "Bibli",
"initial": false
},
"NWPtiEiz62LTtjo2": {
"name": "Amphis de rentrée",
"short_name": "Prés. de rentrée"
},
"JiRt58aJXay9kfyk": {
"name": "Réunions de rentrée des Masters",
"short_name": "Masters"
},
"5Rb4bRjCDcsFjDdQ": {
"name": "Activités pour les étudiants internationaux",
"short_name": "Internationaux"
},
"62wKfQRrLNz2WXjt": {
"name": "Divers"
},
"TFjE83ASCMK9rfRi": { "TFjE83ASCMK9rfRi": {
"name": "BandarrêtdurgENS", "name": "BandarrêtdurgENS",
"short_name": "Banda" "short_name": "Banda"
}, },
"kR8fMzmf4ciop9Je": { "TyMrLaPPDzT7yAGC": {
"name": "Club Jeux", "name": "BDS"
"short_name": "Jeux", }
"color": "#5f9ae0" },
"klub-reseau": {
"5WrcagPPARQ3BD87": {
"name": "Club réseau",
"default_location": "Cave d'hackENS"
}, },
"22rQF3gjjz8LifZC": { "TFEAKjAgNFQZpNjo": {
"name": "La Psychédéliste", "name": "hackENS",
"short_name": "Psychédéliste"
},
"AfHYkm3gqQ4fRRj5": {
"name": "HackENS",
"default_location": "Cave d'hackENS" "default_location": "Cave d'hackENS"
} }
}, },
"frama-agenda": { "frama-agenda": {
"qZcPZdGb5YtJHrNZ": {
"name": "ENSelle"
},
"K6iGBG47WXaKWs3Q": {
"name": "Créneaux encadrés",
"initial": false
},
"TFjE83ASCMK9rfRi": { "TFjE83ASCMK9rfRi": {
"name": "BandarrêtdurgENS", "name": "BandarrêtdurgENS",
"short_name": "Banda" "short_name": "Banda"
}, },
"dSYCtdC6bgyWpKyt": {
"name": "Évènements (BDS)"
},
"goXLq2dQ8LgFAjkM": {
"name": "Club Bouffe"
},
"Q8w6dw4jGLBP9ftB": {
"name": "Écocampus"
},
"T5WoHbs4FT5A945Z": { "T5WoHbs4FT5A945Z": {
"name": "CinéClub" "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"
} }
} }
} }

View file

@ -1,20 +1,10 @@
{ {
"nameMap": { "nameMap": {
"Amphi Jourdan": "Amphithéâtre Jourdan", "Amphi Jourdan": "Amphithéâtre Jourdan",
"Cour aux Ernest": "Cour aux Ernests",
"R2-21 (Jourdan)": "R2-21", "R2-21 (Jourdan)": "R2-21",
"Salle Jean Ibanes (Jourdan, R1-07)": "Salle Jean Ibanes (R1-07)", "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 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",
"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": { "rooms": {
@ -22,7 +12,6 @@
"Amphithéâtre Galois", "Amphithéâtre Galois",
"Bibliothèque Lettres", "Bibliothèque Lettres",
"Salle Histoire", "Salle Histoire",
"Salle Aron",
"Salle Cavaillès", "Salle Cavaillès",
"Salle Dussane", "Salle Dussane",
"Salle des Actes", "Salle des Actes",
@ -31,10 +20,6 @@
"Salle Cartan", "Salle Cartan",
"Salle Noether", "Salle Noether",
"Salle Bourbaki", "Salle Bourbaki",
"Petite salle ECLA",
"Salle Reig ECLA",
"Salle Césaire ECLA",
"Salle Beckett",
"Cour aux Ernests", "Cour aux Ernests",
"Cour du NIR", "Cour du NIR",
"Cour Pasteur", "Cour Pasteur",
@ -43,17 +28,11 @@
"Canopée", "Canopée",
"K-Fêt", "K-Fêt",
"Cave d'hackENS", "Cave d'hackENS",
"Gymnase Jean Prévost", "Gymnase"
"Salle d'expression artistique (SEA)",
"Locaux des départements lettres et sciences humaines et sociales"
], ],
"24 rue Lhomond": ["Salle CONF IV"], "24 rue Lhomond": ["Salle CONF IV"],
"29 rue d'Ulm": [ "29 rue d'Ulm": ["Bibliothèque des sciences expérimentales", "Salle Jaurès"],
"Bâtiment du 29",
"Bibliothèque des sciences expérimentales",
"Amphithéâtre Jaurès"],
"Jourdan": [ "Jourdan": [
"Campus de Jourdan",
"Bibliothèque de Jourdan", "Bibliothèque de Jourdan",
"Salle Marcel Roncayolo (R2-05)", "Salle Marcel Roncayolo (R2-05)",
"Salle Madeleine Rebérioux (R2-02)", "Salle Madeleine Rebérioux (R2-02)",

View file

@ -1,44 +1,9 @@
{ pkgs ? import ./nix {} }:
{ {
sources ? import ./npins, production = pkgs.npmlock2nix.build {
pkgs ? import sources.nixpkgs { }, src = ./.;
}: installPhase = "cp -r public/build $out";
buildCommands = [ "npm run build" ];
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; };
} }

12
nix/default.nix Normal file
View 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
View 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
View 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); }

View file

@ -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`"

View file

@ -1,11 +0,0 @@
{
"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

BIN
public.tar.gz Normal file

Binary file not shown.

View file

@ -4,7 +4,7 @@
<meta charset='utf-8'> <meta charset='utf-8'>
<meta name='viewport' content='width=device-width,initial-scale=1'> <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' href='/favicon.svg'>
<link rel='stylesheet' href='/global.css'> <link rel='stylesheet' href='/global.css'>

View file

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

View file

@ -102,7 +102,6 @@
title: room title: room
})) }))
), ),
filterResourcesWithEvents: true,
height: '100%', height: '100%',
schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives', schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
nowIndicator: true, nowIndicator: true,
@ -122,11 +121,6 @@
isLoading = b; isLoading = b;
if (spinner) { if (spinner) {
spinner.$set({ isLoading: b }); spinner.$set({ isLoading: b });
if (b) {
setTimeout(() => {
spinner.$set({ isLoading: false });
}, 3000);
}
} }
}, },
eventSources: [], eventSources: [],
@ -135,14 +129,11 @@
progressiveEventRendering: true, progressiveEventRendering: true,
expandRows: true, expandRows: true,
eventDidMount: info => { eventDidMount: info => {
const title = info.event.extendedProps.short_name; new Tooltip(info.el, {
if (title !== undefined) { title: info.event.extendedProps.short_name,
new Tooltip(info.el, { trigger: 'hover',
title: title, placement: 'top'
trigger: 'hover', });
placement: 'top'
});
}
}, },
viewDidMount: arg => { viewDidMount: arg => {
spinner = new Spinner({ spinner = new Spinner({
@ -205,12 +196,6 @@
<FullCalendar bind:this={calendar} options={$options} /> <FullCalendar bind:this={calendar} options={$options} />
<EventModal event={$event} open={openModal} {toggle} /> <EventModal event={$event} open={openModal} {toggle} />
<script
defer
data-domain="calendrier.dgnum.eu"
src="https://analytics.dgnum.eu/js/script.js"
></script>
</div> </div>
<style> <style>

View file

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

View file

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

View file

@ -132,31 +132,13 @@ function fcEventFromjCalEvent(cal) {
return function (evt) { return function (evt) {
const start = new Date(evt.dtstart) const start = new Date(evt.dtstart)
const end = new Date(evt.dtend) 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 = { const fcEvent = {
title: `${cal.short_name ?? cal.name} : ${evt.summary}`, title: `${cal.short_name ?? cal.name} : ${evt.summary}`,
start: evt.dtstart, start: evt.dtstart,
end: evt.dtend, end: evt.dtend,
color: cal.color, color: cal.color,
textColor: invertColor(cal.color), textColor: invertColor(cal.color),
duration: duration duration: end - start // in ms
}
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 fcEvent.calendar = cal.name
@ -190,6 +172,14 @@ 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) { export function mkSource(name) {
const calendarId = calendarsByName[name] const calendarId = calendarsByName[name]
if (!calendarId) return null if (!calendarId) return null