Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 32 additions & 26 deletions src/Components/Officers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import "../CSS/Officers.css";
import ProfileCard from "./profileCard";

const Officers = () => {

const SHOW_OFFICER_APPLICATION = false;
const APPLICATION_YEAR = "2025-2026";
const [selectedYear, setSelectedYear] = useState(null);
const [teamMembers, setTeamMembers] = useState([]);
const [yearOptions, setYearOptions] = useState([]);
Expand All @@ -14,12 +15,12 @@ const Officers = () => {
const availableYears = [];

// officer data will be out at the end of June, this will update beginning of July
const defaultToThisYear = currentDate.getMonth() > 5;
const defaultToThisYear = currentDate.getMonth() > 5;

// check if officer json data for the current year should be added
// and exists first, then add previous years back to 2022
for (let year = currentDate.getFullYear(); year >= 2022; year--) {
if(defaultToThisYear || year !== currentDate.getFullYear()) {
if (defaultToThisYear || year !== currentDate.getFullYear()) {
try {
await import(`../Data/officers${year}.json`);
availableYears.push(year);
Expand Down Expand Up @@ -64,30 +65,35 @@ const Officers = () => {
<h1>Our Officers</h1>
</div>
<div className="Officer-content">
<div className="officer-application-link">
<Link to="/OfficerApplication">
<button className="apply-button">Apply to be an Officer for 2025-2026!</button>
</Link>
{/* CONTROLLED BY FLAG ABOVE */}
{SHOW_OFFICER_APPLICATION && (
<div className="officer-application-link">
<Link to="/OfficerApplication">
<button className="apply-button">
Apply to be an Officer for {APPLICATION_YEAR}!
</button>
</Link>
</div>
)}
</div>
<nav className="officer-sidebar">
<h2>Year</h2>
<ul>
{yearOptions.map((year) => (
<li key={year}>
<button
onClick={() => handleYearChange(year)}
className={selectedYear === year ? "selected" : ""}
>
{year}
</button>
</li>
))}
</ul>
</nav>
<div className="officer-info">
<h2>{selectedYear} Officers</h2>
<ProfileCard info={teamMembers} />
</div>
<nav className="officer-sidebar">
<h2>Year</h2>
<ul>
{yearOptions.map((year) => (
<li key={year}>
<button
onClick={() => handleYearChange(year)}
className={selectedYear === year ? "selected" : ""}
>
{year}
</button>
</li>
))}
</ul>
</nav>
<div className="officer-info">
<h2>{selectedYear} Officers</h2>
<ProfileCard info={teamMembers} />
</div>
</div>
</div>
Expand Down