Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
Shortcuts helper (#917)
Jacob Beckerman8c23a8ce551a
diff --git a/js/app/bun.lock b/js/app/bun.lockindex 5133f19f9c..4eb65b6b70 100644--- a/js/app/bun.lock+++ b/js/app/bun.lock@@ -1,6 +1,5 @@{"lockfileVersion": 1,- "configVersion": 0,"workspaces": {"": {"name": "@coparse/monorepo",diff --git a/js/app/packages/app/component/Layout.tsx b/js/app/packages/app/component/Layout.tsxindex aec791cef5..feb99aebe5 100644--- a/js/app/packages/app/component/Layout.tsx+++ b/js/app/packages/app/component/Layout.tsx@@ -22,6 +22,7 @@ import { Paywall } from './paywall/Paywall';import { QuickCreateMenu } from './QuickCreateMenu';import { RightbarWrapper } from './rightbar/Rightbar';import { SettingsWrapper } from './settings/SettingsWrapper';+import { ShortcutsHelper } from './settings/ShortcutsHelper';const AUTH_URLS = ['/app/login',@@ -131,6 +132,7 @@ export function Layout(props: RouteSectionProps) {</Suspense><QuickCreateMenu /><GlobalBulkEditEntityModal />+ <ShortcutsHelper /></Show><Showwhen={!isAuthenticated() && !AUTH_URLS.includes(location.pathname)}diff --git a/js/app/packages/app/component/settings/Settings.tsx b/js/app/packages/app/component/settings/Settings.tsxindex 4d41ffb486..508cec99ba 100644--- a/js/app/packages/app/component/settings/Settings.tsx+++ b/js/app/packages/app/component/settings/Settings.tsx@@ -16,6 +16,7 @@ import { Appearance } from './Appearance';import { Tabs } from '@kobalte/core/tabs';import { Account } from './Account';import { Inbox } from './Inbox';+import { Shortcuts } from './Shortcuts';import { isTouchDevice } from '@core/mobile/isTouchDevice';import { isMobileWidth } from '@core/mobile/mobileWidth';@@ -114,7 +115,8 @@ export function SettingsPanel(props: SettingsPanelProps) {const settingsTabs = createMemo(() => {const tabs: {value: string; label: string }[] = [{value: 'Appearance', label: 'Appearance'},- {value: 'Account', label: 'Account'}+ {value: 'Account', label: 'Account'},+ {value: 'Shortcuts', label: 'Shortcuts'}];if(!orgName() && !isNativeMobilePlatform()){tabs.push({value: 'Subscription', label: 'Subscription'})}@@ -141,7 +143,7 @@ export function SettingsPanel(props: SettingsPanelProps) {<Tabsvalue={activeTabId()}onChange={(value: string | undefined) => {- if(value && (value === 'Account' || value === 'Subscription' || value === 'Organization' || value === 'Appearance' || value === 'Mobile' || value === 'AI Memory' || value === 'Inbox')){+ if(value && (value === 'Account' || value === 'Subscription' || value === 'Organization' || value === 'Appearance' || value === 'Mobile' || value === 'AI Memory' || value === 'Inbox' || value === 'Shortcuts')){setActiveTabId(value as SettingsTab);track(TrackingEvents.SETTINGS.CHANGETAB, { tab: value });}@@ -266,6 +268,9 @@ export function SettingsPanel(props: SettingsPanelProps) {<Tabs.Content value="Appearance" class="absolute inset-0"><Appearance /></Tabs.Content>+ <Tabs.Content value="Shortcuts" class="absolute inset-0">+ <Shortcuts />+ </Tabs.Content><Show when={DEV_MODE_ENV}><Tabs.Content value="Inbox" class="absolute inset-0"><Inbox />diff --git a/js/app/packages/app/component/settings/Shortcuts.tsx b/js/app/packages/app/component/settings/Shortcuts.tsxnew file mode 100644index 0000000000..af5a09dbfc--- /dev/null+++ b/js/app/packages/app/component/settings/Shortcuts.tsx@@ -0,0 +1,134 @@+import { IS_MAC } from '@core/constant/isMac';+import { CustomScrollbar } from '@core/component/CustomScrollbar';+import { Hotkey } from '@core/component/Hotkey';+import { createSignal, For } from 'solid-js';++const cmdOrCtrl = IS_MAC ? 'cmd' : 'ctrl';++type ShortcutItem = {+ keys: string[];+ description: string;+};++type ShortcutSection = {+ title: string;+ items: ShortcutItem[];+};++const shortcutSections: ShortcutSection[] = [+ {+ title: 'Core Shortcuts',+ items: [+ { keys: ['c'], description: 'Open the create menu (new email, new doc, etc.)' },+ { keys: [`${cmdOrCtrl}+k`], description: 'Open the command menu' },+ ],+ },+ {+ title: 'Unified List Navigation',+ items: [+ { keys: ['j', 'arrowdown'], description: 'Move down' },+ { keys: ['k', 'arrowup'], description: 'Move up' },+ { keys: ['e'], description: 'Mark done' },+ { keys: ['x'], description: `Select items (then ${IS_MAC ? '⌘' : 'Ctrl'}+K to bring up actions)` },+ { keys: ['shift+j', 'shift+arrowdown'], description: `Select down` },+ { keys: ['shift+k', 'shift+arrowup'], description: `Select up` },+ { keys: ['p'], description: 'Preview an item in the side panel' },+ { keys: ['enter'], description: 'Open an item fullscreen' },+ { keys: [`${cmdOrCtrl}+f`], description: 'Search (uses current filters)' },+ ],+ },+ {+ title: 'Filtering the List',+ items: [+ { keys: ['d'], description: 'Filter to docs' },+ { keys: ['l'], description: 'Filter to email' },+ ],+ },+ {+ title: 'Splits & Navigation',+ items: [+ { keys: ['\\'], description: 'Create a split' },+ { keys: ['escape'], description: 'Return to the list, or close split if already on list' },+ { keys: ['cmd+escape'], description: 'Close the split' },+ { keys: ['arrowleft'], description: 'Focus split to the left' },+ { keys: ['arrowright'], description: 'Focus split to the right' },+ ],+ },+ {+ title: 'Miscellaneous',+ items: [+ { keys: [`${cmdOrCtrl}+j`], description: 'Open popover AI chat' },+ { keys: [`${cmdOrCtrl}+/`], description: 'Open sidebar AI chat' },+ { keys: [`${cmdOrCtrl}+;`], description: 'Open settings panel' },+ { keys: [`opt+[`], description: 'Go back in current split' },+ { keys: [`opt+]`], description: 'Go forward in current split' },+ ],+ },+];++function Kbd(props: { shortcut: string; class?: string }) {+ return (+ <span+ class={`inline-flex items-center font-mono text-xs px-1.5 py-0.5 rounded border border-accent/30 bg-accent/10 text-accent ${props.class ?? ''}`}+ >+ <Hotkey shortcut={props.shortcut} class="flex gap-[2px]" lowercase />+ </span>+ );+}++function ShortcutRow(props: { item: ShortcutItem }) {+ return (+ <div class="flex items-center gap-2 py-1.5 px-3 rounded-md hover:bg-panel-secondary/50 transition-colors">+ <div class="shrink-0 flex items-center gap-1">+ <For each={props.item.keys}>+ {(key) => <Kbd shortcut={key} />}+ </For>+ </div>+ <span class="text-ink-muted text-sm">{props.item.description}</span>+ </div>+ );+}++function ShortcutSectionComponent(props: { section: ShortcutSection }) {+ return (+ <div class="mb-6">+ <h3 class="text-accent font-medium text-sm mb-2 px-3 flex items-center gap-2">+ <span class="w-1.5 h-1.5 rounded-full bg-accent" />+ {props.section.title}+ </h3>+ <div class="flex flex-col">+ <For each={props.section.items}>+ {(item) => <ShortcutRow item={item} />}+ </For>+ </div>+ </div>+ );+}++export function Shortcuts() {+ const [scrollRef, setScrollRef] = createSignal<HTMLDivElement>();++ return (+ <div class="absolute inset-0 bg-panel">+ <div+ ref={setScrollRef}+ class="absolute inset-0 overflow-auto p-6 scrollbar-hidden"+ >+ <div class="max-w-2xl mx-auto">+ <div class="mb-8">+ <h2 class="text-lg font-semibold text-ink mb-2">Keyboard Shortcuts</h2>+ <p class="text-ink-muted text-sm">+ Shortcuts without a {IS_MAC ? 'cmd' : 'ctrl'}/option modifier key require text inputs to be unfocused. For example, pressing <kbd>j</kbd> in a document will insert a j, but will move down the list if the document text is unfocused.+ </p>+ </div>++ <For each={shortcutSections}>+ {(section) => <ShortcutSectionComponent section={section} />}+ </For>+ </div>+ </div>+ <CustomScrollbar scrollContainer={scrollRef} />+ </div>+ );+}+diff --git a/js/app/packages/app/component/settings/ShortcutsHelper.tsx b/js/app/packages/app/component/settings/ShortcutsHelper.tsxnew file mode 100644index 0000000000..f4e7915bc2--- /dev/null+++ b/js/app/packages/app/component/settings/ShortcutsHelper.tsx@@ -0,0 +1,54 @@+import { useSettingsState } from '@core/constant/SettingsState';+import { isTouchDevice } from '@core/mobile/isTouchDevice';+import { isMobileWidth } from '@core/mobile/mobileWidth';+import KeyboardIcon from '@icon/regular/keyboard.svg';+import CloseIcon from '@icon/regular/x.svg';+import { makePersisted } from '@solid-primitives/storage';+import { createSignal, Show } from 'solid-js';++const [showShortcutsHelper, setShowShortcutsHelper] = makePersisted(+ createSignal(true),+ { name: 'show-shortcuts-helper' }+);++export function ShortcutsHelper() {+ const { openSettings } = useSettingsState();++ const handleClick = () => {+ openSettings('Shortcuts');+ };++ const handleDismiss = (e: MouseEvent) => {+ e.stopPropagation();+ setShowShortcutsHelper(false);+ };++ const shouldShow = () =>+ showShortcutsHelper() && !isTouchDevice() && !isMobileWidth();++ return (+ <Show when={shouldShow()}>+ <div class="fixed bottom-4 right-4 z-50 group">+ <button+ type="button"+ onClick={handleClick}+ class="flex items-center gap-1.5 rounded-xs px-3 py-1.5 bg-panel border border-edge-muted ring-accent text-ink text-sm font-medium shadow hover:bg-panel-secondary hover:border-accent/50 transition-colors"+ >+ <KeyboardIcon class="w-4 h-4 text-accent" />+ <span>Shortcuts</span>+ </button>++ {/* Dismiss button */}+ <button+ type="button"+ onClick={handleDismiss}+ class="absolute -top-1.5 -right-1.5 flex items-center justify-center w-4 h-4 bg-edge rounded-full text-ink-muted hover:text-ink transition-colors opacity-0 group-hover:opacity-100"+ aria-label="Dismiss shortcuts helper"+ >+ <CloseIcon class="w-2.5 h-2.5" />+ </button>+ </div>+ </Show>+ );+}+diff --git a/js/app/packages/core/constant/SettingsState.tsx b/js/app/packages/core/constant/SettingsState.tsxindex 75f0b91be7..c487778b99 100644--- a/js/app/packages/core/constant/SettingsState.tsx+++ b/js/app/packages/core/constant/SettingsState.tsx@@ -12,7 +12,8 @@ export type SettingsTab =| 'Appearance'| 'Mobile'| 'AI Memory'- | 'Inbox';+ | 'Inbox'+ | 'Shortcuts';export const settingsOpen = isSettingsPanelOpen;export const setSettingsOpen = setIsSettingsPanelOpen;