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.

fix(ui): hotkey tokens and hovercard (#3210)

Fake-User8e4420bbd3a9
diff --git a/js/app/packages/app/component/Launcher.tsx b/js/app/packages/app/component/Launcher.tsx
index e8372193a0..f389fd378d 100644
--- a/js/app/packages/app/component/Launcher.tsx
+++ b/js/app/packages/app/component/Launcher.tsx
@@ -699,11 +699,7 @@ export const LauncherInner = (props: LauncherInnerProps) => {
: 'ring-edge-muted'
)}
>
- <Hotkey
- token={
- TOKENS.global.commandMenu /* scuffed, should use TOKENS.ts */
- }
- />
+ <Hotkey shortcut="shift" />
</span>
</span>
to launch in new split
diff --git a/js/app/packages/app/component/app-sidebar/sidebar.tsx b/js/app/packages/app/component/app-sidebar/sidebar.tsx
index e70262dfc8..3c39c28914 100644
--- a/js/app/packages/app/component/app-sidebar/sidebar.tsx
+++ b/js/app/packages/app/component/app-sidebar/sidebar.tsx
@@ -68,6 +68,7 @@ interface SidebarItem {
JSX.SvgSVGAttributes<SVGSVGElement> | { triggerAnimation?: boolean }
>;
hotkey: ValidHotkey;
+ hotkeyToken: HotkeyToken;
standaloneHotkey?: boolean;
}
@@ -78,6 +79,7 @@ export const SIDEBAR_LINKS = [
href: LIST_VIEW_PATHS.inbox,
icon: AnimatedInboxIcon,
hotkey: 'i',
+ hotkeyToken: TOKENS.sidebar.goTo.inbox,
},
{
id: 'search',
@@ -85,6 +87,7 @@ export const SIDEBAR_LINKS = [
href: LIST_VIEW_PATHS.search,
icon: AnimatedSearchIcon,
hotkey: '/',
+ hotkeyToken: TOKENS.sidebar.goTo.search,
standaloneHotkey: true,
},
{
@@ -93,6 +96,7 @@ export const SIDEBAR_LINKS = [
href: LIST_VIEW_PATHS.agents,
icon: AnimatedStarIcon,
hotkey: 'a',
+ hotkeyToken: TOKENS.sidebar.goTo.agents,
},
{
id: 'mail',
@@ -100,6 +104,7 @@ export const SIDEBAR_LINKS = [
href: LIST_VIEW_PATHS.mail,
icon: AnimatedEmailIcon,
hotkey: 'e',
+ hotkeyToken: TOKENS.sidebar.goTo.mail,
},
{
id: 'documents',
@@ -107,6 +112,7 @@ export const SIDEBAR_LINKS = [
href: LIST_VIEW_PATHS.documents,
icon: AnimatedFileMdIcon,
hotkey: 'd',
+ hotkeyToken: TOKENS.sidebar.goTo.documents,
},
{
id: 'tasks',
@@ -114,6 +120,7 @@ export const SIDEBAR_LINKS = [
href: LIST_VIEW_PATHS.tasks,
icon: AnimatedTaskIcon,
hotkey: 't',
+ hotkeyToken: TOKENS.sidebar.goTo.tasks,
},
{
id: 'channels',
@@ -121,6 +128,7 @@ export const SIDEBAR_LINKS = [
href: LIST_VIEW_PATHS.channels,
icon: AnimatedChannelIcon,
hotkey: 'c',
+ hotkeyToken: TOKENS.sidebar.goTo.channels,
},
{
id: 'folders',
@@ -128,6 +136,7 @@ export const SIDEBAR_LINKS = [
href: LIST_VIEW_PATHS.folders,
icon: AnimatedFolderIcon,
hotkey: 'f',
+ hotkeyToken: TOKENS.sidebar.goTo.folders,
},
] satisfies SidebarItem[];
@@ -242,6 +251,7 @@ export const registerSidebarHotkeys = ({
registerHotkey({
hotkey: GO_TO_LEADER_KEY,
scopeId: 'global',
+ hotkeyToken: TOKENS.sidebar.goToLeader,
description: 'Go to page',
keyDownHandler: () => {
// We debounce the time till the hot keys are visible to allow other commands
@@ -353,6 +363,7 @@ export const registerSidebarHotkeys = ({
registerHotkey({
hotkey: link.hotkey,
scopeId: link.standaloneHotkey ? 'global' : GO_TO_COMMAND_SCOPE,
+ hotkeyToken: link.hotkeyToken,
description: `Go to ${link.label}`,
keyDownHandler: openSidebarView,
icon: link.icon,
@@ -421,6 +432,7 @@ const CALLS_LINK: SidebarItem = {
href: LIST_VIEW_PATHS.calls,
icon: AnimatedCallIcon,
hotkey: 'l',
+ hotkeyToken: TOKENS.sidebar.goTo.calls,
};
export const AppSidebar = (props: AppSidebarProps) => {
@@ -734,13 +746,8 @@ const SidebarLink = (props: SidebarLinkProps) => {
hotkey={
props.sidebarState === 'slim'
? props.standaloneHotkey
- ? TOKENS.global.commandMenu /* scuffed, should use TOKENS.ts */
- : [
- TOKENS.global
- .commandMenu /* scuffed, should use TOKENS.ts */,
- TOKENS.global
- .commandMenu /* scuffed, should use TOKENS.ts */,
- ]
+ ? props.hotkeyToken
+ : [TOKENS.sidebar.goToLeader, props.hotkeyToken]
: undefined
}
onMouseLeave={() => setIsHovering(false)}
@@ -792,30 +799,15 @@ const SidebarLink = (props: SidebarLinkProps) => {
<div class="flex gap-1 items-center text-ink-extra-muted font-normal text-xxs">
<Show when={!props.standaloneHotkey}>
<div class="text-xxs text-ink-extra-muted rounded-sm ml-auto border border-ink/5 px-1.5 py-0.5 -my-1">
- <Hotkey
- token={
- TOKENS.global
- .commandMenu /* scuffed, should use TOKENS.ts */
- }
- />
+ <Hotkey token={TOKENS.sidebar.goToLeader} />
</div>
<div class="text-xxs text-ink-extra-muted rounded-sm ml-auto border border-ink/5 px-1.5 py-0.5 -my-1">
- <Hotkey
- token={
- TOKENS.global
- .commandMenu /* scuffed, should use TOKENS.ts */
- }
- />
+ <Hotkey token={props.hotkeyToken} />
</div>
</Show>
<Show when={props.standaloneHotkey}>
<div class="text-xxs text-ink-extra-muted rounded-sm ml-auto border border-ink/5 px-1.5 py-0.5 -my-1">
- <Hotkey
- token={
- TOKENS.global
- .commandMenu /* scuffed, should use TOKENS.ts */
- }
- />
+ <Hotkey token={props.hotkeyToken} />
</div>
</Show>
</div>
@@ -829,11 +821,7 @@ const SidebarLink = (props: SidebarLinkProps) => {
props.sidebarState !== 'slim' && 'relative p-1 ml-auto'
)}
>
- <Hotkey
- token={
- TOKENS.global.commandMenu /* scuffed, should use TOKENS.ts */
- }
- />
+ <Hotkey token={props.hotkeyToken} />
</div>
</Show>
</Button>
diff --git a/js/app/packages/core/hotkey/tokens.ts b/js/app/packages/core/hotkey/tokens.ts
index 43279067a5..57f59cb551 100644
--- a/js/app/packages/core/hotkey/tokens.ts
+++ b/js/app/packages/core/hotkey/tokens.ts
@@ -82,6 +82,22 @@ export const TOKENS = {
redo: 'global.redo',
},
+ // sidebar navigation
+ sidebar: {
+ goToLeader: 'sidebar.goToLeader',
+ goTo: {
+ inbox: 'sidebar.goTo.inbox',
+ search: 'sidebar.goTo.search',
+ agents: 'sidebar.goTo.agents',
+ mail: 'sidebar.goTo.mail',
+ documents: 'sidebar.goTo.documents',
+ tasks: 'sidebar.goTo.tasks',
+ channels: 'sidebar.goTo.channels',
+ calls: 'sidebar.goTo.calls',
+ folders: 'sidebar.goTo.folders',
+ },
+ },
+
// email
email: {
nextThread: 'email.nextThread',
diff --git a/js/app/packages/ui/components/HoverCard.tsx b/js/app/packages/ui/components/HoverCard.tsx
index 0edb34c850..37cec98b6d 100644
--- a/js/app/packages/ui/components/HoverCard.tsx
+++ b/js/app/packages/ui/components/HoverCard.tsx
@@ -1,4 +1,4 @@
-import { HoverCard as KobalteHoverCard } from '@kobalte/core/hover-card';
+import { Tooltip as KobalteTooltip } from '@kobalte/core/tooltip';
import type { Placement } from '@floating-ui/dom';
import type { ParentProps } from 'solid-js';
import { cn } from '../utils/classname';
@@ -19,7 +19,7 @@ type ContentProps = ParentProps<{ class?: string }>;
function HoverCardRoot(props: RootProps) {
return (
- <KobalteHoverCard
+ <KobalteTooltip
placement={props.placement ?? 'bottom'}
overflowPadding={16}
fitViewport={true}
@@ -29,25 +29,25 @@ function HoverCardRoot(props: RootProps) {
gutter={4}
>
{props.children}
- </KobalteHoverCard>
+ </KobalteTooltip>
);
}
function HoverCardTrigger(props: TriggerProps) {
return (
- <KobalteHoverCard.Trigger
+ <KobalteTooltip.Trigger
class={cn('inline-flex items-center', props.class)}
as={props.as ?? 'div'}
>
{props.children}
- </KobalteHoverCard.Trigger>
+ </KobalteTooltip.Trigger>
);
}
function HoverCardContent(props: ContentProps) {
return (
- <KobalteHoverCard.Portal>
- <KobalteHoverCard.Content class="z-tool-tip max-w-[calc(100vw-32px)]">
+ <KobalteTooltip.Portal>
+ <KobalteTooltip.Content class="z-tool-tip max-w-[calc(100vw-32px)]">
<Surface
class={cn(
'flex items-center justify-center p-2 text-ink-muted text-xs wrap-break-word',
@@ -57,8 +57,8 @@ function HoverCardContent(props: ContentProps) {
>
{props.children}
</Surface>
- </KobalteHoverCard.Content>
- </KobalteHoverCard.Portal>
+ </KobalteTooltip.Content>
+ </KobalteTooltip.Portal>
);
}
diff --git a/js/bun.lock b/js/bun.lock
index e2ec2551a9..abb76fa624 100644
--- a/js/bun.lock
+++ b/js/bun.lock
@@ -839,7 +839,7 @@
"@img/sharp-win32-x64": ["@img/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw=="],
- "@inkibra/tauri-plugins": ["@inkibra/tauri-plugins@github:macro-inc/tauri-plugins#6152009", { "dependencies": { "react": "^18.3.1", "react-dom": "^18.3.1" } }, "macro-inc-tauri-plugins-6152009"],
+ "@inkibra/tauri-plugins": ["@inkibra/tauri-plugins@github:macro-inc/tauri-plugins#6152009", { "dependencies": { "react": "^18.3.1", "react-dom": "^18.3.1" } }, "macro-inc-tauri-plugins-6152009", "sha512-XLN+niDA9BkzrxiZqBjYf+DL4TLoMIcI80ypCowacVfrfAjWt0qLwLkzWVUXjD7k3v0DB/G+BP4OLJNkGygHIw=="],
"@inquirer/external-editor": ["@inquirer/[email protected]", "", { "dependencies": { "chardet": "^2.1.1", "iconv-lite": "^0.7.0" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-RWbSrDiYmO4LbejWY7ttpxczuwQyZLBUyygsA9Nsv95hpzUWwnNTVQmAq3xuh7vNwCp07UTmE5i11XAEExx4RA=="],
@@ -2565,7 +2565,7 @@
"pathval": ["[email protected]", "", {}, "sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ=="],
- "pdfjs-dist": ["pdfjs-dist@github:macro-inc/pdf.js#f9b2ce6", { "dependencies": { "dommatrix": "^1.0.3", "web-streams-polyfill": "^3.2.1" }, "peerDependencies": { "worker-loader": "^3.0.8" }, "optionalPeers": ["worker-loader"] }, "macro-inc-pdf.js-f9b2ce6"],
+ "pdfjs-dist": ["pdfjs-dist@github:macro-inc/pdf.js#f9b2ce6", { "dependencies": { "dommatrix": "^1.0.3", "web-streams-polyfill": "^3.2.1" }, "peerDependencies": { "worker-loader": "^3.0.8" }, "optionalPeers": ["worker-loader"] }, "macro-inc-pdf.js-f9b2ce6", "sha512-HDFaPbCxLG2GHpf1smUG97nku5aPGBGaCcIbK05dGdp07TBLUlDcXsM4WcE82mO5W4RBPIBVYobX5N/6M6NFrA=="],
"performance-now": ["[email protected]", "", {}, "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow=="],