Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 1x 1x 1x 1x 1x 1x 1x 1x 4x 4x 4x 2x | import { Url } from "../../clientUtils/urls/Url" import { UrlMigration } from "../../clientUtils/urls/UrlMigration" import { getExplorerSlugFromUrl, QueryParamTransformMap, transformQueryParams, } from "./ExplorerUrlMigrationUtils" const EXPLORER_SLUG = "coronavirus-data-explorer" const transformMap: QueryParamTransformMap = { Metric: { transformValue: (value) => { // Since we introduced multiple vaccinations metrics, we want to // differentiate between them. // And while we're there, reduce the length of "Tests per confirmed // case", because it wraps to 2 lines. // // -@danielgavrilov, 2021-03-30 // if (value === "Vaccinations") return "Vaccine doses" if (value === "Tests per confirmed case") return "Tests per case" return value }, }, "Align outbreaks": { newName: "Color by test positivity", }, } export const covidUrlMigration: UrlMigration = (url: Url) => { // if it's not the /explorer/energy path, skip it const explorerSlug = getExplorerSlugFromUrl(url) if (explorerSlug !== EXPLORER_SLUG) return url return url.setQueryParams( transformQueryParams(url.queryParams, transformMap) ) } |