Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(chat): hotkey to create (#989)

Eric Hayese3836d653747
diff --git a/js/app/packages/app/component/rightbar/Rightbar.tsx b/js/app/packages/app/component/rightbar/Rightbar.tsx
index ea3c2ff0b4..4b21f5412f 100644
--- a/js/app/packages/app/component/rightbar/Rightbar.tsx
+++ b/js/app/packages/app/component/rightbar/Rightbar.tsx
@@ -64,6 +64,8 @@ import {
untrack,
} from 'solid-js';
import { SplitlikeContainer } from '../split-layout/components/SplitContainer';
+import { Button } from '@ui/components/Button';
+import { Hotkey } from '@core/component/Hotkey';
type ChatData = {
messages: ChatMessageWithAttachments[];
@@ -177,11 +179,9 @@ function TopBar(props: {
class="h-10 border-b border-edge-muted flex items-center w-full px-2 shrink-0 grow-0"
data-split-panel
>
- <DeprecatedIconButton
- size="sm"
- icon={XIcon}
- tooltip={{ label: 'Close Assistant Panel' }}
- theme="current"
+ <Button
+ tooltip="Close Assistant Panel"
+ class="p-1 size-6"
onClick={() => {
if (bigChatOpen()) {
setBigChatOpen(false);
@@ -189,16 +189,23 @@ function TopBar(props: {
toggleRightPanel();
}
}}
- />
- <DeprecatedIconButton
- size="sm"
- icon={PlusIcon}
- tooltip={{ label: 'Create New Chat' }}
- theme="current"
- onClick={() => {
- createNewRightbarChat();
- }}
- />
+ >
+ <XIcon />
+ </Button>
+ <Button
+ tooltip={
+ <div class="flex flex-row gap-x-1">
+ <div>Create New Chat</div>
+ <div class="flex border border-edge-muted text-[0.625rem] rounded-xs items-center px-1.5 py-0.25 font-normal">
+ <Hotkey shortcut="ctrl+t" />
+ </div>
+ </div>
+ }
+ class="p-1 size-6"
+ onClick={createNewRightbarChat}
+ >
+ <PlusIcon />
+ </Button>
<div class="grow" />
<Show when={ENABLE_REFERENCES_MODAL && props.chatId}>
<ReferencesModal
@@ -615,6 +622,19 @@ export const RightbarWrapper = (_props: { isBigChat?: boolean }) => {
},
});
+ registerHotkey({
+ scopeId,
+ hotkey: 'ctrl+t',
+ hotkeyToken: TOKENS.chat.new,
+ description: 'Create a new chat',
+ runWithInputFocused: true,
+ keyDownHandler: () => {
+ console.log('create new chat');
+ setChatId(undefined);
+ return true;
+ },
+ });
+
const stopGenerating = () => {
const stream_ = stream();
if (!stream_) return false;
diff --git a/js/app/packages/core/hotkey/tokens.ts b/js/app/packages/core/hotkey/tokens.ts
index 01aa19321a..672be0e4cf 100644
--- a/js/app/packages/core/hotkey/tokens.ts
+++ b/js/app/packages/core/hotkey/tokens.ts
@@ -226,6 +226,7 @@ export const TOKENS = {
toggle: 'chat-spotlight-toggle',
close: 'chat-spotlight-close',
},
+ new: 'chat-new',
},
} as const;