little tweaks

This commit is contained in:
Hailey
2024-06-15 18:53:35 -07:00
parent c1aa58f27c
commit 43b071a05f
6 changed files with 49 additions and 44 deletions
@@ -147,20 +147,11 @@ export const ProfileStarterPacks = React.forwardRef<
}) })
function CreateAnother() { function CreateAnother() {
const t = useTheme()
const {_} = useLingui() const {_} = useLingui()
const navigation = useNavigation<NavigationProp>() const navigation = useNavigation<NavigationProp>()
return ( return (
<View <View style={[a.px_md, a.py_lg, a.justify_between, a.gap_lg]}>
style={[
a.px_md,
a.py_lg,
a.justify_between,
a.gap_lg,
a.border_t,
t.atoms.border_contrast_medium,
]}>
<Button <Button
label={_(msg`Create a starter pack`)} label={_(msg`Create a starter pack`)}
variant="ghost" variant="ghost"
@@ -28,8 +28,11 @@ export function WizardFeedCard({
const isDiscover = generator.uri === DISCOVER_FEED_URI const isDiscover = generator.uri === DISCOVER_FEED_URI
const includesFeed = const includesFeed =
isDiscover || state.feeds.some(f => f.uri === generator.uri) isDiscover || state.feeds.some(f => f.uri === generator.uri)
const isDisabled = isDiscover || (!includesFeed && state.feeds.length >= 3)
const onPressAddRemove = () => { const onPressAddRemove = () => {
if (isDisabled) return
Keyboard.dismiss() Keyboard.dismiss()
if (includesFeed) { if (includesFeed) {
dispatch({type: 'RemoveFeed', feedUri: generator.uri}) dispatch({type: 'RemoveFeed', feedUri: generator.uri})
@@ -74,7 +77,7 @@ export function WizardFeedCard({
: _(msg`Add ${generator.displayName} to starter pack`) : _(msg`Add ${generator.displayName} to starter pack`)
} }
value={includesFeed} value={includesFeed}
disabled={isDiscover} disabled={isDisabled}
onChange={onPressAddRemove}> onChange={onPressAddRemove}>
<Checkbox /> <Checkbox />
</Toggle.Item> </Toggle.Item>
@@ -27,8 +27,12 @@ export function WizardProfileCard({
const {currentAccount} = useSession() const {currentAccount} = useSession()
const includesProfile = state.profiles.some(p => p.did === profile.did) const includesProfile = state.profiles.some(p => p.did === profile.did)
const isMe = profile.did === currentAccount?.did
const isDisabled = isMe || state.profiles.length >= 50
const onPressAddRemove = () => { const onPressAddRemove = () => {
if (isDisabled) return
Keyboard.dismiss() Keyboard.dismiss()
if (profile.did === currentAccount?.did) return if (profile.did === currentAccount?.did) return
@@ -67,27 +71,26 @@ export function WizardProfileCard({
@{profile?.handle} @{profile?.handle}
</Text> </Text>
</View> </View>
{profile.did !== currentAccount?.did && ( <Toggle.Item
<Toggle.Item name={_(msg`Person toggle`)}
name={_(msg`Person toggle`)} label={
label={ includesProfile
includesProfile ? _(
? _( msg`Remove ${
msg`Remove ${ profile.displayName || profile.handle
profile.displayName || profile.handle } from starter pack`,
} from starter pack`, )
) : _(
: _( msg`Add ${
msg`Add ${ profile.displayName || profile.handle
profile.displayName || profile.handle } to starter pack`,
} to starter pack`, )
) }
} value={includesProfile}
value={includesProfile} disabled={isDisabled}
onChange={onPressAddRemove}> onChange={onPressAddRemove}>
<Checkbox /> <Checkbox />
</Toggle.Item> </Toggle.Item>
)}
</Pressable> </Pressable>
) )
} }
+1 -1
View File
@@ -66,7 +66,7 @@ function reducer(state: State, action: Action): State {
switch (action.type) { switch (action.type) {
case 'SetName': case 'SetName':
updatedState = {...state, name: action.name} updatedState = {...state, name: action.name.slice(0, 50)}
break break
case 'SetDescription': case 'SetDescription':
updatedState = {...state, description: action.description} updatedState = {...state, description: action.description}
+18 -10
View File
@@ -6,7 +6,7 @@ import {useLingui} from '@lingui/react'
import {useProfileQuery} from 'state/queries/profile' import {useProfileQuery} from 'state/queries/profile'
import {useSession} from 'state/session' import {useSession} from 'state/session'
import {useWizardState} from '#/screens/StarterPack/Wizard/State' import {useWizardState} from '#/screens/StarterPack/Wizard/State'
import {atoms as a} from '#/alf' import {atoms as a, useTheme} from '#/alf'
import * as TextField from '#/components/forms/TextField' import * as TextField from '#/components/forms/TextField'
import {StarterPackIcon} from '#/components/icons/StarterPackIcon' import {StarterPackIcon} from '#/components/icons/StarterPackIcon'
import {ScreenTransition} from '#/components/StarterPack/Wizard/ScreenTransition' import {ScreenTransition} from '#/components/StarterPack/Wizard/ScreenTransition'
@@ -14,6 +14,7 @@ import {Text} from '#/components/Typography'
export function StepDetails() { export function StepDetails() {
const {_} = useLingui() const {_} = useLingui()
const t = useTheme()
const [state, dispatch] = useWizardState() const [state, dispatch] = useWizardState()
const {currentAccount} = useSession() const {currentAccount} = useSession()
@@ -42,15 +43,22 @@ export function StepDetails() {
<TextField.LabelText> <TextField.LabelText>
<Trans>What do you want to call your starter pack?</Trans> <Trans>What do you want to call your starter pack?</Trans>
</TextField.LabelText> </TextField.LabelText>
<TextField.Input <TextField.Root>
label={_( <TextField.Input
msg`${ label={_(
currentProfile?.displayName || currentProfile?.handle msg`${
}'s starter pack`, currentProfile?.displayName || currentProfile?.handle
)} }'s starter pack`,
value={state.name} )}
onChangeText={text => dispatch({type: 'SetName', name: text})} value={state.name}
/> onChangeText={text => dispatch({type: 'SetName', name: text})}
/>
<TextField.SuffixText label={_(`${state.name?.length} out of 50`)}>
<Text style={[t.atoms.text_contrast_medium]}>
{state.name?.length ?? 0}/50
</Text>
</TextField.SuffixText>
</TextField.Root>
</View> </View>
<View> <View>
<TextField.LabelText> <TextField.LabelText>
+1 -1
View File
@@ -189,7 +189,7 @@ function WizardInner({
msg`${ msg`${
currentProfile?.displayName || `@${currentProfile?.handle}` currentProfile?.displayName || `@${currentProfile?.handle}`
}'s Starter Pack`, }'s Starter Pack`,
) ).slice(0, 50)
const wizardUiStrings: Record< const wizardUiStrings: Record<
WizardStep, WizardStep,