Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add links to search in MAT tooltip for all counts #810

Open
wants to merge 42 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
4a67862
Add links to search in MAT tooltip for all counts
majakomel Oct 18, 2022
17d901a
Build improvements (#808)
majakomel Oct 21, 2022
7141f16
Refactor MAT filters table to virtualize rows (#809)
majakomel Oct 21, 2022
0e9be68
Search page refactoring (#799)
majakomel Oct 21, 2022
0914dcf
Use SWC instead of Babel (#804)
majakomel Oct 25, 2022
0234a1d
Stringify MAT errors
majakomel Oct 25, 2022
951d58a
Fix measurement tests
majakomel Nov 10, 2022
75d127b
Update docs on managing translations (#748)
hellais Nov 10, 2022
ddad910
Import regenerator-runtime
majakomel Nov 24, 2022
5dac6ab
Fix server errors due to missing vars
majakomel Nov 24, 2022
0f92180
Force time_grain to day
majakomel Dec 6, 2022
311341d
Bump decode-uri-component from 0.2.0 to 0.2.2 (#817)
dependabot[bot] Dec 7, 2022
7510800
Bump qs from 6.5.2 to 6.5.3 (#819)
dependabot[bot] Dec 7, 2022
4637933
Bump minimatch from 3.0.4 to 3.1.2 (#820)
dependabot[bot] Dec 7, 2022
acc70fe
Upgrade nivo libraries
majakomel Dec 21, 2022
2eb3711
Move strings to localization file, localized date formatting, RTL sup…
majakomel Dec 22, 2022
801980a
Move vanilla tor from legacy to experimental category (#825)
majakomel Dec 27, 2022
f9d1696
Fix back button where params applied programmatically (#815)
majakomel Dec 27, 2022
9c5dfdd
Improve MAT conditional filters (#752)
sarathms Dec 28, 2022
ebcabdc
replaced older IM and circumvention charts (#785)
GermaVinsmoke Jan 8, 2023
674fd8e
Bump json5 from 1.0.1 to 1.0.2 (#829)
dependabot[bot] Jan 8, 2023
24b519f
Bump ua-parser-js from 0.7.31 to 0.7.33 (#835)
dependabot[bot] Feb 1, 2023
05f908f
DNS Answers: Add ancillary information (#828)
sleinen Feb 1, 2023
44c93f1
Search page filter values (#836)
GermaVinsmoke Feb 9, 2023
219366c
Update coverage chart color scale and add a legend (#823)
majakomel Feb 10, 2023
daee5f6
Update copy
majakomel Feb 13, 2023
8d039a8
Update inputs when navigating back circumvention page (#837)
majakomel Feb 15, 2023
bad54ab
Add support for selecting time granularity on MAT (#818)
majakomel Feb 15, 2023
0541f87
Default to day granularity for charts on thematic pages
majakomel Feb 15, 2023
5db15aa
Fix mat chart if time grain is missing
majakomel Feb 15, 2023
54471a9
Add missing dependency
majakomel Feb 15, 2023
7ca542d
Fix MAT subtitle for categories
majakomel Feb 20, 2023
8ae9d18
Return default value for getDatesBetween
majakomel Feb 20, 2023
4f40115
Update document.js
majakomel Feb 23, 2023
131dc0b
Remove redundant babel related packages
majakomel Feb 23, 2023
329cc9a
Fix error on MAT when dates typed in manually
majakomel Feb 24, 2023
7d2f211
Correctly map test ids
majakomel Feb 27, 2023
6a02865
Pull latest translations
majakomel Feb 27, 2023
63d7a14
Fix date picker ranges
majakomel Feb 27, 2023
d224928
Adjust MAT confirmation modal logic
majakomel Feb 27, 2023
2e4d5d7
User feedback mechanism with login (#790)
majakomel Mar 8, 2023
d7928ed
resolved conflicts
GermaVinsmoke Mar 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
User feedback mechanism with login (#790)
majakomel authored Mar 8, 2023
commit 2e4d5d7de7ee19a5e2a6533749c6850711cb05db
3 changes: 2 additions & 1 deletion .env.development
Original file line number Diff line number Diff line change
@@ -2,7 +2,8 @@
# To override locally, make a copy called `.env.development.local`
# Refer: https://nextjs.org/docs/basic-features/environment-variables

NEXT_PUBLIC_OONI_API=https://ams-pg-test.ooni.org
NEXT_PUBLIC_OONI_API=https://api.ooni.io
NEXT_PUBLIC_USER_FEEDBACK_API=https://ams-pg-test.ooni.org
NEXT_PUBLIC_EXPLORER_URL=http://localhost:3100

RUN_GIT_COMMIT_SHA_SHORT=yarn --silent git:getCommitSHA:short
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -3,5 +3,6 @@
# Refer: https://nextjs.org/docs/basic-features/environment-variables

NEXT_PUBLIC_OONI_API=https://api.ooni.io
NEXT_PUBLIC_USER_FEEDBACK_API=https://api.ooni.io
NEXT_PUBLIC_SENTRY_DSN=https://49af7fff247c445b9a7c98ee21ddfd2f@o155150.ingest.sentry.io/1427510
NEXT_PUBLIC_EXPLORER_URL=https://explorer.ooni.org
9 changes: 3 additions & 6 deletions .env.test
Original file line number Diff line number Diff line change
@@ -3,9 +3,6 @@
# Refer: https://nextjs.org/docs/basic-features/environment-variables

NEXT_PUBLIC_OONI_API=https://api.ooni.io
NEXT_PUBLIC_EXPLORER_URL=https://explorer-test.ooni.io

RUN_GIT_COMMIT_SHA_SHORT=yarn --silent git:getCommitSHA:short
RUN_GIT_COMMIT_SHA=yarn --silent git:getCommitSHA
RUN_GIT_COMMIT_REF=yarn --silent git:getCommitRef
RUN_GIT_COMMIT_TAGS=yarn --silent git:getReleasesAndTags
NEXT_PUBLIC_USER_FEEDBACK_API=https://ams-pg-test.ooni.org
NEXT_PUBLIC_EXPLORER_URL=https://explorer.test.ooni.org
NEXT_PUBLIC_IS_TEST_ENV=1
9 changes: 5 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -11,18 +11,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Cypress run
uses: cypress-io/github-action@v4.1.0
uses: cypress-io/github-action@v5
with:
build: npm run build
start: npm start
wait-on: 'http://localhost:3100'
browser: chrome
env:
NODE_ENV: 'test'

- name: Upload screenshots on failure
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: always()
with:
name: cypress-screenshots
6 changes: 3 additions & 3 deletions components/Flag.js
Original file line number Diff line number Diff line change
@@ -34,9 +34,9 @@ const FlagContainer = styled.div`
border-radius: 50%;
/* padding-left: 3px; */
/* padding-top: 3px; */
width: ${props => props.size + 6}px;
height: ${props => props.size + 6}px;
border: ${props => props.border ? '3px solid white' : 'none'};
width: ${props => props.size + 2}px;
height: ${props => props.size + 2}px;
border: ${props => props.border ? '1px solid white' : 'none'};
`

export const Flag = ({countryCode, size, border}) => {
21 changes: 11 additions & 10 deletions components/Layout.js
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ import Header from './Header'
import Footer from './Footer'
import { useIntl } from 'react-intl'
import { getDirection } from 'components/withIntl'
// import FeedbackButton from '../components/FeedbackFloat'
import { UserProvider } from 'hooks/useUser'

theme.maxWidth = 1024

@@ -61,22 +61,23 @@ const Layout = ({ children, disableFooter = false }) => {
return (
<MatomoProvider value={matomoInstance}>
<ThemeProvider theme={theme}>
<GlobalStyle direction={getDirection(locale)} />
<div className="site">
<Header />
<div className="content">
{ children }
<UserProvider>
<GlobalStyle direction={getDirection(locale)} />
<div className="site">
<Header />
<div className="content">
{ children }
</div>
{!disableFooter && <Footer />}
</div>
{!disableFooter && <Footer />}
</div>
{/* <FeedbackButton /> */}
</UserProvider>
</ThemeProvider>
</MatomoProvider>
)
}

Layout.propTypes = {
children: PropTypes.array.isRequired,
children: PropTypes.object.isRequired,
disableFooter: PropTypes.bool
}

20 changes: 17 additions & 3 deletions components/NavBar.js
Original file line number Diff line number Diff line change
@@ -3,18 +3,16 @@ import { useRouter, withRouter } from 'next/router'
import NLink from 'next/link'
import styled from 'styled-components'
import { FormattedMessage, useIntl } from 'react-intl'

import { getLocalisedLanguageName } from 'utils/i18nCountries'

import ExplorerLogo from 'ooni-components/components/svgs/logos/Explorer-HorizontalMonochromeInverted.svg'

import {
Link,
Flex,
Box,
Container,
Select,
} from 'ooni-components'
import useUser from 'hooks/useUser'

const StyledNavItem = styled.a`
text-decoration: none;
@@ -83,11 +81,17 @@ export const NavBar = ({color}) => {
const { locale } = useIntl()
const router = useRouter()
const { pathname, asPath, query } = router
const { user, logout } = useUser()

const handleLocaleChange = (event) => {
router.push({ pathname, query }, asPath, { locale: event.target.value })
}

const logoutUser = (e) => {
e.preventDefault()
logout()
}

return (
<StyledNavBar color={color}>
<Container>
@@ -116,6 +120,16 @@ export const NavBar = ({color}) => {
))}
</LanguageSelect>
</Box> */}
{user?.logged_in &&
<Box ml={[0, 4]} my={[2, 0]}>
<StyledNavItem>
<NavItemLabel onClick={logoutUser}>
<FormattedMessage id='General.Logout' />
</NavItemLabel>
<Underline />
</StyledNavItem>
</Box>
}
</Flex>
</Box>
</Flex>
107 changes: 107 additions & 0 deletions components/login/LoginForm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import React, { useState, useCallback, useEffect } from 'react'
import { useForm, Controller } from 'react-hook-form'
import { Flex, Box, Input, Button, Modal, Text, Heading, Container } from 'ooni-components'
import styled from 'styled-components'
import NLink from 'next/link'

import { registerUser } from '/lib/api'
import { useRouter } from 'next/router'
import { FormattedMessage } from 'react-intl'
import SpinLoader from 'components/vendor/SpinLoader'

const StyledError = styled.small`
color: ${props => props.theme.colors.red5};
`

const StyledInputContainer = styled(Box).attrs({
width: '100%',
mt: 3,
})`
position: relative;
& ${StyledError} {
position: absolute;
top: -10px;
right: 0px;
}
`

export const LoginForm = ({ onLogin, redirectTo }) => {
const router = useRouter()
const [submitting, setSubmitting] = useState(false)
const [loginError, setError] = useState(null)

const { handleSubmit, control, formState, reset } = useForm({
mode: 'onTouched',
defaultValues: { email_address: '' }
})

const { errors, isValid, isDirty } = formState

const onSubmit = useCallback((data) => {
const { email_address } = data
const registerApi = async (email_address) => {
try {
await registerUser(email_address, redirectTo)
if (typeof onLogin === 'function') {
onLogin()
}
} catch (e) {
setError(e.message)
// Reset form to mark `isDirty` as false
reset({}, { keepValues: true })
} finally {
setSubmitting(false)
}
}
setSubmitting(true)
registerApi(email_address)
}, [onLogin, reset, redirectTo])

useEffect(() => {
// Remove previous errors when form becomes dirty again
if (isDirty) {
setError(null)
}
}, [isDirty])

return (
<form onSubmit={handleSubmit(onSubmit)}>
<Flex
flexDirection={['column']}
>
<StyledInputContainer>
<Controller
render={({field}) => (
<Input
placeholder='Email *'
{...field}
/>
)}
rules={{
pattern: {
value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
},
required: true,
}}
name='email_address'
control={control}
/>
<StyledError>{errors?.email_address?.message}</StyledError>
</StyledInputContainer>
{loginError &&
<Box mt={1}>
<StyledError>{loginError}</StyledError>
</Box>
}
<Box mt={3} alignSelf='center'>
{!submitting ?
<Button disabled={!isValid} type='submit'><FormattedMessage id="General.Login" /></Button> :
<SpinLoader size={3} margin='1px' />
}
</Box>
</Flex>
</form>
)
}

export default LoginForm
2 changes: 1 addition & 1 deletion components/measurement/AccessPointStatus.js
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ const AccessPointStatus = ({ icon, label, ok, content, color, ...props}) => {
}

AccessPointStatus.propTypes = {
icon: PropTypes.element.isRequired,
icon: PropTypes.element,
label: PropTypes.oneOfType([
PropTypes.string,
PropTypes.element
12 changes: 11 additions & 1 deletion components/measurement/CommonDetails.js
Original file line number Diff line number Diff line change
@@ -47,7 +47,8 @@ JsonViewer.propTypes = {

const CommonDetails = ({
measurement,
reportId
reportId,
userFeedbackItems =[]
}) => {
const {
software_name,
@@ -143,6 +144,15 @@ const CommonDetails = ({
bg={theme.colors.gray2}
/>
</Flex>
{/* User Feedback */}
{!!userFeedbackItems.length &&
<Flex my={4}>
<DetailsBoxTable
title={<FormattedMessage id='Measurement.CommonDetails.Label.UserFeedback' />}
items={userFeedbackItems}
/>
</Flex>
}
{/* Raw Measurement */}
<Flex>
<DetailsBox
Loading