Skip to content

Commit 7294e28

Browse files
authored
Load measurement on the client side (#1085)
1 parent 00b0f96 commit 7294e28

File tree

12 files changed

+253
-230
lines changed

12 files changed

+253
-230
lines changed

.github/workflows/playwright.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
branches: [ main, master ]
77
jobs:
88
test:
9-
timeout-minutes: 60
9+
timeout-minutes: 90
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v5

components/Footer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const Footer = () => {
2626
year: 'numeric',
2727
}).format(new Date())
2828
return (
29-
<footer className="text-white mt-8 bg-blue-900">
29+
<footer className="text-white bg-blue-900">
3030
<div className="container">
3131
<div className="flex flex-wrap">
3232
<div className="py-6 w-full md:w-2/5">

components/Layout.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ const Layout = ({ children, isEmbeddedView }) => {
3636

3737
return (
3838
<UserProvider>
39-
<div className="site flex flex-col min-h-[100vh]">
40-
<div className="flex-[1_0_auto]">
39+
<div className="site">
40+
<div className="flex flex-col min-h-screen">
4141
<Header />
4242
{!isEmbeddedView && (
4343
<ConditionalWrapper
@@ -49,7 +49,9 @@ const Layout = ({ children, isEmbeddedView }) => {
4949
<NavBar color={navbarColor} />
5050
</ConditionalWrapper>
5151
)}
52-
<div className={`content ${!navbarColor ? 'mt-[-66px]' : ''}`}>
52+
<div
53+
className={`content flex-1 flex flex-col ${!navbarColor ? 'mt-[-66px]' : ''}`}
54+
>
5355
{children}
5456
</div>
5557
</div>

components/vendor/SpinLoader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const getClassName = (classes) =>
99
classes,
1010
)
1111

12-
const SpinLoader = ({ className, props }) => (
12+
const SpinLoader = ({ className = '' }) => (
1313
<CgSpinner className={getClassName(className)} />
1414
)
1515

pages/countries.js

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { useMemo, useState } from 'react'
88
import { FormattedMessage, useIntl } from 'react-intl'
99
import { getLocalisedRegionName } from 'utils/i18nCountries'
1010
import { StickySubMenu } from '../components/SharedStyledComponents'
11+
import countries from 'data/countries.json'
1112

1213
const Regions = ({ regions, countries }) => {
1314
return regions.map((regionCode, index) => {
@@ -19,7 +20,7 @@ const Regions = ({ regions, countries }) => {
1920

2021
return (
2122
<RegionBlock
22-
key={index}
23+
key={regionCode}
2324
regionCode={regionCode}
2425
countries={countries.filter(
2526
(c) => measuredCountriesInRegion.indexOf(c.alpha_2) > -1,
@@ -72,19 +73,7 @@ const NoCountriesFound = ({ searchTerm }) => (
7273
</div>
7374
)
7475

75-
export const getStaticProps = async () => {
76-
const client = axios.create({ baseURL: process.env.NEXT_PUBLIC_OONI_API })
77-
const result = await client.get('/api/_/countries')
78-
79-
return {
80-
props: {
81-
countries: result.data.countries,
82-
},
83-
revalidate: 60 * 60 * 12, // 12 hours
84-
}
85-
}
86-
87-
const Countries = ({ countries }) => {
76+
const Countries = () => {
8877
const intl = useIntl()
8978
const [searchInput, setSearchInput] = useState('')
9079

@@ -101,7 +90,7 @@ const Countries = ({ countries }) => {
10190
b.localisedName,
10291
),
10392
),
104-
[intl, countries],
93+
[intl],
10594
)
10695

10796
const filteredCountries = useMemo(

pages/index.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,11 @@ const LandingPage = ({
117117
<FormattedMessage id="Home.Banner.Subtitle.ExploreCensorshipEvents" />
118118
</div>
119119
<div className="inline-block">
120-
<Link href="/chart/mat">
121-
<button
122-
className="btn btn-white-hollow hover:!text-white btn-xl mt-12 mx-auto"
123-
type="button"
124-
>
125-
<FormattedMessage id="Home.Banner.Button.Explore" />
126-
</button>
120+
<Link
121+
href="/chart/mat"
122+
className="btn btn-white-hollow hover:!text-white btn-xl mt-12 mx-auto"
123+
>
124+
<FormattedMessage id="Home.Banner.Button.Explore" />
127125
</Link>
128126
</div>
129127
</div>

0 commit comments

Comments
 (0)