This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import { useRecoilValueLoadable, useRecoilValue } from "recoil" | |
import { mapboxToken } from "../../mapbox-token" | |
import { countriesQuery, currentDateStatusState } from "../../state/api" | |
import DataMap from "./DataMap" | |
import LoadingIndicator from "../ui/LoadingIndicator" | |
import { currentStatState } from "../../state/app" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import DeckGLMap from "./DeckGLMap" | |
import { ScatterplotLayer } from "@deck.gl/layers" | |
const DataMap = ({ mapboxToken = "", data = [], dotCoordinates = "coordinates", displayStat = "cases" }) => { | |
const scatterplotLayer = new ScatterplotLayer({ | |
id: "scatterplot-layer", | |
data, | |
stroked: false, | |
filled: true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import { useRecoilValueLoadable } from "recoil" | |
import { mapboxToken } from "../../mapbox-token" | |
import { countriesQuery, currentDateStatusState } from "../../state/api" | |
import DataMap from "./DataMap" | |
import LoadingIndicator from "../ui/LoadingIndicator" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import styled from "styled-components" | |
import { useRecoilState } from "recoil" | |
import { currentStatState, availableStats } from "../../state/app" | |
const StyledCurrentStatSelect = styled("div")` | |
display: flex; | |
flex-flow: column; | |
align-items: center; | |
position: absolute; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { selector, atom } from "recoil" | |
import { isAfter, isBefore } from "date-fns" | |
export const CASES = "cases" | |
export const DEATHS = "deaths" | |
export const RECOVERED = "recovered" | |
export const availableStats = [CASES, DEATHS, RECOVERED] | |
export const currentStatState = atom({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { selector, selectorFamily, waitForNone } from "recoil" | |
import { format, subDays, differenceInCalendarDays } from "date-fns" | |
import { currentDateState, DATE_RANGE } from "../app" | |
export const API_DATE_FORMAT = "yyyy-MM-dd" | |
export const countriesQuery = selector({ | |
key: "countries", | |
get: async () => { | |
try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import styled from "styled-components" | |
import { useRecoilState } from "recoil" | |
import { currentDateState, DATE_RANGE } from "../../state/app" | |
import { differenceInCalendarDays, addDays } from "date-fns" | |
const StyledTimeTravelSlider = styled("div")` | |
display: flex; | |
flex-flow: column; | |
align-items: center; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { selector, atom } from "recoil" | |
import { isAfter, isBefore } from "date-fns" | |
export const DATE_RANGE = [new Date("10 Jan 2020"), new Date()] | |
const dateState = atom({ | |
key: "date-state", | |
default: DATE_RANGE[1], | |
}) |