Skip to content

Commit 6f7d5ff

Browse files
Su Yeon LeeSu Yeon Lee
authored andcommitted
migrated the member and project db to notion
1 parent 61d0402 commit 6f7d5ff

File tree

13 files changed

+404
-365
lines changed

13 files changed

+404
-365
lines changed

components/TextBlock.jsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from 'react';
2+
3+
function TextBlock({ content, className, id }) {
4+
if (!content) return null;
5+
6+
return (
7+
<div
8+
className={className}
9+
id={id}
10+
dangerouslySetInnerHTML={{ __html: content }}
11+
/>
12+
);
13+
}
14+
15+
export default TextBlock;

components/projects/projectCard.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function ProjectCard({ title, thumbnail, urlSlug, description }) {
1616
<CardBody>
1717
<h3 className="text-center">{title}</h3>
1818
<div className="text-center" style={{ maxHeight: '200px', overflow: 'auto' }}>
19-
<ContentBlock content={description.json} />
19+
{description}
2020
</div>
2121
<div className="text-center action-btn-box">
2222
<ActionButton white link={`/projects/${urlSlug}`}>

components/projects/projectExplore.jsx

Lines changed: 0 additions & 35 deletions
This file was deleted.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"lint:fix": "eslint --fix \"./**/*.{js,jsx}\""
1313
},
1414
"dependencies": {
15+
"@notionhq/client": "^4.0.1",
1516
"lucide-react": "^0.501.0",
1617
"mongodb": "^4.17.2",
1718
"next": "^13.5.0",
@@ -29,15 +30,15 @@
2930
"devDependencies": {
3031
"@contentful/rich-text-html-renderer": "^14.1.2",
3132
"@hack4impact-uiuc/eslint-plugin": "2.0.3",
33+
"@typescript-eslint/eslint-plugin": "3.10.1",
34+
"@typescript-eslint/parser": "3.10.1",
3235
"babel-plugin-inline-react-svg": "^1.0.1",
3336
"eslint": "^7.32.0",
3437
"eslint-config-prettier": "^8.10.0",
3538
"eslint-plugin-prettier": "^4.2.1",
3639
"jest": "^29.6.2",
3740
"prettier": "^3.0.0",
3841
"styled-jsx-plugin-sass": "^1.0.0",
39-
"@typescript-eslint/parser": "3.10.1",
40-
"@typescript-eslint/eslint-plugin": "3.10.1",
4142
"typescript": "^4.9.5"
4243
}
43-
}
44+
}

pages/about.jsx

Lines changed: 48 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ import MissionSection from '../components/about/missionSection';
44
import OurValues from '../components/about/ourValues';
55
import Head from '../components/head';
66
import Team from '../components/about/team';
7-
import fetchContent from '../utils/fetchContent';
7+
import { fetchContent } from '../utils/fetchContent';
8+
import fetchNotionContent from '../utils/fetchContent';
89

910
function 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 technologys 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 }) {
2526
export default AboutPage;
2627

2728
export 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' || /chair/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
}

pages/apply/nonprofits.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Quote from '../../components/quote';
66
import ApplicationProcess from '../../components/apply/applicationProcess';
77
import Head from '../../components/head';
88
import ActionButton from '../../components/actionButton';
9-
import fetchContent from '../../utils/fetchContent';
9+
import { fetchContent } from '../../utils/fetchContent';
1010

1111
function NonProfits({
1212
applicationLink,

pages/apply/students.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Quote from '../../components/quote';
66
import ApplicationProcess from '../../components/apply/applicationProcess';
77
import Head from '../../components/head';
88
import ActionButton from '../../components/actionButton';
9-
import fetchContent from '../../utils/fetchContent';
9+
import { fetchContent } from '../../utils/fetchContent';
1010

1111
function Students({
1212
applicationLink,

pages/clients/quizpage.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import Head from '../../components/head';
33
import { Container, Row, Col } from 'reactstrap';
44
import Quiz from '../../components/clients/ProjectQuiz';
5-
import fetchContent from '../../utils/fetchContent';
5+
import {fetchContent} from '../../utils/fetchContent';
66

77
export async function getStaticProps() {
88
const {

pages/index.jsx

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import PartnerSection from '../components/homepage/partnerSection';
66
import OtherChapters from '../components/homepage/otherChapters';
77
import { ToastContainer } from 'react-toastify';
88
import Head from '../components/head';
9-
import fetchContent from '../utils/fetchContent';
9+
import fetchNotionContent from '../utils/fetchContent';
1010
import Section from '../components/section';
1111
import { Container } from 'reactstrap';
1212

@@ -24,7 +24,7 @@ function Home({ chapterLogos, previewProjects }) {
2424
</Container>
2525
</Section>
2626
<PartnerSection />
27-
<OtherChapters chapterLogos={chapterLogos} />
27+
{/* <OtherChapters chapterLogos={chapterLogos} /> */}
2828
</>
2929
);
3030
}
@@ -35,36 +35,8 @@ export async function getStaticProps() {
3535
const {
3636
chapterCollection,
3737
pennWebsiteLayout: { projectsCollection },
38-
} = await fetchContent(`
39-
{
40-
chapterCollection {
41-
items {
42-
name
43-
websiteLink
44-
socialMediaLink
45-
codeRepoLink
46-
universityLogo {
47-
url
48-
}
49-
}
50-
}
51-
pennWebsiteLayout(id: "${process.env.LAYOUT_ENTRY_ID}") {
52-
projectsCollection(limit: 3) {
53-
items {
54-
title
55-
description {
56-
json
57-
}
58-
thumbnail {
59-
url
60-
description
61-
}
62-
urlSlug
63-
}
64-
}
65-
}
66-
}
67-
`);
38+
} = await fetchNotionContent('homepage');
39+
6840
return {
6941
props: {
7042
chapterLogos: chapterCollection.items.map(

0 commit comments

Comments
 (0)