From f04d8abd4e8ddc6f555a8f6cd9e7609c56e23d80 Mon Sep 17 00:00:00 2001 From: ComputelessComputer Date: Mon, 16 Mar 2026 16:29:24 +0900 Subject: [PATCH] fix: restore the new meeting upload menu styling - bring back the width-matched anchored popover for the header new meeting button - restore the dedicated chevron hit area and context-menu behavior from the earlier UI - keep the current upload audio and upload transcript flows wired to the menu actions --- .../src/shared/main/header-listen-button.tsx | 122 +++++++++++++----- 1 file changed, 89 insertions(+), 33 deletions(-) diff --git a/apps/desktop/src/shared/main/header-listen-button.tsx b/apps/desktop/src/shared/main/header-listen-button.tsx index 644cf36f21..0d8c2b2af1 100644 --- a/apps/desktop/src/shared/main/header-listen-button.tsx +++ b/apps/desktop/src/shared/main/header-listen-button.tsx @@ -1,9 +1,16 @@ -import { ChevronDownIcon } from "lucide-react"; -import { useCallback, useState } from "react"; +import { ChevronDown } from "lucide-react"; +import { + type MouseEvent, + useCallback, + useEffect, + useRef, + useState, +} from "react"; import { Button } from "@hypr/ui/components/ui/button"; import { Popover, + PopoverAnchor, PopoverContent, PopoverTrigger, } from "@hypr/ui/components/ui/popover"; @@ -84,15 +91,50 @@ function useHeaderListenState() { function HeaderListenButtonInner() { const { isDisabled, warningMessage } = useHeaderListenState(); + const [menuWidth, setMenuWidth] = useState(null); + const containerRef = useRef(null); const handleClick = useNewNoteAndListen(); const handleUpload = useNewNoteAndUpload(); const openNew = useTabs((state) => state.openNew); const [open, setOpen] = useState(false); + useEffect(() => { + const node = containerRef.current; + + if (!node) { + return; + } + + const updateWidth = () => { + setMenuWidth(node.offsetWidth); + }; + + updateWidth(); + + const observer = new ResizeObserver(updateWidth); + observer.observe(node); + + return () => { + observer.disconnect(); + }; + }, []); + const handleConfigure = useCallback(() => { openNew({ type: "ai", state: { tab: "transcription" } }); }, [openNew]); + const handleMenuMouseDown = useCallback((event: MouseEvent) => { + if (event.button === 2) { + event.preventDefault(); + } + }, []); + + const handleOpenMenu = useCallback((event: MouseEvent) => { + event.preventDefault(); + event.stopPropagation(); + setOpen(true); + }, []); + const handleUploadAudio = useCallback(() => { setOpen(false); handleUpload("audio").catch((error) => { @@ -111,15 +153,17 @@ function HeaderListenButtonInner() { ); - const content = ( + return ( -
- {warningMessage ? ( - - {button} - - - - - ) : ( - button - )} - {chevron} -
+ +
+ {warningMessage ? ( + + + {button} + + + + + + ) : ( + button + )} + {chevron} +
+