diff --git a/package-lock.json b/package-lock.json
index 3fb41ba..1dddaf5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -29,6 +29,7 @@
"@types/react-dom": "^18.2.21",
"astro": "^4.3.6",
"auth-astro": "^4.1.2",
+ "date-fns": "^3.6.0",
"firebase": "^9.23.0",
"i": "^0.3.7",
"react": "^18.2.0",
diff --git a/package.json b/package.json
index 7e1b39f..932bfda 100644
--- a/package.json
+++ b/package.json
@@ -33,6 +33,7 @@
"@types/react-dom": "^18.2.21",
"astro": "^4.3.6",
"auth-astro": "^4.1.2",
+ "date-fns": "^3.6.0",
"firebase": "^9.23.0",
"i": "^0.3.7",
"react": "^18.2.0",
diff --git a/src/components/ActivityPage.tsx b/src/components/ActivityPage.tsx
index 7cca99e..6c0be34 100644
--- a/src/components/ActivityPage.tsx
+++ b/src/components/ActivityPage.tsx
@@ -1,5 +1,6 @@
import { useState } from "react"
import type { UserInfo } from "firebase/auth"
+import { isAfter, subYears, toDate } from "date-fns"
import Login from "../components/Login"
import { useActivityData } from "../hooks/activity.ts"
import ActivityTable from "./ActivityTable.tsx"
@@ -10,6 +11,9 @@ const ActivityPage = () => {
setUser(loggedUser)
}
const activityData = useActivityData(user)
+ const yearlyActivityData = activityData?.filter((data) =>
+ isAfter(toDate(data.date.toDate()), subYears(new Date(), 1))
+ )
return (
@@ -22,10 +26,18 @@ const ActivityPage = () => {
)}
{user && activityData && (
-
-
- {activityData.length} download(s)
-
+
+
+
+ {activityData.length} total download(s)
+
+ {yearlyActivityData && (
+
+ {yearlyActivityData.length} download(s) in
+ the past year
+
+ )}
+
)}
diff --git a/src/components/Login.tsx b/src/components/Login.tsx
index 859b9fb..910cc06 100644
--- a/src/components/Login.tsx
+++ b/src/components/Login.tsx
@@ -13,10 +13,7 @@ const Login: React.FC = ({ currentUser, setUserFunction }) => {
const login = async () => {
await handleLogin().then((loggedUser) => {
- if (!loggedUser)
- setMessage(
- "You must be an admin on this project in order to see this data. If you believe this to be an error, please reach out to David Lindstrom (david_lindstrom@brown.edu)."
- )
+ if (!loggedUser) setMessage("You must be an admin on this project in order to see this data.")
setUserFunction(loggedUser)
})
}
diff --git a/src/consts.ts b/src/consts.ts
index 5d7956c..3850337 100644
--- a/src/consts.ts
+++ b/src/consts.ts
@@ -1,12 +1,4 @@
export const SITE_TITLE = "MMP"
export const SITE_DESCRIPTION = "Mesoamerican Migration Project"
-export const LINKS = [
- "people",
- "news",
- "publications",
- "study-design",
- "data",
- "documentation",
- "activity",
-]
+export const LINKS = ["people", "news", "publications", "study-design", "data", "documentation"]
diff --git a/src/pages/activity.astro b/src/pages/activity.astro
index 80e4ba9..0b0af78 100644
--- a/src/pages/activity.astro
+++ b/src/pages/activity.astro
@@ -3,6 +3,6 @@ import Layout from "../layouts/Layout.astro"
import ActivityPage from "../components/ActivityPage"
---
-
+