-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
50f9e28
commit e254d74
Showing
17 changed files
with
308 additions
and
61 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
72 changes: 70 additions & 2 deletions
72
packages/mobile/src/screens/sign-up-screen/screens/CreatePasswordScreen.tsx
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 |
---|---|---|
@@ -1,15 +1,83 @@ | ||
import { useCallback } from 'react' | ||
|
||
import { setValueField } from 'audius-client/src/common/store/pages/signon/actions' | ||
import { Formik } from 'formik' | ||
import { View } from 'react-native' | ||
import { useDispatch } from 'react-redux' | ||
|
||
import { Button, Text } from 'app/components/core' | ||
import { TextField } from 'app/components/fields' | ||
import { useNavigation } from 'app/hooks/useNavigation' | ||
|
||
import { Text } from 'app/components/core' | ||
import type { SignUpScreenParamList } from '../types' | ||
import { useRoute } from '../useRoute' | ||
|
||
const messages = { | ||
header: 'Create Your Password' | ||
header: 'Create Your Password', | ||
description: | ||
"Create a password that's secure and easy to remember! We can't reset your password, so write it down or use a password manager.", | ||
yourEmail: 'Your Email', | ||
passwordLabel: 'Password', | ||
confirmPasswordLabel: 'Confirm Password', | ||
continue: 'Continue' | ||
} | ||
|
||
export type CreatePasswordParams = { | ||
email: string | ||
} | ||
|
||
const initialValues = { | ||
password: '', | ||
confirmPassword: '' | ||
} | ||
|
||
type CreatePasswordValues = { | ||
password: string | ||
confirmPassword: string | ||
} | ||
|
||
export const CreatePasswordScreen = () => { | ||
const { params } = useRoute<'CreatePassword'>() | ||
const { email } = params | ||
const dispatch = useDispatch() | ||
const navigation = useNavigation<SignUpScreenParamList>() | ||
|
||
const handleSubmit = useCallback( | ||
(values: CreatePasswordValues) => { | ||
const { password } = values | ||
dispatch(setValueField('password', password)) | ||
navigation.navigate('PickHandle') | ||
}, | ||
[dispatch, navigation] | ||
) | ||
|
||
return ( | ||
<View> | ||
<Text>{messages.header}</Text> | ||
<Text>{messages.description}</Text> | ||
|
||
<Text>{messages.yourEmail}</Text> | ||
<Text>{email}</Text> | ||
|
||
<Formik initialValues={initialValues} onSubmit={handleSubmit}> | ||
{({ handleSubmit }) => ( | ||
<View> | ||
<TextField | ||
name='password' | ||
label={messages.passwordLabel} | ||
textContentType='password' | ||
secureTextEntry | ||
/> | ||
<TextField | ||
name='confirmPassword' | ||
label={messages.confirmPasswordLabel} | ||
textContentType='password' | ||
secureTextEntry | ||
/> | ||
<Button title={messages.continue} onPress={() => handleSubmit()} /> | ||
</View> | ||
)} | ||
</Formik> | ||
</View> | ||
) | ||
} |
14 changes: 14 additions & 0 deletions
14
packages/mobile/src/screens/sign-up-screen/screens/PickHandleScreen.tsx
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,14 @@ | ||
import { View } from 'react-native' | ||
|
||
import { Text } from 'app/components/core' | ||
|
||
const messages = { | ||
header: 'Pick Your Handle' | ||
} | ||
export const PickHandleScreen = () => { | ||
return ( | ||
<View> | ||
<Text>{messages.header}</Text> | ||
</View> | ||
) | ||
} |
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 |
---|---|---|
@@ -1,4 +1,7 @@ | ||
import type { CreatePasswordParams } from './screens/CreatePasswordScreen' | ||
|
||
export type SignUpScreenParamList = { | ||
SignUp: undefined | ||
CreatePassword: { email: string } | ||
CreatePassword: CreatePasswordParams | ||
PickHandle: undefined | ||
} |
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,8 @@ | ||
import type { RouteProp } from '@react-navigation/core' | ||
import { useRoute as useRouteRN } from '@react-navigation/core' | ||
|
||
import type { SignUpScreenParamList } from './types' | ||
|
||
export const useRoute = <RouteName extends keyof SignUpScreenParamList>() => { | ||
return useRouteRN<RouteProp<SignUpScreenParamList, RouteName>>() | ||
} |
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,32 @@ | ||
import { useState } from 'react' | ||
|
||
import { | ||
CreatePasswordPage, | ||
CreatePasswordState | ||
} from './pages/CreatePasswordPage' | ||
import { PickHandlePage, PickHandleState } from './pages/PickHandlePage' | ||
import { SignUpPage, SignUpState } from './pages/SignUpPage' | ||
|
||
type SignUpRootState = SignUpState | CreatePasswordState | PickHandleState | ||
|
||
export const SignUpRootPage = () => { | ||
const [signUpState, setSignUpState] = useState<SignUpRootState>({ | ||
stage: 'sign-up' | ||
}) | ||
|
||
return ( | ||
<div> | ||
{signUpState.stage === 'sign-up' ? ( | ||
<SignUpPage onNext={setSignUpState} /> | ||
) : null} | ||
{signUpState.stage === 'create-password' ? ( | ||
<CreatePasswordPage | ||
params={signUpState.params} | ||
onPrevious={setSignUpState} | ||
onNext={setSignUpState} | ||
/> | ||
) : null} | ||
{signUpState.stage === 'create-password' ? <PickHandlePage /> : null} | ||
</div> | ||
) | ||
} |
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 |
---|---|---|
@@ -1 +1 @@ | ||
export * from './SignUpPage' | ||
export * from './SignUpRootPage' |
Oops, something went wrong.