Skip to content

Commit 498e02c

Browse files
committed
refactored history page to render data by selected year
1 parent 5b06bf6 commit 498e02c

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

frontend/src/pages/about/our-history.tsx

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,21 @@ import { useState } from "react";
55
import PortfolioDisplay from "@/components/About/PortfolioDisplay";
66
import ExecDisplay from "@/components/About/ExecDisplay";
77

8+
// Need to import more data
9+
import { teamData as data2020 } from "@/../public/data/years/2020";
10+
811
const MIN_YEAR = 2007;
912
const MAX_YEAR = 2020;
1013
const DEFAULT_YEAR = 2020;
1114

15+
const TEAM_DATA_BY_YEAR: Record<number, { execs: Exec[], portfolios: PortfolioData[] }> = {
16+
2020: data2020,
17+
};
18+
1219
const OurHistoryPage = () => {
1320
const [year, setYear] = useState(DEFAULT_YEAR);
1421
const [shouldDisplayTip, setShouldDisplayTip] = useState(true);
22+
const currentTeam = TEAM_DATA_BY_YEAR[year];
1523

1624
return (
1725
<Layout>
@@ -71,14 +79,18 @@ const OurHistoryPage = () => {
7179
<p className="mt-5">Use the slider to see the teams from past years!</p>
7280
)}
7381

74-
<div className="pt-6">
75-
<ExecDisplay />
76-
</div>
77-
<div className="space-y-6 w-full">
78-
<div className="border-t border-gray-300 my-10"></div>
79-
<h2 className="text-xl font-semibold mb-2">Directors</h2>
80-
<PortfolioDisplay />
81-
</div>
82+
{currentTeam && (
83+
<>
84+
<div className="pt-6 w-full">
85+
<ExecDisplay execs={currentTeam.execs}/>
86+
</div>
87+
<div className="space-y-6 w-full">
88+
<div className="border-t border-gray-300 my-10"></div>
89+
<h2 className="text-xl font-semibold mb-2">Directors</h2>
90+
<PortfolioDisplay portfolios={currentTeam.portfolios}/>
91+
</div>
92+
</>
93+
)}
8294

8395
</div>
8496
</PageBody>

0 commit comments

Comments
 (0)