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: move to next entity when marked as done (#1557)

Peter Chinman0a2a62d249c5
diff --git a/js/app/packages/app/component/next-soup/actions/make-mark-done-action.ts b/js/app/packages/app/component/next-soup/actions/make-mark-done-action.ts
index a64a9903f0..a458e82f6e 100644
--- a/js/app/packages/app/component/next-soup/actions/make-mark-done-action.ts
+++ b/js/app/packages/app/component/next-soup/actions/make-mark-done-action.ts
@@ -95,7 +95,11 @@ export const makeMarkDoneAction = (options: MakeMarkDoneOptions) => {
);
};
- const executeWithSoup = async (entities: EntityData[], soup: SoupState) => {
+ const executeWithSoup = async (
+ entities: EntityData[],
+ soup: SoupState,
+ onNavigate?: (entity: EntityData) => void
+ ) => {
const currentIndex = soup.focus.index();
const nextEntity =
soup.items.at(currentIndex + 1) ?? soup.items.at(currentIndex - 1);
@@ -111,8 +115,11 @@ export const makeMarkDoneAction = (options: MakeMarkDoneOptions) => {
await execute(entities);
soup.selection.clear();
- if (nextEntity) {
+ const shouldNavigate =
+ soup.filters.isActive('signal') || soup.filters.isActive('noise');
+ if (nextEntity && shouldNavigate) {
soup.focus.set(nextEntity.id);
+ onNavigate?.(nextEntity);
}
};
diff --git a/js/app/packages/app/component/next-soup/actions/use-entity-action-hotkeys.ts b/js/app/packages/app/component/next-soup/actions/use-entity-action-hotkeys.ts
index 7364068978..cd825c569e 100644
--- a/js/app/packages/app/component/next-soup/actions/use-entity-action-hotkeys.ts
+++ b/js/app/packages/app/component/next-soup/actions/use-entity-action-hotkeys.ts
@@ -12,17 +12,20 @@ import {
} from './index';
import { useUserId } from '@core/context/user';
import { registerHotkey } from '@core/hotkey/hotkeys';
+import type { SplitHandle } from '@app/component/split-layout/layoutManager';
+import { openEntityInSplitFromUnifiedList } from '@app/component/next-soup/utils';
type UseEntityActionHotkeysOptions = {
scopeId: string;
soup: SoupState;
+ splitHandle?: SplitHandle;
condition?: () => boolean;
};
export const useEntityActionHotkeys = (
options: UseEntityActionHotkeysOptions
) => {
- const { scopeId, soup, condition } = options;
+ const { scopeId, soup, splitHandle, condition } = options;
const userId = useUserId();
const notificationSource = useGlobalNotificationSource();
@@ -52,6 +55,13 @@ export const useEntityActionHotkeys = (
return focused ? [focused] : [];
};
+ const openNextEntity = (entity: EntityData) => {
+ if (!splitHandle) return;
+ const handleContent = splitHandle.content().type;
+ if (handleContent === 'component' || handleContent === 'project') return;
+ openEntityInSplitFromUnifiedList(entity, { splitHandle });
+ };
+
// Mark Done - 'e'
registerHotkey({
hotkey: ['e'],
@@ -63,7 +73,7 @@ export const useEntityActionHotkeys = (
if (entities.length === 0) return false;
if (!entities.some(markDone.canExecute)) return false;
- markDone.executeWithSoup(entities, soup);
+ markDone.executeWithSoup(entities, soup, openNextEntity);
return true;
},
condition: () => {
diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx
index a9b813609d..3e22122522 100644
--- a/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx
@@ -253,6 +253,7 @@ export const SoupViewList = (props: SoupViewListProps) => {
useEntityActionHotkeys({
scopeId: scopeId(),
soup,
+ splitHandle: panel.handle,
});
// Property editor