Skip to content
This repository was archived by the owner on Dec 26, 2023. It is now read-only.

Commit de5699d

Browse files
mulfdevkempsterrrrnaz3eh
authored
Initial integration of CMS into the website (#255)
* installing appolo graphql * implemented data fetching for partner logo * Add `key` * resolve build errors * remove log * misc * prod env update Co-authored-by: WIll <[email protected]> Co-authored-by: Nazeeh Vahora <[email protected]>
1 parent f4a19d5 commit de5699d

File tree

7 files changed

+180
-56
lines changed

7 files changed

+180
-56
lines changed

frontend/.env.development

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ NEXT_PUBLIC_OPENSEA_DIRECT_LINK_PREFIX=https://testnets.opensea.io/assets/0xbf11
66
NEXT_PUBLIC_OPENSEA_COLLECTION_LINK=https://testnets.opensea.io/collection/devs-for-revolution-kexfxbcvp8
77
NEXT_PUBLIC_ETHER_SCAN_LINK_PREFIX=https://rinkeby.etherscan.io/address
88
NEXT_PUBLIC_ETHERSCAN_TX_URL=https://rinkeby.etherscan.io/tx/
9-
NEXT_PUBLIC_INFURA_ID=
9+
NEXT_PUBLIC_INFURA_ID=
10+
NEXT_PUBLIC_GRAPHQL_API=http://localhost:1337/graphql
11+
NEXT_PUBLIC_CMS_URL=http://localhost:1337

frontend/.env.production

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ NEXT_PUBLIC_OPENSEA_DIRECT_LINK_PREFIX=https://opensea.io/assets/0x25ed58c027921
66
NEXT_PUBLIC_OPENSEA_COLLECTION_LINK=https://opensea.io/collection/devs-for-revolution
77
NEXT_PUBLIC_ETHER_SCAN_LINK_PREFIX=https://etherscan.io/address
88
NEXT_PUBLIC_ETHERSCAN_TX_URL=https://etherscan.io/tx/
9-
NEXT_PUBLIC_INFURA_ID=
9+
NEXT_PUBLIC_INFURA_ID=
10+
NEXT_PUBLIC_GRAPHQL_API=https://cms-6eyr9.ondigitalocean.app/graphql
11+
NEXT_PUBLIC_CMS_URL=https://cms-6eyr9.ondigitalocean.app

frontend/.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
# misc
1414
.DS_Store
1515
.env.local
16-
.env.development.local
16+
.env.development
1717
.env.test.local
18-
.env.production.local
18+
.env.production
1919
.yarnrc
2020

2121
npm-debug.log*

frontend/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.2.1",
44
"private": true,
55
"dependencies": {
6+
"@apollo/client": "^3.6.9",
67
"@chakra-ui/icons": "^1.0.15",
78
"@chakra-ui/react": "^1.6.7",
89
"@emotion/react": "^11",
@@ -14,6 +15,7 @@
1415
"@testing-library/react": "^11.1.0",
1516
"@testing-library/user-event": "^12.1.10",
1617
"framer-motion": "^4",
18+
"graphql": "^16.5.0",
1719
"jest": "^27.2.0",
1820
"next": "12.2.2",
1921
"next-i18next": "^8.8.0",

frontend/src/Components/Partners/index.tsx

Lines changed: 29 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,21 @@ import {
99
} from '@chakra-ui/react';
1010
import { useCallback } from 'react';
1111

12-
const Partners = () => {
12+
interface Props {
13+
partnerData: Array<Record<string, any>>;
14+
}
15+
16+
const Partners = ({ partnerData }: Props) => {
1317
const { colorMode } = useColorMode();
1418
const handleButtonClick = useCallback(() => {
1519
const partnerFormUrl = 'https://airtable.com/shrYLrOrjhOHJUdVl';
1620
window.open(partnerFormUrl, '_blank');
1721
}, []);
1822

23+
if (partnerData === null || typeof partnerData === 'undefined') {
24+
return <></>;
25+
}
26+
1927
return (
2028
<Flex flexDir="column" justifyContent="center" pt="5.5rem" pb="5.5rem">
2129
<Heading
@@ -29,47 +37,26 @@ const Partners = () => {
2937
Our Partners
3038
</Heading>
3139
<Flex flexDir={{ base: 'column', xl: 'row' }} alignItems={'center'}>
32-
<Link
33-
href="https://thirdweb.com"
34-
mb={{ base: '4rem', xl: '0' }}
35-
mr={{ base: '0', xl: '6rem' }}
36-
target="_blank"
37-
>
38-
<Image
39-
src={colorMode === 'dark' ? '/thirdweb.svg' : '/thirdweb-light.svg'}
40-
alt="third web"
41-
/>
42-
</Link>
43-
<Link
44-
href="https://gitcoin.co"
45-
mb={{ base: '4rem', xl: '0' }}
46-
mr={{ base: '0', xl: '6rem' }}
47-
target="_blank"
48-
>
49-
<Image
50-
src={colorMode === 'dark' ? '/gitcoin.svg' : '/gitcoin-light.svg'}
51-
alt="gitcoin"
52-
/>
53-
</Link>
54-
<Link
55-
mb={{ base: '4rem', xl: '0' }}
56-
mr={{ base: '0', xl: '6rem' }}
57-
href="https://polygon.technology"
58-
target="_blank"
59-
>
60-
<Image
61-
src={colorMode === 'dark' ? '/polygon.svg' : '/polygon-light.svg'}
62-
alt="polygon"
63-
/>
64-
</Link>
65-
<Link href="https://thegraph.com" target="_blank">
66-
<Image
67-
src={
68-
colorMode === 'dark' ? '/the-graph.svg' : '/the-graph-light.svg'
69-
}
70-
alt="the graph"
71-
/>
72-
</Link>
40+
{partnerData?.map((item: any, index: number) => {
41+
return (
42+
<Link
43+
href={item.attributes.website}
44+
key={index}
45+
mb={{ base: '4rem', xl: '0' }}
46+
mr={{ base: '0', xl: '6rem' }}
47+
target="_blank"
48+
>
49+
<Image
50+
src={
51+
colorMode === 'dark'
52+
? `${process.env.NEXT_PUBLIC_CMS_URL}${item.attributes.logo_dark.data.attributes.url}`
53+
: `${process.env.NEXT_PUBLIC_CMS_URL}${item.attributes.logo_light.data.attributes.url}`
54+
}
55+
alt="third web"
56+
/>
57+
</Link>
58+
);
59+
})}
7360
</Flex>
7461
<Button
7562
backgroundColor={colorMode === 'dark' ? 'white' : 'black'}

frontend/src/pages/index.tsx

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
import { Divider, useColorMode, VStack } from '@chakra-ui/react';
22
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
3+
import { ApolloClient, InMemoryCache, gql } from '@apollo/client';
4+
import nextI18nextConfig from '../../next-i18next.config';
35

6+
// COMPONENTS
47
import Footer from '../Components/Footer';
58
import IntroComponent from '../Components/Intro';
69
import Partners from '../Components/Partners';
710
import Values from '../Components/Values';
811

9-
export default function IndexPage() {
12+
interface Props {
13+
partnerData: Array<Record<string, any>>;
14+
}
15+
16+
export default function IndexPage({ partnerData }: Props) {
1017
const { colorMode } = useColorMode();
1118

1219
return (
13-
1420
<VStack w="full" justify="center" spacing={4}>
1521
<IntroComponent />
1622
<Values />
17-
<Partners />
23+
<Partners partnerData={partnerData} />
24+
1825
<Divider
1926
w="full"
2027
size="1px"
@@ -25,8 +32,44 @@ export default function IndexPage() {
2532
);
2633
}
2734

28-
export const getStaticProps = async ({ locale }: { locale: string }) => ({
29-
props: {
30-
...(await serverSideTranslations(locale, ['common'])),
31-
},
32-
});
35+
export const getStaticProps = async ({ locale }: { locale: string }) => {
36+
const client = new ApolloClient({
37+
uri: process.env.NEXT_PUBLIC_GRAPHQL_API,
38+
cache: new InMemoryCache(),
39+
});
40+
41+
const partnerData = await client.query({
42+
query: gql`
43+
query HomePage {
44+
partners {
45+
data {
46+
attributes {
47+
website
48+
logo_dark {
49+
data {
50+
attributes {
51+
url
52+
}
53+
}
54+
}
55+
logo_light {
56+
data {
57+
attributes {
58+
url
59+
}
60+
}
61+
}
62+
}
63+
}
64+
}
65+
}
66+
`,
67+
});
68+
69+
return {
70+
props: {
71+
...(await serverSideTranslations(locale, ['common'], nextI18nextConfig)),
72+
partnerData: partnerData.data ? partnerData.data.partners.data : null,
73+
},
74+
};
75+
};

frontend/yarn.lock

Lines changed: 90 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22
# yarn lockfile v1
33

44

5+
"@apollo/client@^3.6.9":
6+
version "3.6.9"
7+
resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.6.9.tgz#ad0ee2e3a3c92dbed4acd6917b6158a492739d94"
8+
integrity sha512-Y1yu8qa2YeaCUBVuw08x8NHenFi0sw2I3KCu7Kw9mDSu86HmmtHJkCAifKVrN2iPgDTW/BbP3EpSV8/EQCcxZA==
9+
dependencies:
10+
"@graphql-typed-document-node/core" "^3.1.1"
11+
"@wry/context" "^0.6.0"
12+
"@wry/equality" "^0.5.0"
13+
"@wry/trie" "^0.3.0"
14+
graphql-tag "^2.12.6"
15+
hoist-non-react-statics "^3.3.2"
16+
optimism "^0.16.1"
17+
prop-types "^15.7.2"
18+
symbol-observable "^4.0.0"
19+
ts-invariant "^0.10.3"
20+
tslib "^2.3.0"
21+
zen-observable-ts "^1.2.5"
22+
523
624
version "7.12.11"
725
resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz"
@@ -1061,6 +1079,11 @@
10611079
resolved "https://registry.npmjs.org/@fontsource/source-code-pro/-/source-code-pro-4.5.0.tgz"
10621080
integrity sha512-IKB+oQfwjj9DzEM2sc5rO70BZV7+ksmZbB+1KzyiZp2VroPw7Lm1ovXBU2JYWIWXmNY+gDudvyZXZHE+6cG47Q==
10631081

1082+
"@graphql-typed-document-node/core@^3.1.1":
1083+
version "3.1.1"
1084+
resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.1.1.tgz#076d78ce99822258cf813ecc1e7fa460fa74d052"
1085+
integrity sha512-NQ17ii0rK1b34VZonlmT2QMJFI70m0TRwbknO/ihlbatXyaktDhN/98vBiUU6kNBPljqGqyIrl2T4nY2RpFANg==
1086+
10641087
"@humanwhocodes/config-array@^0.5.0":
10651088
version "0.5.0"
10661089
resolved "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz"
@@ -1824,6 +1847,27 @@
18241847
"@typescript-eslint/types" "4.31.0"
18251848
eslint-visitor-keys "^2.0.0"
18261849

1850+
"@wry/context@^0.6.0":
1851+
version "0.6.1"
1852+
resolved "https://registry.yarnpkg.com/@wry/context/-/context-0.6.1.tgz#c3c29c0ad622adb00f6a53303c4f965ee06ebeb2"
1853+
integrity sha512-LOmVnY1iTU2D8tv4Xf6MVMZZ+juIJ87Kt/plMijjN20NMAXGmH4u8bS1t0uT74cZ5gwpocYueV58YwyI8y+GKw==
1854+
dependencies:
1855+
tslib "^2.3.0"
1856+
1857+
"@wry/equality@^0.5.0":
1858+
version "0.5.2"
1859+
resolved "https://registry.yarnpkg.com/@wry/equality/-/equality-0.5.2.tgz#72c8a7a7d884dff30b612f4f8464eba26c080e73"
1860+
integrity sha512-oVMxbUXL48EV/C0/M7gLVsoK6qRHPS85x8zECofEZOVvxGmIPLA9o5Z27cc2PoAyZz1S2VoM2A7FLAnpfGlneA==
1861+
dependencies:
1862+
tslib "^2.3.0"
1863+
1864+
"@wry/trie@^0.3.0":
1865+
version "0.3.1"
1866+
resolved "https://registry.yarnpkg.com/@wry/trie/-/trie-0.3.1.tgz#2279b790f15032f8bcea7fc944d27988e5b3b139"
1867+
integrity sha512-WwB53ikYudh9pIorgxrkHKrQZcCqNM/Q/bDzZBffEaGUKGuHrRb3zZUT9Sh2qw9yogC7SsdRmQ1ER0pqvd3bfw==
1868+
dependencies:
1869+
tslib "^2.3.0"
1870+
18271871
abab@^2.0.3, abab@^2.0.5:
18281872
version "2.0.5"
18291873
resolved "https://registry.npmjs.org/abab/-/abab-2.0.5.tgz"
@@ -3525,6 +3569,18 @@ graceful-fs@^4.2.0, graceful-fs@^4.2.4:
35253569
resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz"
35263570
integrity sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==
35273571

3572+
graphql-tag@^2.12.6:
3573+
version "2.12.6"
3574+
resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.12.6.tgz#d441a569c1d2537ef10ca3d1633b48725329b5f1"
3575+
integrity sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg==
3576+
dependencies:
3577+
tslib "^2.1.0"
3578+
3579+
graphql@^16.5.0:
3580+
version "16.5.0"
3581+
resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.5.0.tgz#41b5c1182eaac7f3d47164fb247f61e4dfb69c85"
3582+
integrity sha512-qbHgh8Ix+j/qY+a/ZcJnFQ+j8ezakqPiHwPiZhV/3PgGlgf96QMBB5/f2rkiC9sgLoy/xvT6TSiaf2nTHJh5iA==
3583+
35283584
har-schema@^2.0.0:
35293585
version "2.0.0"
35303586
resolved "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz"
@@ -3577,7 +3633,7 @@ hey-listen@^1.0.8:
35773633
resolved "https://registry.npmjs.org/hey-listen/-/hey-listen-1.0.8.tgz"
35783634
integrity sha512-COpmrF2NOg4TBWUJ5UVyaCU2A88wEMkUPK4hNqyCkqHbxT92BbvfjoSozkAIIm6XhicGlJHhFdullInrdhwU8Q==
35793635

3580-
hoist-non-react-statics@^3.2.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.1:
3636+
hoist-non-react-statics@^3.2.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.1, hoist-non-react-statics@^3.3.2:
35813637
version "3.3.2"
35823638
resolved "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz"
35833639
integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==
@@ -4973,6 +5029,14 @@ onetime@^5.1.0, onetime@^5.1.2:
49735029
dependencies:
49745030
mimic-fn "^2.1.0"
49755031

5032+
optimism@^0.16.1:
5033+
version "0.16.1"
5034+
resolved "https://registry.yarnpkg.com/optimism/-/optimism-0.16.1.tgz#7c8efc1f3179f18307b887e18c15c5b7133f6e7d"
5035+
integrity sha512-64i+Uw3otrndfq5kaoGNoY7pvOhSsjFEN4bdEFh80MWVk/dbgJfMv7VFDeCT8LxNAlEVhQmdVEbfE7X2nWNIIg==
5036+
dependencies:
5037+
"@wry/context" "^0.6.0"
5038+
"@wry/trie" "^0.3.0"
5039+
49765040
optionator@^0.8.1:
49775041
version "0.8.3"
49785042
resolved "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz"
@@ -5925,6 +5989,11 @@ supports-hyperlinks@^2.0.0:
59255989
has-flag "^4.0.0"
59265990
supports-color "^7.0.0"
59275991

5992+
symbol-observable@^4.0.0:
5993+
version "4.0.0"
5994+
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-4.0.0.tgz#5b425f192279e87f2f9b937ac8540d1984b39205"
5995+
integrity sha512-b19dMThMV4HVFynSAM1++gBHAbk2Tc/osgLIBZMKsyqh34jb2e8Os7T6ZW/Bt3pJFdBTd2JwAnAAEQV7rSNvcQ==
5996+
59285997
symbol-tree@^3.2.4:
59295998
version "3.2.4"
59305999
resolved "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz"
@@ -6062,6 +6131,13 @@ ts-essentials@^7.0.1:
60626131
resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-7.0.3.tgz#686fd155a02133eedcc5362dc8b5056cde3e5a38"
60636132
integrity sha512-8+gr5+lqO3G84KdiTSMRLtuyJ+nTBVRKuCrK4lidMPdVeEp0uqC875uE5NMcaA7YYMN7XsNiFQuMvasF8HT/xQ==
60646133

6134+
ts-invariant@^0.10.3:
6135+
version "0.10.3"
6136+
resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.10.3.tgz#3e048ff96e91459ffca01304dbc7f61c1f642f6c"
6137+
integrity sha512-uivwYcQaxAucv1CzRp2n/QdYPo4ILf9VXgH19zEIjFx2EJufV16P0JtJVpYHy89DItG6Kwj2oIUjrcK5au+4tQ==
6138+
dependencies:
6139+
tslib "^2.1.0"
6140+
60656141
tsconfig-paths@^3.11.0, tsconfig-paths@^3.9.0:
60666142
version "3.11.0"
60676143
resolved "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.11.0.tgz"
@@ -6082,7 +6158,7 @@ tslib@^2.1.0:
60826158
resolved "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz"
60836159
integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==
60846160

6085-
tslib@^2.4.0:
6161+
tslib@^2.3.0, tslib@^2.4.0:
60866162
version "2.4.0"
60876163
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3"
60886164
integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==
@@ -6482,3 +6558,15 @@ yauzl@^2.10.0:
64826558
dependencies:
64836559
buffer-crc32 "~0.2.3"
64846560
fd-slicer "~1.1.0"
6561+
6562+
zen-observable-ts@^1.2.5:
6563+
version "1.2.5"
6564+
resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-1.2.5.tgz#6c6d9ea3d3a842812c6e9519209365a122ba8b58"
6565+
integrity sha512-QZWQekv6iB72Naeake9hS1KxHlotfRpe+WGNbNx5/ta+R3DNjVO2bswf63gXlWDcs+EMd7XY8HfVQyP1X6T4Zg==
6566+
dependencies:
6567+
zen-observable "0.8.15"
6568+
6569+
6570+
version "0.8.15"
6571+
resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.8.15.tgz#96415c512d8e3ffd920afd3889604e30b9eaac15"
6572+
integrity sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ==

0 commit comments

Comments
 (0)