Skip to content

Commit

Permalink
Merge pull request #1080 from geyserfund/staging
Browse files Browse the repository at this point in the history
❗️Production Push:❗️01.08.2023
  • Loading branch information
sajald77 authored Aug 1, 2023
2 parents 98b06e1 + 6afbe14 commit 31e7c87
Show file tree
Hide file tree
Showing 32 changed files with 716 additions and 145 deletions.
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
## [0.4.1](https://github.com/geyserfund/geyser-app/compare/v0.4.0...v0.4.1) (2023-08-01)


### Features

* add delete user profile ([0f2de29](https://github.com/geyserfund/geyser-app/commit/0f2de29156d38006ef74250f12b9b1adef2328fb))


### Bug Fixes

* add tooltip when delete profile button is disabled ([40dbfae](https://github.com/geyserfund/geyser-app/commit/40dbfae900f7e2cefad204dd89fbf75ddbbc8d05))
* add update email feature ([02cf41f](https://github.com/geyserfund/geyser-app/commit/02cf41f28538d63175d25725f5a5c7eee7cbf593))
* allow save only on form dirty ([3e0da2c](https://github.com/geyserfund/geyser-app/commit/3e0da2c730b71fa7a28338abeecd1acbd5b839ce))
* check mark color, resolves GEY-3041 ([9aafbad](https://github.com/geyserfund/geyser-app/commit/9aafbad4b24bc9b3870bb12239cc11ee57c17ae2))
* dont show tag that has less than 3 projects ([2a0a99e](https://github.com/geyserfund/geyser-app/commit/2a0a99e2bee1e635f39ef5e81de7ca7efc9bad54))
* e2e test ([8d80a41](https://github.com/geyserfund/geyser-app/commit/8d80a4167e5e11c5a418084f8f316f35f94c04a0))
* final chnage to delete user profile tooltip ([631ac9c](https://github.com/geyserfund/geyser-app/commit/631ac9c88814797c52518a9ec2654e92b6a30c8c))
* final OTP fixes ([cc75bcf](https://github.com/geyserfund/geyser-app/commit/cc75bcf98cfd26fbf3bb89e3efb03bc462677aec))
* fix otp copy when wallet update and add back button ([c33f6fc](https://github.com/geyserfund/geyser-app/commit/c33f6fc94f2d0d677bcae646502aaa12e13370ba))
* fixes based on linear issues ([84e9704](https://github.com/geyserfund/geyser-app/commit/84e970481a41c7b957e05988b4291774ae430e2c))
* only show projects with length 3 ([f1dde51](https://github.com/geyserfund/geyser-app/commit/f1dde5199906bb06ef87a8eee02c0964f4007731))
* remove verify email prompt ([a0c423e](https://github.com/geyserfund/geyser-app/commit/a0c423e487b965a085d60e228699604a35f293fd))
* typo ([7ded5fc](https://github.com/geyserfund/geyser-app/commit/7ded5fcdee4c7aabac6107d04dbd168be59ecc3b))
* update changelog and package version ([9478d01](https://github.com/geyserfund/geyser-app/commit/9478d01ce748f7fbfc0e4b8fbfbe6c031494bf39))
* update copy to mention look in spam folder ([6fb1c68](https://github.com/geyserfund/geyser-app/commit/6fb1c68c804cce1102cbaafcca1ce58d84ecc668))
* update tooltip copy ([b4d3c10](https://github.com/geyserfund/geyser-app/commit/b4d3c10a6b6bf12637a2d445331895bfb9c5739a))

## [0.4.0](https://github.com/geyserfund/geyser-app/compare/v0.3.1...v0.4.0) (2023-07-25)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "geyser-app",
"private": true,
"version": "0.4.0",
"version": "0.4.1",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
Expand Down
2 changes: 0 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { client } from './config'
import { Head } from './config/Head'
import { AuthProvider, ChakraThemeProvider, NavProvider } from './context'
import { BtcProvider } from './context/btc'
import { DefaultEmailVerify } from './pages/otp'

export const App = () => (
<ChakraProvider>
Expand All @@ -19,7 +18,6 @@ export const App = () => (
<BtcProvider>
<Head />
<AppLayout />
<DefaultEmailVerify />
</BtcProvider>
</NavProvider>
</AuthProvider>
Expand Down
2 changes: 1 addition & 1 deletion src/components/nav/top-nav-bar/TopNavBarMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const TopNavBarMenu = ({
width="100%"
onClick={onDashboardSelected}
>
(t{'Edit project'})
{t('Edit project')}
</Button>
</MenuItem>

Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/TextInputBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const TextInputBox = forwardRef<HTMLInputElement, TextInputBoxProps>(
{error ? (
typeof error === 'object' ? (
error
) : (
) : typeof error === 'boolean' ? null : (
<Text color="secondary.red" fontSize="12px">
{t(`${error}`)}
</Text>
Expand Down
10 changes: 6 additions & 4 deletions src/forms/components/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ export const TextField = ({
<FormControl>
<FieldContainer
title={
<>
{label || name}
{required ? '*' : ''}
</>
label && (
<>
{label}
{required ? '*' : ''}
</>
)
}
subtitle={caption}
error={
Expand Down
9 changes: 9 additions & 0 deletions src/graphql/mutations/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,12 @@ export const MUTATION_UPDATE_USER = gql`
}
}
`

export const MUTATION_DELETE_USER = gql`
mutation UserDelete {
userDelete {
message
success
}
}
`
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const ProjectsDisplayMostFundedThisWeek = ({
return <ProjectsDisplaySkeleton />
}

if (projects.length === 0) {
if (projects.length <= 2) {
return null
}

Expand Down
41 changes: 0 additions & 41 deletions src/pages/otp/DefaultEmailVerify.tsx

This file was deleted.

22 changes: 12 additions & 10 deletions src/pages/otp/VerifyYourEmail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ import { Stack, Text, VStack } from '@chakra-ui/react'
import { useTranslation } from 'react-i18next'

import { CustomModalProps, Modal } from '../../components/layouts'
import { MfaAction, OtpResponseFragment } from '../../types'
import { VerifyYourEmailContent } from './VerifyYourEmailContent'
import { MfaAction } from '../../types'
import {
VerifyYourEmailContent,
VerifyYourEmailContentProps,
} from './VerifyYourEmailContent'

interface VerifyYourEmailProps extends Omit<CustomModalProps, 'children'> {
action?: MfaAction
handleVerify?: (
otpCode: number,
optData: OtpResponseFragment,
email?: string,
) => void
}
interface VerifyYourEmailProps
extends VerifyYourEmailContentProps,
Omit<CustomModalProps, 'children'> {}

export const VerifyYourEmail = ({
action,
handleVerify,
otpSent,
otpData,
...rest
}: VerifyYourEmailProps) => {
const { t } = useTranslation()
Expand All @@ -40,6 +40,8 @@ export const VerifyYourEmail = ({
<VerifyYourEmailContent
action={getAction()}
handleVerify={handleVerify}
otpSent={otpSent}
otpData={otpData}
/>
</Stack>
</Modal>
Expand Down
26 changes: 20 additions & 6 deletions src/pages/otp/VerifyYourEmailContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,35 @@ import {
import { useNotification } from '../../utils'
import { ReceiveOneTimePassword, VerifyOneTimePassword } from './components'

interface VerifyYourEmailContentProps {
export interface VerifyYourEmailContentProps {
action: MfaAction
otpSent?: boolean
otpData?: OtpResponseFragment
handleVerify?: (
otpCode: number,
optData: OtpResponseFragment,
otpData: OtpResponseFragment,
email?: string,
) => void
}

export const VerifyYourEmailContent = ({
action,
handleVerify,
otpSent,
otpData: otp,
}: VerifyYourEmailContentProps) => {
const { t } = useTranslation()
const { toast } = useNotification()

const [sentOtp, setSentOtp] = useState(false)
const [otpData, setOtpData] = useState<OtpResponseFragment>()
const [sentOtp, setSentOtp] = useState(otpSent || false)
const [otpData, setOtpData] = useState<OtpResponseFragment | undefined>(otp)
const [inputEmail, setInputEmail] = useState('')

const [sendOtpByEmail] = useSendOtpByEmailMutation({
onError() {
toast({
status: 'error',
title: 'Failed to generate otp.',
title: 'Failed to generate OTP.',
description: 'Please try again',
})
},
Expand Down Expand Up @@ -68,6 +72,12 @@ export const VerifyYourEmailContent = ({
)
}

if (action === MfaAction.UserEmailUpdate) {
return t(
'You can update your email securely by using One Time Password sent to your last verfied email.',
)
}

return t(
'Backup your Geyser account and project with your email. This will ensure that you can always access Geyser (in case of social media censorship) and can securely update your project information.',
)
Expand All @@ -94,7 +104,11 @@ export const VerifyYourEmailContent = ({
alignSelf="center"
/>

<Body1 semiBold>{getDescription()}</Body1>
<Body1 semiBold>
{getDescription()} {t('Check your SPAM folder for the email.')}
</Body1>

<Body1 semiBold></Body1>
{sentOtp && otpData ? (
<VerifyOneTimePassword
action={action}
Expand Down
17 changes: 4 additions & 13 deletions src/pages/otp/components/ReceiveOneTimePassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,11 @@ import { yupResolver } from '@hookform/resolvers/yup'
import { Dispatch, SetStateAction } from 'react'
import { useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import * as yup from 'yup'

import { useAuthContext } from '../../../context'
import { TextField } from '../../../forms/components/TextField'
import { MfaAction, useUserEmailUpdateMutation } from '../../../types'
import { useNotification } from '../../../utils'

const schema = yup.object({
email: yup
.string()
.required('Email is a required field')
.email('Please enter a valid Email address'),
})
import { emailValidationSchema, useNotification } from '../../../utils'

interface ReceiveOneTimePasswordProps {
handleSendOtpByEmail(email: string): void
Expand All @@ -30,12 +22,11 @@ export const ReceiveOneTimePassword = ({
}: ReceiveOneTimePasswordProps) => {
const { t } = useTranslation()
const { toast } = useNotification()
const { user, setUser, isUserAProjectCreator } = useAuthContext()
const canEditEmail =
!user.email || !isUserAProjectCreator || !user.isEmailVerified
const { user, setUser } = useAuthContext()
const canEditEmail = !user.email || !user.isEmailVerified

const form = useForm<{ email: string }>({
resolver: canEditEmail ? yupResolver(schema) : undefined,
resolver: canEditEmail ? yupResolver(emailValidationSchema) : undefined,
values: user.email
? {
email: user.email,
Expand Down
5 changes: 4 additions & 1 deletion src/pages/otp/components/VerifyOneTimePassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface VerifyOneTimePasswordProps {
handleSendOtpByEmail(email: string): void
handleVerify?: (
otpCode: number,
optData: OtpResponseFragment,
otpData: OtpResponseFragment,
email?: string,
) => void
inputEmail: string
Expand Down Expand Up @@ -68,6 +68,7 @@ export const VerifyOneTimePassword = ({
},
onCompleted() {
queryCurrentUser()
toast({ status: 'success', title: 'Email verification successfull!' })
},
})

Expand All @@ -90,6 +91,8 @@ export const VerifyOneTimePassword = ({
},
})
}

setOptCode('')
}

const handleSendCodeAgain = () => {
Expand Down
1 change: 0 additions & 1 deletion src/pages/otp/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './DefaultEmailVerify'
export * from './VerifyYourEmail'
Loading

0 comments on commit 31e7c87

Please sign in to comment.