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: disable search service with signal/noise views (#942)

gbirmanca37829b7044
diff --git a/js/app/packages/app/component/UnifiedListView.tsx b/js/app/packages/app/component/UnifiedListView.tsx
index e7a4b975c3..b8e4fe0ed0 100644
--- a/js/app/packages/app/component/UnifiedListView.tsx
+++ b/js/app/packages/app/component/UnifiedListView.tsx
@@ -864,12 +864,19 @@ export function UnifiedListView(props: UnifiedListViewProps) {
const emailActive = useEmailLinksStatus();
- const validSearchTerms = createMemo(() => {
- return debouncedSearchForService().length >= 3;
- });
- const isSearchActive = createMemo(() => {
- return validSearchTerms();
+ const validSearchTerms = createMemo(
+ () => debouncedSearchForService().length >= 3
+ );
+ const hasSignalOrNoiseFilter = createMemo(() => {
+ const focusFilters_ = focusFilters();
+ return (
+ focusFilters_?.includes('signal') === true ||
+ focusFilters_?.includes('noise') === true
+ );
});
+ const isSearchActive = createMemo(
+ () => validSearchTerms() && !hasSignalOrNoiseFilter()
+ );
const dssQueryParams = createMemo(
(): GetItemsSoupParams => ({
@@ -1853,6 +1860,7 @@ export function UnifiedListView(props: UnifiedListViewProps) {
shiftKey: shiftKey ?? false,
})
}
+ searchActive={!!searchText()}
/>
</EntityRow>
);
diff --git a/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx b/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
index 995464e230..d1a1613e42 100644
--- a/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
+++ b/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
@@ -457,6 +457,7 @@ interface EntityProps<T extends WithNotification<EntityData>>
ref?: Ref<HTMLDivElement>;
onChecked?: (checked: boolean, shiftKey?: boolean) => void;
checked?: boolean;
+ searchActive?: boolean;
}
const [hoveredEntityId, setHoveredEntityId] = createSignal<string | null>(null);
@@ -506,6 +507,10 @@ export function EntityWithEverything(
return notifications.filter(({ done }) => !done);
};
+ const isSearch = createMemo(
+ () => !!props.searchActive && isSearchEntity(props.entity)
+ );
+
const searchHighlightName = () =>
isSearchEntity(props.entity) && props.entity.search.nameHighlight;
@@ -571,8 +576,6 @@ export function EntityWithEverything(
return `${firstNames[0]} .. ${firstNames[firstNames.length - 2]}, ${firstNames[firstNames.length - 1]}`;
};
- const isSearch = () => isSearchEntity(props.entity);
-
return (
<div class="flex gap-1 items-center text-sm min-w-0 w-full truncate overflow-hidden @max-md/split:flex-col @max-md/split:items-start @max-md/split:gap-1 @max-md/split:truncate-none">
{/* sometimes senderName and senderEmail are the same */}
@@ -652,7 +655,10 @@ export function EntityWithEverything(
<Show when={isSearch()}>
<span class="@max-md/split:hidden"> – </span>
</Show>
- <Show when={searchHighlightName()} fallback={props.entity.name}>
+ <Show
+ when={isSearch() && searchHighlightName()}
+ fallback={props.entity.name}
+ >
{(name) => (
<StaticMarkdown
markdown={name()}
@@ -1097,7 +1103,7 @@ export function EntityWithEverything(
</div>
</div>
{/* Content Hits from Search */}
- <Show when={contentHitData().length > 0}>
+ <Show when={isSearch() && contentHitData().length > 0}>
<div class="relative row-2 col-2 col-end-4 pb-2 @max-md/split:row-auto @max-md/split:col-auto @max-md/split:w-full @max-md/split:mt-1">
<CollapsibleList
items={contentHitData()}