diff --git a/apps/desktop/src/components/toolbar/bars/main-toolbar.tsx b/apps/desktop/src/components/toolbar/bars/main-toolbar.tsx index 4f1d682fb..b9bfae5dc 100644 --- a/apps/desktop/src/components/toolbar/bars/main-toolbar.tsx +++ b/apps/desktop/src/components/toolbar/bars/main-toolbar.tsx @@ -3,12 +3,11 @@ import { useMatch } from "@tanstack/react-router"; import { DeleteNoteButton } from "@/components/toolbar/buttons/delete-note-button"; import { NewNoteButton } from "@/components/toolbar/buttons/new-note-button"; import { NewWindowButton } from "@/components/toolbar/buttons/new-window-button"; -// import { ShareButton } from "@/components/toolbar/buttons/share-button"; import { getCurrentWebviewWindowLabel } from "@hypr/plugin-windows"; +import { ChatPanelButton } from "@hypr/ui/components/block/chat-panel-button"; import { cn } from "@hypr/ui/lib/utils"; -import { useLeftSidebar } from "@hypr/utils/contexts"; +import { useLeftSidebar, useRightPanel } from "@hypr/utils/contexts"; import { SearchBar } from "../../search-bar"; -import { ChatPanelButton } from "../buttons/chat-panel-button"; import { LeftSidebarButton } from "../buttons/left-sidebar-button"; import { ShareButton } from "../buttons/share-button"; @@ -24,6 +23,8 @@ export function MainToolbar() { const isNote = !!noteMatch; const isMain = getCurrentWebviewWindowLabel() === "main"; + const { isExpanded: isChatPanelExpanded, togglePanel: toggleChatPanel } = useRightPanel(); + return (
{(organizationMatch || humanMatch) && } {isNote && } - + )} diff --git a/apps/desktop/src/components/toolbar/buttons/chat-panel-button.tsx b/apps/desktop/src/components/toolbar/buttons/chat-panel-button.tsx deleted file mode 100644 index a8903bfbd..000000000 --- a/apps/desktop/src/components/toolbar/buttons/chat-panel-button.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import { MessageCircleMore } from "lucide-react"; -import { memo, useEffect } from "react"; - -import { Button } from "@hypr/ui/components/ui/button"; -import { Tooltip, TooltipContent, TooltipTrigger } from "@hypr/ui/components/ui/tooltip"; -import { cn } from "@hypr/ui/lib/utils"; -import { useRightPanel } from "@hypr/utils/contexts"; -import Shortcut from "../../shortcut"; - -function ChatPanelButtonBase() { - const { isExpanded, togglePanel } = useRightPanel(); - - useEffect(() => { - const handleKeyDown = (event: KeyboardEvent) => { - if (event.key === "j" && (event.metaKey || event.ctrlKey)) { - event.preventDefault(); - togglePanel(); - } - }; - - document.addEventListener("keydown", handleKeyDown); - - return () => { - document.removeEventListener("keydown", handleKeyDown); - }; - }, [togglePanel]); - - const handleClick = () => { - togglePanel(); - }; - - return ( - - - - - -

- Toggle chat panel -

-
-
- ); -} - -export const ChatPanelButton = memo(ChatPanelButtonBase); diff --git a/apps/desktop2/src/components/chat.tsx b/apps/desktop2/src/components/chat.tsx index 8645302e1..b7f74902f 100644 --- a/apps/desktop2/src/components/chat.tsx +++ b/apps/desktop2/src/components/chat.tsx @@ -53,40 +53,64 @@ export function Chat() { if (!currentChatGroupId || !messageIds?.length) { return ( -
-
Select or create a chat group
- -
- {chatGroupIds?.map((chatGroupId) => ( - setCurrentChatGroupId(chatGroupId)} +
+
+
+ {chatGroupIds?.map((chatGroupId) => ( + setCurrentChatGroupId(chatGroupId)} + /> + ))} +
+
+ +
+
+