From 06de0129af47c8671d6a62819ff6be590cac46ad Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Tue, 3 Jan 2023 11:49:40 -0600 Subject: [PATCH] Add 'is 13' checkbox to account creation --- src/view/com/login/CreateAccount.tsx | 60 ++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/src/view/com/login/CreateAccount.tsx b/src/view/com/login/CreateAccount.tsx index 7f128d69..971ab37b 100644 --- a/src/view/com/login/CreateAccount.tsx +++ b/src/view/com/login/CreateAccount.tsx @@ -15,6 +15,7 @@ import * as EmailValidator from 'email-validator' import {Logo} from './Logo' import {Picker} from '../util/Picker' import {TextLink} from '../util/Link' +import {ToggleButton} from '../util/forms/ToggleButton' import {Text} from '../util/text/Text' import {s, colors} from '../../lib/styles' import { @@ -39,6 +40,7 @@ export const CreateAccount = ({onPressBack}: {onPressBack: () => void}) => { const [email, setEmail] = useState('') const [password, setPassword] = useState('') const [handle, setHandle] = useState('') + const [is13, setIs13] = useState(false) useEffect(() => { let aborted = false @@ -128,6 +130,7 @@ export const CreateAccount = ({onPressBack}: {onPressBack: () => void}) => { if (tos) { els.push( void}) => { if (pp) { els.push( void}) => { ) } if (els.length === 2) { - els.splice(1, 0, and ) + els.splice( + 1, + 0, + + {' '} + and{' '} + , + ) } return ( @@ -155,6 +166,7 @@ export const CreateAccount = ({onPressBack}: {onPressBack: () => void}) => { ) } + const isReady = !!email && !!password && !!handle && is13 return ( @@ -296,15 +308,34 @@ export const CreateAccount = ({onPressBack}: {onPressBack: () => void}) => { + + + Legal + + + setIs13(!is13)}> + + {is13 && ( + + )} + + + I am 13 years old or older + + + + ) : undefined} - + Back - {serviceDescription ? ( + {isReady ? ( {isProcessing ? ( @@ -312,8 +343,14 @@ export const CreateAccount = ({onPressBack}: {onPressBack: () => void}) => { Next )} + ) : !serviceDescription ? ( + <> + + Connecting... + ) : undefined} + ) @@ -409,6 +446,23 @@ const styles = StyleSheet.create({ pickerIcon: { color: colors.white, }, + checkbox: { + borderWidth: 1, + borderColor: colors.white, + borderRadius: 2, + width: 16, + height: 16, + marginLeft: 16, + }, + checkboxFilled: { + borderWidth: 1, + borderColor: colors.white, + backgroundColor: colors.white, + borderRadius: 2, + width: 16, + height: 16, + marginLeft: 16, + }, policies: { flexDirection: 'row', alignItems: 'flex-start',