-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* completed rough event card * possible fix * remove console log * fix padding (#213) * fix text colors for different orgs * responsive navbar (#215) * started responsive navbar * commit typing * finish navbar * move navbar styles to component level module * commit module typing * use proper color variables * use seconds for transitions * fix navlink order * fix easing functions * add css comments * Fetch data for board cards at build time server-side (#211) * fetch board data from spreadsheet and populate * moved code to api util function * isr generate date once a day * delete hardcoded data * fixed board card fetch * fixes * Update BoardAPI.ts * dumb fix * Update Navbar.module.scss (#216) * fix navbar with events tab * optional facebook url
- Loading branch information
1 parent
7009f41
commit 4b02500
Showing
21 changed files
with
656 additions
and
1,250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,3 @@ yarn-error.log* | |
|
||
# vercel | ||
.vercel | ||
|
||
# autogenerated css module typings | ||
*.module.scss.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,24 @@ | ||
const EventsPage: React.FC = () => { | ||
import { EventsArray, getAllEvents } from "src/api/EventsAPI"; | ||
import SEO from "src/components/SEO"; | ||
import EventsContent from "src/sections/events/Events.Content"; | ||
|
||
const EventsPage: React.FC<{ events: EventsArray }> = ({ events }) => { | ||
return ( | ||
<> | ||
<h1>Events Page</h1> | ||
<SEO title="Events" path="/events" /> | ||
<EventsContent events={events} /> | ||
</> | ||
); | ||
}; | ||
|
||
export default EventsPage; | ||
|
||
export async function getStaticProps() { | ||
const eventsData = await getAllEvents(); | ||
return { | ||
props: { | ||
events: eventsData || [], | ||
}, | ||
revalidate: 1 * 60 * 60, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { BoardMemberProps } from "src/types"; | ||
|
||
const formatLinkedIn = val => { | ||
return val.includes("https://www.linkedin.com/in/") ? val : `https://www.linkedin.com/in/${val}`; | ||
}; | ||
|
||
export const getBoardData = async () => { | ||
const url = process.env.SPREADSHEET_URL; // Default value can be found at https://vercel.com/acmucsd/main-website/settings/environment-variables | ||
|
||
const data: BoardMemberProps[] = await fetch(url) | ||
.then(res => res.text()) | ||
.then(res => JSON.parse(res.substring(47).slice(0, -2))) // only get object | ||
.then(res => { | ||
const cols = res.table.cols.map((col, idx) => { | ||
return { idx, label: col.label }; | ||
}); | ||
const colMap = {}; | ||
cols.forEach(colHeader => { | ||
colMap[colHeader.label.toLowerCase()] = colHeader.idx; | ||
}); | ||
colMap["team"] = 0; // Team shall always be the first column | ||
|
||
const rows = res.table.rows | ||
.map(row => row.c) | ||
.map(row => { | ||
const get = label => row[colMap[label.toLowerCase()]]?.v ?? ""; // helper function for repetitive task | ||
const userData: BoardMemberProps = { | ||
name: get("Name"), // use spreadsheet column headers to find data | ||
org: get("Team").toLowerCase(), | ||
title: get("Position"), | ||
profile_image: get("Profile Picture"), | ||
email: get("ACM Email") || null, | ||
personal_link: get("Website") || null, | ||
linkedin_link: formatLinkedIn(get("LinkedIn")) || null, | ||
}; | ||
return userData; | ||
}) | ||
.filter(user => user.name) // name is required | ||
.filter(user => user.org && user.org !== "members at large") // valid suborg is required | ||
.filter(user => user.title) // position title is required | ||
.filter(user => user.profile_image); // image url is required | ||
|
||
return rows; | ||
}); | ||
return data; | ||
}; |
Oops, something went wrong.