From 4eedd83fafb31a152491966c660c0f2eaafffaf4 Mon Sep 17 00:00:00 2001 From: Samuel Gratzl Date: Tue, 25 May 2021 08:14:11 -0400 Subject: [PATCH 1/2] feat: add new epivis --- content/epivis/_index.md | 8 ++++++++ package-lock.json | 7 +++++++ package.json | 6 ++++-- static/covidcast/.gitignore | 3 ++- static/epivis/.gitignore | 5 +++++ themes/delphi/assets/css/pages/_covidcast.scss | 7 ++++++- themes/delphi/assets/js/main.js | 2 ++ themes/delphi/layouts/_default/epivis_app.html | 11 +++++++++++ themes/delphi/layouts/partials/epivis/find-file.html | 10 ++++++++++ 9 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 content/epivis/_index.md create mode 100644 static/epivis/.gitignore create mode 100644 themes/delphi/layouts/_default/epivis_app.html create mode 100644 themes/delphi/layouts/partials/epivis/find-file.html diff --git a/content/epivis/_index.md b/content/epivis/_index.md new file mode 100644 index 000000000..3c40df856 --- /dev/null +++ b/content/epivis/_index.md @@ -0,0 +1,8 @@ +--- +title: EPIVis +description: EpiVis is an interactive tool for visualizing epidemiological time-series data. +layout: epivis_app +order: 1 +feedback: true +footer: false +--- diff --git a/package-lock.json b/package-lock.json index c43d06def..ce58fc1a0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2565,6 +2565,13 @@ "uikit": "^3.6.19" } }, + "www-epivis": { + "version": "github:cmu-delphi/www-epivis#89ce44bfd7eb1bfeef0da64efdcf652793bef5c8", + "from": "github:cmu-delphi/www-epivis#dev", + "requires": { + "uikit": "^3.6.22" + } + }, "xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", diff --git a/package.json b/package.json index a91d923b4..429637100 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "highlight.js": "^10.7.2", "katex": "^0.13.11", "uikit": "^3.6.22", - "www-covidcast": "https://github.com/cmu-delphi/www-covidcast/releases/download/v2.4.0/www-covidcast-2.4.0.tgz" + "www-covidcast": "https://github.com/cmu-delphi/www-covidcast/releases/download/v2.4.0/www-covidcast-2.4.0.tgz", + "www-epivis": "github:cmu-delphi/www-epivis#dev" }, "devDependencies": { "hugo-bin": "^0.71.1", @@ -25,7 +26,8 @@ "clean": "rimraf \"*.tgz\" public", "copy_fonts": "shx cp -r \"node_modules/katex/dist/fonts/*\" themes/delphi/static/css/fonts/", "copy_covidcast": "shx rm -rf \"static/covidcast/*\" && shx cp \"node_modules/www-covidcast/public/**/*.{js,txt,css,map}\" static/covidcast/", - "postinstall": "npm run copy_fonts && npm run copy_covidcast", + "copy_epivis": "shx rm -rf \"static/epivis/*\" && shx cp \"node_modules/www-epivis/public/**/*.{js,txt,css,map}\" static/epivis/", + "postinstall": "npm run copy_fonts && npm run copy_covidcast && npm run copy_epivis", "build:blog": "Rscript -e \"blogdown::build_site(local=FALSE, run_hugo=FALSE, build_rmd='md5sum')\"", "prebuild": "npm run clean", "build": "hugo --gc --minify", diff --git a/static/covidcast/.gitignore b/static/covidcast/.gitignore index 8b42cac9a..7cc47d84a 100644 --- a/static/covidcast/.gitignore +++ b/static/covidcast/.gitignore @@ -1,4 +1,5 @@ *.js *.txt *.html -*.css \ No newline at end of file +*.css +*.map \ No newline at end of file diff --git a/static/epivis/.gitignore b/static/epivis/.gitignore new file mode 100644 index 000000000..7cc47d84a --- /dev/null +++ b/static/epivis/.gitignore @@ -0,0 +1,5 @@ +*.js +*.txt +*.html +*.css +*.map \ No newline at end of file diff --git a/themes/delphi/assets/css/pages/_covidcast.scss b/themes/delphi/assets/css/pages/_covidcast.scss index 0750cc759..89bac1ef0 100644 --- a/themes/delphi/assets/css/pages/_covidcast.scss +++ b/themes/delphi/assets/css/pages/_covidcast.scss @@ -1,7 +1,12 @@ -#vizbox { +#vizbox, +#epivis { margin-top: 5px !important; } +#epivis { + flex-grow: 1; +} + .covidcast_wrapper { display: flex; flex-direction: column; diff --git a/themes/delphi/assets/js/main.js b/themes/delphi/assets/js/main.js index dee102a9e..958fa67c3 100644 --- a/themes/delphi/assets/js/main.js +++ b/themes/delphi/assets/js/main.js @@ -7,3 +7,5 @@ UIkit.use(plugin); window.UIkit = UIkit; // define for covidcast at which base url it is embedded window.DELPHI_COVIDCAST_PAGE = "/covidcast/"; +// define for covidcast at which base url it is embedded +window.DELPHI_EPIVIS_PAGE = "/epivis/"; diff --git a/themes/delphi/layouts/_default/epivis_app.html b/themes/delphi/layouts/_default/epivis_app.html new file mode 100644 index 000000000..9637a83ff --- /dev/null +++ b/themes/delphi/layouts/_default/epivis_app.html @@ -0,0 +1,11 @@ +{{ define "styles" }} + +{{ end }} +{{ define "scripts" }} + +{{ end }} +{{ define "breadcrumb" }}{{ end }} +{{ define "body_class" }}{{ if eq .Params.footer false }}covidcast_wrapper{{ end }}{{ end }} +{{ define "main" }} +
+{{ end }} diff --git a/themes/delphi/layouts/partials/epivis/find-file.html b/themes/delphi/layouts/partials/epivis/find-file.html new file mode 100644 index 000000000..125472dad --- /dev/null +++ b/themes/delphi/layouts/partials/epivis/find-file.html @@ -0,0 +1,10 @@ + +{{ $pattern := . }} +{{ $matchedFile := false }} +{{ range (readDir "./static/epivis") }} + {{ $testFile := . }} + {{ with (index (findRE $pattern .Name 1) 0) }} + {{ $matchedFile = path.Join "./epivis" $testFile.Name }} + {{ end }} +{{ end }} +{{ return $matchedFile }} From 71f09f2fd1dadf58fb8508a5bbe6ebe6726ed967 Mon Sep 17 00:00:00 2001 From: Samuel Gratzl Date: Thu, 27 May 2021 10:24:39 -0400 Subject: [PATCH 2/2] feat: link to epivis --- content/tools/epivis.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/tools/epivis.md b/content/tools/epivis.md index c62bc3e62..e6990332d 100644 --- a/content/tools/epivis.md +++ b/content/tools/epivis.md @@ -1,6 +1,6 @@ --- title: EpiVis -link: https://delphi.cmu.edu/epivis/epivis.html +link: /epivis/ order: 1 ---