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(search): match group-by header style for search sections (#3315)

gbirmanaac9bb41f214
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 e493f62a0a..297638cb43 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
@@ -122,50 +122,64 @@ import { SoupEntitySelectionToolbar } from './soup-entity-selection-toolbar';
import { useSoupNavigationHotkeys } from './use-soup-navigation-hotkeys';
import { useSoupViewHotkeys } from './use-soup-view-hotkeys';
-const DefaultGroupHeader = (
- props: GroupHeaderProps & { highlighted?: boolean }
-) => {
+export const SoupSectionHeader = (props: {
+ children: JSX.Element;
+ onClick?: () => void;
+ highlighted?: boolean;
+}) => {
return (
<Layer depth={2}>
- <button
- type="button"
+ <Dynamic
+ component={props.onClick ? 'button' : 'div'}
+ type={props.onClick ? 'button' : undefined}
+ onClick={props.onClick}
class={cn(
'group/header w-[calc(100%-0.5rem)] mx-1 mb-1 rounded px-2 py-2 flex items-center gap-2.5 text-xs font-semibold tracking-tight',
- 'text-text-muted bg-surface hover:bg-active border border-edge-muted',
- 'relative',
- {
- 'ring ring-edge bg-active ring-inset': props.highlighted,
- }
+ 'text-text-muted bg-surface border border-edge-muted relative',
+ props.onClick && 'hover:bg-active',
+ props.highlighted && 'ring ring-edge bg-active ring-inset'
)}
- onClick={() => props.group.toggle()}
>
- <Layer depth={3}>
- <div class="flex items-center justify-center size-4.5 rounded-xs bg-surface group-hover/header:bg-active">
- <ChevronRightIcon
- class={cn('size-2.5', {
- 'rotate-90': props.group.isExpanded(),
- })}
- />
- </div>
- </Layer>
- <PropertyValueIcon
- optionId={props.group.value as string}
- class="size-3.5"
- />
- <span class="truncate">{props.group.label}</span>
- <span
- class={cn(
- 'shrink-0 tabular-nums text-xs font-medium',
- 'px-1.5 py-px rounded-full bg-ink/10 text-text-subtle'
- )}
- >
- {props.group.count}
- </span>
- </button>
+ {props.children}
+ </Dynamic>
</Layer>
);
};
+const DefaultGroupHeader = (
+ props: GroupHeaderProps & { highlighted?: boolean }
+) => {
+ return (
+ <SoupSectionHeader
+ onClick={() => props.group.toggle()}
+ highlighted={props.highlighted}
+ >
+ <Layer depth={3}>
+ <div class="flex items-center justify-center size-4.5 rounded-xs bg-surface group-hover/header:bg-active">
+ <ChevronRightIcon
+ class={cn('size-2.5', {
+ 'rotate-90': props.group.isExpanded(),
+ })}
+ />
+ </div>
+ </Layer>
+ <PropertyValueIcon
+ optionId={props.group.value as string}
+ class="size-3.5"
+ />
+ <span class="truncate">{props.group.label}</span>
+ <span
+ class={cn(
+ 'shrink-0 tabular-nums text-xs font-medium',
+ 'px-1.5 py-px rounded-full bg-ink/10 text-text-subtle'
+ )}
+ >
+ {props.group.count}
+ </span>
+ </SoupSectionHeader>
+ );
+};
+
const useSoupNotificationInvalidators = () => {
const notificationSource = useGlobalNotificationSource();
const entityQueryClient = useQueryClient();
@@ -1018,9 +1032,11 @@ export const SoupViewList = (props: SoupViewListProps) => {
return (
<>
<Show when={i() === 0 && featuredCount() > 0}>
- <div class="px-3 py-1.5 text-xs text-text-muted font-medium">
- Featured Results
- </div>
+ <SoupSectionHeader>
+ <span class="truncate">
+ Featured Results
+ </span>
+ </SoupSectionHeader>
</Show>
<Show
when={
@@ -1028,9 +1044,9 @@ export const SoupViewList = (props: SoupViewListProps) => {
featuredCount() > 0
}
>
- <div class="px-3 py-1.5 text-xs text-text-muted font-medium border-t border-edge-muted mt-1">
- More Results
- </div>
+ <SoupSectionHeader>
+ <span class="truncate">More Results</span>
+ </SoupSectionHeader>
</Show>
<Switch>