From 8c723116e199a9bfb9db756dc9e39d1aa3611973 Mon Sep 17 00:00:00 2001 From: majakomel Date: Tue, 16 Jan 2024 21:56:09 +0100 Subject: [PATCH] Fix link styling --- components/Chart.js | 14 +++--- components/measurement/CommonSummary.js | 15 ++++--- .../measurement/nettests/WebConnectivity.js | 45 +++++++++---------- components/search/ResultsList.js | 7 +-- pages/api/cloudflare.js | 4 +- pages/search.js | 6 +-- 6 files changed, 43 insertions(+), 48 deletions(-) diff --git a/components/Chart.js b/components/Chart.js index 1e3bd7ea3..9be643ec3 100644 --- a/components/Chart.js +++ b/components/Chart.js @@ -23,7 +23,7 @@ export const MATLink = ({ query }) => { const showMATButton = !Array.isArray(query.test_name) return ( - + {showMATButton && @@ -33,16 +33,14 @@ export const MATLink = ({ query }) => { } - - - - {intl.formatMessage({id: 'MAT.Charts.DownloadJSONData'})} - - + + + {intl.formatMessage({id: 'MAT.Charts.DownloadJSONData'})} + {intl.formatMessage({id: 'MAT.Charts.DownloadCSVData'})} - + ) } diff --git a/components/measurement/CommonSummary.js b/components/measurement/CommonSummary.js index ef873d972..8167553ac 100644 --- a/components/measurement/CommonSummary.js +++ b/components/measurement/CommonSummary.js @@ -18,8 +18,11 @@ const SummaryContainer = styled(Box)` color: white; ` -const StyledSummaryItemLabel = styled(Text)` - font-weight: 600; +const StyledLink = styled(NLink)` + color: white; + &:hover { + color: white; + } ` const CommonSummary = ({ @@ -62,7 +65,7 @@ const CommonSummary = ({ {hero} - + @@ -71,11 +74,11 @@ const CommonSummary = ({ {country} - + - + {network} {networkName} - + diff --git a/components/measurement/nettests/WebConnectivity.js b/components/measurement/nettests/WebConnectivity.js index 16eef8d65..c39745221 100644 --- a/components/measurement/nettests/WebConnectivity.js +++ b/components/measurement/nettests/WebConnectivity.js @@ -305,6 +305,19 @@ const validateMeasurement = (measurement) => { const getSearchHref = (input) => (`${process.env.NEXT_PUBLIC_EXPLORER_URL}/search?input=${input}`) +const StyledLink = styled(NLink)` + direction: ltr; + display: inline; +` + +const StyledStatusInfoLink = styled(NLink)` + color: white; + text-decoration: underline; + &:hover { + color: white; + } +` + const WebConnectivityDetails = ({ isConfirmed, isAnomaly, @@ -349,7 +362,7 @@ const WebConnectivityDetails = ({ id='Measurement.SummaryText.Websites.Failed' values={{ date, - WebsiteURL: {input}, + WebsiteURL: {input}, network: probe_asn, country }} @@ -360,7 +373,7 @@ const WebConnectivityDetails = ({ id='Measurement.SummaryText.Websites.ConfirmedBlocked' values={{ date, - WebsiteURL: {input}, + WebsiteURL: {input}, network: probe_asn, country }} @@ -384,7 +397,7 @@ const WebConnectivityDetails = ({ id='Measurement.SummaryText.Websites.Anomaly' values={{ date, - WebsiteURL: {input}, + WebsiteURL: {input}, 'link-to-docs': (string) => ({string}), network: probe_asn, country, @@ -409,7 +422,7 @@ const WebConnectivityDetails = ({ id='Measurement.SummaryText.Websites.Accessible' values={{ date, - WebsiteURL: {input}, + WebsiteURL: {input}, network: probe_asn, country }} @@ -432,7 +445,7 @@ const WebConnectivityDetails = ({ id='Measurement.SummaryText.Websites.Down' values={{ date, - WebsiteURL: {input}, + WebsiteURL: {input}, network: probe_asn, country }} @@ -456,7 +469,7 @@ const WebConnectivityDetails = ({ id='Measurement.SummaryText.Websites.Failed' values={{ date, - WebsiteURL: {input}, + WebsiteURL: {input}, network: probe_asn, country }} @@ -489,9 +502,9 @@ const WebConnectivityDetails = ({ status: status, statusInfo: + {input} - + } message={reason} />, @@ -603,21 +616,5 @@ const WebConnectivityDetails = ({ ) } -WebConnectivityDetails.propTypes = { - country: PropTypes.string.isRequired, - input: PropTypes.any, - isAnomaly: PropTypes.bool.isRequired, - isConfirmed: PropTypes.bool.isRequired, - isFailure: PropTypes.bool.isRequired, - measurement: PropTypes.object.isRequired, - probe_asn: PropTypes.any, - render: PropTypes.func, - scores: PropTypes.shape({ - analysis: PropTypes.shape({ - blocking_type: PropTypes.any - }) - }), - measurement_start_time: PropTypes.any -} export default WebConnectivityDetails diff --git a/components/search/ResultsList.js b/components/search/ResultsList.js index b59866a65..283725393 100644 --- a/components/search/ResultsList.js +++ b/components/search/ResultsList.js @@ -220,8 +220,7 @@ ASNBox.propTypes = { asn: PropTypes.string } -// XXX add this to the design system -const StyledViewDetailsLink = styled.span` +const StyledViewDetailsLink = styled(NLink)` cursor: pointer; text-decoration: none; color: ${props => props.theme.colors.blue5}; @@ -234,9 +233,7 @@ const ViewDetailsLink = ({measurementUid, children}) => { let href = `/m/${measurementUid}` return ( - - {children} - + {children} ) } diff --git a/pages/api/cloudflare.js b/pages/api/cloudflare.js index 96e3826ae..e608cef96 100644 --- a/pages/api/cloudflare.js +++ b/pages/api/cloudflare.js @@ -1,12 +1,12 @@ import axios from 'axios' +import { LRUCache } from 'lru-cache' import dayjs from 'services/dayjs' -import LRU from 'lru-cache' const CACHE_MAX_SIZE = process.env.CACHE_MAX_SIZE || 100 const CACHE_MAX_AGE_IN_S = process.env.CACHE_MAX_AGE_IN_S || 60 * 60 const context = { - cache: new LRU({ + cache: new LRUCache({ max: CACHE_MAX_SIZE, ttl: CACHE_MAX_AGE_IN_S }) diff --git a/pages/search.js b/pages/search.js index 682d6ae49..c0c016b97 100644 --- a/pages/search.js +++ b/pages/search.js @@ -17,15 +17,15 @@ import styled from 'styled-components' import NavBar from '/components/NavBar' +import dynamic from 'next/dynamic' +import { sortByKey } from '../utils' import FormattedMarkdown from '/components/FormattedMarkdown' import FilterSidebar, { queryToFilterMap } from '/components/search/FilterSidebar' -// import { Loader } from '/components/search/Loader' import ResultsList from '/components/search/ResultsList' const Loader = dynamic(() => import('/components/search/Loader'), { ssr: false }) -import dynamic from 'next/dynamic' -import { sortByKey } from '../utils' + export const getServerSideProps = async ({query}) => { // By default, on '/search' show measurements published until today