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 {BottomSheetProvider} from '../modules/bottom-sheet'
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()
if (isIOS) {
@@ -257,9 +259,9 @@ export default Sentry.wrap(App)
function Testbed() {
const control = Dialog.useDialogControl()
const [showItem, setShowItem] = useState(true)
return (
<View
style={[{height: '100%'}, a.align_center, a.justify_center, {gap: 16}]}>
<View style={[a.align_center, a.justify_center, {gap: 16}, a.h_full]}>
<Button
label="show dialog"
onPress={() => {
@@ -269,6 +271,31 @@ function Testbed() {
color="primary">
<ButtonText>Show dialog</ButtonText>
</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.Handle />
<Dialog.ScrollableInner
@@ -303,6 +330,18 @@ function Testbed() {
color="primary">
<ButtonText>Close - toast after</ButtonText>
</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.Outer>
</View>
@@ -30,7 +30,7 @@ import {
import {precacheProfile} from '#/state/queries/profile'
import {useSession} from '#/state/session'
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 * as tokens from '#/alf/tokens'
import {useDialogControl} from '#/components/Dialog'
@@ -47,6 +47,7 @@ import {Text} from '#/components/Typography'
import {useSimpleVerificationState} from '#/components/verification'
import {VerificationCheck} from '#/components/verification/VerificationCheck'
import type * as bsky from '#/types/bsky'
import {Button} from '#/components/Button'
export const ChatListItemPortal = createPortalGroup()
@@ -349,15 +350,14 @@ function ChatListItemReady({
a.absolute,
{top: tokens.space.md, left: tokens.space.lg},
]}>
<PreviewableUserAvatar
profile={profile}
<UserAvatar
type="user"
size={52}
moderation={moderation.ui('avatar')}
/>
</View>
<Link
to={`/messages/${convo.id}`}
<Button
label={displayName}
accessibilityHint={
!isDeletedAccount
@@ -509,10 +509,10 @@ function ChatListItemReady({
)}
</View>
)}
</Link>
</Button>
<ChatListItemPortal.Outlet />
{/*
{showMenu && (
<ConvoMenu
convo={convo}
@@ -535,12 +535,12 @@ function ChatListItemReady({
]}
latestReportableMessage={latestReportableMessage}
/>
)}
<LeaveConvoPrompt
)}*/}
{/*<LeaveConvoPrompt
control={leaveConvoControl}
convoId={convo.id}
currentScreen="list"
/>
/>*/}
</View>
</GestureActionView>
</ChatListItemPortal.Provider>
@@ -50,11 +50,11 @@ export function RejectMenu({
}) {
const {_} = useLingui()
const shadowedProfile = useProfileShadow(profile)
const navigation = useNavigation<NavigationProp>()
// const navigation = useNavigation<NavigationProp>()
const {mutate: leaveConvo} = useLeaveConvo(convo.id, {
onMutate: () => {
if (currentScreen === 'conversation') {
navigation.dispatch(StackActions.pop())
// navigation.dispatch(StackActions.pop())
}
},
onError: () => {
@@ -192,7 +192,7 @@ export function AcceptChatButton({
}) {
const {_} = useLingui()
const queryClient = useQueryClient()
const navigation = useNavigation<NavigationProp>()
// const navigation = useNavigation<NavigationProp>()
const {needsEmailVerification} = useEmail()
const emailDialogControl = useEmailDialogControl()
@@ -201,10 +201,10 @@ export function AcceptChatButton({
onAcceptConvo?.()
if (currentScreen === 'list') {
precacheConvoQuery(queryClient, {...convo, status: 'accepted'})
navigation.navigate('MessagesConversation', {
conversation: convo.id,
accept: true,
})
// navigation.navigate('MessagesConversation', {
// conversation: convo.id,
// accept: true,
// })
}
},
onError: () => {
@@ -272,12 +272,12 @@ export function DeleteChatButton({
currentScreen: 'list' | 'conversation'
}) {
const {_} = useLingui()
const navigation = useNavigation<NavigationProp>()
// const navigation = useNavigation<NavigationProp>()
const {mutate: leaveConvo} = useLeaveConvo(convo.id, {
onMutate: () => {
if (currentScreen === 'conversation') {
navigation.dispatch(StackActions.pop())
// navigation.dispatch(StackActions.pop())
}
},
onError: () => {
@@ -27,14 +27,6 @@ export function RequestListItem({convo}: {convo: ChatBskyConvoDefs.ConvoView}) {
return (
<View style={[a.relative, a.flex_1]}>
<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 */}
<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 */}