diff --git a/src/app/features/bots/BotConversations.tsx b/src/app/features/bots/BotConversations.tsx index 7d474e51..0b5f959c 100644 --- a/src/app/features/bots/BotConversations.tsx +++ b/src/app/features/bots/BotConversations.tsx @@ -63,6 +63,7 @@ function NewChatComposer({ preset, room }: { preset: BotPreset; room: Room }) { roomId={room.roomId} fileDropContainerRef={fileDropRef} onSend={handleSend} + textOnly /> diff --git a/src/app/features/room/RoomInput.tsx b/src/app/features/room/RoomInput.tsx index ad3dbf60..f03eca51 100644 --- a/src/app/features/room/RoomInput.tsx +++ b/src/app/features/room/RoomInput.tsx @@ -205,9 +205,14 @@ interface RoomInputProps { // freshly-rooted thread (the just-sent top-level event IS the thread root). // Channel / DM / thread composers omit it and stay fire-and-forget. onSend?: (eventId: string) => void; + // Text-only mode: hides the file/sticker affordances and no-ops file + // paste/drop. The AI "new chat" landing uses it because only a text send + // navigates into the freshly-rooted thread (onSend) — a sticker/file first + // move would otherwise strand the user on the landing. + textOnly?: boolean; } export const RoomInput = forwardRef( - ({ editor, fileDropContainerRef, roomId, room, threadId, onSend }, ref) => { + ({ editor, fileDropContainerRef, roomId, room, threadId, onSend, textOnly }, ref) => { const { t } = useTranslation(); const mx = useMatrixClient(); const useAuthentication = useMediaAuthentication(); @@ -276,6 +281,9 @@ export const RoomInput = forwardRef( const handleFiles = useCallback( async (files: File[]) => { + // Text-only composer (AI new-chat landing) ignores every file vector — + // picker, paste and drop all funnel through here. + if (textOnly) return; setUploadBoard(true); const safeFiles = files.map(safeFile); const fileItems: TUploadItem[] = []; @@ -309,7 +317,7 @@ export const RoomInput = forwardRef( item: fileItems, }); }, - [setSelectedFiles, room] + [setSelectedFiles, room, textOnly] ); const pickFile = useFilePicker(handleFiles, true); const handlePaste = useFilePasteHandler(handleFiles); @@ -764,7 +772,7 @@ export const RoomInput = forwardRef( )} } style={{ pointerEvents: 'none' }} > @@ -873,9 +881,9 @@ export const RoomInput = forwardRef( gap="200" style={{ padding: `${toRem(2)} ${toRem(8)} ${toRem(4)}` }} > - {plusButton} + {!textOnly && plusButton} - {emojiButton} + {!textOnly && emojiButton} {sendButton} }