From bcffaffc07c035fc172608690214c27f49f6b1eb Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Wed, 20 Mar 2024 16:42:07 -0500 Subject: [PATCH] StepInfo tweaks --- src/screens/Signup/StepInfo.tsx | 17 ++--- src/view/com/auth/create/Policies.tsx | 90 +++++++++------------------ 2 files changed, 38 insertions(+), 69 deletions(-) diff --git a/src/screens/Signup/StepInfo.tsx b/src/screens/Signup/StepInfo.tsx index 30a31884..784d9e01 100644 --- a/src/screens/Signup/StepInfo.tsx +++ b/src/screens/Signup/StepInfo.tsx @@ -2,19 +2,20 @@ import React from 'react' import {View} from 'react-native' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' + +import {logger} from '#/logger' +import {Policies} from 'view/com/auth/create/Policies' +import {ScreenTransition} from '#/screens/Login/ScreenTransition' +import {is13, is18, useSignupContext} from '#/screens/Signup/state' import {atoms as a} from '#/alf' +import * as DateField from '#/components/forms/DateField' +import {FormError} from '#/components/forms/FormError' +import {HostingProvider} from '#/components/forms/HostingProvider' import * as TextField from '#/components/forms/TextField' import {Envelope_Stroke2_Corner0_Rounded as Envelope} from '#/components/icons/Envelope' import {Lock_Stroke2_Corner0_Rounded as Lock} from '#/components/icons/Lock' import {Ticket_Stroke2_Corner0_Rounded as Ticket} from '#/components/icons/Ticket' -import {is13, is18, useSignupContext} from '#/screens/Signup/state' -import * as DateField from '#/components/forms/DateField' -import {logger} from '#/logger' import {Loader} from '#/components/Loader' -import {Policies} from 'view/com/auth/create/Policies' -import {HostingProvider} from '#/components/forms/HostingProvider' -import {FormError} from '#/components/forms/FormError' -import {ScreenTransition} from '#/screens/Login/ScreenTransition' function sanitizeDate(date: Date): Date { if (!date || date.toString() === 'Invalid Date') { @@ -32,7 +33,7 @@ export function StepInfo() { return ( - + diff --git a/src/view/com/auth/create/Policies.tsx b/src/view/com/auth/create/Policies.tsx index f69b4bdb..8a656203 100644 --- a/src/view/com/auth/create/Policies.tsx +++ b/src/view/com/auth/create/Policies.tsx @@ -1,50 +1,39 @@ import React from 'react' -import {Linking, StyleSheet, View} from 'react-native' -import { - FontAwesomeIcon, - FontAwesomeIconStyle, -} from '@fortawesome/react-native-fontawesome' +import {View} from 'react-native' import {ComAtprotoServerDescribeServer} from '@atproto/api' -import {TextLink} from '../../util/Link' -import {Text} from '../../util/text/Text' -import {s, colors} from 'lib/styles' -import {usePalette} from 'lib/hooks/usePalette' -import {Trans, msg} from '@lingui/macro' +import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' -type ServiceDescription = ComAtprotoServerDescribeServer.OutputSchema +import {atoms as a, useTheme} from '#/alf' +import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo' +import {InlineLink} from '#/components/Link' +import {Text} from '#/components/Typography' export const Policies = ({ serviceDescription, needsGuardian, under13, }: { - serviceDescription: ServiceDescription + serviceDescription: ComAtprotoServerDescribeServer.OutputSchema needsGuardian: boolean under13: boolean }) => { - const pal = usePalette('default') + const t = useTheme() const {_} = useLingui() + if (!serviceDescription) { return } + const tos = validWebLink(serviceDescription.links?.termsOfService) const pp = validWebLink(serviceDescription.links?.privacyPolicy) + if (!tos && !pp) { return ( - - - - - + + + + This service has not provided terms of service or a privacy policy. @@ -52,50 +41,45 @@ export const Policies = ({ ) } + const els = [] if (tos) { els.push( - Linking.openURL(tos)} - />, + + {_(msg`Terms of Service`)} + , ) } if (pp) { els.push( - Linking.openURL(pp)} - />, + + {_(msg`Privacy Policy`)} + , ) } if (els.length === 2) { els.splice( 1, 0, - + {' '} and{' '} , ) } + return ( - - + + By creating an account you agree to the {els}. + {under13 ? ( - + You must be 13 years of age or older to sign up. ) : needsGuardian ? ( - + If you are not yet an adult according to the laws of your country, your parent or legal guardian must read these Terms on your behalf. @@ -111,19 +95,3 @@ function validWebLink(url?: string): string | undefined { ? url : undefined } - -const styles = StyleSheet.create({ - policies: { - flexDirection: 'column', - gap: 8, - }, - errorIcon: { - borderWidth: 1, - borderColor: colors.white, - borderRadius: 30, - width: 16, - height: 16, - alignItems: 'center', - justifyContent: 'center', - }, -})