@@ -4,15 +4,16 @@ import MissionSection from '../components/about/missionSection';
44import OurValues from '../components/about/ourValues' ;
55import Head from '../components/head' ;
66import Team from '../components/about/team' ;
7- import fetchContent from '../utils/fetchContent' ;
7+ import { fetchContent } from '../utils/fetchContent' ;
8+ import fetchNotionContent from '../utils/fetchContent' ;
89
910function AboutPage ( { members, alumni, values, execBoard } ) {
1011 return (
1112 < div >
1213 < Head title = "About Us" />
1314 < GradientBanner
1415 title = "We believe in using tech for good."
15- subHeadline = "Hack4Impact believes in technology’ s huge potential to empower activists and humanitarians to create lasting and impactful social change. We work to foster the wider adoption of software as a tool for social good."
16+ subHeadline = "Hack4Impact believes in technology' s huge potential to empower activists and humanitarians to create lasting and impactful social change. We work to foster the wider adoption of software as a tool for social good."
1617 arrow
1718 />
1819 < MissionSection />
@@ -25,63 +26,53 @@ function AboutPage({ members, alumni, values, execBoard }) {
2526export default AboutPage ;
2627
2728export async function getStaticProps ( ) {
28- const {
29- pennWebsiteLayout : {
30- chapterValuesCollection,
31- execBoardCollection,
32- membersCollection,
33- alumniCollection,
34- } ,
35- } = await fetchContent ( `
36- fragment profile on PennMemberProfile{
37- name
38- title
39- image {
40- url
41- }
42- linkedIn
43- classOf
44- urlSlug
45- }
46-
47- {
48- pennWebsiteLayout(id: "${ process . env . LAYOUT_ENTRY_ID } ") {
49- chapterValuesCollection {
50- items {
51- header
52- body {
53- json
29+ try {
30+ // Fetch values from Contentful and all members from Notion
31+ const [ contentfulData , allMembers ] = await Promise . all ( [
32+ fetchContent ( `
33+ {
34+ pennWebsiteLayout(id: "${ process . env . LAYOUT_ENTRY_ID } ") {
35+ chapterValuesCollection {
36+ items {
37+ header
38+ body {
39+ json
40+ }
41+ image {
42+ url
43+ description
44+ }
45+ }
5446 }
55- image {
56- url
57- description
58- }
59- }
60- }
61- execBoardCollection {
62- items {
63- ...profile
64- }
65- }
66- membersCollection {
67- items {
68- ...profile
6947 }
7048 }
71- alumniCollection {
72- items {
73- ...profile
74- }
75- }
76- }
49+ ` ) ,
50+ fetchNotionContent ( 'members' )
51+ ] ) ;
52+
53+ const membersList = allMembers . memberCollection . items ;
54+ const activeMembers = membersList . filter ( member => member . status === 'Active' ) ;
55+ const alumni = membersList . filter ( member => member . status === 'Alumni' ) ;
56+ const execBoard = membersList . filter ( member => member . title === 'Co-Director' || / c h a i r / i. test ( member . title ) ) ;
57+
58+
59+ return {
60+ props : {
61+ values : contentfulData . pennWebsiteLayout . chapterValuesCollection . items ,
62+ members : activeMembers ,
63+ alumni : alumni ,
64+ execBoard : execBoard
65+ } ,
66+ } ;
67+ } catch ( error ) {
68+ console . error ( 'Error fetching about page data:' , error ) ;
69+ return {
70+ props : {
71+ members : [ ] ,
72+ alumni : [ ] ,
73+ values : [ ] ,
74+ execBoard : [ ]
75+ } ,
76+ } ;
7777 }
78- ` ) ;
79- return {
80- props : {
81- values : chapterValuesCollection . items ,
82- members : membersCollection . items ,
83- alumni : alumniCollection . items ,
84- execBoard : execBoardCollection . items ,
85- } ,
86- } ;
8778}
0 commit comments