Skip to content

Commit 1a0ea3a

Browse files
authored
Merge branch 'dev' into fix-md-images
2 parents 01753ee + 5427754 commit 1a0ea3a

File tree

15 files changed

+115
-100
lines changed

15 files changed

+115
-100
lines changed

.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
# GOOGLE_API_KEY=
1717
# GOOGLE_CALENDAR_ID=
1818

19+
# Matomo environment (URL and site ID required for analytics)
20+
NEXT_PUBLIC_MATOMO_URL=
21+
NEXT_PUBLIC_MATOMO_SITE_ID=
22+
1923
# Used to avoid loading Matomo in our preview deploys
2024
IS_PREVIEW_DEPLOY=false
2125

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"@docsearch/react": "^3.5.2",
2222
"@emotion/react": "^11.11.1",
2323
"@emotion/styled": "^11.11.0",
24+
"@socialgouv/matomo-next": "^1.8.0",
2425
"clipboard": "^2.0.11",
2526
"embla-carousel-react": "^7.0.0",
2627
"ethereum-blockies-base64": "^1.0.2",

src/components/Hero/HubHero/index.tsx

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
import {
2-
Box,
3-
Heading,
4-
HStack,
5-
Stack,
6-
Text,
7-
useBreakpointValue,
8-
} from "@chakra-ui/react"
1+
import { Box, Heading, HStack, Stack, Text } from "@chakra-ui/react"
92

103
import type { CommonHeroProps } from "@/lib/types"
114

@@ -21,22 +14,21 @@ const HubHero = (props: CommonHeroProps) => {
2114
)
2215
}
2316

