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.

Revert "feat: j/k navigation from blocks when coming from inbox or email views" (#3923)

dev-rb5e052d1fa4ae
diff --git a/js/app/packages/app/component/next-soup/actions/use-block-entity-commands.ts b/js/app/packages/app/component/next-soup/actions/use-block-entity-commands.ts
index 472a62501c..94d8f0cce4 100644
--- a/js/app/packages/app/component/next-soup/actions/use-block-entity-commands.ts
+++ b/js/app/packages/app/component/next-soup/actions/use-block-entity-commands.ts
@@ -1,9 +1,6 @@
import { useGlobalNotificationSource } from '@app/component/GlobalAppState';
-import { useMaybeSoup } from '@app/component/next-soup/soup-context';
-import { openEntityInSplitFromUnifiedList } from '@app/component/next-soup/utils';
import { useAllProperties } from '@app/component/property-edit-modal/hooks/useAllProperties';
import { openPropertyEditor } from '@app/component/property-edit-modal/state/propertyEditor';
-import { useSplitPanel } from '@app/component/split-layout/layoutUtils';
import { useBlockId } from '@core/block';
import { useQuickAccess } from '@core/context/quickAccess';
import { useUserId } from '@core/context/user';
@@ -37,8 +34,6 @@ export const useBlockEntityCommands = () => {
const quickAccess = useQuickAccess();
const userId = useUserId();
const notificationSource = useGlobalNotificationSource();
- const soup = useMaybeSoup();
- const splitPanel = useSplitPanel();
const markDone = makeMarkDoneAction({
userId: () => userId(),
@@ -85,35 +80,13 @@ export const useBlockEntityCommands = () => {
const group = createHotkeyGroup();
registerHotkey({
- hotkey: ['e'],
- hotkeyToken: TOKENS.entity.action.markDone,
scopeId,
description: 'Mark done',
keyDownHandler: () => {
const entity = getEntity();
if (!entity) return false;
if (!markDone.canExecute(entity)) return false;
-
- const selectedRow = soup?.items.get(entity.id);
- console.log(splitPanel?.handle.referredFrom());
- if (soup && selectedRow) {
- markDone.executeWithSoup(
- [selectedRow.original],
- soup,
- (nextEntity) => {
- const splitHandle = splitPanel?.handle;
- if (!splitHandle) return;
- void openEntityInSplitFromUnifiedList(nextEntity, {
- splitHandle,
- mergeHistory: true,
- referredFrom: splitHandle.referredFrom(),
- });
- }
- );
- } else {
- markDone.execute([entity]);
- }
-
+ markDone.execute([entity]);
return true;
},
condition: () => {
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 52b8c42643..2a0e80aa1f 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
@@ -151,7 +151,7 @@ export const useEntityActionHotkeys = (
},
displayPriority: 10,
tags: [HotkeyTags.SelectionModification],
- }).withGroup(group);
+ });
// Delete - 'delete', 'backspace'
registerHotkey({
diff --git a/js/app/packages/app/component/next-soup/soup-view/create-search-state.ts b/js/app/packages/app/component/next-soup/soup-view/create-search-state.ts
index a4c42b940f..cd153046b3 100644
--- a/js/app/packages/app/component/next-soup/soup-view/create-search-state.ts
+++ b/js/app/packages/app/component/next-soup/soup-view/create-search-state.ts
@@ -137,7 +137,7 @@ interface CreateSearchStateArgs {
soup: SoupState;
filters: Accessor<QueryState>;
assignees: Accessor<string[]>;
- disableLocalSearch?: Accessor<boolean>;
+ disableLocalSearch?: boolean;
searchPaused?: Accessor<boolean>;
/**
* Reactive search text. Owned by the caller so it can be wired to
@@ -248,7 +248,7 @@ export const createSearchState = ({
const localFuzzyResults = createMemo(
on(debouncedSearchForLocal, (query) => {
- if (disableLocalSearch?.()) return [];
+ if (disableLocalSearch) return [];
if (!query || query.length === 0) return [];
const pool = entityPool();
// TODO: we can optimize fresh search for small feature counts since we
diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsx
index 67d980ba76..eef83e3dd8 100644
--- a/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsx
@@ -57,7 +57,6 @@ import type { SoupPage } from '@service-storage/generated/schemas';
import type { InfiniteData } from '@tanstack/solid-query';
import {
type Accessor,
- batch,
createContext,
createEffect,
createMemo,
@@ -87,16 +86,8 @@ type DataSource<T> = {
fetchNextPage: VoidFunction;
};
-type SoupViewInitializeOptions = {
- initialQuery?: Query;
- initialSearchText?: string;
- disableLocalSearch?: boolean;
- additionalEntities?: Accessor<EntityData[]>;
-};
-
interface SoupViewContextValues {
soup: SoupState;
- initialize: (options?: SoupViewInitializeOptions, force?: boolean) => void;
source: DataSource<EntityData>;
searchText: Accessor<string>;
setSearchText: (value: string) => void;
@@ -133,9 +124,16 @@ export const useSoupView = () => {
export const useMaybeSoupView = () => useContext(SoupViewContext);
-interface SoupViewContextProviderProps extends SoupViewInitializeOptions {
+interface SoupViewContextProviderProps {
soup?: SoupState;
- initialEnabled?: boolean;
+ initialQuery?: Query;
+ initialSearchText?: string;
+ disableLocalSearch?: boolean;
+ /**
+ * Additional client-side entities to merge into the soup item stream.
+ * Visibility is still controlled by the active client filters.
+ */
+ additionalEntities?: Accessor<EntityData[]>;
}
type ApiSortMethod = NonNullable<SoupParams['sort_method']>;
@@ -150,13 +148,6 @@ export const SoupViewContextProvider: FlowComponent<
SoupViewContextProviderProps
> = (props) => {
const soup = props.soup ?? createSoupState();
- const [enabled, setEnabled] = createSignal(props.initialEnabled ?? false);
- const [config, setConfig] = createSignal<SoupViewInitializeOptions>({
- initialQuery: props.initialQuery,
- initialSearchText: props.initialSearchText,
- disableLocalSearch: props.disableLocalSearch,
- additionalEntities: props.additionalEntities,
- });
const queryClient = useQueryClient();
@@ -247,7 +238,6 @@ export const SoupViewContextProvider: FlowComponent<
};
const [searchPaused, setSearchPaused] = createSignal(false);
- const sourceSearchPaused = createMemo(() => searchPaused() || !enabled());
const [assigneeFilter, setAssigneeFilter] = useEntryState<string[]>(
'soup.assigneeFilter',
{ default: [] }
@@ -307,28 +297,12 @@ export const SoupViewContextProvider: FlowComponent<
soup,
filters: () => applyInboxFilter(queryFilters.state),
assignees: assigneeFilter,
- disableLocalSearch: () => config().disableLocalSearch ?? false,
- searchPaused: sourceSearchPaused,
+ disableLocalSearch: props.disableLocalSearch,
+ searchPaused,
searchText,
setSearchText,
});
- const initialize = (
- options: SoupViewInitializeOptions = {},
- force = false
- ) => {
- batch(() => {
- setConfig(options);
- if ((!persistedFilters && options.initialQuery) || force) {
- queryFilters.replace(options.initialQuery ?? null);
- }
- if ((options.initialSearchText !== undefined && !searchText()) || force) {
- setSearchText(options.initialSearchText ?? '');
- }
- setEnabled(true);
- });
- };
-
const notificationSource = useGlobalNotificationSource();
const userId = useUserId();
const showSupportedForeignEntitiesFF = useFeatureFlag(
@@ -362,7 +336,7 @@ export const SoupViewContextProvider: FlowComponent<
groupBy: groupByField(),
}),
() => ({
- enabled: enabled() && !search.isSearching(),
+ enabled: !search.isSearching(),
showSupportedForeignEntities: showSupportedForeignEntitiesFF().enabled,
})
);
@@ -380,7 +354,7 @@ export const SoupViewContextProvider: FlowComponent<
isWithNotification(e) ? e : attachNotifications(e)
) as SoupEntity[];
- const extras = config().additionalEntities?.() ?? [];
+ const extras = props.additionalEntities?.() ?? [];
if (extras.length === 0) return base;
@@ -476,7 +450,7 @@ export const SoupViewContextProvider: FlowComponent<
const items = itemsQuery.data?.items;
const dataVersion = itemsQuery.dataUpdatedAt;
- if (!enabled() || !field || !groups || !items) {
+ if (!field || !groups || !items) {
return [];
}
@@ -538,7 +512,7 @@ export const SoupViewContextProvider: FlowComponent<
}
).map((e) => attachNotifications(e)) as SoupEntity[];
},
- enabled: enabled(),
+ enabled: true,
staleTime: Infinity,
};
});
@@ -648,7 +622,6 @@ export const SoupViewContextProvider: FlowComponent<
const context = {
soup,
- initialize,
source: {
data: entities,
isLoading: () => itemsQuery.isLoading,
@@ -658,16 +631,12 @@ export const SoupViewContextProvider: FlowComponent<
isFetchingNextPage: () =>
itemsQuery.isFetchingNextPage || searchQuery.isFetchingNextPage,
hasNextPage: () => {
- if (!enabled()) return false;
-
return (
(itemsQuery.isEnabled && itemsQuery.hasNextPage) ||
(searchQuery.isEnabled && searchQuery.hasNextPage)
);
},
fetchNextPage: () => {
- if (!enabled()) return;
-
if (itemsQuery.isEnabled) {
itemsQuery.fetchNextPage();
}
@@ -680,7 +649,7 @@ export const SoupViewContextProvider: FlowComponent<
rows,
searchText: search.searchText,
setSearchText: search.setSearchText,
- searchPaused: sourceSearchPaused,
+ searchPaused,
setSearchPaused,
featuredIds: search.featuredIds,
isSearchServiceLoading: search.isSearchServiceLoading,
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 421cd7833b..38b6527d19 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
@@ -29,7 +29,10 @@ import {
soupNavigationTouchHighlight,
} from '@app/component/next-soup/soup-view/soup-navigation-touch-highlight';
import { activeSoupViewCounts } from '@app/component/next-soup/soup-view/soup-view-cache-key';
-import { useSoupView } from '@app/component/next-soup/soup-view/soup-view-context';
+import {
+ SoupViewContextProvider,
+ useSoupView,
+} from '@app/component/next-soup/soup-view/soup-view-context';
import { SoupViewCreateButton } from '@app/component/next-soup/soup-view/soup-view-create-button';
import { SoupViewFileDropzone } from '@app/component/next-soup/soup-view/soup-view-file-dropzone';
import { SoupViewMobileCreateButton } from '@app/component/next-soup/soup-view/soup-view-mobile-create-button';
@@ -340,19 +343,6 @@ interface SoupViewProps {
export const SoupView = (props: SoupViewProps) => {
const soup = useSoup();
const panel = useSplitPanelOrThrow();
- const soupView = useSoupView();
-
- onMount(() => {
- soupView.initialize(
- {
- initialQuery: props.initialFilters,
- initialSearchText: props.initialSearchText,
- disableLocalSearch: props.disableLocalSearch,
- additionalEntities: props.additionalEntities,
- },
- true
- );
- });
createEffect(() => {
panel.handle.setDisplayName(props.viewName);
@@ -438,149 +428,161 @@ export const SoupView = (props: SoupViewProps) => {
: undefined,
}}
>
- <div class="size-full flex flex-col" data-list-view={activeListView()}>
- <div class="flex flex-col w-full">
- <SplitHeaderLeft>
- <div
- class={cn('h-full flex gap-3 items-center', {
- 'shrink-0': !narrowSearchExpanded(),
- 'flex-1 min-w-0': narrowSearchExpanded(),
- })}
- >
- <Show when={!isMobile() && !narrowSearchExpanded()}>
- <span class="text-base font-bold">{props.viewName}</span>
- </Show>
- <Show
- when={!narrowSearchExpanded() && !isComponentListView('search')}
+ <SoupViewContextProvider
+ soup={soup}
+ initialQuery={props.initialFilters}
+ initialSearchText={props.initialSearchText}
+ disableLocalSearch={props.disableLocalSearch}
+ additionalEntities={props.additionalEntities}
+ >
+ <div class="size-full flex flex-col" data-list-view={activeListView()}>
+ <div class="flex flex-col w-full">
+ <SplitHeaderLeft>
+ <div
+ class={cn('h-full flex gap-3 items-center', {
+ 'shrink-0': !narrowSearchExpanded(),
+ 'flex-1 min-w-0': narrowSearchExpanded(),
+ })}
>
- <Show when={!isMobile()}>
- <CollapsibleHeaderItem
- id="tabs"
- priority={1}
- expanded={() => <SoupViewTabs />}
- collapsed={() => <CollapsedSoupViewTabs />}
- containerClass="h-full"
- />
+ <Show when={!isMobile() && !narrowSearchExpanded()}>
+ <span class="text-base font-bold">{props.viewName}</span>
</Show>
- </Show>
- <Show
- when={
- !isMobile() &&
- !narrowSearchExpanded() &&
- isComponentListView('mail')
- }
- >
- <InboxSelector />
- </Show>
- </div>
- </SplitHeaderLeft>
- <Show when={!isMobile()}>
- <SplitHeaderRight>
- <Show
- when={!narrowSearchExpanded() && !isComponentListView('search')}
- >
- <SoupViewCreateButton />
- </Show>
- <Show when={narrowSearchExpanded()}>
- <Layer depth={2}>
- <div class="flex-1 min-w-0">
- <SoupSearchbar
- variant="secondary"
- autoFocus
- initialValue={props.initialSearchText}
- onDismiss={() => setNarrowSearchExpanded(false)}
+ <Show
+ when={
+ !narrowSearchExpanded() && !isComponentListView('search')
+ }
+ >
+ <Show when={!isMobile()}>
+ <CollapsibleHeaderItem
+ id="tabs"
+ priority={1}
+ expanded={() => <SoupViewTabs />}
+ collapsed={() => <CollapsedSoupViewTabs />}
+ containerClass="h-full"
/>
- </div>
- </Layer>
- </Show>
- <Show
- when={!isComponentListView('search')}
- fallback={
+ </Show>
+ </Show>
+ <Show
+ when={
+ !isMobile() &&
+ !narrowSearchExpanded() &&
+ isComponentListView('mail')
+ }
+ >
+ <InboxSelector />
+ </Show>
+ </div>
+ </SplitHeaderLeft>
+ <Show when={!isMobile()}>
+ <SplitHeaderRight>
+ <Show
+ when={
+ !narrowSearchExpanded() && !isComponentListView('search')
+ }
+ >
+ <SoupViewCreateButton />
+ </Show>
+ <Show when={narrowSearchExpanded()}>
<Layer depth={2}>
- <div class="grow ml-2">
+ <div class="flex-1 min-w-0">
<SoupSearchbar
variant="secondary"
- placeholder="Search, @mention contacts"
+ autoFocus
initialValue={props.initialSearchText}
+ onDismiss={() => setNarrowSearchExpanded(false)}
/>
</div>
</Layer>
- }
- >
- <CollapsibleHeaderItem
- id="search"
- priority={0}
- onCollapsedChange={(isCollapsed) => {
- setSearchIsCollapsed(isCollapsed);
- if (!isCollapsed) setNarrowSearchExpanded(false);
- }}
- expanded={() => (
+ </Show>
+ <Show
+ when={!isComponentListView('search')}
+ fallback={
<Layer depth={2}>
- <div class="w-60 ml-2">
+ <div class="grow ml-2">
<SoupSearchbar
variant="secondary"
+ placeholder="Search, @mention contacts"
initialValue={props.initialSearchText}
/>
</div>
</Layer>
- )}
- collapsed={() => (
- <Show when={!narrowSearchExpanded()}>
- <Tooltip label="Search" hotkey={TOKENS.soup.openSearch}>
- <Button
- variant="base"
- class="p-1 size-7 rounded-lg ml-2 bg-surface"
- onClick={() => setNarrowSearchExpanded(true)}
- depth={2}
- >
- <SearchIcon class="size-4 touch:size-6" />
- </Button>
- </Tooltip>
- </Show>
- )}
+ }
+ >
+ <CollapsibleHeaderItem
+ id="search"
+ priority={0}
+ onCollapsedChange={(isCollapsed) => {
+ setSearchIsCollapsed(isCollapsed);
+ if (!isCollapsed) setNarrowSearchExpanded(false);
+ }}
+ expanded={() => (
+ <Layer depth={2}>
+ <div class="w-60 ml-2">
+ <SoupSearchbar
+ variant="secondary"
+ initialValue={props.initialSearchText}
+ />
+ </div>
+ </Layer>
+ )}
+ collapsed={() => (
+ <Show when={!narrowSearchExpanded()}>
+ <Tooltip label="Search" hotkey={TOKENS.soup.openSearch}>
+ <Button
+ variant="base"
+ class="p-1 size-7 rounded-lg ml-2 bg-surface"
+ onClick={() => setNarrowSearchExpanded(true)}
+ depth={2}
+ >
+ <SearchIcon class="size-4 touch:size-6" />
+ </Button>
+ </Tooltip>
+ </Show>
+ )}
+ />
+ </Show>
+ </SplitHeaderRight>
+ </Show>
+ <SoupFiltersBar />
+ </div>
+ <div class="relative grow min-h-1 flex max-sm:flex-col flex-row size-full">
+ <Suspense>
+ <SoupViewFileDropzone>
+ <SoupViewList
+ initialClientFilters={props.initialClientFilters}
+ initialGroupBy={props.initialGroupBy}
+ onScrollOffsetBaseline={resetFloatingButtonScrollTracking}
+ onScrollOffsetChange={handleSoupScrollOffsetChange}
/>
- </Show>
- </SplitHeaderRight>
- </Show>
- <SoupFiltersBar />
- </div>
- <div class="relative grow min-h-1 flex max-sm:flex-col flex-row size-full">
- <Suspense>
- <SoupViewFileDropzone>
- <SoupViewList
- initialClientFilters={props.initialClientFilters}
- initialGroupBy={props.initialGroupBy}
- onScrollOffsetBaseline={resetFloatingButtonScrollTracking}
- onScrollOffsetChange={handleSoupScrollOffsetChange}
+ </SoupViewFileDropzone>
+ </Suspense>
+ <Show when={isMobile()}>
+ <SoupViewMobileSettingsButton visible={floatingButtonsVisible} />
+ <SoupViewMobileSearchButton
+ open={mobileSearchOpen}
+ visible={floatingButtonsVisible}
+ onOpen={() => setMobileSearchOpen(true)}
+ />
+ <SoupViewMobileCreateButton
+ activeView={activeListView}
+ visible={floatingButtonsVisible}
+ />
+ <SoupViewMobileSearchBar
+ open={mobileSearchOpen}
+ onClose={() => setMobileSearchOpen(false)}
/>
- </SoupViewFileDropzone>
- </Suspense>
+ </Show>
+ </div>
<Show when={isMobile()}>
- <SoupViewMobileSettingsButton visible={floatingButtonsVisible} />
- <SoupViewMobileSearchButton
- open={mobileSearchOpen}
- visible={floatingButtonsVisible}
- onOpen={() => setMobileSearchOpen(true)}
- />
- <SoupViewMobileCreateButton
- activeView={activeListView}
- visible={floatingButtonsVisible}
- />
- <SoupViewMobileSearchBar
- open={mobileSearchOpen}
- onClose={() => setMobileSearchOpen(false)}
- />
+ <MobileSoupViewTabs />
</Show>
</div>
- <Show when={isMobile()}>
- <MobileSoupViewTabs />
- </Show>
- </div>
- <Suspense>
- <Show when={ENABLE_UNIFIED_LIST_AI_INPUT && !isMobile()}>
- <SoupChatInput />
- </Show>
- </Suspense>
+ <Suspense>
+ <Show when={ENABLE_UNIFIED_LIST_AI_INPUT && !isMobile()}>
+ <SoupChatInput />
+ </Show>
+ </Suspense>
+ </SoupViewContextProvider>
</SplitPanelContext.Provider>
);
};
@@ -687,17 +689,14 @@ export const SoupViewList = (props: SoupViewListProps) => {
});
// Register navigation hotkeys on the active list scope (usually the split
- // scope). Most handlers are disposed with SoupViewList, but j/k intentionally
- // remain on the split scope so an entity opened from the list can continue to
- // drive list navigation and update the split content.
+ // scope), but dispose them with the mounted SoupViewList. This keeps j/k
+ // available while the list split is active without leaking into opened blocks
+ // after the list unmounts.
useSoupNavigationHotkeys({
scopeId: scopeId(),
soup,
splitHandle: panel.handle,
virtualizerHandle,
- hasNextPage: source.hasNextPage,
- isFetchingNextPage: source.isFetchingNextPage,
- fetchNextPage: source.fetchNextPage,
});
// Register entity action hotkeys
@@ -785,7 +784,6 @@ export const SoupViewList = (props: SoupViewListProps) => {
openInNewSplit: event.shiftKey,
location,
splitHandle: panel.handle,
- referredFrom: currentView(),
});
} finally {
finishTouchHighlight?.();
diff --git a/js/app/packages/app/component/next-soup/soup-view/use-soup-navigation-hotkeys.ts b/js/app/packages/app/component/next-soup/soup-view/use-soup-navigation-hotkeys.ts
index 1c7bdadae3..9ff08ecb87 100644
--- a/js/app/packages/app/component/next-soup/soup-view/use-soup-navigation-hotkeys.ts
+++ b/js/app/packages/app/component/next-soup/soup-view/use-soup-navigation-hotkeys.ts
@@ -1,11 +1,10 @@
import { openEntityInSplitFromUnifiedList } from '@app/component/next-soup/utils';
import type { SplitHandle } from '@app/component/split-layout/layoutManager';
-import { isListViewID } from '@app/constants/list-views';
import { entityIdSelector } from '@core/dom-selectors';
import { createHotkeyGroup, registerHotkey } from '@core/hotkey/hotkeys';
import { TOKENS } from '@core/hotkey/tokens';
import type { EntityData } from '@entity';
-import { type Accessor, createMemo, onCleanup } from 'solid-js';
+import { type Accessor, onCleanup } from 'solid-js';
import type { VirtualizerHandle } from 'virtua/solid';
import type { SoupState } from '../create-soup-state';
@@ -14,9 +13,6 @@ type UseSoupNavigationHotkeysOptions = {
soup: SoupState;
splitHandle: SplitHandle;
virtualizerHandle: Accessor<VirtualizerHandle | undefined>;
- hasNextPage?: Accessor<boolean>;
- isFetchingNextPage?: Accessor<boolean>;
- fetchNextPage?: () => void;
};
export const useSoupNavigationHotkeys = (
@@ -34,17 +30,6 @@ export const useSoupNavigationHotkeys = (
});
};
- const navigationReferredFrom = createMemo(() => {
- const content = splitHandle.content();
-
- if (content.type === 'component' && isListViewID(content.id)) {
- return content.id;
- }
-
- const referredFrom = splitHandle.referredFrom();
- return isListViewID(referredFrom) ? referredFrom : undefined;
- });
-
const openEntity = (entity: EntityData) => {
const handleContent = splitHandle.content().type;
@@ -53,7 +38,6 @@ export const useSoupNavigationHotkeys = (
openEntityInSplitFromUnifiedList(entity, {
splitHandle,
mergeHistory: true,
- referredFrom: navigationReferredFrom(),
});
};
@@ -111,31 +95,14 @@ export const useSoupNavigationHotkeys = (
const group = createHotkeyGroup();
- const { fetchNextPage, isFetchingNextPage, hasNextPage } = options;
-
- const LOAD_MORE_DISTANCE_FROM_END = 3;
-
- const fetchNextPageIfNeeded = () => {
- if (!hasNextPage?.() || isFetchingNextPage?.()) return;
- fetchNextPage?.();
- };
-
const navigateDown = () => {
- const rowCount = soup.rows().length;
const next = soup.navigate.down();
- if (!next) {
- fetchNextPageIfNeeded();
- return true;
- }
+ if (!next) return true;
scrollTo(next.index);
openEntity(next.row.original);
- if (next.index >= rowCount - 1 - LOAD_MORE_DISTANCE_FROM_END) {
- fetchNextPageIfNeeded();
- }
-
return true;
};
@@ -150,29 +117,14 @@ export const useSoupNavigationHotkeys = (
return true;
};
- const canRunListNavigation = () => {
- const contentType = splitHandle.content().type;
- const referredFrom = navigationReferredFrom();
- return (
- contentType === 'component' ||
- contentType === 'project' ||
- referredFrom === 'inbox' ||
- referredFrom === 'mail'
- );
- };
-
- // Keep j/k registered on the split scope after the list unmounts. When an
- // entity is opened from a list into the same split, this lets j/k continue
- // navigating the originating soup list and update the split content.
registerHotkey({
hotkey: ['j'],
scopeId,
description: 'Down',
hotkeyToken: TOKENS.entity.step.end,
- condition: canRunListNavigation,
keyDownHandler: navigateDown,
hide: true,
- });
+ }).withGroup(group);
registerHotkey({
hotkey: ['arrowdown'],
@@ -182,18 +134,14 @@ export const useSoupNavigationHotkeys = (
hide: true,
}).withGroup(group);
- // Keep j/k registered on the split scope after the list unmounts. When an
- // entity is opened from a list into the same split, this lets j/k continue
- // navigating the originating soup list and update the split content.
registerHotkey({
hotkey: ['k'],
scopeId,
hotkeyToken: TOKENS.entity.step.start,
description: 'Up',
- condition: canRunListNavigation,
keyDownHandler: navigateUp,
hide: true,
- });
+ }).withGroup(group);
registerHotkey({
hotkey: ['arrowup'],
diff --git a/js/app/packages/app/component/next-soup/soup-view/use-soup-view-hotkeys.ts b/js/app/packages/app/component/next-soup/soup-view/use-soup-view-hotkeys.ts
index c3997af759..2d866f34f1 100644
--- a/js/app/packages/app/component/next-soup/soup-view/use-soup-view-hotkeys.ts
+++ b/js/app/packages/app/component/next-soup/soup-view/use-soup-view-hotkeys.ts
@@ -179,7 +179,6 @@ export const useSoupViewHotkeys = (options: UseSoupViewHotkeysOptions) => {
openEntityInSplitFromUnifiedList(entity, {
splitHandle,
location,
- referredFrom: currentView(),
});
return true;
},
@@ -233,7 +232,6 @@ export const useSoupViewHotkeys = (options: UseSoupViewHotkeysOptions) => {
openEntityInSplitFromUnifiedList(entity, {
splitHandle,
- referredFrom: currentView(),
});
return true;
},
@@ -343,7 +341,6 @@ export const useSoupViewHotkeys = (options: UseSoupViewHotkeysOptions) => {
openEntityInSplitFromUnifiedList(entity, {
splitHandle,
openInNewSplit: true,
- referredFrom: currentView(),
});
return true;
},
diff --git a/js/app/packages/app/component/next-soup/utils.ts b/js/app/packages/app/component/next-soup/utils.ts
index 8bdd88b79c..002af2f39c 100644
--- a/js/app/packages/app/component/next-soup/utils.ts
+++ b/js/app/packages/app/component/next-soup/utils.ts
@@ -1,8 +1,4 @@
-import type {
- ReferredFrom,
- SplitHandle,
-} from '@app/component/split-layout/layoutManager';
-import { isListViewID } from '@app/constants/list-views';
+import type { SplitHandle } from '@app/component/split-layout/layoutManager';
import { globalSplitManager } from '@app/signal/splitLayout';
import { URL_PARAMS as CALL_PARAMS } from '@block-call/constants';
import { URL_PARAMS as CHANNEL_PARAMS } from '@block-channel/constants';
@@ -312,7 +308,6 @@ interface OpenEntityOptions {
splitHandle?: SplitHandle;
mergeHistory?: boolean;
allowDuplicate?: boolean;
- referredFrom?: ReferredFrom;
}
/**
@@ -360,19 +355,10 @@ export const openEntityInSplitFromUnifiedList = async (
params = { [CALL_PARAMS.transcriptId]: location.transcriptId };
}
- const sourceContent =
- splitHandle?.content() ?? splitManager.activeSplit()?.content();
-
- const sourceListView =
- sourceContent?.type === 'component' && isListViewID(sourceContent.id)
- ? sourceContent.id
- : undefined;
- const referredFrom = options.referredFrom ?? sourceListView;
-
splitManager.openWithSplit(
{ ...content, params },
{
- referredFrom,
+ referredFrom: 'list-view',
activate: true,
preferNewSplit: openInNewSplit,
handle: splitHandle,
diff --git a/js/app/packages/app/component/split-layout/components/SplitHeader.tsx b/js/app/packages/app/component/split-layout/components/SplitHeader.tsx
index 5475795a11..4f66c6e710 100644
--- a/js/app/packages/app/component/split-layout/components/SplitHeader.tsx
+++ b/js/app/packages/app/component/split-layout/components/SplitHeader.tsx
@@ -1,4 +1,3 @@
-import { useSoup } from '@app/component/next-soup/soup-context';
import { openEntityInSplitFromUnifiedList } from '@app/component/next-soup/utils';
import { isListViewID } from '@app/constants/list-views';
import type { BlockName } from '@core/block';
@@ -8,10 +7,8 @@ import { isMobile } from '@core/mobile/isMobile';
import type { EntityDragEvent } from '@entity';
import CollapseIcon from '@phosphor/arrows-in.svg';
import ExpandIcon from '@phosphor/arrows-out.svg';
-import CaretDown from '@phosphor/caret-down.svg';
import CaretLeft from '@phosphor/caret-left.svg';
import CaretRight from '@phosphor/caret-right.svg';
-import CaretUp from '@phosphor/caret-up.svg';
import CloseIcon from '@phosphor/x.svg';
import { mergeRefs } from '@solid-primitives/refs';
import { createDroppable, useDragDropContext } from '@thisbeyond/solid-dnd';
@@ -140,76 +137,6 @@ function SplitCloseButton() {
);
}
-function SoupNavigationButtons() {
- const context = useContext(SplitPanelContext);
- const soup = useSoup();
- if (!context) return null;
-
- const rows = createMemo(() => soup.rows());
- const currentIndex = () => soup.focus.index();
-
- const navigationReferredFrom = createMemo(() => {
- const referredFrom = context.handle.referredFrom();
- if (referredFrom !== 'inbox' && referredFrom !== 'mail') {
- return;
- }
-
- return referredFrom;
- });
-
- const shouldShow = createMemo(() => {
- const referredFrom = navigationReferredFrom();
- const isNavigableListView =
- referredFrom === 'inbox' || referredFrom === 'mail';
-
- return isNavigableListView && rows().length > 0;
- });
-
- const canNavigateUp = createMemo(() => {
- return rows().length > 0 && currentIndex() !== 0;
- });
-
- const canNavigateDown = createMemo(() => {
- return rows().length > 0 && currentIndex() !== rows().length - 1;
- });
-
- const navigate = (offset: number) => {
- const next = soup.navigate.by(offset);
- if (!next) return;
-
- void openEntityInSplitFromUnifiedList(next.row.original, {
- splitHandle: context.handle,
- mergeHistory: true,
- referredFrom: navigationReferredFrom(),
- });
- };
-
- return (
- <Show when={shouldShow()}>
- <div class="flex items-center gap-0.5 pl-1">
- <Button
- class="p-1 rounded-lg"
- label="Previous item"
- hotkey={TOKENS.entity.step.start}
- disabled={!canNavigateUp()}
- onClick={() => navigate(-1)}
- >
- <CaretUp class="size-4" />
- </Button>
- <Button
- class="p-1 rounded-lg"
- label="Next item"
- hotkey={TOKENS.entity.step.end}
- disabled={!canNavigateDown()}
- onClick={() => navigate(1)}
- >
- <CaretDown class="size-4" />
- </Button>
- </div>
- </Show>
- );
-}
-
export function SplitHeader(props: { ref: Setter<HTMLDivElement | null> }) {
const panel = useContext(SplitPanelContext);
if (!panel) {
@@ -306,15 +233,12 @@ export function SplitHeader(props: { ref: Setter<HTMLDivElement | null> }) {
</div>
</Show>*/}
- <div class="min-w-4 h-full grow shrink flex items-center justify-end gap-0.5 px-2">
- <div
- class="contents"
- ref={(ref) => {
- panel.layoutRefs.headerRight = ref;
- }}
- />
- <SoupNavigationButtons />
- </div>
+ <div
+ class="min-w-4 h-full grow shrink flex items-center justify-end gap-0.5 px-2"
+ ref={(ref) => {
+ panel.layoutRefs.headerRight = ref;
+ }}
+ />
</div>
</div>
);
diff --git a/js/app/packages/app/component/split-layout/components/SplitPanel.tsx b/js/app/packages/app/component/split-layout/components/SplitPanel.tsx
index d5ce6cdcde..ae4066dc02 100644
--- a/js/app/packages/app/component/split-layout/components/SplitPanel.tsx
+++ b/js/app/packages/app/component/split-layout/components/SplitPanel.tsx
@@ -1,6 +1,5 @@
import { createSoupState } from '@app/component/next-soup/create-soup-state';
import { SoupContextProvider } from '@app/component/next-soup/soup-context';
-import { SoupViewContextProvider } from '@app/component/next-soup/soup-view/soup-view-context';
import { isListViewID, LIST_VIEW_ID } from '@app/constants/list-views';
import { globalSplitManager } from '@app/signal/splitLayout';
import { splitContainerAttribute } from '@core/dom-selectors';
@@ -143,75 +142,73 @@ export function SplitPanel(props: SplitPanelProps) {
panelRef,
}}
>
- <SoupViewContextProvider soup={nextSoup}>
- <SplitDrawerGroup contentOffsetTop={offsetTop} panelSize={panelSize}>
- <Show when={props.handle.isSpotLight()}>
- <div
- class="fixed inset-0 w-screen h-screen z-modal-overlay bg-modal-overlay pattern-diagonal-4 pattern-edge-muted"
- onClick={() => props.handle.toggleSpotlight(false)}
- />
- <div class="fixed inset-16 bg-surface shadow-xl" />
- </Show>
-
+ <SplitDrawerGroup contentOffsetTop={offsetTop} panelSize={panelSize}>
+ <Show when={props.handle.isSpotLight()}>
<div
- class="relative"
- classList={{
- 'fixed inset-16 z-modal-overlay isolate opacity-50':
- props.handle.isSpotLight(),
- 'opacity-100': props.active || props.handle.isSpotLight(),
- 'size-full': !props.handle.isSpotLight(),
- }}
- ref={(ref) => {
- setPanelRef(ref);
- props.setPanelRef(ref);
- attachHotKeys(ref);
- }}
- data-split-id={props.split.id}
- {...splitContainerAttribute}
- data-modal={props.handle.isSpotLight()}
- tabindex={-1}
+ class="fixed inset-0 w-screen h-screen z-modal-overlay bg-modal-overlay pattern-diagonal-4 pattern-edge-muted"
+ onClick={() => props.handle.toggleSpotlight(false)}
+ />
+ <div class="fixed inset-16 bg-surface shadow-xl" />
+ </Show>
+
+ <div
+ class="relative"
+ classList={{
+ 'fixed inset-16 z-modal-overlay isolate opacity-50':
+ props.handle.isSpotLight(),
+ 'opacity-100': props.active || props.handle.isSpotLight(),
+ 'size-full': !props.handle.isSpotLight(),
+ }}
+ ref={(ref) => {
+ setPanelRef(ref);
+ props.setPanelRef(ref);
+ attachHotKeys(ref);
+ }}
+ data-split-id={props.split.id}
+ {...splitContainerAttribute}
+ data-modal={props.handle.isSpotLight()}
+ tabindex={-1}
+ >
+ <Panel
+ active={
+ !isMobile() &&
+ props.active &&
+ multipleSplits() &&
+ !props.handle.isSpotLight()
+ }
+ class="rounded-xl mobile:rounded-none mobile:after:hidden mobile:!border-0"
+ depth={1}
>
- <Panel
- active={
- !isMobile() &&
- props.active &&
- multipleSplits() &&
- !props.handle.isSpotLight()
- }
- class="rounded-xl mobile:rounded-none mobile:after:hidden mobile:!border-0"
- depth={1}
+ <Panel.Header
+ class={cn(
+ 'block min-h-10.25 touch:min-h-11.25 p-0 overflow-visible',
+ shouldHideSplitHeader() && 'hidden'
+ )}
+ >
+ <SplitHeader ref={setHeaderRef} />
+ </Panel.Header>
+
+ <Panel.Toolbar
+ class={cn(
+ 'items-start py-2 overflow-visible',
+ !hasToolbarContent() && 'hidden',
+ !previewState() &&
+ 'border-b-0' /* scuffed: this is shit, but we are blinded by linear */
+ )}
>
- <Panel.Header
- class={cn(
- 'block min-h-10.25 touch:min-h-11.25 p-0 overflow-visible',
- shouldHideSplitHeader() && 'hidden'
- )}
- >
- <SplitHeader ref={setHeaderRef} />
- </Panel.Header>
-
- <Panel.Toolbar
- class={cn(
- 'items-start py-2 overflow-visible',
- !hasToolbarContent() && 'hidden',
- !previewState() &&
- 'border-b-0' /* scuffed: this is shit, but we are blinded by linear */
- )}
- >
- <SplitToolbar ref={setToolbarRef} />
- </Panel.Toolbar>
-
- <Panel.Body>
- <div class="@container/split size-full overflow-hidden relative">
- <Suspense>
- <Dynamic component={props.split.mount.element} />
- </Suspense>
- </div>
- </Panel.Body>
- </Panel>
- </div>
- </SplitDrawerGroup>
- </SoupViewContextProvider>
+ <SplitToolbar ref={setToolbarRef} />
+ </Panel.Toolbar>
+
+ <Panel.Body>
+ <div class="@container/split size-full overflow-hidden relative">
+ <Suspense>
+ <Dynamic component={props.split.mount.element} />
+ </Suspense>
+ </div>
+ </Panel.Body>
+ </Panel>
+ </div>
+ </SplitDrawerGroup>
</SplitPanelContext.Provider>
</SoupContextProvider>
);
diff --git a/js/app/packages/app/component/split-layout/layoutManager.ts b/js/app/packages/app/component/split-layout/layoutManager.ts
index e919de8be2..e65d6904f5 100644
--- a/js/app/packages/app/component/split-layout/layoutManager.ts
+++ b/js/app/packages/app/component/split-layout/layoutManager.ts
@@ -1,4 +1,4 @@
-import { LIST_VIEW_ID, type ListView } from '@app/constants/list-views';
+import { LIST_VIEW_ID } from '@app/constants/list-views';
import type {
BlockAlias,
BlockAliasContext,
@@ -116,7 +116,7 @@ export type PopoverSplitHandle = {
};
export type ReferredFrom =
- | ListView
+ | 'list-view'
| 'kommand-menu'
| 'mention'
| 'attachment'
@@ -128,6 +128,7 @@ export type ReferredFrom =
| 'hotkey'
| 'quick-access'
| 'file-upload'
+ | 'search'
| null;
export type SplitState = {
diff --git a/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsx b/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsx
index 099144a66c..869ff70c5c 100644
--- a/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsx
+++ b/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsx
@@ -1,7 +1,6 @@
import { useBlockEntityCommands } from '@app/component/next-soup/actions';
import { useMaybePreviewPanel } from '@app/component/PreviewPanel';
import { SplitHeaderRight } from '@app/component/split-layout/components/SplitHeader';
-import { useNavigatedFromJK } from '@app/component/useNavigatedFromJK';
import { globalSplitManager } from '@app/signal/splitLayout';
import { URL_PARAMS } from '@block-channel/constants';
import { ChannelAttachmentsTab } from '@channel/Attachments/ChannelAttachmentsTab';
@@ -158,7 +157,6 @@ export function NewChannelBlockAdapter(props: BlockChannelProps) {
useBlockEntityCommands();
const isPreview = !!useMaybePreviewPanel();
- const { navigatedFromJK } = useNavigatedFromJK();
const channelId = useBlockId();
const blockHandle = blockHandleSignal.get;
const [searchParams, setSearchParams] = useSearchParams();
@@ -308,7 +306,7 @@ export function NewChannelBlockAdapter(props: BlockChannelProps) {
<NewChannel
channelId={channelId}
onHandleReady={onChannelReady}
- autofocus={!isPreview && !navigatedFromJK()}
+ autofocus={!isPreview}
{...convertTargetMessage(initialTargetMessageParams())}
/>
</Match>
diff --git a/js/app/packages/block-chat/component/Chat.tsx b/js/app/packages/block-chat/component/Chat.tsx
index 2aca7e5098..9d65972269 100644
--- a/js/app/packages/block-chat/component/Chat.tsx
+++ b/js/app/packages/block-chat/component/Chat.tsx
@@ -312,7 +312,7 @@ function ChatInner(props: {
chatId={chat.chatId()}
onSend={onSend}
onStop={onStop}
- autoFocusOnMount={!isPreview && !navigatedFromJK()}
+ autoFocusOnMount={!isPreview}
/>
</div>
</div>
diff --git a/js/app/packages/block-email/component/Email.tsx b/js/app/packages/block-email/component/Email.tsx
index ec2f704187..7e4cc20875 100644
--- a/js/app/packages/block-email/component/Email.tsx
+++ b/js/app/packages/block-email/component/Email.tsx
@@ -358,7 +358,6 @@ function EmailContent(props: EmailViewProps) {
onMount(() => {
registerEmailHotkeys(scopeId(), {
blockSender: context.blockSender,
- markDone: context.archiveThread,
markSenderSignal: context.markSenderSignal,
markSenderNoise: context.markSenderNoise,
navigateToPreviousMessage,
diff --git a/js/app/packages/block-email/component/EmailContext.tsx b/js/app/packages/block-email/component/EmailContext.tsx
index 6a908997bd..28f4b9f015 100644
--- a/js/app/packages/block-email/component/EmailContext.tsx
+++ b/js/app/packages/block-email/component/EmailContext.tsx
@@ -1,8 +1,6 @@
import { useGlobalNotificationSource } from '@app/component/GlobalAppState';
import { makeMarkDoneAction } from '@app/component/next-soup/actions';
import { useMaybeSoup } from '@app/component/next-soup/soup-context';
-import { openEntityInSplitFromUnifiedList } from '@app/component/next-soup/utils';
-import { useSplitPanel } from '@app/component/split-layout/layoutUtils';
import { URL_PARAMS } from '@block-email/constants';
import { convertContactInfoToEmailRecipient } from '@block-email/util/recipientConversion';
import {
@@ -319,7 +317,6 @@ export function EmailProvider(props: FlowProps<{ threadID: string }>) {
};
const soup = useMaybeSoup();
- const splitPanel = useSplitPanel();
const userId = useUserId();
@@ -353,19 +350,7 @@ export function EmailProvider(props: FlowProps<{ threadID: string }>) {
if (selectedRow) {
if (soup) {
- markAsDoneAction.executeWithSoup(
- [selectedRow.original],
- soup,
- (nextEntity) => {
- const splitHandle = splitPanel?.handle;
- if (!splitHandle) return;
- void openEntityInSplitFromUnifiedList(nextEntity, {
- splitHandle,
- mergeHistory: true,
- referredFrom: splitHandle.referredFrom(),
- });
- }
- );
+ markAsDoneAction.executeWithSoup([selectedRow.original], soup);
} else {
markAsDoneAction.execute([selectedRow.original]);
}
diff --git a/js/app/packages/block-email/util/emailHotkeys.ts b/js/app/packages/block-email/util/emailHotkeys.ts
index c6b4b44850..f768549694 100644
--- a/js/app/packages/block-email/util/emailHotkeys.ts
+++ b/js/app/packages/block-email/util/emailHotkeys.ts
@@ -3,7 +3,6 @@ import { registerHotkey } from 'core/hotkey/hotkeys';
interface EmailHotkeyHandlers {
blockSender: () => boolean;
- markDone: () => boolean;
markSenderSignal: () => boolean;
markSenderNoise: () => boolean;
navigateToPreviousMessage: () => boolean;
@@ -49,14 +48,6 @@ export function registerEmailHotkeys(
hotkeyToken: TOKENS.email.forward,
displayPriority: 7,
});
- registerHotkey({
- hotkey: 'e',
- scopeId,
- description: 'Mark done',
- keyDownHandler: handlers.markDone,
- hotkeyToken: TOKENS.entity.action.markDone,
- displayPriority: 10,
- });
registerHotkey({
scopeId: scopeId,
description: 'Block sender',
diff --git a/js/app/packages/block-md/component/Notebook.tsx b/js/app/packages/block-md/component/Notebook.tsx
index 9f31add354..e03b12c5d1 100644
--- a/js/app/packages/block-md/component/Notebook.tsx
+++ b/js/app/packages/block-md/component/Notebook.tsx
@@ -1,4 +1,3 @@
-import { useNavigatedFromJK } from '@app/component/useNavigatedFromJK';
import { CommentMargin } from '@block-md/comments/CommentMargin';
import {
commentsStore,
@@ -82,7 +81,6 @@ export function Notebook(props: {
const scopeId = blockHotkeyScopeSignal.get;
const isTask = useBlockAliasedName() === 'task';
const md = mdStore.get;
- const { navigatedFromJK } = useNavigatedFromJK();
let notebookRef!: HTMLDivElement;
let commentMarginRef: HTMLDivElement | undefined;
@@ -270,10 +268,7 @@ export function Notebook(props: {
return (
<div class={containerClasses()} ref={notebookRef}>
<div class={contentDivClasses()} ref={contentRef}>
- <TitleEditor
- autoFocusOnMount={!navigatedFromJK()}
- mustBeConnected={props.mustBeConnected}
- />
+ <TitleEditor autoFocusOnMount mustBeConnected={props.mustBeConnected} />
<div class="spacer h-3" />
<div class="mb-6 flex flex-row flex-wrap items-center gap-2 text-sm empty:hidden">
<InlineTaskProperties />
diff --git a/js/app/packages/block-project/component/Block.tsx b/js/app/packages/block-project/component/Block.tsx
index b96115e6c4..09601b8bc0 100644
--- a/js/app/packages/block-project/component/Block.tsx
+++ b/js/app/packages/block-project/component/Block.tsx
@@ -196,7 +196,6 @@ const ProjectEntityList = (props: {
<SoupContextProvider soup={props.soup}>
<SoupViewContextProvider
soup={props.soup}
- initialEnabled
initialQuery={defineQueryFilters({
include: {
// Filter documents by project