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(home): unread/read/all single select filter (#6613)

Seamus5a3fe4de80e5
diff --git a/apps/web/src/components/view-shell/ListDropdowns.test.tsx b/apps/web/src/components/view-shell/ListDropdowns.test.tsx
index e13b0ebacf..f122ec738f 100644
--- a/apps/web/src/components/view-shell/ListDropdowns.test.tsx
+++ b/apps/web/src/components/view-shell/ListDropdowns.test.tsx
@@ -111,17 +111,17 @@ it('keeps multi-select menus open while adding and removing filters', async () =
it('closes a single-select menu after choosing an option and retains it on reopen', async () => {
const { selected, open, setOpen } = setup(true);
await openSubmenu();
- selectOption(await screen.findByRole('menuitemcheckbox', { name: 'Alice' }));
+ selectOption(await screen.findByRole('menuitemradio', { name: 'Alice' }));
expect(selected()).toEqual(['alice']);
await waitFor(() => expect(open()).toBe(false));
setOpen(true);
await openSubmenu();
expect(
- (
- await screen.findByRole('menuitemcheckbox', { name: 'Alice' })
- ).getAttribute('aria-checked')
+ (await screen.findByRole('menuitemradio', { name: 'Alice' })).getAttribute(
+ 'aria-checked'
+ )
).toBe('true');
- selectOption(screen.getByRole('menuitemcheckbox', { name: 'Bob' }));
+ selectOption(screen.getByRole('menuitemradio', { name: 'Bob' }));
expect(selected()).toEqual(['bob']);
await waitFor(() => expect(open()).toBe(false));
});
diff --git a/apps/web/src/components/view-shell/ListDropdowns.tsx b/apps/web/src/components/view-shell/ListDropdowns.tsx
index 7a0063fc96..f7d611e23a 100644
--- a/apps/web/src/components/view-shell/ListDropdowns.tsx
+++ b/apps/web/src/components/view-shell/ListDropdowns.tsx
@@ -204,6 +204,7 @@ export function ListFilterDropdown<
fallback={
<FilterSubmenu
label={group.label}
+ selectionMode={group.selectionMode}
active={isGroupActive(group)}
options={group.options}
isSelected={(id) => props.isSelected(group.id, id)}
diff --git a/apps/web/src/features/next-soup/soup-view/filters-bar/filter-menu.tsx b/apps/web/src/features/next-soup/soup-view/filters-bar/filter-menu.tsx
index eab99a15c2..3bcc998107 100644
--- a/apps/web/src/features/next-soup/soup-view/filters-bar/filter-menu.tsx
+++ b/apps/web/src/features/next-soup/soup-view/filters-bar/filter-menu.tsx
@@ -95,6 +95,7 @@ export function FilterSubmenu<TId extends string>(props: {
onSelect: (id: TId) => void;
closeOnSelect?: boolean;
contentClass?: string;
+ selectionMode?: 'single' | 'multiple';
}) {
return (
<Dropdown.Sub>
@@ -109,18 +110,53 @@ export function FilterSubmenu<TId extends string>(props: {
</Dropdown.SubTrigger>
<Dropdown.SubContent class={props.contentClass}>
<Dropdown.Group>
- <For each={props.options}>
- {(option) => (
- <FilterOptionItem
- label={option.label}
- icon={option.icon}
- disabled={option.disabled}
- active={props.isSelected(option.id)}
- onSelect={() => props.onSelect(option.id)}
- closeOnSelect={props.closeOnSelect}
- />
- )}
- </For>
+ <Show
+ when={props.selectionMode === 'single'}
+ fallback={
+ <For each={props.options}>
+ {(option) => (
+ <FilterOptionItem
+ label={option.label}
+ icon={option.icon}
+ disabled={option.disabled}
+ active={props.isSelected(option.id)}
+ onSelect={() => props.onSelect(option.id)}
+ closeOnSelect={props.closeOnSelect}
+ />
+ )}
+ </For>
+ }
+ >
+ <Dropdown.RadioGroup
+ value={
+ props.options.find((option) => props.isSelected(option.id))?.id
+ }
+ onChange={(id) => {
+ const option = props.options.find((option) => option.id === id);
+ if (option) props.onSelect(option.id);
+ }}
+ >
+ <For each={props.options}>
+ {(option) => (
+ <Dropdown.RadioItem
+ value={option.id}
+ disabled={option.disabled}
+ closeOnSelect={props.closeOnSelect}
+ >
+ <Show when={option.icon}>
+ <span class="size-4 flex items-center justify-center shrink-0">
+ {option.icon?.()}
+ </span>
+ </Show>
+ <span class="flex-1">{option.label}</span>
+ <Dropdown.ItemIndicator>
+ <CheckIcon class="size-3.5 text-accent" />
+ </Dropdown.ItemIndicator>
+ </Dropdown.RadioItem>
+ )}
+ </For>
+ </Dropdown.RadioGroup>
+ </Show>
</Dropdown.Group>
</Dropdown.SubContent>
</Dropdown.Sub>
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index a3305fad7b..f0490c16a6 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -75,7 +75,8 @@ notifications with Activity's `touched_by_me` recents, including sent emails and
AI chats. Each entity appears once, ordered by its latest notification or own
action. On desktop, the funnel button to the right of **Home** opens **Filter Home**.
The menu shares the legacy compact submenus: **Status** offers **Unread**, **Read**,
-and **All**, and **Type** contains the entity checkboxes. Status closes the menu
+and **All** as single-select radio items with a checkmark on the right of the selected
+option, and **Type** contains the entity checkboxes. Status closes the menu
after selection; type selections leave it open. Press **f** to open the menu.
Entity type checkboxes start checked. Unchecking **Email** hides received
and sent mail. **Channels** controls