24-
const height = useBreakpointValue({
25-
base: "192px",
26-
md: "256px",
27-
lg: "320px",
28-
xl: "576px",
29-
"2xl": "672px",
30-
})
31-
3217
return (
3318
<Box position="relative">
3419
<Image
3520
src={heroImg}
3621
alt=""
3722
priority
3823
sizes="100vw"
39-
style={{ width: "100vw", objectFit: "cover", height }}
24+
style={{ width: "100vw", objectFit: "cover" }}
25+
h={{
26+
base: "192px",
27+
md: "256px",
28+
lg: "320px",
29+
xl: "576px",
30+
"2xl": "672px",
31+
}}
4032
/>
4133
<Stack
4234
spacing={{ base: "3", md: "4" }}

src/components/PageHero.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ const PageHero = ({
9797
{subtitle}
9898
</Text>
9999
{buttons && (
100-
// FIXME: remove the `ul` override once removed the corresponding
101-
// global styles in `src/@chakra-ui/gatsby-plugin/styles.ts`
102100
<Wrap spacing={2} overflow="visible" sx={{ ul: { m: 0 } }}>
103101
{buttons.map((button, idx) => {
104102
if (isButtonLink(button)) {

src/components/SideNav.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ export interface SideNavProps {
144144
// TODO set tree state based on if current path is a child
145145
// of the given parent. Currently all `path` items default to open
146146
// and they only collapse when clicked on.
147-
// e.g. solution: https://github.com/hasura/gatsby-gitbook-starter/blob/5c165af40e48fc55eb06b45b95c84eb64b17ed32/src/components/sidebar/tree.js
148147
const SideNav = ({ path }: SideNavProps) => {
149148
const { t } = useTranslation("page-developers-docs")
150149

src/global.d.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ declare global {
1414
GITHUB_TOKEN: string
1515
ALGOLIA_ADMIN_KEY: string
1616
ETHERSCAN_API_KEY: string
17-
GATSBY_ALGOLIA_APP_ID: string
18-
GATSBY_ALGOLIA_SEARCH_KEY: string
19-
GATSBY_GITHUB_TOKEN_READ_ONLY: string
20-
GATSBY_FUNCTIONS_PATH: string
2117
CROWDIN_API_KEY: string
2218
}
2319
}

src/layouts/Roadmap.tsx

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -141,52 +141,50 @@ export const RoadmapLayout: React.FC<IProps> = ({
141141
/>
142142
) : (
143143
<HeroContainer>
144-
<TitleCard>
145-
{/* TODO: Double check this slug works */}
146-
<Breadcrumbs slug={slug} mb="8" />
147-
<Title>{frontmatter.title}</Title>
148-
<OldText>{frontmatter.description}</OldText>
149-
{frontmatter?.buttons && (
150-
// FIXME: remove the `ul` override once removed the corresponding
151-
// global styles in `src/@chakra-ui/gatsby-plugin/styles.ts`
152-
<Wrap spacing={2} marginBottom={4} sx={{ ul: { m: 0 } }}>
153-
{frontmatter.buttons.map((button, idx) => {
154-
if (button?.to) {
155-
return (
156-
<WrapItem key={idx}>
157-
<ButtonLink variant={button?.variant} to={button?.to}>
158-
{button.label}
159-
</ButtonLink>
160-
</WrapItem>
161-
)
162-
}
144+
<TitleCard>
145+
{/* TODO: Double check this slug works */}
146+
<Breadcrumbs slug={slug} mb="8" />
147+
<Title>{frontmatter.title}</Title>
148+
<OldText>{frontmatter.description}</OldText>
149+
{frontmatter?.buttons && (
150+
<Wrap spacing={2} marginBottom={4} sx={{ ul: { m: 0 } }}>
151+
{frontmatter.buttons.map((button, idx) => {
152+
if (button?.to) {
163153
return (
164154
<WrapItem key={idx}>
165-
<Button variant={button?.variant} toId={button?.toId}>
166-
{button?.label}
167-
</Button>
155+
<ButtonLink variant={button?.variant} to={button?.to}>
156+
{button.label}
157+
</ButtonLink>
168158
</WrapItem>
169159
)
170-
})}
171-
</Wrap>
172-
)}
173-
<TableOfContents
174-
position="relative"
175-
zIndex="2"
176-
items={tocItems}
177-
isMobile
178-
/>
179-
</TitleCard>
180-
<Center>
181-
<Image
182-
src={frontmatter.image}
183-
alt={frontmatter.alt ?? ""}
184-
style={{ objectFit: "contain" }}
185-
width={1504}
186-
height={345}
187-
priority
188-
/>
189-
</Center>
160+
}
161+
return (
162+
<WrapItem key={idx}>
163+
<Button variant={button?.variant} toId={button?.toId}>
164+
{button?.label}
165+
</Button>
166+
</WrapItem>
167+
)
168+
})}
169+
</Wrap>
170+
)}
171+
<TableOfContents
172+
position="relative"
173+
zIndex="2"
174+
items={tocItems}
175+
isMobile
176+
/>
177+
</TitleCard>
178+
<Center>
179+
<Image
180+
src={frontmatter.image}
181+
alt={frontmatter.alt ?? ""}
182+
style={{ objectFit: "contain" }}
183+
width={1504}
184+
height={345}
185+
priority
186+
/>
187+
</Center>
190188
</HeroContainer>
191189
)}
192190
<Page>

src/lib/api/calendarEvents.ts

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,26 @@ export async function fetchCommunityEvents(): Promise<CommunityEventsReturnType>
2222
const pastEvents = await pastEventsReq.json()
2323
const pastEventsReqData: ReqCommunityEvent[] = pastEvents.items
2424

25-
const pastEventData = pastEventsReqData.map((event) => {
26-
return {
27-
date: event.start.dateTime,
28-
title: event.summary,
29-
calendarLink: event.htmlLink,
30-
pastEventLink: event.location,
31-
}
32-
})
33-
const upcomingEventData = futureEventsReqData.map((event) => {
34-
return {
35-
date: event.start.dateTime,
36-
title: event.summary,
37-
calendarLink: event.htmlLink,
38-
pastEventLink: event.location,
39-
}
40-
})
25+
const pastEventData = pastEventsReqData
26+
.filter((event) => event.start)
27+
.map((event) => {
28+
return {
29+
date: event.start.dateTime,
30+
title: event.summary,
31+
calendarLink: event.htmlLink,
32+
pastEventLink: event.location,
33+
}
34+
})
35+
const upcomingEventData = futureEventsReqData
36+
.filter((event) => event.start)
37+
.map((event) => {
38+
return {
39+
date: event.start.dateTime,
40+
title: event.summary,
41+
calendarLink: event.htmlLink,
42+
pastEventLink: event.location,
43+
}
44+
})
4145

4246
return {
4347
pastEventData,

src/lib/api/ghRepoData.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import axios from "axios"
2-
31
import { Framework } from "@/lib/interfaces"
42

53
import EthDiamondBlackImage from "@/public/assets/eth-diamond-black.png"
@@ -128,25 +126,38 @@ export const ghRepoData = async (githubUrl: string) => {
128126
const split = githubUrl.split("/")
129127
const repoOwner = split[split.length - 2]
130128
const repoName = split[split.length - 1]
131-
const repoData = await axios.get(
129+
const repoReq = await fetch(
132130
`https://api.github.com/repos/${repoOwner}/${repoName}`,
133131
{
134132
headers: {
135133
Authorization: `Bearer ${process.env.GITHUB_TOKEN_READ_ONLY}`,
136134
},
137135
}
138136
)
139-
const languageData = await axios.get(
137+
if (!repoReq.ok) {
138+
console.log(repoReq.status, repoReq.statusText)
139+
throw new Error("Failed to fetch Github repo data")
140+
}
141+
142+
const repoData = await repoReq.json()
143+
144+
const languageReq = await fetch(
140145
`https://api.github.com/repos/${repoOwner}/${repoName}/languages`,
141146
{
142147
headers: {
143148
Authorization: `Bearer ${process.env.GITHUB_TOKEN_READ_ONLY}`,
144149
},
145150
}
146151
)
152+
if (!languageReq.ok) {
153+
console.log(languageReq.status, languageReq.statusText)
154+
throw new Error("Failed to fetch Github repo language data")
155+
}
156+
const languageData = await languageReq.json()
157+
147158
return {
148-
starCount: repoData.data.stargazers_count,
149-
languages: Object.keys(languageData.data),
159+
starCount: repoData.stargazers_count,
160+
languages: Object.keys(languageData),
150161
}
151162
}
152163

src/lib/utils/matomo.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { push } from "@socialgouv/matomo-next"
2+
13
export const MATOMO_LS_KEY = "ethereum-org.matomo-opt-out"
24

35
export interface MatomoEventOptions {
@@ -13,15 +15,12 @@ export const trackCustomEvent = ({
1315
eventName,
1416
eventValue,
1517
}: MatomoEventOptions): void => {
16-
if (process.env.NODE_ENV !== "production" && !window.dev) return
18+
if (process.env.NODE_ENV !== "production") return
1719
const optedOutValue = localStorage.getItem(MATOMO_LS_KEY) || "false"
1820
const isOptedOut = JSON.parse(optedOutValue)
19-
if (!window._paq || isOptedOut) return
20-
21-
const { _paq, dev } = window
21+
if (isOptedOut) return
2222

23-
_paq.push([`trackEvent`, eventCategory, eventAction, eventName, eventValue])
24-
if (!dev) return
23+
push([`trackEvent`, eventCategory, eventAction, eventName, eventValue])
2524

2625
console.debug(
2726
`[Matomo] event tracked, category: ${eventCategory}, action: ${eventAction}, name: ${eventName}, value: ${eventValue}`

0 commit comments

Comments
 (0)