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

Notifications: wiring and integration with API #318

Merged
merged 40 commits into from
May 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
805d65d
Email notifications
rperez89 May 12, 2020
e3b59e7
Loader
rperez89 May 12, 2020
94b3476
tweaks
rperez89 May 12, 2020
aaca905
Existing email modal screen merge
rperez89 May 13, 2020
5c3b986
Status info merge
rperez89 May 13, 2020
f2f6900
Global preferences merge
rperez89 May 13, 2020
61c6046
Merge branch 'development' into email-notifications-testing
rperez89 May 14, 2020
30554c9
Delete and unlock fix
rperez89 May 14, 2020
37c5d1f
Verify Email merge
rperez89 May 14, 2020
722b17d
sing request merge
rperez89 May 15, 2020
5562f0b
Integration Fixes
rperez89 May 15, 2020
b6e5de4
Merge branch 'development' into email-notifications-testing
rperez89 May 15, 2020
20c02b2
Integration Fixes
rperez89 May 15, 2020
bbd1b75
use inside modal pattern
rperez89 May 18, 2020
b4d00c2
Resend verification email
rperez89 May 18, 2020
a4bc976
remove unnecessary file
rperez89 May 18, 2020
cb63d92
constants cleanup
rperez89 May 18, 2020
1281e6a
Loading constants
rperez89 May 18, 2020
50818ff
loading
rperez89 May 18, 2020
4dc4b06
PR comments
rperez89 May 18, 2020
ceb3138
Merge branch 'development' into email-notifications-testing
rperez89 May 18, 2020
f1fd50e
remove unnecessary file
rperez89 May 18, 2020
d75c4ed
rename utils file import
rperez89 May 18, 2020
7b3f832
useWallet
rperez89 May 18, 2020
99ff2ac
Loading screen
rperez89 May 18, 2020
16319aa
unnecessary file
rperez89 May 18, 2020
575d69f
cleanup
rperez89 May 18, 2020
153892a
Fix loading screen when unsubscribed
rperez89 May 18, 2020
35c7ff7
.
rperez89 May 18, 2020
f64493e
z-index for the modal
rperez89 May 18, 2020
f73af80
Incorrect delete success screen from preferences fix
rperez89 May 18, 2020
0af5494
change account fix
rperez89 May 19, 2020
973b379
fix unlock screen on not subscibed account
rperez89 May 19, 2020
8ee93c2
unlock screen on unsubscribed account
rperez89 May 19, 2020
43ba3a5
remove styled button
rperez89 May 19, 2020
dc0a91d
only one useEffect
rperez89 May 19, 2020
ad6f164
Email notifications: update copy, troubleshooting link (#331)
sohkai May 19, 2020
288b2d1
Notifications: Animation transition fix and prevent same email update…
rperez89 May 20, 2020
46068a5
Use Input hook and screens refactors (#343)
rperez89 May 25, 2020
2810737
Notifications: Endpoint url change (#344)
rperez89 May 25, 2020
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
2 changes: 2 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import AppLoader from './components/AppLoader'
import GlobalErrorHandler from './GlobalErrorHandler'
import MainView from './components/MainView'
import OnboardingLoader from './components/OnboardingLoader'
import EmailNotificationsLoader from './components/EmailNotificationsLoader'
import RequestPanel from './components/RequestPanel/RequestPanel'
import Routes from './Routes'
import { ActivityProvider } from './components/Activity/ActivityProvider'
Expand All @@ -32,6 +33,7 @@ function App() {
<RequestQueueProvider>
<MainView>
<OnboardingLoader>
<EmailNotificationsLoader />
<AppLoader>
<Routes />
</AppLoader>
Expand Down
7 changes: 7 additions & 0 deletions src/Routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import Tasks from './components/Tasks/Tasks'
import Disputes from './components/Disputes/Disputes'
import DisputeDetail from './components/Disputes/DisputeDetail'

// Preferences
const GLOBAL_PREFERENCES_QUERY_PARAM = '?preferences=/'

export default function Routes() {
return (
<Switch>
Expand All @@ -18,3 +21,7 @@ export default function Routes() {
</Switch>
)
}

export function getPreferencesSearch(screen) {
return `${GLOBAL_PREFERENCES_QUERY_PARAM}${screen}`
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like usePreferences() also exports this constant.

2 changes: 1 addition & 1 deletion src/assets/emailIllustration.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/enableAccount.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/global-preferences-notifications.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/loader.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/assets/signRequest.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/assets/signRequestFail.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/assets/signRequestSuccess.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 9 additions & 9 deletions src/components/EmailNotifications/DeleteEmail.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import React from 'react'
import { Button, GU, textStyle, useTheme } from '@aragon/ui'
import { Button, GU, textStyle, useInside, useTheme } from '@aragon/ui'

import emailNotifcationIllustration from '../../assets/emailNotifications.svg'

const DeleteEmail = React.memo(function DeleteEmail({
isModal,
email,
onDelete,
onCancel,
}) {
const theme = useTheme()
const [insideModal] = useInside('NotificationsModal')

return (
<div
css={`
display: flex;
padding-top: ${isModal ? 3 : 0 * GU}px;
padding-top: ${insideModal ? 3 : 0 * GU}px;
flex-direction: column;
`}
>
{!isModal && (
{!insideModal && (
<div
css={`
text-align: center;
Expand All @@ -37,8 +37,8 @@ const DeleteEmail = React.memo(function DeleteEmail({
css={`
display: flex;
flex-direction: column;
text-align: ${isModal ? 'left' : 'center'};
margin-top: ${isModal ? 0 : 5 * GU}px;
text-align: ${insideModal ? 'left' : 'center'};
margin-top: ${insideModal ? 0 : 5 * GU}px;
`}
>
<span
Expand All @@ -63,7 +63,7 @@ const DeleteEmail = React.memo(function DeleteEmail({
css={`
margin-top: ${4 * GU}px;
display: flex;
justify-content: ${isModal ? 'flex-end' : 'center'};
justify-content: ${insideModal ? 'flex-end' : 'center'};
`}
>
<Button
Expand All @@ -72,15 +72,15 @@ const DeleteEmail = React.memo(function DeleteEmail({
`}
onClick={onCancel}
size="medium"
wide={!isModal}
wide={!insideModal}
>
Cancel
</Button>
<Button
mode="negative"
onClick={onDelete}
size="medium"
wide={!isModal}
wide={!insideModal}
>
Delete email
</Button>
Expand Down
107 changes: 107 additions & 0 deletions src/components/EmailNotifications/EmailInput.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import React, { useEffect, useState } from 'react'
import {
Field,
GU,
IconCheck,
IconCross,
TextInput,
textStyle,
useInside,
useTheme,
} from '@aragon/ui'

const EmailInput = React.memo(function EmailInput({
existingEmail,
status,
...inputProps
}) {
const theme = useTheme()
const [error, setError] = useState('')
const [insideModal] = useInside('NotificationsModal')

useEffect(() => {
if (status === 'invalid') {
return setError('Please enter a valid email address.')
}
return setError('')
}, [status])

const adornment = (() => {
if (status === 'invalid')
return (
<IconCross
css={`
color: ${theme.negative};
`}
/>
)

if (status === 'empty')
return (
<IconCheck
css={`
opacity: 0;
color: ${theme.positive};
`}
/>
)

return (
<IconCheck
css={`
opacity: 1;
color: ${theme.positive};
`}
/>
) // status === 'valid'
})()
return (
<div
css={`
display: flex;
flex-direction: column;
width: 100%;
`}
>
<Field
label={
existingEmail
? insideModal
? 'Update email address'
: 'Enter new email address'
: 'Enter email address'
}
css={`
width: 100%;
margin-bottom: 0;
`}
>
<TextInput
adornment={adornment}
adornmentPosition="end"
type="email"
wide
placeholder="you@example.org"
{...inputProps}
/>
</Field>
{error && (
<div>
<p
css={`
color: ${theme.negative};
${textStyle('body4')};
text-align: left;
height: 0;
margin-top: ${0.5 * GU}px;
`}
>
{error}
</p>
</div>
)}
</div>
)
})

export default EmailInput
51 changes: 51 additions & 0 deletions src/components/EmailNotifications/EmailNotificationError.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React from 'react'
import { GU, textStyle, useTheme } from '@aragon/ui'

import emailIllustration from '../../assets/emailIllustration.svg'

const VerifyEmailAddress = React.memo(function VerifyEmailAddress({ email }) {
const theme = useTheme()

return (
<div
css={`
display: flex;
flex-direction: column;
justify-content: center;
padding: ${5 * GU}px;
`}
>
<div
css={`
display: flex;
flex-direction: column;
text-align: center;
`}
>
<img src={emailIllustration} />
<span
css={`
${textStyle('title2')};
margin-top: ${4 * GU}px;
`}
>
Cannot connect to Notifications server
</span>

<span
css={`
${textStyle('body2')};
color: ${theme.surfaceContentSecondary};
margin-top: ${1.5 * GU}px;
`}
>
There was a problem when trying to connect to the Email Notifications
server. Make sure your Internet connection is working and please try
again.
</span>
</div>
</div>
)
})

export default VerifyEmailAddress
Empty file.
Loading