From 225c19d5f36e8147631c0ade3f7a4acfccd67c43 Mon Sep 17 00:00:00 2001 From: Samuel Gratzl Date: Thu, 1 Jul 2021 13:47:35 +0200 Subject: [PATCH 1/3] feat: add covidcast-classic --- content/covidcast/classic.md | 3 +-- package.json | 6 ++++-- static/covidcast/classic/.gitignore | 5 +++++ themes/delphi/assets/js/main.js | 2 ++ .../_default/covidcast_classic_app.html | 18 ++++++++++++++++++ .../partials/covidcast_classic/find-file.html | 10 ++++++++++ 6 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 static/covidcast/classic/.gitignore create mode 100644 themes/delphi/layouts/_default/covidcast_classic_app.html create mode 100644 themes/delphi/layouts/partials/covidcast_classic/find-file.html diff --git a/content/covidcast/classic.md b/content/covidcast/classic.md index 1556ed04c..3e5e55ce1 100644 --- a/content/covidcast/classic.md +++ b/content/covidcast/classic.md @@ -2,8 +2,7 @@ title: COVIDcast | Classic Map linkTitle: Classic Map description: COVIDcast tracks and forecasts the spread of COVID-19. By Carnegie Mellon's Delphi Research Group. -layout: covidcast_app -app_mode: classic +layout: covidcast_classic_app order: 3 heroImage: images/landing-page/hero-images/covidcast_v2.jpg feedback: true diff --git a/package.json b/package.json index 32f918a53..832c10f46 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "katex": "^0.13.11", "uikit": "^3.6.22", "www-covidcast": "https://github.com/cmu-delphi/www-covidcast/releases/download/v2.5.2/www-covidcast-2.5.2.tgz", - "www-epivis": "https://github.com/cmu-delphi/www-epivis/releases/download/v2.0.1/www-epivis-2.0.1.tgz" + "www-epivis": "https://github.com/cmu-delphi/www-epivis/releases/download/v2.0.1/www-epivis-2.0.1.tgz", + "www-covidcast-classic": "github:cmu-delphi/www-covidcast-classic#dev" }, "devDependencies": { "hugo-bin": "^0.71.1", @@ -26,8 +27,9 @@ "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/", + "copy_covidcast_classic": "shx rm -rf \"static/covidcast/classic/*\" && shx cp \"node_modules/www-covidcast-classic/public/**/*.{js,txt,css,map}\" static/covidcast/classic/", "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", + "postinstall": "npm run copy_fonts && npm run copy_covidcast && npm run copy_epivis && npm run copy_covidcast_classic", "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/classic/.gitignore b/static/covidcast/classic/.gitignore new file mode 100644 index 000000000..7cc47d84a --- /dev/null +++ b/static/covidcast/classic/.gitignore @@ -0,0 +1,5 @@ +*.js +*.txt +*.html +*.css +*.map \ No newline at end of file diff --git a/themes/delphi/assets/js/main.js b/themes/delphi/assets/js/main.js index 958fa67c3..c20f64e01 100644 --- a/themes/delphi/assets/js/main.js +++ b/themes/delphi/assets/js/main.js @@ -8,4 +8,6 @@ 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_COVIDCAST_CLASSIC_PAGE = "/covidcast/classic/"; +// define for covidcast at which base url it is embedded window.DELPHI_EPIVIS_PAGE = "/epivis/"; diff --git a/themes/delphi/layouts/_default/covidcast_classic_app.html b/themes/delphi/layouts/_default/covidcast_classic_app.html new file mode 100644 index 000000000..89ce80bc8 --- /dev/null +++ b/themes/delphi/layouts/_default/covidcast_classic_app.html @@ -0,0 +1,18 @@ +{{ 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/covidcast_classic/find-file.html b/themes/delphi/layouts/partials/covidcast_classic/find-file.html new file mode 100644 index 000000000..ef4749223 --- /dev/null +++ b/themes/delphi/layouts/partials/covidcast_classic/find-file.html @@ -0,0 +1,10 @@ + +{{ $pattern := . }} +{{ $matchedFile := false }} +{{ range (readDir "./static/covidcast/classic") }} + {{ $testFile := . }} + {{ with (index (findRE $pattern .Name 1) 0) }} + {{ $matchedFile = path.Join "./covidcast/classic" $testFile.Name }} + {{ end }} +{{ end }} +{{ return $matchedFile }} From 99924275cf250a3b7242b6199414fd9c5e8aec4a Mon Sep 17 00:00:00 2001 From: Samuel Gratzl Date: Thu, 1 Jul 2021 13:52:42 +0200 Subject: [PATCH 2/3] build: fix package resolution --- package-lock.json | 14 ++++++++++++++ package.json | 2 +- static/covidcast/classic/.gitignore | 5 ----- 3 files changed, 15 insertions(+), 6 deletions(-) delete mode 100644 static/covidcast/classic/.gitignore diff --git a/package-lock.json b/package-lock.json index 27cf6f624..145383989 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2565,6 +2565,20 @@ "uikit": "^3.6.22" } }, + "www-covidcast-classic": { + "version": "github:cmu-delphi/www-covidcast-classic#6835774e8d74040deb3f87749ebdae244ef49173", + "from": "github:cmu-delphi/www-covidcast-classic#dev", + "requires": { + "uikit": "^3.7.0" + }, + "dependencies": { + "uikit": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/uikit/-/uikit-3.7.0.tgz", + "integrity": "sha512-N0xluQ380EHey26toMmNA4H2YLtvVRHMaYksG31qDxW2VaAAf9i0Q0aT82zeMdrK2Tx9sqnHz6GaOMTIYYM0ZQ==" + } + } + }, "www-epivis": { "version": "https://github.com/cmu-delphi/www-epivis/releases/download/v2.0.1/www-epivis-2.0.1.tgz", "integrity": "sha512-sREuzprNbuXnDY4aCWldkus2wrS1y/n0YZzmoB8afW3yQZifFMgN5BC45Pqjugm20SJ86kYuD1XtzXCfkmhNCw==", diff --git a/package.json b/package.json index 832c10f46..f86b562c7 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "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/", - "copy_covidcast_classic": "shx rm -rf \"static/covidcast/classic/*\" && shx cp \"node_modules/www-covidcast-classic/public/**/*.{js,txt,css,map}\" static/covidcast/classic/", + "copy_covidcast_classic": "shx rm -rf \"static/covidcast/classic/*\" && shx mkdir -p static/covidcast/classic/ && shx cp \"node_modules/www-covidcast-classic/public/**/*.{js,txt,css,map}\" static/covidcast/classic/", "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 && npm run copy_covidcast_classic", "build:blog": "Rscript -e \"blogdown::build_site(local=FALSE, run_hugo=FALSE, build_rmd='md5sum')\"", diff --git a/static/covidcast/classic/.gitignore b/static/covidcast/classic/.gitignore deleted file mode 100644 index 7cc47d84a..000000000 --- a/static/covidcast/classic/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -*.js -*.txt -*.html -*.css -*.map \ No newline at end of file From db9dd65e345093018095cbbdbe21a4d4fd30394b Mon Sep 17 00:00:00 2001 From: Samuel Gratzl Date: Thu, 1 Jul 2021 16:02:20 +0200 Subject: [PATCH 3/3] build: use published version of covidcast-classic --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 14a5888dd..58494011b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2566,8 +2566,8 @@ } }, "www-covidcast-classic": { - "version": "github:cmu-delphi/www-covidcast-classic#6835774e8d74040deb3f87749ebdae244ef49173", - "from": "github:cmu-delphi/www-covidcast-classic#dev", + "version": "https://github.com/cmu-delphi/www-covidcast-classic/releases/download/v2.5.3/www-covidcast-classic-2.5.3.tgz", + "integrity": "sha512-uiIqXzt3gY/HMTBnw1ocgSupioYX+hgHWkF7+NjKgeADSqDYfOjmIMZkKHCMAKQjU/KibLvkxEglqiKCjBkLmg==", "requires": { "uikit": "^3.7.0" }, diff --git a/package.json b/package.json index cf1524d9d..02762bf05 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "uikit": "^3.6.22", "www-covidcast": "https://github.com/cmu-delphi/www-covidcast/releases/download/v2.5.2/www-covidcast-2.5.2.tgz", "www-epivis": "https://github.com/cmu-delphi/www-epivis/releases/download/v2.0.1/www-epivis-2.0.1.tgz", - "www-covidcast-classic": "github:cmu-delphi/www-covidcast-classic#dev" + "www-covidcast-classic": "https://github.com/cmu-delphi/www-covidcast-classic/releases/download/v2.5.3/www-covidcast-classic-2.5.3.tgz" }, "devDependencies": { "hugo-bin": "^0.72.3",