Skip to content

Commit

Permalink
Add data download, fix loading issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nofurtherinformation committed Aug 7, 2024
1 parent e481930 commit cea36be
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
8 changes: 7 additions & 1 deletion components/ReportLoadingShade/ReportLoadingShade.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@ import { usePathname } from "next/navigation"
import React, { useEffect, useState } from "react"
import Spinner from "components/Spinner"

const DOWNLOAD_PATH_NAMES = [
"/data"
]

export const ReportLoadingShade: React.FC<{ forceLoading?: boolean }> = ({ forceLoading }) => {
const pathname = usePathname()
const [isLoading, setIsLoading] = useState(false)

useEffect(() => setIsLoading(false), [pathname])

useEffect(() => {
window.addEventListener("beforeunload", (_) => {
window.addEventListener("beforeunload", (e: any) => {
const destination = e.target.location.pathname
if (DOWNLOAD_PATH_NAMES.includes(destination)) return
setIsLoading(true)
})
}, [])
Expand Down
9 changes: 9 additions & 0 deletions public/content/page/data.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ sections:
this project.
Download:
[CSV Data Download](/data/grocery-gap-atlas-data-august-2024.csv.zip)
[XLS Data Download](/data/grocery-gap-atlas-data-august-2024.xlsx)
| Data |
Source
| Year |
Expand Down
Binary file not shown.
Binary file not shown.

0 comments on commit cea36be

Please sign in to comment.