From 21087247100494e4953f747cd220b7e28cedff13 Mon Sep 17 00:00:00 2001 From: Arjun Mahanti Date: Wed, 26 Aug 2026 08:36:20 -0400 Subject: [PATCH] refactor(desktop): reuse composer in Bestie handoff Co-authored-by: Arjun Mahanti Signed-off-by: Arjun Mahanti Co-authored-by: Codex --- .../messages/ui/BestieMessagePopover.tsx | 102 ++++++++++-------- .../features/messages/ui/MessageComposer.tsx | 7 +- .../messages/ui/MessageComposer.types.ts | 5 + desktop/tests/e2e/bestie.spec.ts | 17 ++- 4 files changed, 78 insertions(+), 53 deletions(-) diff --git a/desktop/src/features/messages/ui/BestieMessagePopover.tsx b/desktop/src/features/messages/ui/BestieMessagePopover.tsx index 65348921b6..7f95d4cacd 100644 --- a/desktop/src/features/messages/ui/BestieMessagePopover.tsx +++ b/desktop/src/features/messages/ui/BestieMessagePopover.tsx @@ -1,5 +1,4 @@ import * as React from "react"; -import { Send } from "lucide-react"; import { toast } from "sonner"; import { pickBestieAgent } from "@/features/agents/lib/bestie"; @@ -10,12 +9,14 @@ import { buildMessageLink } from "@/features/messages/lib/messageLink"; import { getThreadReference } from "@/features/messages/lib/threading"; import { useSendMessageMutation } from "@/features/messages/hooks"; import type { TimelineMessage } from "@/features/messages/types"; +import { MessageComposer } from "@/features/messages/ui/MessageComposer"; import { ProfileAvatar } from "@/features/profile/ui/ProfileAvatar"; import { useIdentityQuery } from "@/shared/api/hooks"; import { Button } from "@/shared/ui/button"; import { Popover, PopoverContent, PopoverTrigger } from "@/shared/ui/popover"; -import { Textarea } from "@/shared/ui/textarea"; import { Tooltip, TooltipContent, TooltipTrigger } from "@/shared/ui/tooltip"; +import { UserAvatar } from "@/shared/ui/UserAvatar"; +import { VideoReviewCommentMarkdown } from "@/shared/ui/VideoReviewCommentMarkdown"; const ACTION_BUTTON_CLASS = "h-8 w-8 rounded-full p-0"; @@ -35,7 +36,6 @@ export function BestieMessagePopover({ const managedAgentsQuery = useManagedAgentsQuery(); const openDmMutation = useOpenDmMutation(); const sendMessageMutation = useSendMessageMutation(null, identityQuery.data); - const [note, setNote] = React.useState(""); const bestie = React.useMemo( () => pickBestieAgent(managedAgentsQuery.data ?? [], activeCommunity?.relayUrl), @@ -45,7 +45,11 @@ export function BestieMessagePopover({ if (!bestie) return null; - const submit = async () => { + const submit = async ( + note: string, + mentionPubkeys: string[], + mediaTags?: string[][], + ) => { const { rootId } = getThreadReference(message.tags ?? []); const link = buildMessageLink({ channelId, @@ -65,14 +69,16 @@ export function BestieMessagePopover({ }); await sendMessageMutation.mutateAsync({ content, + mediaTags, + mentionPubkeys, targetChannel: dm, }); - setNote(""); onOpenChange(false); toast.success(`Sent to ${bestie.name}`); } catch (error) { console.error("Failed to send message to Bestie", error); toast.error(`Couldn't send to ${bestie.name}`); + throw error; } }; @@ -103,64 +109,66 @@ export function BestieMessagePopover({ -
{ - event.preventDefault(); - void submit(); - }} - > +
-
-

Send to Bestie

-

- Share this message with {bestie.name} -

+

Bestie

+
+ +
+
+ +
+
+

+ {message.author} +

+

+ {message.time} +

+
+
+ +
+
-
-

- {message.body} -

-
- -