From f7b25261cc0eda551b216f1ced5400609aa6b683 Mon Sep 17 00:00:00 2001 From: Max Litruv Boonzaayer Date: Wed, 13 May 2026 10:13:34 +1000 Subject: [PATCH] fix(mobile): make share picker fullscreen with full-width search, remove confirmation dialog --- overlay/src/app/features/ShareRoomPicker.tsx | 328 ++++++++----------- 1 file changed, 130 insertions(+), 198 deletions(-) diff --git a/overlay/src/app/features/ShareRoomPicker.tsx b/overlay/src/app/features/ShareRoomPicker.tsx index c921b5c..8e10a0b 100644 --- a/overlay/src/app/features/ShareRoomPicker.tsx +++ b/overlay/src/app/features/ShareRoomPicker.tsx @@ -1,5 +1,5 @@ import { useAtomValue } from 'jotai'; -import React, { ChangeEventHandler, useCallback, useMemo, useRef, useState } from 'react'; +import React, { ChangeEventHandler, useCallback, useMemo, useRef } from 'react'; import { useVirtualizer } from '@tanstack/react-virtual'; import FocusTrap from 'focus-trap-react'; import { @@ -11,10 +11,8 @@ import { Icons, Input, MenuItem, - Modal, Overlay, OverlayBackdrop, - OverlayCenter, Scroll, Text, config, @@ -62,7 +60,6 @@ export function ShareRoomPicker({ share, onPick, onDismiss }: ShareRoomPickerPro const mx = useMatrixClient(); const useAuthentication = useMediaAuthentication(); const scrollRef = useRef(null); - const [confirmRoomId, setConfirmRoomId] = useState(null); const mDirects = useAtomValue(mDirectAtom); const allRoomsSet = useAllJoinedRoomsSet(); @@ -108,213 +105,148 @@ export function ShareRoomPicker({ share, onPick, onDismiss }: ShareRoomPickerPro const handleRoomClick: React.MouseEventHandler = (evt) => { const roomId = evt.currentTarget.getAttribute('data-room-id'); if (roomId) { - setConfirmRoomId(roomId); + onPick(roomId); } }; - const handleConfirm = useCallback(() => { - if (confirmRoomId) { - onPick(confirmRoomId); - } - }, [confirmRoomId, onPick]); - - const handleCancelConfirm = useCallback(() => { - setConfirmRoomId(null); - }, []); - const previewText = share.text?.slice(0, 80) ?? share.subject?.slice(0, 80); const fileCount = share.files.length; return ( }> - - + - - -
- - Share to Room - {(previewText || fileCount > 0) && ( - - {previewText - ? `"${previewText}${(share.text?.length ?? 0) > 80 ? '…' : ''}"` - : `${fileCount} file${fileCount !== 1 ? 's' : ''}`} - - )} - - - - - - -
- - - } - placeholder="Search rooms…" - size="400" - variant="Background" - outlined - autoFocus - /> - - - - - {vItems.length === 0 && ( - - - {searchResult ? 'No Match Found' : 'No Rooms'} - - - {searchResult - ? `No rooms found for "${searchResult.query}".` - : 'You have no rooms to share into.'} - - - )} - - {vItems.map((vItem) => { - const roomId = items[vItem.index]; - const room = getRoom(roomId); - if (!room) return null; - const isDm = mDirects.has(roomId); - - const avatarSrc = isDm - ? getDirectRoomAvatarUrl(mx, room, 96, useAuthentication) - : getRoomAvatarUrl(mx, room, 96, useAuthentication); - - return ( - - - {avatarSrc ? ( - ( - - {nameInitials(room.name)} - - )} - /> - ) : ( - - )} - - } - > - - - {room.name} - - - - - ); - })} - - - +
+ + Share to Room + {(previewText || fileCount > 0) && ( + + {previewText + ? `"${previewText}${(share.text?.length ?? 0) > 80 ? '…' : ''}"` + : `${fileCount} file${fileCount !== 1 ? 's' : ''}`} + + )} - - - + + + + + +
- {confirmRoomId && (() => { - const room = getRoom(confirmRoomId); - const roomName = room?.name ?? confirmRoomId; - const isDm = mDirects.has(confirmRoomId); - return ( - - - - - - Share to {isDm ? 'Person' : 'Room'}? - - Send to {roomName}? - - - - - - + + } + placeholder="Search rooms…" + size="400" + variant="Background" + outlined + autoFocus + /> + + + + + {vItems.length === 0 && ( + + + {searchResult ? 'No Match Found' : 'No Rooms'} + + + {searchResult + ? `No rooms found for "${searchResult.query}".` + : 'You have no rooms to share into.'} + - - - - ); - })()} + )} + + {vItems.map((vItem) => { + const roomId = items[vItem.index]; + const room = getRoom(roomId); + if (!room) return null; + const isDm = mDirects.has(roomId); + + const avatarSrc = isDm + ? getDirectRoomAvatarUrl(mx, room, 96, useAuthentication) + : getRoomAvatarUrl(mx, room, 96, useAuthentication); + + return ( + + + {avatarSrc ? ( + ( + + {nameInitials(room.name)} + + )} + /> + ) : ( + + )} + + } + > + + + {room.name} + + + + + ); + })} + +
+ +
+
); }