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(home): autofocus & press enter to focus (#3871)

dev-rbbddd158def0a
diff --git a/js/app/packages/app/component/home/home.tsx b/js/app/packages/app/component/home/home.tsx
index b8360c7937..b0f56218fe 100644
--- a/js/app/packages/app/component/home/home.tsx
+++ b/js/app/packages/app/component/home/home.tsx
@@ -16,6 +16,8 @@ import { deriveChatName } from '@core/component/AI/util/deriveName';
import { ENABLE_HOME_OVERRIDE } from '@core/constant/featureFlags';
import { PaywallKey, usePaywallState } from '@core/constant/PaywallState';
import { useUserContext } from '@core/context/user';
+import { registerHotkey } from '@core/hotkey/hotkeys';
+import { TOKENS } from '@core/hotkey/tokens';
import { isPaymentError } from '@core/util/handlePaymentError';
import { createRenameDssEntityMutation } from '@macro-entity';
import { invalidateAllSoup } from '@queries/soup/normalized-cache';
@@ -141,7 +143,7 @@ function HomeContent() {
);
}
-const HomeChatInputInner = () => {
+const HomeChatInput = () => {
const analytics = useAnalytics();
const splitPanelContext = useSplitPanelOrThrow();
const input = useChatInputContext();
@@ -159,6 +161,18 @@ const HomeChatInputInner = () => {
showOpenTabs: true,
});
+ registerHotkey({
+ hotkey: 'enter',
+ scopeId: splitPanelContext.splitHotkeyScope,
+ description: 'Focus Chat Input',
+ keyDownHandler: () => {
+ editor.controls.focus();
+ return true;
+ },
+ hotkeyToken: TOKENS.block.focus,
+ hide: true,
+ });
+
const renameMutation = createRenameDssEntityMutation();
const handleSend = async (request: ChatSendInput) => {
@@ -228,13 +242,9 @@ const HomeChatInputInner = () => {
return true;
}}
isPersistent={true}
- autoFocusOnMount={false}
+ autoFocusOnMount={true}
/>
</div>
</div>
);
};
-
-const HomeChatInput = () => {
- return <HomeChatInputInner />;
-};