-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
65 changed files
with
2,848 additions
and
2,104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import Chart, { ChartSpinLoader } from 'components/Chart' | ||
import { useRouter } from 'next/router' | ||
import { useMemo } from 'react' | ||
import { useInView } from 'react-intersection-observer' | ||
|
||
type ChartWrapperProps = { | ||
domain?: string | ||
testName?: string | ||
headerOptions?: object | ||
} | ||
|
||
const ChartWrapper = ({ | ||
domain, | ||
testName = 'web_connectivity', | ||
headerOptions, | ||
}: ChartWrapperProps) => { | ||
const router = useRouter() | ||
|
||
const { | ||
query: { since, until, probe_cc }, | ||
} = router | ||
|
||
const query = useMemo( | ||
() => ({ | ||
axis_x: 'measurement_start_day', | ||
axis_y: 'probe_cc', | ||
since, | ||
until, | ||
test_name: testName, | ||
...(domain && { domain }), | ||
...(probe_cc && { probe_cc }), | ||
time_grain: 'day', | ||
}), | ||
[domain, since, until, probe_cc, testName], | ||
) | ||
|
||
const { ref, inView } = useInView({ | ||
triggerOnce: true, | ||
rootMargin: '-300px 0px 0px 0px', | ||
threshold: 0.5, | ||
initialInView: false, | ||
}) | ||
|
||
return ( | ||
<div ref={ref}> | ||
{inView ? ( | ||
<Chart | ||
// testName={testName} | ||
queryParams={query} | ||
headerOptions={headerOptions} | ||
/> | ||
) : ( | ||
<ChartSpinLoader /> | ||
)} | ||
</div> | ||
) | ||
} | ||
|
||
export default ChartWrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { FindingBox } from 'components/landing/HighlightBox' | ||
import Link from 'next/link' | ||
|
||
interface Finding { | ||
id: string | ||
} | ||
|
||
type FindingsSectionProps = { | ||
title: string | ||
theme: string | ||
findings: Finding[] | ||
} | ||
|
||
const FindingsSection = ({ | ||
title, | ||
theme, | ||
findings = [], | ||
}: FindingsSectionProps) => { | ||
return ( | ||
<section className="mb-12"> | ||
<h3>{title}</h3> | ||
{findings.length ? ( | ||
<> | ||
<div className="grid my-8 gap-6 grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4"> | ||
{findings.map((finding) => ( | ||
<FindingBox key={finding.id} incident={finding} /> | ||
))} | ||
</div> | ||
<div className="flex my-4 justify-center"> | ||
<Link href={`/findings?theme=${theme}`}> | ||
<button type="button" className="btn btn-primary-hollow"> | ||
See more | ||
</button> | ||
</Link> | ||
</div> | ||
</> | ||
) : ( | ||
<div className="my-3">No findings available</div> | ||
)} | ||
</section> | ||
) | ||
} | ||
|
||
export default FindingsSection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.