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: mobile filter bar and dock fixes (#1045)

Peter Chinman0be387edd8c0
diff --git a/js/app/packages/app/component/Soup.tsx b/js/app/packages/app/component/Soup.tsx
index 59b9ef07fc..b3147d89ed 100644
--- a/js/app/packages/app/component/Soup.tsx
+++ b/js/app/packages/app/component/Soup.tsx
@@ -31,6 +31,7 @@ import SearchIcon from '@macro-icons/macro-magnifying-glass.svg';
import PreviewIcon from '@macro-icons/wide/preview.svg';
import NoiseIcon from '@macro-icons/wide/noise.svg';
import SignalIcon from '@macro-icons/wide/signal.svg';
+import XIcon from '@icon/regular/x.svg?component-solid';
import { createEffectOnEntityTypeNotification } from '@notifications';
import { invalidateEntityNotifications } from '@queries/notification/user-notifications';
import { storageServiceClient } from '@service-storage/client';
@@ -314,7 +315,7 @@ function EntityTypeIconFilter() {
style={{ opacity: rightOpacity() }}
/>
<div
- class="flex items-center h-full overflow-x-auto scrollbar-hidden overscroll-none"
+ class="flex items-center h-full overflow-x-auto scrollbar-hidden overscroll-none text-xs touch:mobile-width:text-sm"
ref={setScrollRef}
>
{/* Inbox toggle */}
@@ -341,7 +342,7 @@ function EntityTypeIconFilter() {
>
<button
type="button"
- class="flex items-center gap-1 h-[22px] pr-2.5 pl-1 active:bg-accent active:text-panel rounded-full"
+ class="flex items-center gap-1 h-[22px] touch:mobile-width:h-9 pr-2.5 pl-1 active:bg-accent active:text-panel rounded-full"
classList={{
'bg-accent text-panel': isUnreadFilterActive(),
'text-ink-muted hover:text-accent hover:bg-accent/20':
@@ -358,7 +359,7 @@ function EntityTypeIconFilter() {
>
<circle cx="12" cy="12" r="4" />
</svg>
- <span class="text-xs leading-none">
+ <span class="leading-none">
<ShortcutLabel label="Unread" shortcut="u" />
</span>
</button>
@@ -390,7 +391,7 @@ function EntityTypeIconFilter() {
>
<button
type="button"
- class="flex items-center gap-1.5 h-[22px] px-2.5 active:bg-accent active:text-panel rounded-full"
+ class="flex items-center gap-1.5 h-[22px] touch:mobile-width:h-9 px-2.5 active:bg-accent active:text-panel rounded-full"
classList={{
'bg-accent text-panel': preview(),
'text-ink-muted hover:text-accent hover:bg-accent/20': !preview(),
@@ -400,8 +401,8 @@ function EntityTypeIconFilter() {
setPreview((prev) => !prev);
}}
>
- <PreviewIcon class="size-3.5" />
- <span class="text-xs leading-none">
+ <PreviewIcon class="size-4.5" />
+ <span class="leading-none">
<ShortcutLabel label="Preview" shortcut="space" />
</span>
</button>
@@ -414,12 +415,14 @@ function EntityTypeIconFilter() {
open={sortDropdownOpen}
onOpenChange={setSortDropdownOpen}
/>
- <FilterDivider />
+ <div class="touch:mobile-width:-order-1">
+ <FilterDivider />
+ </div>
{/* Filter search bar */}
- <div class="flex items-center shrink-0">
+ <div class="flex items-center shrink-0 touch:mobile-width:-order-2">
<Tooltip tooltip={<LabelAndHotKey label="Filter" shortcut="⌘F" />}>
<div
- class="relative flex items-center gap-1.5 h-[22px] px-2.5 rounded-full"
+ class="relative flex items-center gap-1.5 h-[22px] touch:mobile-width:h-9 px-2.5 rounded-full touch:mobile-width:min-w-35"
classList={{
'bg-accent text-panel': !!searchText() && !searchFocused(),
'text-ink-muted hover:text-accent hover:bg-accent/20':
@@ -427,9 +430,9 @@ function EntityTypeIconFilter() {
}}
onClick={() => searchInputRef?.focus()}
>
- <SearchIcon class="size-3.5 shrink-0" />
+ <SearchIcon class="size-4.5 shrink-0" />
<Show when={!searchText() && !searchFocused()}>
- <span class="text-xs leading-none pointer-events-none">
+ <span class="leading-none pointer-events-none">
<span class="underline underline-offset-2 decoration-current/60">
{IS_MAC ? '⌘' : '^'}F
</span>
@@ -455,7 +458,7 @@ function EntityTypeIconFilter() {
e.currentTarget.blur();
}
}}
- class="p-0 text-xs bg-transparent border-none outline-none ring-0 focus:outline-none focus:ring-0 cursor-default"
+ class="p-0 bg-transparent border-none outline-none ring-0 focus:outline-none focus:ring-0 cursor-default"
style={{
width:
!searchText() && !searchFocused()
@@ -494,11 +497,11 @@ function ClearFiltersButton() {
<Tooltip tooltip={<LabelAndHotKey label="Clear filters" shortcut="/" />}>
<button
type="button"
- class="flex items-center gap-1.5 h-[22px] px-2.5 rounded-full text-ink-muted hover:text-accent hover:bg-accent/20 active:bg-accent active:text-panel"
+ class="flex items-center gap-1.5 px-2.5 rounded-full text-ink-muted hover:text-accent hover:bg-accent/20 active:bg-accent active:text-panel"
onClick={clearAllFilters}
>
- <span class="text-sm leading-none">✕</span>
- <span class="text-xs leading-none">
+ <XIcon class="size-4.5" />
+ <span class="text-xs touch:mobile-width:text-sm leading-none">
Clear
<span class="ml-1 font-mono opacity-70">/</span>
</span>
@@ -534,7 +537,7 @@ function SettingsButton() {
}}
onClick={() => toggleSettings()}
>
- <IconGear class="size-3.5" />
+ <IconGear class="size-4.5" />
</button>
</Tooltip>
</Show>
diff --git a/js/app/packages/app/component/Soup/components/FilterButton.tsx b/js/app/packages/app/component/Soup/components/FilterButton.tsx
index 4d0dc5c734..51d7c8e4c4 100644
--- a/js/app/packages/app/component/Soup/components/FilterButton.tsx
+++ b/js/app/packages/app/component/Soup/components/FilterButton.tsx
@@ -50,7 +50,7 @@ export const FilterButton: Component<FilterButtonProps> = (props) => (
>
<button
type="button"
- class={`flex items-center gap-1 h-[22px] ${props.paddingClass ?? 'pl-2 pr-2.5'} active:bg-accent active:text-panel rounded-full`}
+ class={`flex items-center gap-1 h-[22px] touch:mobile-width:h-9 ${props.paddingClass ?? 'pl-2 pr-2.5'} active:bg-accent active:text-panel rounded-full`}
classList={{
'bg-accent text-panel': props.isActive(),
'text-ink-muted hover:text-accent hover:bg-accent/20':
@@ -59,7 +59,7 @@ export const FilterButton: Component<FilterButtonProps> = (props) => (
onClick={props.onClick}
>
<Dynamic component={props.icon} class="size-4.5" />
- <span class="text-xs leading-none">
+ <span class="leading-none">
<ShortcutLabel label={props.label} shortcut={props.shortcut} />
</span>
</button>
diff --git a/js/app/packages/app/component/Soup/components/SortDropdown.tsx b/js/app/packages/app/component/Soup/components/SortDropdown.tsx
index a6a8cc0dd1..f563238ffe 100644
--- a/js/app/packages/app/component/Soup/components/SortDropdown.tsx
+++ b/js/app/packages/app/component/Soup/components/SortDropdown.tsx
@@ -85,8 +85,8 @@ export const SortDropdown: Component<SortDropdownProps> = (props) => {
'text-ink-muted hover:text-accent hover:bg-accent/20': !open(),
}}
>
- <SortIcon class="size-3.5" />
- <span class="text-xs leading-none">
+ <SortIcon class="size-4.5" />
+ <span class="leading-none">
<ShortcutLabel label="Sort" shortcut="s" />
</span>
</Popover.Trigger>
diff --git a/js/app/packages/app/component/mobile/MobileDock.tsx b/js/app/packages/app/component/mobile/MobileDock.tsx
index b2e1c5c997..8ed98ddaf3 100644
--- a/js/app/packages/app/component/mobile/MobileDock.tsx
+++ b/js/app/packages/app/component/mobile/MobileDock.tsx
@@ -1,12 +1,18 @@
import WideChannel from '@macro-icons/wide/channel.svg';
-import WideEmail from '@macro-icons/wide/email.svg';
-import WideCode from '@macro-icons/wide/file-code.svg';
+import SignalIcon from '@macro-icons/wide/signal.svg';
+import WideFolder from '@macro-icons/wide/folder.svg';
import WidePlus from '@macro-icons/wide/plus.svg';
import WideTask from '@macro-icons/wide/task.svg';
-import type { Component, JSX } from 'solid-js';
+import { batch, type Component, type JSX } from 'solid-js';
import { setCreateMenuOpen } from '../Launcher';
import { useSplitPanelOrThrow } from '../split-layout/layoutUtils';
-import { VIEWCONFIG_DEFAULTS_IDS_ENUM } from '../ViewConfig';
+import { VIEWCONFIG_BASE } from '../ViewConfig';
+import { FOCUS_FILTER_CONFIGS } from '../Soup/utils/filterConfigs';
+import {
+ isEntityTypeFilterActive,
+ isFocusFilterActive,
+ sameSet,
+} from '../Soup/utils/filterHelpers';
type MobileDockButtonProps = {
icon: Component<JSX.SvgSVGAttributes<SVGSVGElement>>;
@@ -33,66 +39,135 @@ function MobileDockButton(props: MobileDockButtonProps) {
export function MobileDock() {
const splitContext = useSplitPanelOrThrow();
- const { selectedView, setSelectedView } = splitContext.soupContext;
+ const { selectedView, setViewDataStore, viewsDataStore } =
+ splitContext.soupContext;
+
+ const splitContent = () => splitContext.handle.content();
+ const view = () => viewsDataStore[selectedView()];
+ const filters = () => view()?.filters ?? VIEWCONFIG_BASE.filters;
+ const typeFilter = () => filters().typeFilter ?? [];
+ const channelCategoryFilter = () => filters().channelCategoryFilter ?? [];
+ const focusFilters = () => filters().focusFilters ?? [];
+
+ const splitIsUnifiedList = () =>
+ splitContent().type === 'component' && splitContent().id === 'unified-list';
const ensureUnifiedList = () => {
- const content = splitContext.handle.content();
- if (content.type === 'component' && content.id === 'unified-list') return;
+ if (splitIsUnifiedList()) return;
splitContext.handle.replace({
next: { type: 'component', id: 'unified-list' },
});
};
- const focusSearchInput = (viewId: string) => {
- setTimeout(() => {
- const el = document.getElementById(
- `search-input-${splitContext.handle.id}-${viewId}`
- );
- if (el instanceof HTMLInputElement) {
- el.focus();
- } else {
- (el as HTMLElement | null)?.focus?.();
- }
- }, 0);
+ const isInboxActive = () =>
+ isFocusFilterActive(focusFilters(), 'signal') && splitIsUnifiedList();
+ const isPeopleTeamsActive = () =>
+ isEntityTypeFilterActive(typeFilter(), 'channel') &&
+ sameSet(channelCategoryFilter(), ['people', 'groups']) &&
+ splitIsUnifiedList();
+ const isTasksActive = () =>
+ isEntityTypeFilterActive(typeFilter(), 'task') && splitIsUnifiedList();
+ const isAllActive = () =>
+ !isInboxActive() &&
+ !isPeopleTeamsActive() &&
+ !isTasksActive() &&
+ splitIsUnifiedList();
+
+ const setFocusFilter = (target: 'signal' | 'noise' | 'none') => {
+ const config =
+ target === 'none'
+ ? FOCUS_FILTER_CONFIGS.none
+ : FOCUS_FILTER_CONFIGS[target];
+ const viewId = selectedView();
+ setViewDataStore(viewId, 'filters', 'focusFilters', [
+ ...config.focusFilters,
+ ]);
+ setViewDataStore(
+ viewId,
+ 'filters',
+ 'notificationFilter',
+ config.notificationFilter
+ );
+ setViewDataStore(
+ viewId,
+ 'display',
+ 'unrollNotifications',
+ config.unrollNotifications
+ );
+ };
+
+ const setTypeFilters = ({
+ type,
+ channelCategories = [],
+ }: {
+ type: Array<'channel' | 'chat' | 'document' | 'email' | 'project' | 'task'>;
+ channelCategories?: Array<'people' | 'groups'>;
+ }) => {
+ const viewId = selectedView();
+ setViewDataStore(viewId, 'filters', 'typeFilter', type);
+ setViewDataStore(viewId, 'filters', 'documentTypeFilter', []);
+ setViewDataStore(viewId, 'filters', 'channelCategoryFilter', [
+ ...channelCategories,
+ ]);
+ };
+
+ const clearSearchFilters = () => {
+ const viewId = selectedView();
+ batch(() => {
+ setTypeFilters({ type: [], channelCategories: [] });
+ setFocusFilter('none');
+ setViewDataStore(viewId, 'filters', 'unreadOnly', false);
+ });
};
return (
<div class="flex flex-row justify-between bg-linear-to-t from-page to-panel border-t border-edge-muted">
<MobileDockButton
- icon={WideCode}
- label="Search"
- active={selectedView() === VIEWCONFIG_DEFAULTS_IDS_ENUM.all}
+ icon={WideFolder}
+ label="All"
+ active={isAllActive()}
onClick={() => {
ensureUnifiedList();
- setSelectedView(VIEWCONFIG_DEFAULTS_IDS_ENUM.all);
- focusSearchInput(VIEWCONFIG_DEFAULTS_IDS_ENUM.all);
+ clearSearchFilters();
}}
/>
<MobileDockButton
- icon={WideEmail}
+ icon={SignalIcon}
label="Inbox"
- active={selectedView() === VIEWCONFIG_DEFAULTS_IDS_ENUM.signal}
+ active={isInboxActive()}
onClick={() => {
ensureUnifiedList();
- setSelectedView(VIEWCONFIG_DEFAULTS_IDS_ENUM.signal);
+ batch(() => {
+ setFocusFilter('signal');
+ setTypeFilters({ type: [] });
+ });
}}
/>
<MobileDockButton
icon={WideChannel}
label="People"
- active={selectedView() === VIEWCONFIG_DEFAULTS_IDS_ENUM.people}
+ active={isPeopleTeamsActive()}
onClick={() => {
ensureUnifiedList();
- setSelectedView(VIEWCONFIG_DEFAULTS_IDS_ENUM.people);
+ batch(() => {
+ setFocusFilter('none');
+ setTypeFilters({
+ type: ['channel'],
+ channelCategories: ['people', 'groups'],
+ });
+ });
}}
/>
<MobileDockButton
icon={WideTask}
label="Tasks"
- active={selectedView() === VIEWCONFIG_DEFAULTS_IDS_ENUM.tasks}
+ active={isTasksActive()}
onClick={() => {
ensureUnifiedList();
- setSelectedView(VIEWCONFIG_DEFAULTS_IDS_ENUM.tasks);
+ batch(() => {
+ setFocusFilter('none');
+ setTypeFilters({ type: ['task'] });
+ });
}}
/>
<MobileDockButton
diff --git a/js/app/packages/macro-icons/wide/noise.svg b/js/app/packages/macro-icons/wide/noise.svg
index 063651fd3a..890a4be55e 100644
--- a/js/app/packages/macro-icons/wide/noise.svg
+++ b/js/app/packages/macro-icons/wide/noise.svg
@@ -1,3 +1,3 @@
-<svg width="100%" height="100%" viewBox="0 0 24 24" fill="currentColor" stroke="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M20.56 13.51H21V13.07V12.01H19.94H19.85H19.71L17.87 7.40003L16.41 12.75L15.28 9.54003L13.76 11.3L11.84 6.03003L10.38 12.34L9.1 8.37003L7.5 12.11L6.08 8.79003L4.33 12.01H4.2H4.17H3V12.99V13.51H3.63H5.22L5.92 12.22L7.5 15.91L8.9 12.64L10.62 17.97L12.16 11.29L13.24 14.22L14.72 12.48L16.59 17.77L18.13 12.12L18.69 13.51H20.56Z"/>
+<svg width="100%" height="100%" viewBox="0 -4 24 24" fill="currentColor" stroke="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M23.4133 9H24V6.99h-1.72l-2.4585-5.1542-1.9462 7.1692-1.5063-4.3015-2.0261 2.3585L11.7836 0 9.8374 8.4556l-1.7062-5.32-2.1328 5.0118-1.8928-4.449L1.7729 7H0v2.01h2.9592l.9331-.7152 2.1061 4.9447 1.8662-4.3819L10.1573 16l2.0528-8.9514 1.4397 3.9263 1.9728-2.3317 2.4927 7.0888 2.0528-7.5712L20.92 9z"/>
</svg>
diff --git a/js/app/packages/macro-icons/wide/readme.md b/js/app/packages/macro-icons/wide/readme.md
new file mode 100644
index 0000000000..10cdf8fa64
--- /dev/null
+++ b/js/app/packages/macro-icons/wide/readme.md
@@ -0,0 +1,5 @@
+Note on the formatting of these wide icons.
+
+1. The view box should be set to 0 n 24 24 where n = -1 * {the height of the svg} / 2. This is so that the svg is correctly centered in a square viewbox.
+2. In the <svg> tag set fill to "currentColor" and width and height to "100%" and stroke set to "None".
+3. <path> tag should not have any fill or stroke set on it.
diff --git a/js/app/packages/macro-icons/wide/signal.svg b/js/app/packages/macro-icons/wide/signal.svg
index 53246c28f2..e66145044f 100644
--- a/js/app/packages/macro-icons/wide/signal.svg
+++ b/js/app/packages/macro-icons/wide/signal.svg
@@ -1,3 +1,3 @@
-<svg width="100%" height="100%" viewBox="0 0 24 24" fill="currentColor" stroke="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M17.27 11.25C16.62 8.37 15.99 6 14.33 6C12.56 6 11.96 8.71 11.26 11.84C10.98 13.12 10.22 16.5 9.66 16.5C9.1 16.5 8.34 13.11 8.06 11.84C8.02 11.64 7.97 11.45 7.93 11.25H3V12.75H6.73C7.38 15.63 8.01 18 9.66 18C11.43 18 12.03 15.29 12.73 12.16C13.01 10.89 13.77 7.5 14.33 7.5C14.89 7.5 15.65 10.89 15.93 12.16C15.97 12.36 16.02 12.55 16.06 12.75H21V11.25H17.27Z"/>
+<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 -4 24 24" fill="currentColor" stroke="none">
+ <path d="M19.0267 7c-.8667-3.84-1.7067-7-3.92-7-2.36 0-3.16 3.6133-4.0934 7.7867C10.64 9.4933 9.6267 14 8.88 14S7.12 9.48 6.7467 7.7867c-.0534-.2667-.12-.52-.1734-.7867H0v2h4.9733C5.84 12.84 6.68 16 8.88 16c2.36 0 3.16-3.6133 4.0933-7.7867C13.3467 6.52 14.36 2 15.1067 2s1.76 4.52 2.1333 6.2133c.0533.2667.12.52.1733.7867H24V7z"/>
</svg>