more testbed

This commit is contained in:
Samuel Newman
2025-10-21 17:02:29 +03:00
parent 9bf7ec7b71
commit 55d022ace9
4 changed files with 60 additions and 29 deletions
+41 -2
View File
@@ -78,6 +78,8 @@ import {Splash} from '#/Splash'
import {BottomSheetOutlet} from '../modules/bottom-sheet' import {BottomSheetOutlet} from '../modules/bottom-sheet'
import {BottomSheetProvider} from '../modules/bottom-sheet' import {BottomSheetProvider} from '../modules/bottom-sheet'
import {BackgroundNotificationPreferencesProvider} from '../modules/expo-background-notification-handler/src/BackgroundNotificationHandlerProvider' import {BackgroundNotificationPreferencesProvider} from '../modules/expo-background-notification-handler/src/BackgroundNotificationHandlerProvider'
import {RequestListItem} from './screens/Messages/components/RequestListItem'
import {List} from './view/com/util/List'
SplashScreen.preventAutoHideAsync() SplashScreen.preventAutoHideAsync()
if (isIOS) { if (isIOS) {
@@ -257,9 +259,9 @@ export default Sentry.wrap(App)
function Testbed() { function Testbed() {
const control = Dialog.useDialogControl() const control = Dialog.useDialogControl()
const [showItem, setShowItem] = useState(true)
return ( return (
<View <View style={[a.align_center, a.justify_center, {gap: 16}, a.h_full]}>
style={[{height: '100%'}, a.align_center, a.justify_center, {gap: 16}]}>
<Button <Button
label="show dialog" label="show dialog"
onPress={() => { onPress={() => {
@@ -269,6 +271,31 @@ function Testbed() {
color="primary"> color="primary">
<ButtonText>Show dialog</ButtonText> <ButtonText>Show dialog</ButtonText>
</Button> </Button>
<Button
label="toggle list item + show toast"
onPress={() => {
Toast.show('toggle list item')
setShowItem(x => !x)
}}
size="large"
color="primary">
<ButtonText>toggle list item + show toast</ButtonText>
</Button>
<List
style={[{width: '100%', height: 300}, a.flex_grow_0]}
data={showItem ? [true] : []}
renderItem={() => (
<RequestListItem
convo={{
id: 'abc',
members: [{did: 'did:plc:abc', handle: 'alice.example.com'}],
muted: false,
rev: '1',
unreadCount: 0,
}}
/>
)}
/>
<Dialog.Outer control={control}> <Dialog.Outer control={control}>
<Dialog.Handle /> <Dialog.Handle />
<Dialog.ScrollableInner <Dialog.ScrollableInner
@@ -303,6 +330,18 @@ function Testbed() {
color="primary"> color="primary">
<ButtonText>Close - toast after</ButtonText> <ButtonText>Close - toast after</ButtonText>
</Button> </Button>
<Button
label="close dialog"
onPress={() => {
control.close(() => {
setShowItem(false)
Toast.show('closed')
})
}}
size="large"
color="primary">
<ButtonText>Close - close + hide item</ButtonText>
</Button>
</Dialog.ScrollableInner> </Dialog.ScrollableInner>
</Dialog.Outer> </Dialog.Outer>
</View> </View>
@@ -30,7 +30,7 @@ import {
import {precacheProfile} from '#/state/queries/profile' import {precacheProfile} from '#/state/queries/profile'
import {useSession} from '#/state/session' import {useSession} from '#/state/session'
import {TimeElapsed} from '#/view/com/util/TimeElapsed' import {TimeElapsed} from '#/view/com/util/TimeElapsed'
import {PreviewableUserAvatar} from '#/view/com/util/UserAvatar' import {PreviewableUserAvatar, UserAvatar} from '#/view/com/util/UserAvatar'
import {atoms as a, useBreakpoints, useTheme, web} from '#/alf' import {atoms as a, useBreakpoints, useTheme, web} from '#/alf'
import * as tokens from '#/alf/tokens' import * as tokens from '#/alf/tokens'
import {useDialogControl} from '#/components/Dialog' import {useDialogControl} from '#/components/Dialog'
@@ -47,6 +47,7 @@ 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 type * as bsky from '#/types/bsky' import type * as bsky from '#/types/bsky'
import {Button} from '#/components/Button'
export const ChatListItemPortal = createPortalGroup() export const ChatListItemPortal = createPortalGroup()
@@ -349,15 +350,14 @@ function ChatListItemReady({
a.absolute, a.absolute,
{top: tokens.space.md, left: tokens.space.lg}, {top: tokens.space.md, left: tokens.space.lg},
]}> ]}>
<PreviewableUserAvatar <UserAvatar
profile={profile} type="user"
size={52} size={52}
moderation={moderation.ui('avatar')} moderation={moderation.ui('avatar')}
/> />
</View> </View>
<Link <Button
to={`/messages/${convo.id}`}
label={displayName} label={displayName}
accessibilityHint={ accessibilityHint={
!isDeletedAccount !isDeletedAccount
@@ -509,10 +509,10 @@ function ChatListItemReady({
)} )}
</View> </View>
)} )}
</Link> </Button>
<ChatListItemPortal.Outlet /> <ChatListItemPortal.Outlet />
{/*
{showMenu && ( {showMenu && (
<ConvoMenu <ConvoMenu
convo={convo} convo={convo}
@@ -535,12 +535,12 @@ function ChatListItemReady({
]} ]}
latestReportableMessage={latestReportableMessage} latestReportableMessage={latestReportableMessage}
/> />
)} )}*/}
<LeaveConvoPrompt {/*<LeaveConvoPrompt
control={leaveConvoControl} control={leaveConvoControl}
convoId={convo.id} convoId={convo.id}
currentScreen="list" currentScreen="list"
/> />*/}
</View> </View>
</GestureActionView> </GestureActionView>
</ChatListItemPortal.Provider> </ChatListItemPortal.Provider>
@@ -50,11 +50,11 @@ export function RejectMenu({
}) { }) {
const {_} = useLingui() const {_} = useLingui()
const shadowedProfile = useProfileShadow(profile) const shadowedProfile = useProfileShadow(profile)
const navigation = useNavigation<NavigationProp>() // const navigation = useNavigation<NavigationProp>()
const {mutate: leaveConvo} = useLeaveConvo(convo.id, { const {mutate: leaveConvo} = useLeaveConvo(convo.id, {
onMutate: () => { onMutate: () => {
if (currentScreen === 'conversation') { if (currentScreen === 'conversation') {
navigation.dispatch(StackActions.pop()) // navigation.dispatch(StackActions.pop())
} }
}, },
onError: () => { onError: () => {
@@ -192,7 +192,7 @@ export function AcceptChatButton({
}) { }) {
const {_} = useLingui() const {_} = useLingui()
const queryClient = useQueryClient() const queryClient = useQueryClient()
const navigation = useNavigation<NavigationProp>() // const navigation = useNavigation<NavigationProp>()
const {needsEmailVerification} = useEmail() const {needsEmailVerification} = useEmail()
const emailDialogControl = useEmailDialogControl() const emailDialogControl = useEmailDialogControl()
@@ -201,10 +201,10 @@ export function AcceptChatButton({
onAcceptConvo?.() onAcceptConvo?.()
if (currentScreen === 'list') { if (currentScreen === 'list') {
precacheConvoQuery(queryClient, {...convo, status: 'accepted'}) precacheConvoQuery(queryClient, {...convo, status: 'accepted'})
navigation.navigate('MessagesConversation', { // navigation.navigate('MessagesConversation', {
conversation: convo.id, // conversation: convo.id,
accept: true, // accept: true,
}) // })
} }
}, },
onError: () => { onError: () => {
@@ -272,12 +272,12 @@ export function DeleteChatButton({
currentScreen: 'list' | 'conversation' currentScreen: 'list' | 'conversation'
}) { }) {
const {_} = useLingui() const {_} = useLingui()
const navigation = useNavigation<NavigationProp>() // const navigation = useNavigation<NavigationProp>()
const {mutate: leaveConvo} = useLeaveConvo(convo.id, { const {mutate: leaveConvo} = useLeaveConvo(convo.id, {
onMutate: () => { onMutate: () => {
if (currentScreen === 'conversation') { if (currentScreen === 'conversation') {
navigation.dispatch(StackActions.pop()) // navigation.dispatch(StackActions.pop())
} }
}, },
onError: () => { onError: () => {
@@ -27,14 +27,6 @@ export function RequestListItem({convo}: {convo: ChatBskyConvoDefs.ConvoView}) {
return ( return (
<View style={[a.relative, a.flex_1]}> <View style={[a.relative, a.flex_1]}>
<ChatListItem convo={convo} showMenu={false}> <ChatListItem convo={convo} showMenu={false}>
<View style={[a.pt_xs, a.pb_2xs]}>
<KnownFollowers
profile={otherUser}
moderationOpts={moderationOpts}
minimal
showIfEmpty
/>
</View>
{/* spacer, since you can't nest pressables */} {/* spacer, since you can't nest pressables */}
<View style={[a.pt_md, a.pb_xs, a.w_full, {opacity: 0}]} aria-hidden> <View style={[a.pt_md, a.pb_xs, a.w_full, {opacity: 0}]} aria-hidden>
{/* Placeholder text so that it responds to the font height */} {/* Placeholder text so that it responds to the font height */}