add a notice

This commit is contained in:
Hailey
2024-06-18 10:39:15 -07:00
parent 44812299bb
commit f988adbc51
2 changed files with 68 additions and 2 deletions
+67 -1
View File
@@ -1,6 +1,11 @@
import React from 'react' import React from 'react'
import {View} from 'react-native' import {View} from 'react-native'
import {LayoutAnimationConfig} from 'react-native-reanimated' import Animated, {
FadeInUp,
FadeOutUp,
LayoutAnimationConfig,
} from 'react-native-reanimated'
import {AppBskyGraphStarterpack} from '@atproto/api'
import {msg, Trans} from '@lingui/macro' import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react' import {useLingui} from '@lingui/react'
@@ -11,6 +16,13 @@ import {createFullHandle} from '#/lib/strings/handles'
import {logger} from '#/logger' import {logger} from '#/logger'
import {useServiceQuery} from '#/state/queries/service' import {useServiceQuery} from '#/state/queries/service'
import {useAgent} from '#/state/session' import {useAgent} from '#/state/session'
import {parseStarterPackHttpUri} from 'lib/strings/starter-pack'
import {
useCurrentStarterPack,
useSetCurrentStarterPack,
} from 'state/preferences/starter-pack'
import {useResolveDidQuery} from 'state/queries/resolve-uri'
import {useStarterPackQuery} from 'state/queries/useStarterPackQuery'
import {LoggedOutLayout} from '#/view/com/util/layouts/LoggedOutLayout' import {LoggedOutLayout} from '#/view/com/util/layouts/LoggedOutLayout'
import { import {
initialState, initialState,
@@ -26,6 +38,7 @@ import {atoms as a, useBreakpoints, useTheme} from '#/alf'
import {AppLanguageDropdown} from '#/components/AppLanguageDropdown' import {AppLanguageDropdown} from '#/components/AppLanguageDropdown'
import {Button, ButtonText} from '#/components/Button' import {Button, ButtonText} from '#/components/Button'
import {Divider} from '#/components/Divider' import {Divider} from '#/components/Divider'
import {LinearGradientBackground} from '#/components/LinearGradientBackground'
import {InlineLinkText} from '#/components/Link' import {InlineLinkText} from '#/components/Link'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
@@ -38,6 +51,15 @@ export function Signup({onPressBack}: {onPressBack: () => void}) {
const {gtMobile} = useBreakpoints() const {gtMobile} = useBreakpoints()
const agent = useAgent() const agent = useAgent()
const currentStarterPack = useCurrentStarterPack()
const setCurrentStarterPack = useSetCurrentStarterPack()
const parsedStarterPackUri = parseStarterPackHttpUri(currentStarterPack?.uri)
const {data: did} = useResolveDidQuery(parsedStarterPackUri?.name)
const {data: starterPack} = useStarterPackQuery({
did,
rkey: parsedStarterPackUri?.rkey,
})
const { const {
data: serviceInfo, data: serviceInfo,
isFetching, isFetching,
@@ -142,6 +164,50 @@ export function Signup({onPressBack}: {onPressBack: () => void}) {
description={_(msg`We're so excited to have you join us!`)} description={_(msg`We're so excited to have you join us!`)}
scrollable> scrollable>
<View testID="createAccount" style={a.flex_1}> <View testID="createAccount" style={a.flex_1}>
{starterPack &&
AppBskyGraphStarterpack.isRecord(starterPack.record) ? (
<Animated.View entering={FadeInUp} exiting={FadeOutUp}>
<LinearGradientBackground
style={[
a.px_lg,
a.py_md,
a.gap_sm,
{
borderBottomLeftRadius: 4,
borderBottomRightRadius: 4,
},
]}>
<Text style={[a.font_bold, a.text_xl, {color: 'white'}]}>
{starterPack.record.name}
</Text>
<Text style={[{color: 'white'}]}>
<Trans>
You are signing up with a starter pack! Other users will see
that you have joined using this pack.
</Trans>
</Text>
<Button
label={_(msg`Remove starter pack`)}
variant="ghost"
color="primary"
size="small"
onPress={() => {
setCurrentStarterPack(undefined)
}}
style={{
backgroundColor: 'white',
borderColor: 'white',
width: 180,
marginLeft: 'auto',
}}
hoverStyle={[{backgroundColor: '#dfdfdf'}]}>
<ButtonText>
<Trans>Remove starter pack</Trans>
</ButtonText>
</Button>
</LinearGradientBackground>
</Animated.View>
) : null}
<View <View
style={[ style={[
a.flex_1, a.flex_1,
+1 -1
View File
@@ -73,7 +73,7 @@ export function LoggedOut({onDismiss}: {onDismiss?: () => void}) {
return ( return (
<View testID="noSessionView" style={[s.hContentRegion]}> <View testID="noSessionView" style={[s.hContentRegion]}>
<ErrorBoundary> <ErrorBoundary>
{onDismiss && screenState !== ScreenState.S_StarterPack ? ( {onDismiss && screenState === ScreenState.S_LoginOrCreateAccount ? (
<Pressable <Pressable
accessibilityHint={_(msg`Go back`)} accessibilityHint={_(msg`Go back`)}
accessibilityLabel={_(msg`Go back`)} accessibilityLabel={_(msg`Go back`)}