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(command): don't show selection mode if not actively viewing list (#1644)

Seamus92e2c6721e5d
diff --git a/js/app/packages/app/component/command/CommandMenu.tsx b/js/app/packages/app/component/command/CommandMenu.tsx
index 0a69801c7e..a0519765a9 100644
--- a/js/app/packages/app/component/command/CommandMenu.tsx
+++ b/js/app/packages/app/component/command/CommandMenu.tsx
@@ -35,6 +35,8 @@ import ArrowLeft from '@icon/regular/arrow-left.svg';
import { debouncedDependent } from '@core/util/debounce';
import { Hotkey } from '@core/component/Hotkey';
import { InlineEntity, type EntityData } from '@entity';
+import { globalSplitManager } from '@app/signal/splitLayout';
+import { createIsActiveSplitContentMemo } from '../split-layout/layoutUtils';
const CATEGORIES: { id: CategoryFilter; label: string }[] = [
{ id: 'all', label: 'All' },
@@ -63,9 +65,20 @@ function getBlockNameForEntity(
export function CommandMenu() {
const [commandMenuRef, setCommandMenuRef] = createSignal<HTMLDivElement>();
+ const splitManager = globalSplitManager();
+ const isListMode = splitManager
+ ? createIsActiveSplitContentMemo(
+ splitManager.activeSplit,
+ 'component',
+ 'unified-list'
+ )
+ : () => true; // assume list mode
createEffect(() => {
const open = CommandState.isOpen();
+ if (!isListMode()) {
+ CommandState.clearEntityActionEntities();
+ }
if (open) {
CommandState.onMenuOpen();
} else {
diff --git a/js/app/packages/app/component/split-layout/layoutManager.ts b/js/app/packages/app/component/split-layout/layoutManager.ts
index d2c550c458..7119798d31 100644
--- a/js/app/packages/app/component/split-layout/layoutManager.ts
+++ b/js/app/packages/app/component/split-layout/layoutManager.ts
@@ -200,6 +200,7 @@ function attachAliasContext(content: SplitContent): SplitContent {
export type SplitManager = {
readonly splits: Accessor<ReadonlyArray<SplitState>>;
readonly activeSplitId: Accessor<SplitId | undefined>;
+ readonly activeSplit: Accessor<SplitHandle | undefined>;
readonly lastActiveSplitId: Accessor<SplitId | undefined>;
readonly events: Accessor<SplitEventWithType>;
readonly resizeContext: Accessor<ResizeZoneCtx | undefined>;
@@ -1040,9 +1041,15 @@ export function createSplitLayout(
}
}
+ const activeSplit = () => {
+ const id = state.activeSplitId;
+ return id ? getSplit(id) : undefined;
+ };
+
return {
splits: () => state.splits,
activeSplitId: () => state.activeSplitId,
+ activeSplit,
lastActiveSplitId: () => state.lastActiveSplitId,
events: lastEvent,
reconcile: reconcileSplits,
diff --git a/js/app/packages/app/component/split-layout/layoutUtils.ts b/js/app/packages/app/component/split-layout/layoutUtils.ts
index 9cb9f1b568..21a4a7ce16 100644
--- a/js/app/packages/app/component/split-layout/layoutUtils.ts
+++ b/js/app/packages/app/component/split-layout/layoutUtils.ts
@@ -149,18 +149,6 @@ export function createIsViewOpenMemo(
return createMemo(() => isViewOpen(manager, viewId));
}
-/**
- * Reactive accessor for the currently active split (via the global split manager).
- */
-export function createActiveSplitMemo(manager?: SplitManager) {
- return createMemo<SplitHandle | undefined>(() => {
- const resolvedManager = manager ?? globalSplitManager();
- if (!resolvedManager) return;
- const activeSplitId = resolvedManager.activeSplitId();
- return activeSplitId ? resolvedManager.getSplit(activeSplitId) : undefined;
- });
-}
-
/**
* Reactive boolean accessor indicating whether the active split is currently
* showing a specific component content id.