Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 11 additions & 1 deletion components/Officers/OfficerCard.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
// import { faEnvelope } from '@fortawesome/free-regular-svg-icons';
// import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import Image from 'next/legacy/image';
import { useState } from 'react';

import styles from '../../styles/components/Officers/OfficerCard.module.scss';
import '@fortawesome/fontawesome-svg-core/styles.css';

const DEFAULT_PHOTO =
'https://t4.ftcdn.net/jpg/02/15/84/43/360_F_215844325_ttX9YiIIyeaR7Ne6EaLLjMAmy4GvPC69.jpg';

function Officer({
name,
position,
Expand All @@ -16,6 +20,10 @@ function Officer({
/* eslint-disable-next-line no-unused-vars */
committee, // no officer card formats use committee yet
}) {
// Fall back to the default photo if the image fails to load
// (e.g. a Google Drive file that isn't shared publicly)
const [failedImg, setFailedImg] = useState(null);
const photo = img && img !== failedImg ? img : DEFAULT_PHOTO;
if (size && size.toLowerCase() === 'compact') {
return (
<div
Expand All @@ -25,12 +33,14 @@ function Officer({
<div className={styles['image-container']}>
<Image
className="officer-image"
src={img}
src={photo}
alt={alt}
width={130}
height={130}
objectFit="cover" // Crop to fit the aspect ratio
unoptimized={true}
referrerPolicy="no-referrer" // Google Drive images return 429 when a Referer is sent
onError={() => setFailedImg(img)}
/>
</div>
</div>
Expand Down
Binary file modified public/images/gm/Fall_GM_2026_graphic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions scripts/officer-parser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async function main() {
// Example: if latest archived is Officers(25-26), then Officers sheet = 26-27
const currentFullYear = `20${latestYear}-20${latestYear + 1}`;
alumYears.push(currentFullYear);
const currentData = await getGoogleSheetData(auth, `Officers!A3:K`);
const currentData = await getGoogleSheetData(auth, `Officers!A3:M`, true);
allData[currentFullYear] = currentData;

// Also write current officers to officeroutput.json for backwards compatibility
Expand Down Expand Up @@ -83,7 +83,7 @@ async function authorizeGoogleAPI() {

// Read data from Google sheets
// using sheet range (eg: 'Week 1!A:H)
async function getGoogleSheetData(auth, range) {
async function getGoogleSheetData(auth, range, isCurrent = false) {
const committees = [
'Board',
'Board, Dev Team',
Expand Down Expand Up @@ -114,6 +114,8 @@ async function getGoogleSheetData(auth, range) {
const rows = res?.data.values;
for (let i = 0; i < rows.length; i++) {
const row = rows[i];
// Current sheet has extra Transfer?/Grad? columns (G, H); drop them
if (isCurrent) row.splice(6, 2);
if (committees.includes(row[0])) {
currCommittee = row[0];
} else if (row[1]) {
Expand Down Expand Up @@ -143,6 +145,7 @@ async function getGoogleSheetData(auth, range) {
}
} catch (err) {
console.log(err);
image = 'https://t4.ftcdn.net/jpg/02/15/84/43/360_F_215844325_ttX9YiIIyeaR7Ne6EaLLjMAmy4GvPC69.jpg';
}
}
row[11] = currCommittee;
Expand Down
Loading