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.

style(soup): correct hotkey style in soup ctx menu, add more hk hints (#4696)

Seamusab6c4ae70005
diff --git a/js/app/packages/app/component/next-soup/soup-view/create-soup-entity-actions.ts b/js/app/packages/app/component/next-soup/soup-view/create-soup-entity-actions.ts
index 2a0e14b570..619ca347c6 100644
--- a/js/app/packages/app/component/next-soup/soup-view/create-soup-entity-actions.ts
+++ b/js/app/packages/app/component/next-soup/soup-view/create-soup-entity-actions.ts
@@ -43,6 +43,7 @@ type SoupEntityActionItem = {
label: string;
icon?: Component<JSX.SvgSVGAttributes<SVGSVGElement>>;
hotkeyToken?: HotkeyToken;
+ shortcut?: string;
onClick: () => void | Promise<void>;
destructive?: boolean;
};
@@ -138,6 +139,7 @@ export function createSoupEntityActions(): {
topItems.push({
id: 'mark-done',
label: 'Mark Done',
+ hotkeyToken: TOKENS.entity.action.markDone,
onClick: handle(markDone.executeWithSoup),
});
}
@@ -231,6 +233,7 @@ export function createSoupEntityActions(): {
topItems.push({
id: 'open-in-split',
label: 'Open in new split',
+ shortcut: 'shift+enter',
onClick: openInNewSplit,
});
}
@@ -242,6 +245,7 @@ export function createSoupEntityActions(): {
middleItems.push({
id: 'rename',
label: 'Rename',
+ hotkeyToken: TOKENS.entity.action.rename,
onClick: handle(renameAction.executeWithSoup),
});
}
@@ -271,6 +275,7 @@ export function createSoupEntityActions(): {
middleItems.push({
id: 'move-to-folder',
label: 'Move to folder',
+ hotkeyToken: TOKENS.entity.action.moveToFolder,
onClick: handle(moveToProjectAction.executeWithSoup),
});
}
@@ -287,6 +292,7 @@ export function createSoupEntityActions(): {
middleItems.push({
id: 'duplicate',
label: 'Duplicate',
+ hotkeyToken: TOKENS.entity.action.copy,
onClick: handle(copyAction.executeWithSoup),
});
}
@@ -295,6 +301,7 @@ export function createSoupEntityActions(): {
middleItems.push({
id: 'copy-link',
label: 'Copy Link',
+ hotkeyToken: TOKENS.entity.action.copyLink,
onClick: handle(copyLinkAction.executeWithSoup),
});
@@ -302,6 +309,7 @@ export function createSoupEntityActions(): {
middleItems.push({
id: 'copy-branch-name',
label: 'Copy Branch Name',
+ hotkeyToken: TOKENS.entity.action.copyBranchName,
onClick: handle(copyBranchNameAction.executeWithSoup),
});
}
@@ -376,6 +384,7 @@ export function createSoupEntityActions(): {
deleteItems.push({
id: 'delete',
label: 'Delete',
+ hotkeyToken: TOKENS.entity.action.delete,
onClick: handle(deleteAction.executeWithSoup),
destructive: true,
});
diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-entity-actions-menu.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-entity-actions-menu.tsx
index 68cbb60e22..758958e4fd 100644
--- a/js/app/packages/app/component/next-soup/soup-view/soup-entity-actions-menu.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/soup-entity-actions-menu.tsx
@@ -49,6 +49,7 @@ export const SoupEntityActionsMenu = (props: SoupEntityActionsMenuProps) => {
text={action.label}
icon={action.icon}
hotkeyToken={action.hotkeyToken}
+ shortcut={action.shortcut}
onClick={() => handleAction(action.onClick)}
class={action.destructive ? 'text-failure-ink' : undefined}
/>
diff --git a/js/app/packages/core/component/ContextMenu.tsx b/js/app/packages/core/component/ContextMenu.tsx
index 953bb84406..5556c622c2 100644
--- a/js/app/packages/core/component/ContextMenu.tsx
+++ b/js/app/packages/core/component/ContextMenu.tsx
@@ -98,6 +98,7 @@ type BaseMenuItemProps = {
closeOnSelect?: boolean;
class?: string;
hotkeyToken?: HotkeyToken;
+ shortcut?: string;
};
type CheckboxMenuItemProps = BaseMenuItemProps & {
@@ -208,14 +209,16 @@ export function MenuItem(props: MenuItemProps) {
</Show>
</Show>
<Show when={props.text}>
- <div class="flex-1 truncate">{props.text}</div>
+ <div class="flex-1 truncate pr-[2em]">{props.text}</div>
</Show>
- <Show when={props.hotkeyToken} keyed>
- {(hotkeyToken) => (
- <div class="ml-auto text-surface text-xs">
- <Hotkey token={hotkeyToken} class="text-ink-muted" showPlus />
- </div>
- )}
+ <Show when={props.hotkeyToken || props.shortcut}>
+ <Hotkey
+ token={props.hotkeyToken}
+ shortcut={props.shortcut}
+ class="ml-auto"
+ theme="subtle"
+ showPlus
+ />
</Show>
</MenuItemWrapper>
);
diff --git a/js/app/packages/ui/components/Hotkey.tsx b/js/app/packages/ui/components/Hotkey.tsx
index 0063023cf4..9f1eb6f3e9 100644
--- a/js/app/packages/ui/components/Hotkey.tsx
+++ b/js/app/packages/ui/components/Hotkey.tsx
@@ -216,7 +216,8 @@ export function Hotkey(props: HotkeyProps) {
<div
{...rest}
class={cn(
- 'inline-flex items-center gap-1',
+ 'inline-flex items-center',
+ local.showPlus ? 'gap-0.5' : 'gap-1',
local.theme && 'rounded-sm px-1.5 py-px text-xxs',
local.theme && hotkeyStyles[local.theme]?.hotkey,
local.class
@@ -228,7 +229,7 @@ export function Hotkey(props: HotkeyProps) {
<span>{modifierMap[mod as keyof typeof modifierMap] || mod}</span>
<Show when={local.showPlus}>
- <span> + </span>
+ <span>+</span>
</Show>
</>
)}