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(search): move search bar into header and drop view title (#3035)

gbirmanf33a14d591ff
diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-filters-bar.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-filters-bar.tsx
index d0c8f93b41..dafeef1770 100644
--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-filters-bar.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-filters-bar.tsx
@@ -1,9 +1,7 @@
import { SoupViewContextSort } from '@app/component/next-soup/soup-view/filters-bar/soup-view-context-sort';
-import { SoupSearchbar } from '@app/component/next-soup/soup-view/filters-bar/soup-view-search-bar';
import { useFilterRefinements } from '@app/component/next-soup/soup-view/filters-bar/use-filter-refinements';
import { useSplitPanelOrThrow } from '@app/component/split-layout/layoutUtils';
-import type { ListView } from '@app/constants/list-views';
-import { createMemo, createSignal, Match, Show, Switch } from 'solid-js';
+import { createMemo, createSignal, Show } from 'solid-js';
import { UnifiedFilterDropdown } from '@app/component/next-soup/soup-view/filters-bar/unified-filter-dropdown';
import { ActiveFilterChips } from '@app/component/next-soup/soup-view/filters-bar/active-filter-chips';
import { isMobile } from '@core/mobile/isMobile';
@@ -14,11 +12,7 @@ import { useSoup } from '../../soup-context';
import { registerHotkey } from '@core/hotkey/hotkeys';
import { useAnalytics } from '@app/component/analytics-context';
-interface SoupFiltersBarProps {
- initialSearchText?: string;
-}
-
-export const SoupFiltersBar = (props: SoupFiltersBarProps = {}) => {
+export const SoupFiltersBar = () => {
const {
resetToTabDefaults,
activeFiltersList,
@@ -59,83 +53,45 @@ export const SoupFiltersBar = (props: SoupFiltersBarProps = {}) => {
},
});
- const component = createMemo(() => {
+ const isSearchView = createMemo(() => {
const content = panel.handle.content();
-
- if (content.type !== 'component') return;
-
- return content.id;
+ return content.type === 'component' && content.id === 'search';
});
- const isComponentListView = (listView: ListView) => {
- return component() === listView;
- };
-
return (
- <Switch>
- <Match when={isComponentListView('search')}>
- <div class="w-full flex flex-col gap-2 p-2 border-b border-edge-muted">
- <SoupSearchbar
- placeholder="Search, @mention contacts"
- initialValue={props.initialSearchText}
- />
- <div class="flex items-start gap-2">
- <UnifiedFilterDropdown />
- <ActiveFilterChips
- filters={activeFiltersList()}
- onRemove={removeFilter}
- onReplace={replaceFilter}
- onClearAll={resetToTabDefaults}
- isOptionActive={isOptionActive}
- />
- <div class="flex-1" />
- <Tooltip
- tooltip={<LabelAndHotKey label="Preview" shortcut="space" />}
- >
- <Button
- variant={soup.previewEntity() ? 'primary' : 'ghost'}
- size="sm"
- class="rounded-xs [&_svg]:size-4 px-1 border border-transparent"
- onClick={togglePreview}
- onMouseEnter={() => setPreviewBtnHovering(true)}
- onMouseLeave={() => setPreviewBtnHovering(false)}
- >
- <AnimatedPreviewIcon triggerAnimation={previewBtnHovering()} />
- </Button>
- </Tooltip>
- </div>
- </div>
- </Match>
- <Match when={true}>
- <Show when={!isMobile()}>
- <div class="flex items-start gap-2 px-2 py-1.5 border-b border-edge-muted w-full">
- <UnifiedFilterDropdown />
- <ActiveFilterChips
- filters={activeFiltersList()}
- onRemove={removeFilter}
- onReplace={replaceFilter}
- onClearAll={resetToTabDefaults}
- isOptionActive={isOptionActive}
- />
- <div class="flex-1" />
- <Tooltip
- tooltip={<LabelAndHotKey label="Preview" shortcut="space" />}
- >
- <Button
- variant={soup.previewEntity() ? 'primary' : 'ghost'}
- size="sm"
- class="rounded-xs [&_svg]:size-4 px-1 border border-transparent"
- onClick={togglePreview}
- onMouseEnter={() => setPreviewBtnHovering(true)}
- onMouseLeave={() => setPreviewBtnHovering(false)}
- >
- <AnimatedPreviewIcon triggerAnimation={previewBtnHovering()} />
- </Button>
- </Tooltip>
- <SoupViewContextSort />
- </div>
+ <Show when={!isMobile()}>
+ <div
+ class="flex items-start gap-2 border-b border-edge-muted w-full"
+ classList={{
+ 'p-2': isSearchView(),
+ 'px-2 py-1.5': !isSearchView(),
+ }}
+ >
+ <UnifiedFilterDropdown />
+ <ActiveFilterChips
+ filters={activeFiltersList()}
+ onRemove={removeFilter}
+ onReplace={replaceFilter}
+ onClearAll={resetToTabDefaults}
+ isOptionActive={isOptionActive}
+ />
+ <div class="flex-1" />
+ <Tooltip tooltip={<LabelAndHotKey label="Preview" shortcut="space" />}>
+ <Button
+ variant={soup.previewEntity() ? 'primary' : 'ghost'}
+ size="sm"
+ class="rounded-xs [&_svg]:size-4 px-1 border border-transparent"
+ onClick={togglePreview}
+ onMouseEnter={() => setPreviewBtnHovering(true)}
+ onMouseLeave={() => setPreviewBtnHovering(false)}
+ >
+ <AnimatedPreviewIcon triggerAnimation={previewBtnHovering()} />
+ </Button>
+ </Tooltip>
+ <Show when={!isSearchView()}>
+ <SoupViewContextSort />
</Show>
- </Match>
- </Switch>
+ </div>
+ </Show>
);
};
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 1aea564942..61073a87a4 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
@@ -283,39 +283,56 @@ export const SoupView = (props: SoupViewProps) => {
<SplitHeaderLeft>
<div
class={cn('h-full flex gap-3 items-center', {
- 'shrink-0': !narrowSearchExpanded(),
- 'flex-1 min-w-0': narrowSearchExpanded(),
+ 'shrink-0':
+ !narrowSearchExpanded() && !isComponentListView('search'),
+ 'flex-1 min-w-0':
+ narrowSearchExpanded() || isComponentListView('search'),
})}
>
- <Show when={!isMobile()}>
- <h1 class="font-semibold text-ink select-none text-sm shrink-0">
- {props.viewName}
- </h1>
- </Show>
- <Show when={!narrowSearchExpanded()}>
- <Show when={!isMobile()}>
- <CollapsibleHeaderItem
- id="tabs"
- priority={1}
- expanded={() => <SoupViewTabs />}
- collapsed={() => <CollapsedSoupViewTabs />}
- containerClass="h-full"
- />
- </Show>
- <Show when={!isMobile()}>
- <SoupViewCreateButton />
- </Show>
- <Show when={isMobile()}>
- <MobileFilterDrawer />
- </Show>
- </Show>
- <Show when={narrowSearchExpanded()}>
+ <Show
+ when={isComponentListView('search')}
+ fallback={
+ <>
+ <Show when={!isMobile()}>
+ <h1 class="font-semibold text-ink select-none text-sm shrink-0">
+ {props.viewName}
+ </h1>
+ </Show>
+ <Show when={!narrowSearchExpanded()}>
+ <Show when={!isMobile()}>
+ <CollapsibleHeaderItem
+ id="tabs"
+ priority={1}
+ expanded={() => <SoupViewTabs />}
+ collapsed={() => <CollapsedSoupViewTabs />}
+ containerClass="h-full"
+ />
+ </Show>
+ <Show when={!isMobile()}>
+ <SoupViewCreateButton />
+ </Show>
+ <Show when={isMobile()}>
+ <MobileFilterDrawer />
+ </Show>
+ </Show>
+ <Show when={narrowSearchExpanded()}>
+ <div class="flex-1 min-w-0">
+ <SoupSearchbar
+ variant="secondary"
+ autoFocus
+ initialValue={props.initialSearchText}
+ onDismiss={() => setNarrowSearchExpanded(false)}
+ />
+ </div>
+ </Show>
+ </>
+ }
+ >
<div class="flex-1 min-w-0">
<SoupSearchbar
variant="secondary"
- autoFocus
+ placeholder="Search, @mention contacts"
initialValue={props.initialSearchText}
- onDismiss={() => setNarrowSearchExpanded(false)}
/>
</div>
</Show>
@@ -361,7 +378,7 @@ export const SoupView = (props: SoupViewProps) => {
/>
</Show>
</SplitHeaderRight>
- <SoupFiltersBar initialSearchText={props.initialSearchText} />
+ <SoupFiltersBar />
</div>
<Show when={hasLinkError()}>
<EmailPermissionsBanner />