redesign select account
This commit is contained in:
@@ -329,6 +329,9 @@ export const atoms = {
|
|||||||
font_normal: {
|
font_normal: {
|
||||||
fontWeight: tokens.fontWeight.normal,
|
fontWeight: tokens.fontWeight.normal,
|
||||||
},
|
},
|
||||||
|
font_medium: {
|
||||||
|
fontWeight: tokens.fontWeight.medium,
|
||||||
|
},
|
||||||
font_bold: {
|
font_bold: {
|
||||||
fontWeight: tokens.fontWeight.bold,
|
fontWeight: tokens.fontWeight.bold,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ export const borderRadius = {
|
|||||||
*/
|
*/
|
||||||
export const fontWeight = {
|
export const fontWeight = {
|
||||||
normal: '400',
|
normal: '400',
|
||||||
|
medium: '500',
|
||||||
bold: '600',
|
bold: '600',
|
||||||
heavy: '800',
|
heavy: '800',
|
||||||
} as const
|
} as const
|
||||||
|
|||||||
@@ -11,12 +11,13 @@ import {useProfilesQuery} from '#/state/queries/profile'
|
|||||||
import {type SessionAccount, useSession} from '#/state/session'
|
import {type SessionAccount, useSession} from '#/state/session'
|
||||||
import {UserAvatar} from '#/view/com/util/UserAvatar'
|
import {UserAvatar} from '#/view/com/util/UserAvatar'
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import {Check_Stroke2_Corner0_Rounded as Check} from '#/components/icons/Check'
|
import {Button} from '#/components/Button'
|
||||||
import {ChevronRight_Stroke2_Corner0_Rounded as Chevron} from '#/components/icons/Chevron'
|
import {CheckThick_Stroke2_Corner0_Rounded as CheckIcon} from '#/components/icons/Check'
|
||||||
|
import {ChevronRight_Stroke2_Corner0_Rounded as ChevronIcon} from '#/components/icons/Chevron'
|
||||||
|
import {PlusLarge_Stroke2_Corner0_Rounded as PlusIcon} from '#/components/icons/Plus'
|
||||||
|
import {Text} from '#/components/Typography'
|
||||||
import {useSimpleVerificationState} from '#/components/verification'
|
import {useSimpleVerificationState} from '#/components/verification'
|
||||||
import {VerificationCheck} from '#/components/verification/VerificationCheck'
|
import {VerificationCheck} from '#/components/verification/VerificationCheck'
|
||||||
import {Button} from './Button'
|
|
||||||
import {Text} from './Typography'
|
|
||||||
|
|
||||||
export function AccountList({
|
export function AccountList({
|
||||||
onSelectAccount,
|
onSelectAccount,
|
||||||
@@ -44,9 +45,9 @@ export function AccountList({
|
|||||||
<View
|
<View
|
||||||
pointerEvents={pendingDid ? 'none' : 'auto'}
|
pointerEvents={pendingDid ? 'none' : 'auto'}
|
||||||
style={[
|
style={[
|
||||||
a.rounded_md,
|
a.rounded_lg,
|
||||||
a.overflow_hidden,
|
a.overflow_hidden,
|
||||||
{borderWidth: 1},
|
a.border,
|
||||||
t.atoms.border_contrast_low,
|
t.atoms.border_contrast_low,
|
||||||
]}>
|
]}>
|
||||||
{accounts.map(account => (
|
{accounts.map(account => (
|
||||||
@@ -58,7 +59,7 @@ export function AccountList({
|
|||||||
isCurrentAccount={account.did === currentAccount?.did}
|
isCurrentAccount={account.did === currentAccount?.did}
|
||||||
isPendingAccount={account.did === pendingDid}
|
isPendingAccount={account.did === pendingDid}
|
||||||
/>
|
/>
|
||||||
<View style={[{borderBottomWidth: 1}, t.atoms.border_contrast_low]} />
|
<View style={[a.border_b, t.atoms.border_contrast_low]} />
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
))}
|
))}
|
||||||
<Button
|
<Button
|
||||||
@@ -72,22 +73,25 @@ export function AccountList({
|
|||||||
a.flex_1,
|
a.flex_1,
|
||||||
a.flex_row,
|
a.flex_row,
|
||||||
a.align_center,
|
a.align_center,
|
||||||
{height: 48},
|
a.p_lg,
|
||||||
|
a.gap_sm,
|
||||||
(hovered || pressed) && t.atoms.bg_contrast_25,
|
(hovered || pressed) && t.atoms.bg_contrast_25,
|
||||||
]}>
|
]}>
|
||||||
<Text
|
<View
|
||||||
style={[
|
style={[
|
||||||
a.font_bold,
|
t.atoms.bg_contrast_25,
|
||||||
a.flex_1,
|
a.rounded_full,
|
||||||
a.flex_row,
|
{width: 48, height: 48},
|
||||||
a.py_sm,
|
a.justify_center,
|
||||||
a.leading_tight,
|
a.align_center,
|
||||||
t.atoms.text_contrast_medium,
|
(hovered || pressed) && t.atoms.bg_contrast_50,
|
||||||
{paddingLeft: 56},
|
|
||||||
]}>
|
]}>
|
||||||
|
<PlusIcon style={[t.atoms.text_contrast_low]} size="md" />
|
||||||
|
</View>
|
||||||
|
<Text style={[a.flex_1, a.leading_tight, a.text_md, a.font_medium]}>
|
||||||
{otherLabel ?? <Trans>Other account</Trans>}
|
{otherLabel ?? <Trans>Other account</Trans>}
|
||||||
</Text>
|
</Text>
|
||||||
<Chevron size="sm" style={[t.atoms.text, a.mr_md]} />
|
<ChevronIcon size="md" style={[t.atoms.text_contrast_low]} />
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -134,14 +138,13 @@ function AccountItem({
|
|||||||
a.flex_1,
|
a.flex_1,
|
||||||
a.flex_row,
|
a.flex_row,
|
||||||
a.align_center,
|
a.align_center,
|
||||||
a.px_md,
|
a.p_lg,
|
||||||
a.gap_sm,
|
a.gap_sm,
|
||||||
{height: 56},
|
|
||||||
(hovered || pressed || isPendingAccount) && t.atoms.bg_contrast_25,
|
(hovered || pressed || isPendingAccount) && t.atoms.bg_contrast_25,
|
||||||
]}>
|
]}>
|
||||||
<UserAvatar
|
<UserAvatar
|
||||||
avatar={profile?.avatar}
|
avatar={profile?.avatar}
|
||||||
size={36}
|
size={48}
|
||||||
type={profile?.associated?.labeler ? 'labeler' : 'user'}
|
type={profile?.associated?.labeler ? 'labeler' : 'user'}
|
||||||
live={live}
|
live={live}
|
||||||
hideLiveBadge
|
hideLiveBadge
|
||||||
@@ -151,7 +154,7 @@ function AccountItem({
|
|||||||
<View style={[a.flex_row, a.align_center, a.gap_xs]}>
|
<View style={[a.flex_row, a.align_center, a.gap_xs]}>
|
||||||
<Text
|
<Text
|
||||||
emoji
|
emoji
|
||||||
style={[a.font_bold, a.leading_tight]}
|
style={[a.font_medium, a.leading_tight, a.text_md]}
|
||||||
numberOfLines={1}>
|
numberOfLines={1}>
|
||||||
{sanitizeDisplayName(
|
{sanitizeDisplayName(
|
||||||
profile?.displayName || profile?.handle || account.handle,
|
profile?.displayName || profile?.handle || account.handle,
|
||||||
@@ -166,15 +169,28 @@ function AccountItem({
|
|||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
<Text style={[a.leading_tight, t.atoms.text_contrast_medium]}>
|
<Text
|
||||||
|
style={[
|
||||||
|
a.leading_tight,
|
||||||
|
t.atoms.text_contrast_medium,
|
||||||
|
a.text_sm,
|
||||||
|
]}>
|
||||||
{sanitizeHandle(account.handle, '@')}
|
{sanitizeHandle(account.handle, '@')}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{isCurrentAccount ? (
|
{isCurrentAccount ? (
|
||||||
<Check size="sm" style={[{color: t.palette.positive_600}]} />
|
<View
|
||||||
|
style={[
|
||||||
|
{width: 20, height: 20, backgroundColor: t.palette.primary_500},
|
||||||
|
a.rounded_full,
|
||||||
|
a.justify_center,
|
||||||
|
a.align_center,
|
||||||
|
]}>
|
||||||
|
<CheckIcon size="xs" style={[{color: t.palette.white}]} />
|
||||||
|
</View>
|
||||||
) : (
|
) : (
|
||||||
<Chevron size="sm" style={[t.atoms.text]} />
|
<ChevronIcon size="md" style={[t.atoms.text_contrast_low]} />
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import Svg, {Path} from 'react-native-svg'
|
import Svg, {Path} from 'react-native-svg'
|
||||||
|
|
||||||
import {Props, useCommonSVGProps} from '#/components/icons/common'
|
import {type Props, useCommonSVGProps} from '#/components/icons/common'
|
||||||
|
|
||||||
export const IconTemplate_Stroke2_Corner0_Rounded = React.forwardRef(
|
export const IconTemplate_Stroke2_Corner0_Rounded = React.forwardRef(
|
||||||
function LogoImpl(props: Props, ref) {
|
function LogoImpl(props: Props, ref) {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import {useState} from 'react'
|
import {useState} from 'react'
|
||||||
|
import {View} from 'react-native'
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
@@ -13,7 +14,6 @@ import * as Toast from '#/view/com/util/Toast'
|
|||||||
import {Logo} from '#/view/icons/Logo'
|
import {Logo} from '#/view/icons/Logo'
|
||||||
import {atoms as a} from '#/alf'
|
import {atoms as a} from '#/alf'
|
||||||
import {AccountList} from '#/components/AccountList'
|
import {AccountList} from '#/components/AccountList'
|
||||||
import * as TextField from '#/components/forms/TextField'
|
|
||||||
import * as Layout from './components/Layout'
|
import * as Layout from './components/Layout'
|
||||||
|
|
||||||
type Props = NativeStackScreenProps<AuthNavigatorParams, 'SelectAccount'>
|
type Props = NativeStackScreenProps<AuthNavigatorParams, 'SelectAccount'>
|
||||||
@@ -79,14 +79,17 @@ export function SelectAccountScreenInner({
|
|||||||
<Layout.Header.Slot />
|
<Layout.Header.Slot />
|
||||||
</Layout.Header.Outer>
|
</Layout.Header.Outer>
|
||||||
<Layout.Content contentContainerStyle={[a.p_xl]}>
|
<Layout.Content contentContainerStyle={[a.p_xl]}>
|
||||||
<TextField.LabelText>
|
<Layout.TitleText>
|
||||||
<Trans>Sign in as...</Trans>
|
<Trans>Select account</Trans>
|
||||||
</TextField.LabelText>
|
</Layout.TitleText>
|
||||||
<AccountList
|
<View style={[a.mt_lg]}>
|
||||||
onSelectAccount={onSelect}
|
<AccountList
|
||||||
onSelectOther={signIn}
|
onSelectAccount={onSelect}
|
||||||
pendingDid={pendingDid}
|
onSelectOther={signIn}
|
||||||
/>
|
pendingDid={pendingDid}
|
||||||
|
otherLabel={_(msg`Add account`)}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
</Layout.Content>
|
</Layout.Content>
|
||||||
</Layout.Screen>
|
</Layout.Screen>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -97,7 +97,9 @@ export function SignInScreenInner({
|
|||||||
<Layout.Header.Slot />
|
<Layout.Header.Slot />
|
||||||
</Layout.Header.Outer>
|
</Layout.Header.Outer>
|
||||||
<Layout.Content contentContainerStyle={[a.p_xl]}>
|
<Layout.Content contentContainerStyle={[a.p_xl]}>
|
||||||
<Text style={[a.font_heavy, a.text_3xl]}>Log in</Text>
|
<Layout.TitleText>
|
||||||
|
<Trans>Log in</Trans>
|
||||||
|
</Layout.TitleText>
|
||||||
<SignInForm
|
<SignInForm
|
||||||
error={error}
|
error={error}
|
||||||
serviceUrl={serviceUrl}
|
serviceUrl={serviceUrl}
|
||||||
|
|||||||
@@ -1 +1,8 @@
|
|||||||
|
import {atoms as a} from '#/alf'
|
||||||
|
import {Text} from '#/components/Typography'
|
||||||
|
|
||||||
export * from '#/components/Layout'
|
export * from '#/components/Layout'
|
||||||
|
|
||||||
|
export function TitleText({children}: {children: React.ReactNode}) {
|
||||||
|
return <Text style={[a.font_heavy, a.text_3xl]}>{children}</Text>
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,9 +3,14 @@ import {View} from 'react-native'
|
|||||||
|
|
||||||
import {atoms as a} from '#/alf'
|
import {atoms as a} from '#/alf'
|
||||||
import {type ContentProps, type ScreenProps} from '#/components/Layout'
|
import {type ContentProps, type ScreenProps} from '#/components/Layout'
|
||||||
|
import {Text} from '#/components/Typography'
|
||||||
|
|
||||||
export * as Header from '#/components/Layout/Header'
|
export * as Header from '#/components/Layout/Header'
|
||||||
|
|
||||||
|
export function TitleText({children}: {children: React.ReactNode}) {
|
||||||
|
return <Text style={[a.font_heavy, a.text_3xl]}>{children}</Text>
|
||||||
|
}
|
||||||
|
|
||||||
export const Screen = memo(function Screen({style, ...props}: ScreenProps) {
|
export const Screen = memo(function Screen({style, ...props}: ScreenProps) {
|
||||||
return <View style={[a.w_full, a.h_full, style]} {...props} />
|
return <View style={[a.w_full, a.h_full, style]} {...props} />
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ export function SignInForm({
|
|||||||
label={_(msg`Username or email address`)}
|
label={_(msg`Username or email address`)}
|
||||||
placeholder=""
|
placeholder=""
|
||||||
autoCapitalize="none"
|
autoCapitalize="none"
|
||||||
autoFocus
|
autoFocus={!initialHandle}
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
autoComplete="username"
|
autoComplete="username"
|
||||||
returnKeyType="next"
|
returnKeyType="next"
|
||||||
@@ -218,6 +218,7 @@ export function SignInForm({
|
|||||||
label={_(msg`Password`)}
|
label={_(msg`Password`)}
|
||||||
placeholder=""
|
placeholder=""
|
||||||
autoCapitalize="none"
|
autoCapitalize="none"
|
||||||
|
autoFocus={!!initialHandle}
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
autoComplete="password"
|
autoComplete="password"
|
||||||
returnKeyType="done"
|
returnKeyType="done"
|
||||||
|
|||||||
Reference in New Issue
Block a user