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: new mobile dock ui (#5698)

Peter Chinman30feee82af80
diff --git a/apps/web/src/components/app/Layout.tsx b/apps/web/src/components/app/Layout.tsx
index 65e8e9eaab..54e8cd1866 100644
--- a/apps/web/src/components/app/Layout.tsx
+++ b/apps/web/src/components/app/Layout.tsx
@@ -13,7 +13,7 @@ import {
Launcher,
setCreateMenuOpen,
} from '@app/features/command/Launcher';
-import { MobileSearchOuter } from '@app/features/command/mobile/MobileSearch';
+import { SearchState } from '@app/features/command/mobile/mobileSearchState';
import { CreateCompanyModal } from '@app/features/companies/CreateCompanyModal';
import { CreateContactModal } from '@app/features/companies/CreateContactModal';
import { DevStatusBar } from '@app/features/devtools/DevStatusBar';
@@ -83,8 +83,8 @@ import GlobalShortcuts from './GlobalHotkeys';
import { ItemDndProvider } from './ItemDragAndDrop';
import { FloatRegion } from './mobile/float-regions/FloatRegion';
import { FloatRegionHost } from './mobile/float-regions/FloatRegionHost';
-import { MobileDock } from './mobile/MobileDock';
-import { MobileBottomEdgeFade } from './mobile/MobileEdgeFade';
+import { MobileSearchRow } from './mobile/MobileSearchRow';
+import { MobileViewsRow } from './mobile/MobileViewsRow';
import { SwipeDownDismissKeyboard } from './mobile/SwipeDownDismissKeyboard';
import { useAppSquishHandlers } from './useAppSquishHandlers';
@@ -541,13 +541,15 @@ function LayoutInner(props: RouteSectionProps) {
}
>
<FloatRegionHost />
- <FloatRegion region="dock" active={() => !virtualKeyboardVisible()}>
- <MobileBottomEdgeFade />
- <MobileDock />
+ <FloatRegion
+ region="accessory"
+ priority={() => (SearchState.isOpen() ? 100 : 0)}
+ active={() => !virtualKeyboardVisible() || SearchState.isOpen()}
+ >
+ <MobileSearchRow />
</FloatRegion>
- </Show>
- <Show when={isTouchDevice()}>
- <MobileSearchOuter />
+ {/* The views row owns the bottom (dock) slot. */}
+ <MobileViewsRow />
</Show>
<SwipeDownDismissKeyboard />
<Suspense>
diff --git a/apps/web/src/components/app/mobile/MobileDock.tsx b/apps/web/src/components/app/mobile/MobileDock.tsx
deleted file mode 100644
index f1c68850a3..0000000000
--- a/apps/web/src/components/app/mobile/MobileDock.tsx
+++ /dev/null
@@ -1,298 +0,0 @@
-import type { ListView } from '@app/constants/list-views';
-import { useCalendarUiFlag } from '@app/features/calendar/use-calendar-ui-flag';
-import {
- CREATABLE_BLOCKS,
- type CreatableBlock,
- runCreateAction,
-} from '@app/features/command/Launcher';
-import { SearchState } from '@app/features/command/mobile/mobileSearchState';
-import { useFeatureFlag } from '@app/lib/analytics/posthog';
-import { globalSplitManager } from '@app/signal/splitLayout';
-import { useHandleFileUpload } from '@app/util/handleFileUpload';
-import {
- ENABLE_ANIMATED_ICONS,
- ENABLE_SNIPPETS_FLAG,
- ENABLE_SNIPPETS_OVERRIDE,
-} from '@core/constant/featureFlags';
-import { useSettingsState } from '@core/constant/SettingsState';
-import { triggerFocusInput } from '@core/directive/focusInput';
-import { hapticImpact } from '@core/mobile/haptics';
-import { openFilePicker } from '@core/util/upload';
-import { ICON_ANIMATION_DURATION_MS } from '@icon/animation';
-import IconGear from '@icon/macro-gear.svg';
-import WideCalendarIcon from '@icon/wide-calendar.svg';
-import { AnimatedCallIcon } from '@icon/wide-call';
-import { AnimatedChannelIcon } from '@icon/wide-channel';
-import { AnimatedEmailIcon } from '@icon/wide-email';
-import { AnimatedFileMdIcon } from '@icon/wide-fileMd';
-import { AnimatedFolderIcon } from '@icon/wide-folder';
-import { AnimatedInboxIcon } from '@icon/wide-inbox';
-import { AnimatedSearchIcon } from '@icon/wide-search';
-import { AnimatedStarIcon } from '@icon/wide-star';
-import { AnimatedTaskIcon } from '@icon/wide-task';
-import CaretUpIcon from '@phosphor/caret-up.svg';
-import PlusIcon from '@phosphor/plus.svg';
-import UploadIcon from '@phosphor/upload-simple.svg';
-import { useLocation } from '@solidjs/router';
-import { cn } from '@ui';
-import { createSignal, Show } from 'solid-js';
-import { Dynamic } from 'solid-js/web';
-import { useSplitLayout } from '../split-layout/layout';
-import {
- type MobileTouchIconComponent,
- MobileTouchMenu,
- type MobileTouchMenuItem,
-} from './MobileTouchMenu';
-import { pressPulse } from './pressPulse';
-
-// Keeps the directive import from being tree-shaken / lint-flagged.
-false && pressPulse;
-
-type DockId = ListView | 'calendar';
-
-type MobileDockButtonProps = {
- icon: MobileTouchIconComponent;
- label?: string;
- /** Accessible name for icon-only buttons (falls back to `label`). */
- ariaLabel?: string;
- onClick: () => void;
- active?: boolean;
- ref?: HTMLButtonElement | ((el: HTMLButtonElement) => void);
- onTouchMove?: (e: TouchEvent) => void;
- onTouchEnd?: (e: TouchEvent) => void;
- iconClass?: string;
- class?: string;
- /** Plain svg icons (e.g. Caret) don't accept `triggerAnimation`. */
- animateIcon?: boolean;
-};
-
-function MobileDockButton(props: MobileDockButtonProps) {
- const [animating, setAnimating] = createSignal(false);
-
- return (
- <button
- type="button"
- ref={props.ref}
- aria-label={props.ariaLabel ?? props.label}
- use:pressPulse
- onPointerDown={() => {
- hapticImpact('light');
- if (props.animateIcon !== false) {
- setAnimating(true);
- setTimeout(() => setAnimating(false), ICON_ANIMATION_DURATION_MS);
- }
- }}
- // Fires on release; the press pulse holds the on-state while touched.
- onClick={() => {
- props.onClick();
- }}
- onTouchMove={props.onTouchMove}
- onTouchEnd={props.onTouchEnd}
- class={cn(
- 'island pointer-events-auto flex items-center justify-center',
- props.active && 'text-accent',
- props.class
- )}
- >
- <div class={cn('size-6 [&_svg]:size-6 shrink-0', props.iconClass)}>
- {props.animateIcon === false ? (
- <Dynamic component={props.icon} />
- ) : (
- <Dynamic component={props.icon} triggerAnimation={animating()} />
- )}
- </div>
- <Show when={props.label}>
- <span class="text-sm font-medium truncate">{props.label}</span>
- </Show>
- </button>
- );
-}
-
-function MoreViewsMenu(props: {
- isActive: (id: DockId) => boolean;
- onNavigate: (id: DockId) => void;
-}) {
- const { settingsOpen, toggleSettings } = useSettingsState();
- const calendarUiEnabled = useCalendarUiFlag();
-
- // Rows render top → bottom, ending at the thumb, so bottom → top this reads
- // Inbox, Email, Channels, Documents, Tasks, Agents, Calls, Folders — keep
- // that order in sync with the Create menu's matching entries.
- const moreViews = (): Array<{
- id: DockId;
- label: string;
- icon: MobileTouchIconComponent;
- }> => [
- { id: 'folders', label: 'Folders', icon: AnimatedFolderIcon },
- { id: 'calls', label: 'Calls', icon: AnimatedCallIcon },
- { id: 'agents', label: 'Agents', icon: AnimatedStarIcon },
- { id: 'tasks', label: 'Tasks', icon: AnimatedTaskIcon },
- ...(calendarUiEnabled()
- ? [{ id: 'calendar' as const, label: 'Calendar', icon: WideCalendarIcon }]
- : []),
- { id: 'documents', label: 'Documents', icon: AnimatedFileMdIcon },
- { id: 'channels', label: 'Channels', icon: AnimatedChannelIcon },
- { id: 'mail', label: 'Email', icon: AnimatedEmailIcon },
- { id: 'inbox', label: 'Inbox', icon: AnimatedInboxIcon },
- ];
-
- return (
- <MobileTouchMenu
- triggerIcon={CaretUpIcon}
- footerLabel="Views"
- footerCaretClass="mr-11"
- items={[
- {
- id: 'settings',
- label: 'Settings',
- icon: IconGear,
- active: settingsOpen,
- animateIcon: false,
- onSelect: toggleSettings,
- },
- ...moreViews().map((item) => ({
- id: item.id,
- label: item.label,
- icon: item.icon,
- active: () => props.isActive(item.id),
- onSelect: () => props.onNavigate(item.id),
- })),
- ]}
- />
- );
-}
-
-// Rows render top → bottom, ending at the thumb, so bottom → top this reads
-// Email, Message, Doc, Task, Agent, Folder, Code, Canvas, Snippet — keep the
-// entries both menus share in sync with the Views menu order. Each name
-// resolves to its first CREATABLE_BLOCKS match, which drops the
-// desktop-only 'Channel' entry: it shares the 'channel' blockName with
-// 'Message', so on mobile both would run the same create action.
-const CREATE_MENU_BLOCK_ORDER: CreatableBlock['blockName'][] = [
- 'snippet',
- 'canvas',
- 'code',
- 'project',
- 'chat',
- 'task',
- 'md',
- 'channel',
- 'email',
-];
-
-function CreateMenu() {
- const snippetsFlag = useFeatureFlag(ENABLE_SNIPPETS_FLAG, {
- enabledOverride: ENABLE_SNIPPETS_OVERRIDE,
- });
- const handleFileUpload = useHandleFileUpload();
-
- const blocks = () =>
- CREATE_MENU_BLOCK_ORDER.filter(
- (blockName) => blockName !== 'snippet' || snippetsFlag().enabled
- ).flatMap((blockName) => {
- const block = CREATABLE_BLOCKS.find((b) => b.blockName === blockName);
- return block ? [block] : [];
- });
-
- const uploadItem: MobileTouchMenuItem = {
- id: 'upload-file',
- label: 'Upload file',
- icon: UploadIcon,
- animateIcon: false,
- onSelect: () => {
- openFilePicker({ multiple: true }, async (files) => {
- await handleFileUpload(files, false);
- });
- },
- };
-
- return (
- <MobileTouchMenu
- triggerIcon={PlusIcon}
- footerLabel="Create"
- items={[
- uploadItem,
- ...blocks().map((block) => {
- const useAnimatedIcon = ENABLE_ANIMATED_ICONS && block.animatedIcon;
- return {
- id: block.blockName,
- label: block.label,
- icon: useAnimatedIcon ? block.animatedIcon : block.icon,
- animateIcon: !!useAnimatedIcon,
- onSelect: () => runCreateAction(block.blockName),
- };
- }),
- ]}
- />
- );
-}
-
-type MobileDockProps = {
- class?: string;
-};
-
-export function MobileDock(props: MobileDockProps) {
- const { openWithSplit } = useSplitLayout();
- const location = useLocation();
-
- const isActive = (id: DockId) => {
- const activeContent = globalSplitManager()?.activeSplit()?.content();
- if (!activeContent) {
- const segments = location.pathname.split('/').filter(Boolean);
- return segments[segments.length - 1] === id;
- }
- return activeContent.id === id;
- };
-
- const navigate = (id: DockId) => {
- // If we're already on a soup/component view, replace in-place (mergeHistory)
- // so the tab switch doesn't push a new entry into the swipe-back BG slot.
- // From any other view (document, task, etc.) treat it as forward navigation
- // so the user can swipe back to where they were.
- const fgContent = globalSplitManager()?.activeSplit()?.content();
- const isOnSoupView = fgContent?.type === 'component';
- openWithSplit({ type: 'component', id }, { mergeHistory: isOnSoupView });
- };
-
- return (
- <div
- class={cn(
- 'flex items-center gap-3 px-(--mobile-chrome-gutter)',
- props.class
- )}
- >
- <MobileDockButton
- icon={AnimatedInboxIcon}
- ariaLabel="Inbox"
- class="size-10 rounded-full shrink-0"
- active={isActive('inbox')}
- onClick={() => navigate('inbox')}
- />
- <MobileDockButton
- icon={AnimatedEmailIcon}
- ariaLabel="Email"
- class="size-10 rounded-full shrink-0"
- active={isActive('mail')}
- onClick={() => navigate('mail')}
- />
- <MobileDockButton
- icon={AnimatedSearchIcon}
- label="Search"
- class="h-10 flex-1 min-w-0 gap-1 rounded-full px-3"
- onClick={() => {
- SearchState.maybeResetState();
- // Arm the focus before opening: iOS only raises the keyboard for a
- // synchronous focus inside the gesture, so triggerFocusInput grabs a
- // temp input now and transfers to the real search input once the
- // dock region portals it in.
- triggerFocusInput(() =>
- document.getElementById('mobile-search-input')
- );
- SearchState.open();
- }}
- />
- <MoreViewsMenu isActive={isActive} onNavigate={navigate} />
- <CreateMenu />
- </div>
- );
-}
diff --git a/apps/web/src/components/app/mobile/MobileSearchRow.tsx b/apps/web/src/components/app/mobile/MobileSearchRow.tsx
new file mode 100644
index 0000000000..d3a5083dc2
--- /dev/null
+++ b/apps/web/src/components/app/mobile/MobileSearchRow.tsx
@@ -0,0 +1,117 @@
+import {
+ CREATABLE_BLOCKS,
+ type CreatableBlock,
+ runCreateAction,
+} from '@app/features/command/Launcher';
+import {
+ MobileAskAiButton,
+ MobileSearchInput,
+} from '@app/features/command/mobile/MobileSearchInput';
+import { SearchState } from '@app/features/command/mobile/mobileSearchState';
+import { useFeatureFlag } from '@app/lib/analytics/posthog';
+import { useHandleFileUpload } from '@app/util/handleFileUpload';
+import {
+ ENABLE_ANIMATED_ICONS,
+ ENABLE_SNIPPETS_FLAG,
+ ENABLE_SNIPPETS_OVERRIDE,
+} from '@core/constant/featureFlags';
+import { openFilePicker } from '@core/util/upload';
+import PlusIcon from '@phosphor/plus.svg';
+import UploadIcon from '@phosphor/upload-simple.svg';
+import { cn } from '@ui';
+import { Show } from 'solid-js';
+import { MobileTouchMenu, type MobileTouchMenuItem } from './MobileTouchMenu';
+
+// Rows render top → bottom, ending at the thumb, so bottom → top this reads
+// Email, Message, Doc, Task, Agent, Folder, Code, Canvas, Snippet. Each name
+// resolves to its first CREATABLE_BLOCKS match, which drops the
+// desktop-only 'Channel' entry: it shares the 'channel' blockName with
+// 'Message', so on mobile both would run the same create action.
+const CREATE_MENU_BLOCK_ORDER: CreatableBlock['blockName'][] = [
+ 'snippet',
+ 'canvas',
+ 'code',
+ 'project',
+ 'chat',
+ 'task',
+ 'md',
+ 'channel',
+ 'email',
+];
+
+function CreateMenu() {
+ const snippetsFlag = useFeatureFlag(ENABLE_SNIPPETS_FLAG, {
+ enabledOverride: ENABLE_SNIPPETS_OVERRIDE,
+ });
+ const handleFileUpload = useHandleFileUpload();
+
+ const blocks = () =>
+ CREATE_MENU_BLOCK_ORDER.filter(
+ (blockName) => blockName !== 'snippet' || snippetsFlag().enabled
+ ).flatMap((blockName) => {
+ const block = CREATABLE_BLOCKS.find((b) => b.blockName === blockName);
+ return block ? [block] : [];
+ });
+
+ const uploadItem: MobileTouchMenuItem = {
+ id: 'upload-file',
+ label: 'Upload file',
+ icon: UploadIcon,
+ animateIcon: false,
+ onSelect: () => {
+ openFilePicker({ multiple: true }, async (files) => {
+ await handleFileUpload(files, false);
+ });
+ },
+ };
+
+ return (
+ <MobileTouchMenu
+ triggerIcon={PlusIcon}
+ // This row sits above the views row, so anchor the menu to the trigger
+ // rather than the bottom chrome row.
+ position="trigger-bottom"
+ footerLabel="Create"
+ items={[
+ uploadItem,
+ ...blocks().map((block) => {
+ const useAnimatedIcon = ENABLE_ANIMATED_ICONS && block.animatedIcon;
+ return {
+ id: block.blockName,
+ label: block.label,
+ icon: useAnimatedIcon ? block.animatedIcon : block.icon,
+ animateIcon: !!useAnimatedIcon,
+ onSelect: () => runCreateAction(block.blockName),
+ };
+ }),
+ ]}
+ />
+ );
+}
+
+type MobileSearchRowProps = {
+ class?: string;
+};
+
+/**
+ * The search/create row: the persistent search bar ("Search or ask AI...")
+ * with the Create menu to its right. It sits in the accessory slot above the
+ * views row (see MobileViewsRow), where per-view inputs (chat, compose, email
+ * reply) replace it. While a search session is active the Create menu's slot
+ * is taken by the "Ask AI" button.
+ */
+export function MobileSearchRow(props: MobileSearchRowProps) {
+ return (
+ <div
+ class={cn(
+ 'flex items-center gap-3 px-(--mobile-chrome-gutter)',
+ props.class
+ )}
+ >
+ <MobileSearchInput />
+ <Show when={!SearchState.isOpen()} fallback={<MobileAskAiButton />}>
+ <CreateMenu />
+ </Show>
+ </div>
+ );
+}
diff --git a/apps/web/src/components/app/mobile/MobileViewsRow.tsx b/apps/web/src/components/app/mobile/MobileViewsRow.tsx
new file mode 100644
index 0000000000..57f44e9ac5
--- /dev/null
+++ b/apps/web/src/components/app/mobile/MobileViewsRow.tsx
@@ -0,0 +1,78 @@
+import { useCalendarUiFlag } from '@app/features/calendar/use-calendar-ui-flag';
+import { SearchState } from '@app/features/command/mobile/mobileSearchState';
+import { virtualKeyboardVisible } from '@core/mobile/virtualKeyboard';
+import IconGear from '@icon/macro-gear.svg';
+import WideCalendarIcon from '@icon/wide-calendar.svg';
+import BellIcon from '@phosphor/bell-simple.svg';
+import { createMemo } from 'solid-js';
+import { FloatRegion } from './float-regions/FloatRegion';
+import { MobileBottomEdgeFade } from './MobileEdgeFade';
+import {
+ useForegroundMobileView,
+ useMobileNavNavigate,
+} from './mobile-nav-state';
+import type { MobileNavViewId } from './mobile-nav-views';
+import { type PillTabItem, PillTabs } from './PillTabs';
+
+/**
+ * The global views pill row in the bottom (dock) slot, beneath the search
+ * row. Doubles as the search scope switcher: it stays visible while the
+ * search session is active (even with the keyboard up).
+ */
+export function MobileViewsRow() {
+ const calendarUiEnabled = useCalendarUiFlag();
+ // Highlight only the view that is actually the foreground split content —
+ // with an entity (or anything else) open, no pill is active.
+ const activeView = useForegroundMobileView();
+ const navigate = useMobileNavNavigate();
+
+ const items = createMemo<PillTabItem<MobileNavViewId>[]>(() => [
+ {
+ value: 'inbox',
+ label: <BellIcon class="size-5" />,
+ iconOnly: true,
+ ariaLabel: 'Inbox',
+ },
+ ...(calendarUiEnabled()
+ ? [
+ {
+ value: 'calendar' as const,
+ label: <WideCalendarIcon class="size-5" />,
+ iconOnly: true,
+ ariaLabel: 'Calendar',
+ },
+ ]
+ : []),
+ { value: 'mail', label: 'Email' },
+ { value: 'channels', label: 'Messages' },
+ { value: 'documents', label: 'Files' },
+ { value: 'agents', label: 'Agents' },
+ { value: 'tasks', label: 'Tasks' },
+ { value: 'calls', label: 'Calls' },
+ {
+ value: 'settings',
+ label: <IconGear class="size-5" />,
+ iconOnly: true,
+ ariaLabel: 'Settings',
+ },
+ ]);
+
+ return (
+ <FloatRegion
+ region="dock"
+ active={() => !virtualKeyboardVisible() || SearchState.isOpen()}
+ >
+ <MobileBottomEdgeFade />
+ {/* Full-bleed strip: the pills scroll to the device edge, and the
+ chrome gutter travels with the scrolled content instead of insetting
+ the scroll box. */}
+ <PillTabs
+ scrollable
+ contentClass="px-(--mobile-chrome-gutter)"
+ items={items()}
+ value={activeView()}
+ onChange={navigate}
+ />
+ </FloatRegion>
+ );
+}
diff --git a/apps/web/src/components/app/mobile/PillTabs.tsx b/apps/web/src/components/app/mobile/PillTabs.tsx
index 5cf00bf03e..7c94defe12 100644
--- a/apps/web/src/components/app/mobile/PillTabs.tsx
+++ b/apps/web/src/components/app/mobile/PillTabs.tsx
@@ -9,6 +9,7 @@ import {
For,
type JSXElement,
on,
+ onCleanup,
Show,
} from 'solid-js';
import { MobileTouchMenu } from './MobileTouchMenu';
@@ -21,27 +22,328 @@ false && pressPulse;
const PILL_CLASS =
'h-10 shrink-0 whitespace-nowrap rounded-full px-3.5 text-xs font-medium island';
+/** Square variant for icon-only pills (the label is the icon). */
+const ICON_PILL_CLASS = 'flex w-10 items-center justify-center px-0';
+
+const MENU_STRIP_CLASS =
+ // The vertical padding gives the pills' shadow room inside the clipping
+ // box; the matching negative margin cancels its layout impact.
+ 'pointer-events-auto relative -my-3 flex w-full min-w-0 flex-1 max-w-full items-center gap-2 py-3 pr-2';
+
+const SCROLL_STRIP_CLASS =
+ // The scrollport clips at its box, so the vertical padding must cover the
+ // full light-mode island shadow bloom (4px offset + 8px spread + 20px blur
+ // = 32px); the matching negative margin cancels its layout impact. The
+ // strip is tap-transparent so the enlarged halo never swallows touches
+ // meant for content behind it — the content row re-enables pointer events
+ // for the pills. A pointer-events:none scroller receives no native scroll
+ // gestures, so panning is driven from the content row's pointer events
+ // instead (see the pan handler in ScrollablePillTabs).
+ 'pointer-events-none -my-8 flex w-full min-w-0 flex-1 max-w-full items-center overflow-x-auto py-8 scrollbar-hidden';
+
+/** Momentum decay time constant after a pan release. */
+const MOMENTUM_TIME_CONSTANT_MS = 325;
+/** Momentum below this speed (px/ms) stops animating. */
+const MOMENTUM_MIN_VELOCITY = 0.02;
+/** Movement below this is a tap, not a pan. */
+const PAN_SLOP_PX = 8;
+
export type PillTabItem<T extends string = string> = {
value: T;
label: JSXElement;
+ /** Render as a compact square pill — pass the icon as `label`. */
+ iconOnly?: boolean;
+ /** Accessible name; required for icon-only pills. */
+ ariaLabel?: string;
+};
+
+type PillTabsProps<T extends string> = {
+ items: readonly PillTabItem<T>[];
+ value: T | undefined;
+ onChange: (value: T) => void;
+ /**
+ * Overflow strategy: by default pills that do not fit collapse into an
+ * ellipsis menu; when set the strip scrolls horizontally instead and the
+ * active pill is kept scrolled into view.
+ */
+ scrollable?: boolean;
+ /** Extra classes on the scroll strip (the outer, clipping box). */
+ class?: string;
+ /**
+ * Scrollable variant only: extra classes on the row that scrolls inside
+ * the strip. Edge padding belongs here rather than on the strip so a
+ * full-bleed strip scrolls its pills to the device edge and the padding
+ * scrolls with the content (trailing padding on the scroll container
+ * itself is also unreliable in WebKit).
+ */
+ contentClass?: string;
+ /**
+ * Scrollable variant only: rendered as the first child of the scroll
+ * content, ahead of the pills. For a control pinned at the strip's start
+ * while pills scroll beneath it (e.g. the filter-drawer button), give it
+ * `sticky left-(--mobile-chrome-gutter) z-10` — the keep-active-in-view
+ * logic accounts for a sticky leading element's width.
+ */
+ leading?: JSXElement;
};
/**
* Horizontal strip of pill tabs — the shared mobile-chrome tab style used by
- * the dock's floating regions (soup-view tabs, search category filters) and
- * the settings bottom bar. Each option is its own island-styled pill.
+ * the dock's floating regions (view pills, soup-view tabs) and header strips.
+ * Each option is its own island-styled pill.
*
* Presentational only: the caller owns selection state via `value`/`onChange`
* and wraps this with its own layout (gutters, sibling controls, region
- * chrome). Pills that do not fit move into the overflow menu.
+ * chrome).
*/
-export function PillTabs<T extends string>(props: {
- items: readonly PillTabItem<T>[];
- value: T | undefined;
- onChange: (value: T) => void;
- /** Extra classes on the scroll strip. */
- class?: string;
+export function PillTabs<T extends string>(props: PillTabsProps<T>) {
+ return (
+ <Show
+ when={props.scrollable}
+ fallback={<MenuOverflowPillTabs {...props} />}
+ >
+ <ScrollablePillTabs {...props} />
+ </Show>
+ );
+}
+
+function PillButton<T extends string>(props: {
+ item: PillTabItem<T>;
+ active: boolean;
+ onSelect: () => void;
}) {
+ return (
+ <button
+ type="button"
+ use:pressPulse
+ data-checked={props.active ? '' : undefined}
+ aria-pressed={props.active}
+ aria-label={props.item.ariaLabel}
+ class={cn(
+ PILL_CLASS,
+ props.item.iconOnly && ICON_PILL_CLASS,
+ props.active
+ ? 'bg-accent text-surface ring-accent'
+ : 'text-ink-extra-muted'
+ )}
+ onPointerDown={(e) => {
+ e.preventDefault();
+ }}
+ // Haptic on activation, not on touch-down: a pan that starts on a pill
+ // never activates it (the pan handler suppresses the click), so it must
+ // not buzz either.
+ onClick={() => {
+ hapticImpact('light');
+ props.onSelect();
+ }}
+ >
+ {props.item.label}
+ </button>
+ );
+}
+
+function ScrollablePillTabs<T extends string>(props: PillTabsProps<T>) {
+ const [stripRef, setStripRef] = createSignal<HTMLDivElement>();
+ const [contentRef, setContentRef] = createSignal<HTMLDivElement>();
+
+ // Horizontal panning, driven manually from the content row's pointer
+ // events: the strip is pointer-events:none (so its shadow halo passes
+ // touches through), which also opts it out of native scroll gestures.
+ // Only gestures that begin on the pill row (the content row's box) pan;
+ // a vertical start leaves the pointer alone, and capturing the pointer on
+ // engage retargets the eventual click away from the pill underneath.
+ createEffect(() => {
+ const strip = stripRef();
+ const content = contentRef();
+ if (!strip || !content) return;
+
+ let pointerId: number | undefined;
+ let panning = false;
+ let lastGestureWasPan = false;
+ let startX = 0;
+ let startY = 0;
+ let startScrollLeft = 0;
+ let lastX = 0;
+ let lastTime = 0;
+ let velocity = 0; // px/ms in scrollLeft direction
+ let momentumFrame: number | undefined;
+
+ const stopMomentum = () => {
+ if (momentumFrame !== undefined) cancelAnimationFrame(momentumFrame);
+ momentumFrame = undefined;
+ };
+
+ const onPointerDown = (e: PointerEvent) => {
+ if (!e.isPrimary) return;
+ stopMomentum();
+ pointerId = e.pointerId;
+ panning = false;
+ lastGestureWasPan = false;
+ startX = lastX = e.clientX;
+ startY = e.clientY;
+ startScrollLeft = strip.scrollLeft;
+ lastTime = e.timeStamp;
+ velocity = 0;
+ };
+
+ const onPointerMove = (e: PointerEvent) => {
+ if (e.pointerId !== pointerId) return;
+ const dx = e.clientX - startX;
+ const dy = e.clientY - startY;
+ if (!panning) {
+ if (Math.abs(dx) < PAN_SLOP_PX) return;
+ if (Math.abs(dx) <= Math.abs(dy)) {
+ // Vertical intent — not ours.
+ pointerId = undefined;
+ return;
+ }
+ panning = true;
+ content.setPointerCapture(e.pointerId);
+ }
+ const dt = e.timeStamp - lastTime;
+ if (dt > 0) {
+ velocity = 0.8 * ((lastX - e.clientX) / dt) + 0.2 * velocity;
+ }
+ lastX = e.clientX;
+ lastTime = e.timeStamp;
+ strip.scrollLeft = startScrollLeft - dx;
+ };
+
+ const onPointerEnd = (e: PointerEvent) => {
+ if (e.pointerId !== pointerId) return;
+ pointerId = undefined;
+ if (!panning) return;
+ panning = false;
+ lastGestureWasPan = true;
+ let v = velocity;
+ let last = performance.now();
+ const step = (now: number) => {
+ const dt = now - last;
+ last = now;
+ strip.scrollLeft += v * dt;
+ v *= Math.exp(-dt / MOMENTUM_TIME_CONSTANT_MS);
+ const atEdge =
+ strip.scrollLeft <= 0 ||
+ strip.scrollLeft >= strip.scrollWidth - strip.clientWidth;
+ momentumFrame =
+ Math.abs(v) > MOMENTUM_MIN_VELOCITY && !atEdge
+ ? requestAnimationFrame(step)
+ : undefined;
+ };
+ momentumFrame = requestAnimationFrame(step);
+ };
+
+ // A pointer-events:none scroller misses trackpad/wheel scrolling too.
+ const onWheel = (e: WheelEvent) => {
+ if (Math.abs(e.deltaX) <= Math.abs(e.deltaY)) return;
+ e.preventDefault();
+ strip.scrollLeft += e.deltaX;
+ };
+
+ // A pan is not a tap: keep touchend watchers (usePreserveFocusOnButtonTaps
+ // re-dispatches clicks for [data-keep-keyboard] buttons) from activating
+ // the pill the finger happened to end on.
+ const onTouchEnd = (e: TouchEvent) => {
+ if (!lastGestureWasPan) return;
+ e.stopPropagation();
+ if (e.cancelable) e.preventDefault();
+ };
+
+ content.addEventListener('pointerdown', onPointerDown);
+ content.addEventListener('pointermove', onPointerMove);
+ content.addEventListener('pointerup', onPointerEnd);
+ content.addEventListener('pointercancel', onPointerEnd);
+ content.addEventListener('wheel', onWheel, { passive: false });
+ content.addEventListener('touchend', onTouchEnd, { passive: false });
+
+ onCleanup(() => {
+ stopMomentum();
+ content.removeEventListener('pointerdown', onPointerDown);
+ content.removeEventListener('pointermove', onPointerMove);
+ content.removeEventListener('pointerup', onPointerEnd);
+ content.removeEventListener('pointercancel', onPointerEnd);
+ content.removeEventListener('wheel', onWheel);
+ content.removeEventListener('touchend', onTouchEnd);
+ });
+ });
+
+ // Keep the active pill scrolled into view as the selection or list changes,
+ // snapping it inside the content row's edge padding rather than flush to
+ // the strip edge.
+ createEffect(
+ on(
+ () =>
+ [
+ props.value,
+ props.items.map((item) => item.value).join('\u0000'),
+ ] as const,
+ () => {
+ queueMicrotask(() => {
+ const strip = stripRef();
+ const active = strip?.querySelector<HTMLElement>('[data-checked]');
+ if (!strip || !active) return;
+ const content = strip.firstElementChild as HTMLElement | null;
+ const contentStyle = content ? getComputedStyle(content) : undefined;
+ const padLeft = Number.parseFloat(contentStyle?.paddingLeft || '0');
+ const padRight = Number.parseFloat(contentStyle?.paddingRight || '0');
+ const gap = Number.parseFloat(contentStyle?.columnGap || '0') || 0;
+ // A sticky leading control stays pinned over the scrolled content,
+ // so the snap origin moves past it.
+ const leading = content?.firstElementChild as HTMLElement | null;
+ const pinnedInset =
+ leading && getComputedStyle(leading).position === 'sticky'
+ ? leading.offsetWidth + gap
+ : 0;
+ const minLeft = padLeft + pinnedInset;
+ // Rect arithmetic rather than offsetLeft: the strip is not
+ // positioned (see SCROLL_STRIP_CLASS), so it is no offsetParent.
+ const stripLeft = strip.getBoundingClientRect().left;
+ const itemRect = active.getBoundingClientRect();
+ const itemLeft = itemRect.left - stripLeft + strip.scrollLeft;
+ const itemRight = itemLeft + itemRect.width;
+ const viewRight = strip.scrollLeft + strip.clientWidth;
+ if (itemLeft - minLeft < strip.scrollLeft) {
+ strip.scrollTo({ left: itemLeft - minLeft, behavior: 'smooth' });
+ } else if (itemRight + padRight > viewRight) {
+ strip.scrollTo({
+ left: itemRight + padRight - strip.clientWidth,
+ behavior: 'smooth',
+ });
+ }
+ });
+ }
+ )
+ );
+
+ return (
+ <div ref={setStripRef} class={cn(SCROLL_STRIP_CLASS, props.class)}>
+ <div
+ ref={setContentRef}
+ // Tapping a pill while typing (e.g. switching search scope) must not
+ // drop the virtual keyboard — see usePreserveFocusOnButtonTaps.
+ data-keep-keyboard
+ class={cn(
+ 'pointer-events-auto touch-none select-none flex w-max shrink-0 items-center gap-2 pr-2',
+ props.contentClass
+ )}
+ >
+ {props.leading}
+ <For each={props.items}>
+ {(item) => (
+ <PillButton
+ item={item}
+ active={props.value === item.value}
+ onSelect={() => props.onChange(item.value)}
+ />
+ )}
+ </For>
+ </div>
+ </div>
+ );
+}
+
+/** Pills that do not fit move into an ellipsis overflow menu. */
+function MenuOverflowPillTabs<T extends string>(props: PillTabsProps<T>) {
const [stripRef, setStripRef] = createSignal<HTMLDivElement>();
const [measureRef, setMeasureRef] = createSignal<HTMLDivElement>();
const [overflowMeasureRef, setOverflowMeasureRef] =
@@ -135,39 +437,15 @@ export function PillTabs<T extends string>(props: {
});
return (
- <div
- ref={setStripRef}
- class={cn(
- // The padding gives the pills' shadow room inside the clipping box;
- // the matching negative margin cancels its layout impact.
- 'pointer-events-auto relative -my-3 flex w-full min-w-0 flex-1 max-w-full items-center gap-2 py-3 pr-2',
- props.class
- )}
- >
+ <div ref={setStripRef} class={cn(MENU_STRIP_CLASS, props.class)}>
<For each={visibleItems()}>
- {(item) => {
- const active = () => props.value === item.value;
- return (
- <button
- type="button"
- use:pressPulse
- data-checked={active() ? '' : undefined}
- class={cn(
- PILL_CLASS,
- active()
- ? 'bg-accent text-surface ring-accent'
- : 'text-ink-extra-muted'
- )}
- onPointerDown={(e) => {
- e.preventDefault();
- hapticImpact('light');
- }}
- onClick={() => props.onChange(item.value)}
- >
- {item.label}
- </button>
- );
- }}
+ {(item) => (
+ <PillButton
+ item={item}
+ active={props.value === item.value}
+ onSelect={() => props.onChange(item.value)}
+ />
+ )}
</For>
<Show when={overflowItems().length > 0}>
<MobileTouchMenu
@@ -193,7 +471,7 @@ export function PillTabs<T extends string>(props: {
type="button"
ref={(el) => measuredButtons.set(item.value, el)}
tabIndex={-1}
- class={PILL_CLASS}
+ class={cn(PILL_CLASS, item.iconOnly && ICON_PILL_CLASS)}
>
{item.label}
</button>
diff --git a/apps/web/src/components/app/mobile/float-regions/FloatRegion.tsx b/apps/web/src/components/app/mobile/float-regions/FloatRegion.tsx
index 8fba864efb..d8067e4aaf 100644
--- a/apps/web/src/components/app/mobile/float-regions/FloatRegion.tsx
+++ b/apps/web/src/components/app/mobile/float-regions/FloatRegion.tsx
@@ -6,8 +6,9 @@ import { type FloatRegionName, FloatRegions } from './float-region-state';
export type FloatRegionProps = ParentProps<{
region: FloatRegionName;
- /** Higher wins; ties go to the most recently mounted contributor. Default 0. */
- priority?: number;
+ /** Higher wins; ties go to the most recently mounted contributor. Default 0.
+ * Pass an accessor to change priority reactively without remounting. */
+ priority?: number | (() => number);
/** Extra reactive gate, e.g. `() => !virtualKeyboardVisible()`. */
active?: () => boolean;
}>;
diff --git a/apps/web/src/components/app/mobile/float-regions/float-region-state.ts b/apps/web/src/components/app/mobile/float-regions/float-region-state.ts
index ff8edaea7a..17b3090e74 100644
--- a/apps/web/src/components/app/mobile/float-regions/float-region-state.ts
+++ b/apps/web/src/components/app/mobile/float-regions/float-region-state.ts
@@ -9,14 +9,20 @@ export type FloatRegionName = (typeof FLOAT_REGIONS)[number];
type FloatRegionRegistration = {
/** Unique identity; comparisons use this rather than object reference. */
id: symbol;
- /** Higher wins; ties go to the most recently mounted contributor. */
- priority: number;
+ /** Higher wins; ties go to the most recently mounted contributor. May be
+ * reactive so a contributor can take a region over without remounting. */
+ priority: number | Accessor<number>;
/** Reactive gate: panel activity, keyboard visibility, etc. */
isActive: Accessor<boolean>;
/** Mount order, used to break priority ties. */
seq: number;
};
+const priorityOf = (registration: FloatRegionRegistration) =>
+ typeof registration.priority === 'function'
+ ? registration.priority()
+ : registration.priority;
+
export type FloatRegionRegistrationHandle = {
/** Reactive: whether this contribution currently wins its region. */
isWinner: () => boolean;
@@ -66,8 +72,8 @@ function createFloatRegionsState() {
if (!r.isActive()) continue;
if (
!winner ||
- r.priority > winner.priority ||
- (r.priority === winner.priority && r.seq > winner.seq)
+ priorityOf(r) > priorityOf(winner) ||
+ (priorityOf(r) === priorityOf(winner) && r.seq > winner.seq)
) {
winner = r;
}
diff --git a/apps/web/src/components/app/mobile/mobile-nav-state.ts b/apps/web/src/components/app/mobile/mobile-nav-state.ts
new file mode 100644
index 0000000000..c968d792b4
--- /dev/null
+++ b/apps/web/src/components/app/mobile/mobile-nav-state.ts
@@ -0,0 +1,40 @@
+import { globalSplitManager } from '@app/signal/splitLayout';
+import { useSettingsState } from '@core/constant/SettingsState';
+import { type Accessor, createMemo } from 'solid-js';
+import { useSplitLayout } from '../split-layout/layout';
+import { isMobileNavViewId, type MobileNavViewId } from './mobile-nav-views';
+
+/** The foreground content's id when it is itself a nav view. */
+export function useForegroundMobileView(): Accessor<
+ MobileNavViewId | undefined
+> {
+ return createMemo(() => {
+ const content = globalSplitManager()?.activeSplit()?.content();
+ if (!content || content.type !== 'component') return undefined;
+ return isMobileNavViewId(content.id) ? content.id : undefined;
+ });
+}
+
+/**
+ * Navigate to a nav view from the pill row. Same semantics as the old dock
+ * buttons: switching between component views replaces in-place (mergeHistory)
+ * so the switch doesn't push a swipe-back entry; from an entity it is forward
+ * navigation so the user can swipe back. Settings toggles the settings split.
+ */
+export function useMobileNavNavigate(): (id: MobileNavViewId) => void {
+ const { openWithSplit } = useSplitLayout();
+ const { toggleSettings } = useSettingsState();
+
+ return (id) => {
+ if (id === 'settings') {
+ toggleSettings();
+ return;
+ }
+ const fgContent = globalSplitManager()?.activeSplit()?.content();
+ const isOnComponentView = fgContent?.type === 'component';
+ openWithSplit(
+ { type: 'component', id },
+ { mergeHistory: isOnComponentView }
+ );
+ };
+}
diff --git a/apps/web/src/components/app/mobile/mobile-nav-views.test.ts b/apps/web/src/components/app/mobile/mobile-nav-views.test.ts
new file mode 100644
index 0000000000..9c3adfe1f0
--- /dev/null
+++ b/apps/web/src/components/app/mobile/mobile-nav-views.test.ts
@@ -0,0 +1,14 @@
+import { describe, expect, it } from 'vitest';
+import { isMobileNavViewId } from './mobile-nav-views';
+
+describe('isMobileNavViewId', () => {
+ it('accepts pill-row views and rejects everything else', () => {
+ expect(isMobileNavViewId('inbox')).toBe(true);
+ expect(isMobileNavViewId('channels')).toBe(true);
+ expect(isMobileNavViewId('settings')).toBe(true);
+ expect(isMobileNavViewId('commands')).toBe(false);
+ expect(isMobileNavViewId('folders')).toBe(false);
+ expect(isMobileNavViewId('search')).toBe(false);
+ expect(isMobileNavViewId('md')).toBe(false);
+ });
+});
diff --git a/apps/web/src/components/app/mobile/mobile-nav-views.ts b/apps/web/src/components/app/mobile/mobile-nav-views.ts
new file mode 100644
index 0000000000..cc751ab3ec
--- /dev/null
+++ b/apps/web/src/components/app/mobile/mobile-nav-views.ts
@@ -0,0 +1,21 @@
+/**
+ * Views reachable from the mobile navigation pill row, in display order.
+ * `settings` navigates through the settings state (not `openWithSplit`), and
+ * `calendar` is additionally gated by the calendar UI flag.
+ */
+export const MOBILE_NAV_VIEW_IDS = [
+ 'inbox',
+ 'calendar',
+ 'mail',
+ 'channels',
+ 'documents',
+ 'agents',
+ 'tasks',
+ 'calls',
+ 'settings',
+] as const;
+
+export type MobileNavViewId = (typeof MOBILE_NAV_VIEW_IDS)[number];
+
+export const isMobileNavViewId = (id: string): id is MobileNavViewId =>
+ (MOBILE_NAV_VIEW_IDS as readonly string[]).includes(id);
diff --git a/apps/web/src/components/app/split-layout/componentRegistry.tsx b/apps/web/src/components/app/split-layout/componentRegistry.tsx
index 29530010b4..fd63c9a5db 100644
--- a/apps/web/src/components/app/split-layout/componentRegistry.tsx
+++ b/apps/web/src/components/app/split-layout/componentRegistry.tsx
@@ -463,6 +463,7 @@ registerComponent(
);
})
);
+
/** END - APP ROUTES */
registerComponent('loading', () => <LoadingBlock />);
diff --git a/apps/web/src/components/app/split-layout/components/SplitHeader.tsx b/apps/web/src/components/app/split-layout/components/SplitHeader.tsx
index b6fe9d4f85..bc4b7f31cb 100644
--- a/apps/web/src/components/app/split-layout/components/SplitHeader.tsx
+++ b/apps/web/src/components/app/split-layout/components/SplitHeader.tsx
@@ -510,9 +510,6 @@ export function SplitHeader(props: {
// On mobile the header overlays the panel body as a transparent strip
// of floating islands
'touch:absolute touch:inset-x-0 touch:top-(--safe-top) touch:z-mobile-nav-bar touch:h-11.25 touch:overflow-visible touch:pointer-events-none',
- isTouchDevice() &&
- isListViewID(panel.handle.content().id) &&
- 'hidden',
isMobile() &&
!isNativeMobilePlatform() &&
'touch:top-[calc(var(--safe-top)+6px)]',
@@ -556,11 +553,15 @@ export function SplitHeader(props: {
</div>
}
>
- {/* Back/forward island. */}
+ {/* Back/forward island. List views never render the back button
+ (their header hosts the filter pills instead), so the island
+ hides for them even when history allows going back. */}
<HeaderIsland
class={cn(
'relative gap-0 px-1',
- !panel.handle.canGoBack() && 'hidden'
+ (!panel.handle.canGoBack() ||
+ isListViewID(panel.handle.content().id)) &&
+ 'hidden'
)}
>
<Show when={!isListViewID(panel.handle.content().id)}>
diff --git a/apps/web/src/components/app/split-layout/components/SplitPanel.tsx b/apps/web/src/components/app/split-layout/components/SplitPanel.tsx
index 5b9638d128..74495817dd 100644
--- a/apps/web/src/components/app/split-layout/components/SplitPanel.tsx
+++ b/apps/web/src/components/app/split-layout/components/SplitPanel.tsx
@@ -150,11 +150,9 @@ export function SplitPanel(props: SplitPanelProps) {
return Boolean(splits && splits.length > 1);
}
- const shouldHideSplitHeader = createMemo(
- () =>
- (isTouchDevice() && isListViewID(props.handle.content().id)) ||
- isSoloSettings()
- );
+ // On mobile the header stays visible for list views too: it hosts the
+ // floating filter-pill strip (see MobileSoupViewTabs).
+ const shouldHideSplitHeader = createMemo(() => isSoloSettings());
const splitFocusStyling = () =>
!isTouchDevice() &&
diff --git a/apps/web/src/features/channel/Bots/BotCreatePage.tsx b/apps/web/src/features/channel/Bots/BotCreatePage.tsx
index 0a09084f6e..3bc39f8df8 100644
--- a/apps/web/src/features/channel/Bots/BotCreatePage.tsx
+++ b/apps/web/src/features/channel/Bots/BotCreatePage.tsx
@@ -170,7 +170,10 @@ export function BotCreate(props: { channelId?: string; onBack: () => void }) {
return (
<div class="size-full overflow-y-auto bg-surface text-ink">
- <main class="mx-auto w-full max-w-[560px] px-8 pt-14 pb-24 touch:px-5 touch:pt-8 touch:pb-12">
+ {/* Mobile chrome insets live inside the scroll content so the page is
+ full-frame, matching SettingsPage (this create view only renders
+ inside the settings panel). */}
+ <main class="mx-auto w-full max-w-[560px] px-8 pt-14 pb-24 touch:px-5 touch:pt-[calc(var(--mobile-content-inset-top,0px)+2rem)] touch:pb-[calc(var(--mobile-content-inset-bottom,0px)+3rem)]">
<Button
type="button"
variant="ghost"
diff --git a/apps/web/src/features/channel/Bots/BotDetailPage.tsx b/apps/web/src/features/channel/Bots/BotDetailPage.tsx
index 1f86550335..042089f965 100644
--- a/apps/web/src/features/channel/Bots/BotDetailPage.tsx
+++ b/apps/web/src/features/channel/Bots/BotDetailPage.tsx
@@ -169,7 +169,10 @@ export function BotDetail(props: { botId: string; onBack: () => void }) {
return (
<>
<div class="size-full overflow-y-auto bg-surface text-ink">
- <main class="mx-auto w-full max-w-[560px] px-8 pt-14 pb-24 touch:px-5 touch:pt-8 touch:pb-12">
+ {/* Mobile chrome insets live inside the scroll content so the page is
+ full-frame, matching SettingsPage (this detail view only renders
+ inside the settings panel). */}
+ <main class="mx-auto w-full max-w-[560px] px-8 pt-14 pb-24 touch:px-5 touch:pt-[calc(var(--mobile-content-inset-top,0px)+2rem)] touch:pb-[calc(var(--mobile-content-inset-bottom,0px)+3rem)]">
<Button
type="button"
variant="ghost"
diff --git a/apps/web/src/features/command/mobile/MobileSearch.tsx b/apps/web/src/features/command/mobile/MobileSearch.tsx
deleted file mode 100644
index 5c3fcb2bae..0000000000
--- a/apps/web/src/features/command/mobile/MobileSearch.tsx
+++ /dev/null
@@ -1,527 +0,0 @@
-/** Mobile Search is based on Command Menu. */
-
-import { openChatWithMessage } from '@app/features/chat/ChatWithAgentButton';
-import { CommandItem } from '@app/features/command/CommandItem';
-import type { CategoryFilter } from '@app/features/command/types';
-import {
- type CommandMenuItem,
- isAskAiItem,
- isCommandItem,
- isEntityItem,
- type PaginationControls,
- useCommandItems,
-} from '@app/features/command/useCommandItems';
-import { openEntityInSplitFromUnifiedList } from '@app/features/next-soup/utils';
-import { FloatRegion } from '@components/app/mobile/float-regions/FloatRegion';
-import { type PillTabItem, PillTabs } from '@components/app/mobile/PillTabs';
-import { useSplitLayout } from '@components/app/split-layout/layout';
-import { TailSpinner } from '@core/component/TailSpinner';
-import { itemToBlockName } from '@core/constant/allBlocks';
-import { getActiveCommandsFromScope } from '@core/hotkey/getCommands';
-import { runCommand } from '@core/hotkey/utils';
-import { debouncedDependent } from '@core/util/debounce';
-import { windowSearchMatch } from '@core/util/searchHighlight';
-import { openExternalUrl } from '@core/util/url';
-import {
- Entity,
- type EntityData,
- isGithubPrEntity,
- type WithSearch,
-} from '@entity';
-import { SearchContent } from '@entity/extractors-search/search-content';
-import WideStar from '@icon/wide-star.svg';
-import ArrowLeft from '@phosphor/arrow-left.svg';
-import SearchIcon from '@phosphor-icons/core/regular/magnifying-glass.svg?component-solid';
-import { useFullTextSearch } from '@queries/soup/useFullTextSearch';
-import { Layer } from '@ui';
-import {
- createSignal,
- Match,
- onCleanup,
- onMount,
- Show,
- Switch,
-} from 'solid-js';
-import { type VirtualizerHandle, VList } from 'virtua/solid';
-import { SearchState } from './mobileSearchState';
-
-const LOAD_MORE_THRESHOLD = 120;
-
-const CATEGORIES: PillTabItem<CategoryFilter>[] = [
- { value: 'all', label: 'All' },
- { value: 'commands', label: 'Command' },
- { value: 'chats', label: 'Agents' },
- { value: 'documents', label: 'Files' },
- { value: 'tasks', label: 'Tasks' },
- { value: 'channels', label: 'Channels' },
- { value: 'dms', label: 'People' },
-];
-
-export function MobileSearchOuter() {
- return (
- <Show when={SearchState.isOpen()}>
- <MobileSearchInner />
- </Show>
- );
-}
-
-function MobileSearchInner() {
- const { openWithSplit } = useSplitLayout();
-
- const query = debouncedDependent(SearchState.query, 60);
-
- const commandItems = useCommandItems(query, SearchState.categoryFilter, {
- showSearchRow: false,
- commandScopeCommands: SearchState.commandScopeCommands,
- searchActive: SearchState.isOpen,
- });
- const { results: fullTextResults, isLoading: isFullTextLoading } =
- useFullTextSearch(SearchState.query);
-
- function handleItemAction(item: CommandMenuItem, openInNewSplit = false) {
- if (!item) return;
-
- if (isCommandItem(item)) {
- const command = item.data;
-
- // Check if this is a multi-stage command
- if (command.activateCommandScopeId) {
- // Get commands from the nested scope
- const nestedCommands = getActiveCommandsFromScope(
- command.activateCommandScopeId,
- {
- sortByScopeLevel: false,
- hideShadowedCommands: false,
- hideCommandsWithoutHotkeys: false,
- limitToCurrentScope: true,
- // Commands run from taps, not keystrokes, so the search input
- // being focused (virtual keyboard up) shouldn't filter them.
- ignoreInputFocused: true,
- }
- );
- SearchState.setQuery('');
- SearchState.setCommandScopeCommands(nestedCommands);
- return;
- }
-
- // Regular command - close and run. Clear any active command scope so a
- // quick reopen (within the reset threshold) doesn't restore a stale
- // nested-command list.
- SearchState.clearCommandScopeCommands();
- SearchState.close();
- SearchState.setQuery('');
- runCommand(command);
- return;
- }
-
- // Handle entity items (documents, channels, chats, etc.)
- if (isEntityItem(item)) {
- // TODO(dev-rb/github): Route GitHub PRs to /pr.
- if (isGithubPrEntity(item.data)) {
- openExternalUrl(item.data.metadata.url);
- SearchState.close();
- SearchState.setQuery('');
- return;
- }
-
- if (item.data.type !== 'foreign') {
- const blockName = itemToBlockName(item.data);
- if (blockName) {
- openWithSplit(
- { type: blockName, id: item.id },
- {
- referredFrom: 'kommand-menu',
- preferNewSplit: openInNewSplit,
- }
- );
- }
- }
- SearchState.close();
- SearchState.setQuery('');
- return;
- }
-
- if (isAskAiItem(item)) {
- // Opens a new chat split and sends the query immediately.
- openChatWithMessage(item.query);
- SearchState.close();
- SearchState.setQuery('');
- return;
- }
-
- SearchState.close();
- SearchState.setQuery('');
- }
-
- function handleFullTextItemAction(entity: WithSearch<EntityData>) {
- const hitData = entity.search.contentHitData?.[0];
- const location =
- hitData && 'location' in hitData ? hitData.location : undefined;
- openEntityInSplitFromUnifiedList(entity, { location });
- SearchState.onMenuClose();
- SearchState.close();
- }
-
- function handleAskAi(query: string) {
- // Opens a new chat split and sends the query immediately — same wiring as
- // the desktop command menu's "Ask AI about" row.
- openChatWithMessage(query);
- SearchState.close();
- SearchState.setQuery('');
- }
-
- const handleBack = () => {
- if (SearchState.isInCommandScope()) {
- SearchState.clearCommandScopeCommands();
- } else {
- SearchState.close();
- }
- };
-
- const showTabs = () =>
- !SearchState.isInCommandScope() && !SearchState.isFullTextMode();
-
- return (
- <>
- {/* Full-frame results surface. Sits below the float host (see
- --z-index-mobile-search) so the input (dock region) and tabs (accessory
- region) float over it; bottom padding clears that floating chrome. */}
- <Layer depth={0}>
- <div class="fixed inset-0 z-mobile-search flex flex-col bg-surface pt-(--safe-top) pr-(--safe-right) pb-[calc(var(--virtual-keyboard-height)+var(--mobile-content-inset-bottom))] pl-(--safe-left)">
- <ResultsContainer
- nameMatchItems={commandItems.items()}
- pagination={commandItems.pagination}
- fullTextItems={fullTextResults()}
- onSelectNameMatch={(item, openInNewSplit) =>
- handleItemAction(item, openInNewSplit)
- }
- onSelectFullText={(entity) => handleFullTextItemAction(entity)}
- isLoading={() =>
- SearchState.isFullTextMode() && isFullTextLoading()
- }
- onFullTextSearch={() => SearchState.enableFullTextMode()}
- onAskAi={handleAskAi}
- query={SearchState.query}
- />
- </div>
- </Layer>
-
- {/* Category filter tabs → accessory region (above the input). */}
- <Show when={showTabs()}>
- <FloatRegion
- region="accessory"
- priority={100}
- active={() => SearchState.isOpen()}
- >
- <CategoryFilterTabs />
- </FloatRegion>
- </Show>
-
- {/* Search input → dock region. High priority so it wins over the dock
- while search is open, regardless of keyboard visibility. */}
- <FloatRegion
- region="dock"
- priority={100}
- active={() => SearchState.isOpen()}
- >
- <SearchInputBar onBack={handleBack} />
- </FloatRegion>
- </>
- );
-}
-
-function SearchInputBar(props: { onBack: () => void }) {
- // Focus (and the iOS keyboard) is driven by triggerFocusInput from the dock
- // Search button, which targets this input by id once it mounts here.
- return (
- <div class="pointer-events-auto px-(--mobile-chrome-gutter)">
- <div class="island flex h-11 items-center gap-1 rounded-full pr-3 pl-1">
- <button
- type="button"
- class="flex size-9 shrink-0 items-center justify-center rounded-full text-ink-muted"
- onClick={props.onBack}
- aria-label="Back"
- title="Back (Esc)"
- >
- <ArrowLeft class="size-5" />
- </button>
- <input
- id="mobile-search-input"
- type="text"
- enterkeyhint="search"
- class="h-full min-w-0 flex-1 border-0 bg-transparent text-ink outline-none ring-0 placeholder:text-ink-placeholder focus:outline-none focus:ring-0"
- placeholder="Search..."
- value={SearchState.query()}
- onInput={(e) => SearchState.setQuery(e.currentTarget.value)}
- onKeyDown={(e) => {
- // Enter (the keyboard's Search key) activates full-text search,
- // same as the "Full-text search for ..." row. Not while an IME
- // composition is being confirmed, and not while picking a nested
- // command's options, where the input filters commands.
- if (e.key !== 'Enter' || e.isComposing) return;
- if (SearchState.isInCommandScope()) return;
- SearchState.enableFullTextMode();
- // Drop the virtual keyboard so the results get the full frame.
- e.currentTarget.blur();
- }}
- />
- </div>
- </div>
- );
-}
-
-function ResultsContainer(props: {
- nameMatchItems: CommandMenuItem[];
- pagination: PaginationControls;
- fullTextItems: WithSearch<EntityData>[];
- onSelectNameMatch: (item: CommandMenuItem, openInNewSplit: boolean) => void;
- onSelectFullText: (entity: WithSearch<EntityData>) => void;
- isLoading?: () => boolean;
- onFullTextSearch: () => void;
- onAskAi: (query: string) => void;
- query: () => string;
-}) {
- let ref: HTMLDivElement | undefined;
- const [availableHeight, setAvailableHeight] = createSignal(0);
-
- onMount(() => {
- if (!ref) return;
- const observer = new ResizeObserver((entries) => {
- const entry = entries[0];
- if (entry) setAvailableHeight(entry.contentRect.height);
- });
- observer.observe(ref);
- onCleanup(() => observer.disconnect());
- });
-
- const [rowHeight, setRowHeight] = createSignal(0);
- const heightOfNameMatchList = () => props.nameMatchItems.length * rowHeight();
-
- // In full-text mode or a command scope the input drives search/command
- // filtering, so neither action row applies.
- const actionsApply = () =>
- !SearchState.isFullTextMode() && !SearchState.isInCommandScope();
- // "Ask AI about" needs something to ask about.
- const wantAskAiButton = () =>
- actionsApply() && props.query().trim().length > 0;
- const actionButtonCount = () =>
- (actionsApply() ? 1 : 0) + (wantAskAiButton() ? 1 : 0);
-
- // There's room for the action rows when the name-match list doesn't fill the
- // frame (with no matches the list isn't rendered, so there's always room).
- const hasRoomForActions = () => {
- if (props.nameMatchItems.length === 0) return true;
- const rh = rowHeight();
- return (
- rh > 0 &&
- availableHeight() - heightOfNameMatchList() > rh * actionButtonCount()
- );
- };
-
- const showFullTextSearchButton = () => actionsApply() && hasRoomForActions();
- const showAskAiButton = () => wantAskAiButton() && hasRoomForActions();
-
- return (
- <div class="flex-1 min-h-0 bg-surface" ref={ref}>
- <Switch>
- <Match when={props.isLoading?.()}>
- <div class="flex items-center gap-2 text-ink-muted h-10 px-2">
- <TailSpinner width={16} height={16} />
- Searching...
- </div>
- </Match>
- <Match
- when={
- SearchState.isFullTextMode() &&
- SearchState.query().trim().length < 3
- }
- >
- <div class="flex items-center gap-2 text-ink-muted h-10 px-2">
- At least 3 characters required for search.
- </div>
- </Match>
- <Match
- when={SearchState.isFullTextMode() && props.fullTextItems.length > 0}
- >
- <div class="h-full overflow-hidden">
- <FullTextResultList
- items={props.fullTextItems}
- onSelect={props.onSelectFullText}
- />
- </div>
- </Match>
- <Match
- when={
- !SearchState.isFullTextMode() && props.nameMatchItems.length > 0
- }
- >
- <div
- class="overflow-hidden shrink-0"
- style={{
- height:
- heightOfNameMatchList() < availableHeight()
- ? `${heightOfNameMatchList()}px`
- : `100%`,
- }}
- >
- <VirtualizedCommandList
- items={props.nameMatchItems}
- onSelect={props.onSelectNameMatch}
- onRowHeightMeasured={setRowHeight}
- pagination={props.pagination}
- />
- </div>
- </Match>
- <Match when={true}>
- <div class="flex items-center text-ink-extra-muted text-sm h-10 px-2">
- No matches
- </div>
- </Match>
- </Switch>
-
- <Show when={showFullTextSearchButton()}>
- <button
- onClick={props.onFullTextSearch}
- class="flex w-full min-w-0 items-center px-2 text-sm gap-2 h-10"
- >
- <SearchIcon class="size-5 p-0.5 shrink-0" />
- <span class="truncate">
- {`Full-text search for${props.query() ? ` "${props.query()}"` : ''}`}
- </span>
- </button>
- </Show>
-
- <Show when={showAskAiButton()}>
- <button
- onClick={() => props.onAskAi(props.query())}
- class="flex w-full min-w-0 items-center px-2 text-sm gap-2 h-10"
- >
- <WideStar class="size-5 p-0.5 shrink-0" />
- <span class="truncate">{`Ask AI about "${props.query()}"`}</span>
- </button>
- </Show>
- </div>
- );
-}
-
-/** Virtualized command list for name-match results */
-function VirtualizedCommandList(props: {
- items: CommandMenuItem[];
- onSelect: (item: CommandMenuItem, openInNewSplit: boolean) => void;
- onRowHeightMeasured?: (height: number) => void;
- pagination: PaginationControls;
-}) {
- let virtualizerHandle: VirtualizerHandle | undefined;
- const loadMoreNearEnd = () => {
- if (
- !virtualizerHandle ||
- !props.pagination.hasMore() ||
- props.pagination.isLoadingMore()
- )
- return;
- const remaining =
- virtualizerHandle.scrollSize -
- virtualizerHandle.scrollOffset -
- virtualizerHandle.viewportSize;
- if (remaining <= LOAD_MORE_THRESHOLD) void props.pagination.loadMore();
- };
-
- return (
- <VList
- ref={(handle) => {
- virtualizerHandle = handle;
- }}
- data={props.items}
- style={{ height: '100%' }}
- class="scrollbar-hidden overscroll-none"
- onScroll={loadMoreNearEnd}
- >
- {(item, index) => (
- <div
- ref={(el) => {
- if (index() !== 0) return;
- const onMeasured = props.onRowHeightMeasured;
- if (!onMeasured) return;
- const ro = new ResizeObserver(([entry]) => {
- if (entry) onMeasured(entry.contentRect.height);
- });
- ro.observe(el);
- onCleanup(() => ro.disconnect());
- }}
- >
- <CommandItem
- item={item}
- index={index()}
- selected={false}
- onSelect={props.onSelect}
- />
- </div>
- )}
- </VList>
- );
-}
-
-/** Virtualized list for full-text search results */
-function FullTextResultList(props: {
- items: WithSearch<EntityData>[];
- onSelect: (entity: WithSearch<EntityData>) => void;
-}) {
- return (
- <VList
- data={props.items}
- style={{ height: '100%' }}
- class="scrollbar-hidden"
- >
- {(entity) => (
- <FullTextResultItem entity={entity} onSelect={props.onSelect} />
- )}
- </VList>
- );
-}
-
-/** Single full-text search result: entity header + first content snippet */
-function FullTextResultItem(props: {
- entity: WithSearch<EntityData>;
- onSelect: (entity: WithSearch<EntityData>) => void;
-}) {
- const hit = () => {
- const hitData = props.entity.search.contentHitData?.[0];
- return hitData
- ? // The char length for windowSearchMatch below is a magic number to keep the highlighted result in approximately the first two lines of the search content snippet. In the future it would be nice to handle this more robustly.
- { ...hitData, content: windowSearchMatch(hitData.content, 50) }
- : null;
- };
-
- return (
- <div
- class="p-2 text-sm font-semibold"
- onClick={() => props.onSelect(props.entity)}
- >
- <div class="flex items-center gap-2 min-w-0">
- <div class="size-5 p-0.5 flex items-center justify-center text-ink-muted shrink-0">
- <Entity.Icon entity={props.entity} />
- </div>
- <Entity.Title entity={props.entity} />
- </div>
- <Show when={hit()}>
- {(h) => (
- <div class="ml-7 mt-1 border-l-2 border-edge-muted pl-2 text-xs font-normal text-ink-muted">
- <SearchContent twoLineClamp hit={h()} />
- </div>
- )}
- </Show>
- </div>
- );
-}
-
-function CategoryFilterTabs() {
- return (
- <div class="flex items-center px-(--mobile-chrome-gutter)">
- <PillTabs
- items={CATEGORIES}
- value={SearchState.categoryFilter()}
- onChange={(value) => SearchState.setCategoryFilter(value)}
- />
- </div>
- );
-}
diff --git a/apps/web/src/features/command/mobile/MobileSearchInput.tsx b/apps/web/src/features/command/mobile/MobileSearchInput.tsx
new file mode 100644
index 0000000000..1179240a3a
--- /dev/null
+++ b/apps/web/src/features/command/mobile/MobileSearchInput.tsx
@@ -0,0 +1,155 @@
+import { openChatWithMessage } from '@app/features/chat/ChatWithAgentButton';
+import { useForegroundMobileView } from '@components/app/mobile/mobile-nav-state';
+import { pressPulse } from '@components/app/mobile/pressPulse';
+import { hapticImpact } from '@core/mobile/haptics';
+import { usePreserveFocusOnButtonTaps } from '@core/mobile/usePreserveFocusOnButtonTaps';
+import XIcon from '@phosphor/x.svg';
+import { cn } from '@ui';
+import { createEffect, on, Show } from 'solid-js';
+import { SearchState } from './mobileSearchState';
+
+// Keeps the directive import from being tree-shaken / lint-flagged.
+false && pressPulse;
+
+// This component only writes the global session state. The active split's
+// bridge effect (see soup-view-context) mirrors the session into its own
+// search text — the input mounts once in the stable app chrome, outside
+// every split, so navigation never remounts (and thereby blurs) it.
+
+/**
+ * Sends the current query to a new AI chat and ends the search session.
+ * Same wiring as the desktop command menu's "Ask AI about" row.
+ */
+function submitAskAi() {
+ const query = SearchState.query().trim();
+ if (!query) return;
+ openChatWithMessage(query);
+ SearchState.close();
+}
+
+/**
+ * "Ask AI" island shown beside the search input while a session is active
+ * (it takes the Create button's slot — see MobileSearchRow).
+ */
+export function MobileAskAiButton() {
+ const hasQuery = () => SearchState.query().trim().length > 0;
+
+ return (
+ <button
+ type="button"
+ use:pressPulse
+ // Tapping it must not drop the keyboard before the action runs.
+ data-keep-keyboard
+ class={cn(
+ 'island pointer-events-auto flex h-11 shrink-0 items-center rounded-full px-3 text-xs font-medium',
+ hasQuery() ? 'text-ink' : 'text-ink-extra-muted'
+ )}
+ onPointerDown={(e) => {
+ // Keep the input focused while tapping.
+ e.preventDefault();
+ hapticImpact('light');
+ }}
+ onClick={() => submitAskAi()}
+ >
+ Ask AI
+ </button>
+ );
+}
+
+/**
+ * The dock search bar ("Search or ask AI..."). Focusing it opens the search
+ * session while the current view stays visible; a typed term feeds the
+ * selected view's own soup search directly.
+ */
+export function MobileSearchInput() {
+ let inputRef: HTMLInputElement | undefined;
+ let containerRef: HTMLDivElement | undefined;
+
+ const foregroundView = useForegroundMobileView();
+
+ // iOS ends the editing session (dropping the keyboard) while processing
+ // button taps even when pointerdown is cancelled. This keeps the input
+ // focused for taps on its own buttons and on [data-keep-keyboard] regions —
+ // notably the pill rows, so switching search scope keeps the keyboard up.
+ usePreserveFocusOnButtonTaps(() => containerRef);
+
+ const hasQuery = () => SearchState.query().trim().length > 0;
+
+ // External closes (result taps, back navigation) drop the keyboard too.
+ createEffect(() => {
+ if (!SearchState.isOpen() && document.activeElement === inputRef) {
+ inputRef?.blur();
+ }
+ });
+
+ // Opening an entity ends the session (and with it the view's search
+ // filter). Pill navigation between views keeps it —
+ // and a session started while an entity is already foregrounded stays too
+ // (both sides undefined).
+ createEffect(
+ on(foregroundView, (view, prevView) => {
+ if (!SearchState.isOpen()) return;
+ if (prevView !== undefined && view === undefined) SearchState.close();
+ })
+ );
+
+ const handleClear = () => {
+ if (hasQuery()) {
+ SearchState.setQuery('');
+ inputRef?.focus();
+ } else {
+ SearchState.close();
+ }
+ };
+
+ return (
+ <div
+ ref={(el) => {
+ containerRef = el;
+ }}
+ class="island pointer-events-auto flex h-11 min-w-0 flex-1 items-center gap-1 rounded-full pr-1 pl-4"
+ >
+ <input
+ id="mobile-search-input"
+ ref={(el) => {
+ inputRef = el;
+ }}
+ type="text"
+ enterkeyhint="search"
+ class="h-full min-w-0 flex-1 border-0 bg-transparent text-ink outline-none ring-0 placeholder:text-ink-placeholder focus:outline-none focus:ring-0"
+ placeholder="Search or ask AI..."
+ value={SearchState.query()}
+ onFocus={() => {
+ if (!SearchState.isOpen()) SearchState.open();
+ }}
+ onBlur={() => {
+ // Dismissing the keyboard with nothing typed ends the session; with
+ // a query it stays so the scoped results remain browsable.
+ if (SearchState.isOpen() && !hasQuery()) SearchState.close();
+ }}
+ onInput={(e) => SearchState.setQuery(e.currentTarget.value)}
+ onKeyDown={(e) => {
+ // Enter (the keyboard's Search key) drops the keyboard; the view is
+ // already live-filtering. Not while an IME composition is being
+ // confirmed.
+ if (e.key !== 'Enter' || e.isComposing) return;
+ e.currentTarget.blur();
+ }}
+ />
+ <Show when={SearchState.isOpen() || hasQuery()}>
+ <button
+ type="button"
+ class="flex size-9 shrink-0 items-center justify-center rounded-full text-ink-muted"
+ aria-label={hasQuery() ? 'Clear search' : 'Close search'}
+ onPointerDown={(e) => {
+ e.preventDefault();
+ hapticImpact('light');
+ }}
+ onClick={handleClear}
+ >
+ <XIcon class="size-4" />
+ </button>
+ </Show>
+ </div>
+ );
+}
diff --git a/apps/web/src/features/command/mobile/mobileSearchState.ts b/apps/web/src/features/command/mobile/mobileSearchState.ts
index cc962106c8..2a0afefd18 100644
--- a/apps/web/src/features/command/mobile/mobileSearchState.ts
+++ b/apps/web/src/features/command/mobile/mobileSearchState.ts
@@ -1,152 +1,54 @@
-import type { CategoryFilter } from '@app/features/command/types';
-import type { CommandWithInfo } from '@core/hotkey/getCommands';
import { createControlledOpenSignal } from '@core/util/createControlledOpenSignal';
-import { type Accessor, createSignal, type Setter } from 'solid-js';
+import { type Accessor, batch, createSignal } from 'solid-js';
-/** timestamp threshold for resetting state after menu close */
-const STATE_RESET_THRESHOLD_MS = 2_000;
-
-interface ICommandState {
- /** visibility */
+interface IMobileSearchState {
+ /**
+ * Whether a search session is active: the dock input is focused, or the
+ * user is browsing scoped results with the keyboard dismissed.
+ */
isOpen: Accessor<boolean>;
- setIsOpen: Setter<boolean>;
- toggle: () => void;
open: () => void;
close: () => void;
- /** query */
+ /** query (the dock input's live value) */
query: Accessor<string>;
- setQuery: Setter<string>;
- clearQuery: () => void;
-
- /** category filter */
- categoryFilter: Accessor<CategoryFilter>;
- setCategoryFilter: Setter<CategoryFilter>;
- resetCategoryFilter: () => void;
-
- /** command scope (for multi-stage commands) */
- commandScopeCommands: Accessor<CommandWithInfo[]>;
- setCommandScopeCommands: Setter<CommandWithInfo[]>;
- clearCommandScopeCommands: () => void;
- isInCommandScope: Accessor<boolean>;
-
- /** full text search mode */
- isFullTextMode: Accessor<boolean>;
- enableFullTextMode: () => void;
- disableFullTextMode: () => void;
-
- /** lifecycle */
- maybeResetState: () => void;
- forceReset: () => void;
- onMenuClose: () => void;
- onMenuOpen: () => void;
+ setQuery: (value: string) => void;
}
-function createSearchState(): ICommandState {
+function createMobileSearchState(): IMobileSearchState {
const [isOpen, setIsOpen] = createControlledOpenSignal(false, {
id: 'command',
});
const [query, setQuery] = createSignal('');
- const [categoryFilter, setCategoryFilter] =
- createSignal<CategoryFilter>('all');
- const [lastClosedTime, setLastClosedTime] = createSignal(0);
- const [commandScopeCommands, setCommandScopeCommands] = createSignal<
- CommandWithInfo[]
- >([]);
- const [isFullTextMode, setIsFullTextMode] = createSignal(false);
-
- function toggle() {
- setIsOpen((prev) => !prev);
- }
function open() {
setIsOpen(true);
}
+ /**
+ * Ends and resets the session. Passes `shouldReturnFocus: false` — the
+ * session opened from the input's own focus, so returning focus would
+ * re-raise the keyboard.
+ */
function close() {
- setIsOpen(false);
- }
-
- function clearQuery() {
- setQuery('');
- }
-
- function resetCategoryFilter() {
- setCategoryFilter('all');
- }
-
- function clearCommandScopeCommands() {
- setCommandScopeCommands([]);
- }
-
- function enableFullTextMode() {
- setIsFullTextMode(true);
- }
-
- function disableFullTextMode() {
- setIsFullTextMode(false);
- }
-
- function isInCommandScope() {
- return commandScopeCommands().length > 0;
- }
-
- function maybeResetState() {
- const now = Date.now();
- if (now - lastClosedTime() >= STATE_RESET_THRESHOLD_MS) {
- forceReset();
- }
- }
-
- function forceReset() {
- clearQuery();
- resetCategoryFilter();
- clearCommandScopeCommands();
- disableFullTextMode();
- setIsFullTextMode(false);
- }
-
- function onMenuClose() {
- setLastClosedTime(Date.now());
- clearCommandScopeCommands();
- disableFullTextMode();
- }
-
- function onMenuOpen() {
- clearQuery();
- setIsFullTextMode(false);
+ batch(() => {
+ setIsOpen(false, false);
+ setQuery('');
+ });
}
return {
isOpen,
- setIsOpen,
- toggle,
open,
close,
query,
setQuery,
- clearQuery,
-
- categoryFilter,
- setCategoryFilter,
- resetCategoryFilter,
-
- commandScopeCommands,
- setCommandScopeCommands,
- clearCommandScopeCommands,
- isInCommandScope,
-
- isFullTextMode,
- enableFullTextMode,
- disableFullTextMode,
-
- maybeResetState,
- forceReset,
- onMenuClose,
- onMenuOpen,
};
}
-/** Global command menu state singleton */
-export const SearchState = createSearchState();
+/**
+ * Global mobile search session singleton — the dock input whose query feeds
+ * the active view's own soup search.
+ */
+export const SearchState = createMobileSearchState();
diff --git a/apps/web/src/features/entity/composed/ListEntity.tsx b/apps/web/src/features/entity/composed/ListEntity.tsx
index 5d4a44fc4d..6eef33b6c9 100644
--- a/apps/web/src/features/entity/composed/ListEntity.tsx
+++ b/apps/web/src/features/entity/composed/ListEntity.tsx
@@ -51,7 +51,6 @@ import { NarrowLayout } from './list-entity/narrow-layout';
import {
type BaseListEntityProps,
hasSearchContentHits,
- InboxDivider,
type LayoutProps,
useCharacterCount,
useListLayout,
@@ -159,8 +158,8 @@ export function ListEntity(props: ListEntityProps) {
const listLayout = useListLayout();
const isWide = listLayout?.isWide ?? (() => true);
- const usesCondensedNarrowLayout = () =>
- !isWide() && listLayout?.narrowLayout() === 'condensed';
+ const isCondensedVariant = () => listLayout?.narrowLayout() === 'condensed';
+ const usesCondensedNarrowLayout = () => !isWide() && isCondensedVariant();
const mobileStacks = createMemo(() => {
if (!isTouchDevice()) return [];
@@ -174,28 +173,6 @@ export function ListEntity(props: ListEntityProps) {
return stackNotifications(validNotifs);
});
- // A single stack collapses into the condensed entity row only when it's a
- // new-messages-in-a-channel stack — the entity (channel) preview already
- // conveys "new messages here". Replies, mentions, and other types carry
- // per-stack context worth showing, so they render as a stack even when
- // alone.
- const shouldUnrollStacks = () => {
- const stacks = mobileStacks();
- if (stacks.length === 0) return false;
- if (stacks.length > 1) return true;
- return stacks[0].type !== 'channel_message_send';
- };
-
- // Latch to true once the stack view has ever been used (including async
- // arrivals). Prevents a jarring layout switch when notifications drop back
- // to a single condensable stack.
- const [hasBeenUnrolled, setHasBeenUnrolled] = createSignal(
- shouldUnrollStacks()
- );
- createEffect(() => {
- if (shouldUnrollStacks()) setHasBeenUnrolled(true);
- });
-
return (
<Entity.Root
entity={props.entity}
@@ -231,20 +208,17 @@ export function ListEntity(props: ListEntityProps) {
<WideLayout {...layoutProps()} />
</MaybeEntityRow>
</Match>
- <Match
- when={isTouchDevice() && (hasBeenUnrolled() || shouldUnrollStacks())}
- >
- <Entity.Notification.MobileStacks
+ <Match when={isTouchDevice() && mobileStacks().length > 0}>
+ <Entity.Notification.MobileStackRows
stacks={mobileStacks()}
entity={props.entity}
entityRowConfig={props.entityRowConfig}
/>
- <InboxDivider />
</Match>
<Match
when={
isTouchDevice() &&
- (isChannelEntity(props.entity) ||
+ ((isChannelEntity(props.entity) && !isCondensedVariant()) ||
isEmailEntity(props.entity) ||
props.showUnrollNotifications)
}
@@ -256,7 +230,7 @@ export function ListEntity(props: ListEntityProps) {
<NarrowInboxLayout {...layoutProps()} />
</MaybeEntityRow>
</Match>
- <Match when={usesCondensedNarrowLayout()}>
+ <Match when={!isMobile() && usesCondensedNarrowLayout()}>
<MaybeEntityRow
entityId={props.entity.id}
config={props.entityRowConfig}
diff --git a/apps/web/src/features/entity/composed/list-entity/narrow-condensed-layout.tsx b/apps/web/src/features/entity/composed/list-entity/narrow-condensed-layout.tsx
index ec90293a36..6a7d437801 100644
--- a/apps/web/src/features/entity/composed/list-entity/narrow-condensed-layout.tsx
+++ b/apps/web/src/features/entity/composed/list-entity/narrow-condensed-layout.tsx
@@ -1,45 +1,33 @@
-import { cn } from '@ui';
import { Show } from 'solid-js';
-import { MultiSelectCheckbox } from '../../components/MultiSelectCheckbox';
-import { UnreadIndicator } from '../../components/UnreadIndicator';
import { Entity } from '../../entity';
import { isChannelEntity } from '../../types/entity';
import { ChannelJoinButton } from './channel';
-import type { LayoutProps } from './shared';
+import { type LayoutProps, RowIndicator } from './shared';
/** Condensed row used for maximum density. */
export function NarrowCondensedLayout(props: LayoutProps) {
return (
<Entity.Layout
- class="w-full gap-x-2 items-center pr-2 grid text-sm"
+ class="w-full gap-x-1 items-center pr-2 pl-1 grid text-sm"
style={{
'grid-template-columns': 'auto 1fr',
'grid-template-rows': '36px',
'grid-template-areas': '"indicator title"',
}}
>
- <Entity.Slot placement="indicator" class="relative self-start pt-2">
- <Show when={!props.hideCheckbox}>
- <div
- class={cn('w-0 opacity-0 overflow-hidden', {
- 'w-6 opacity-100': props.checked,
- })}
- >
- <MultiSelectCheckbox
- checked={props.checked}
- onChecked={props.onChecked}
- />
- </div>
- </Show>
+ <Entity.Slot placement="indicator" class="relative">
+ <RowIndicator
+ checked={props.checked}
+ hideCheckbox={props.hideCheckbox}
+ onChecked={props.onChecked}
+ unread={props.unread}
+ />
</Entity.Slot>
<Entity.Slot
placement="title"
class="ph-no-capture flex min-w-0 items-center gap-2 truncate font-normal"
>
- <Show when={props.unread} fallback={<div class="size-2" />}>
- <UnreadIndicator active />
- </Show>
<div class="size-4 shrink-0">
<Entity.Icon entity={props.entity} streamState={props.streamState} />
</div>
diff --git a/apps/web/src/features/entity/composed/list-entity/narrow-layout.tsx b/apps/web/src/features/entity/composed/list-entity/narrow-layout.tsx
index a12f9624de..3232963f34 100644
--- a/apps/web/src/features/entity/composed/list-entity/narrow-layout.tsx
+++ b/apps/web/src/features/entity/composed/list-entity/narrow-layout.tsx
@@ -1,8 +1,5 @@
import { UserIcon } from '@core/component/UserIcon';
-import { cn } from '@ui';
import { Show } from 'solid-js';
-import { MultiSelectCheckbox } from '../../components/MultiSelectCheckbox';
-import { UnreadIndicator } from '../../components/UnreadIndicator';
import { Entity } from '../../entity';
import { SearchContent } from '../../extractors-search/search-content';
import { SearchSender } from '../../extractors-search/search-sender';
@@ -15,40 +12,31 @@ import {
import { isSearchEntity } from '../../types/search';
import { ChannelJoinButton } from './channel';
import { EmailInboxChip } from './email';
-import type { LayoutProps } from './shared';
+import { type LayoutProps, RowIndicator } from './shared';
export function NarrowLayout(props: LayoutProps) {
return (
<Entity.Layout
- class="w-full gap-x-2 items-center text-sm px-2 grid"
+ class="w-full gap-x-1 items-center text-sm pr-2 pl-1 grid"
style={{
'grid-template-columns': 'auto 1fr max-content',
'grid-template-rows': '44px',
'grid-template-areas': '"indicator title timestamp"',
}}
>
- <Entity.Slot placement="indicator" class="relative self-start pt-3">
- <Show when={!props.hideCheckbox}>
- <div
- class={cn('w-0 opacity-0 overflow-hidden', {
- 'w-6 opacity-100': props.checked,
- })}
- >
- <MultiSelectCheckbox
- checked={props.checked}
- onChecked={props.onChecked}
- />
- </div>
- </Show>
+ <Entity.Slot placement="indicator" class="relative">
+ <RowIndicator
+ checked={props.checked}
+ hideCheckbox={props.hideCheckbox}
+ onChecked={props.onChecked}
+ unread={props.unread}
+ />
</Entity.Slot>
<Entity.Slot
placement="title"
class="ph-no-capture flex items-center gap-2 truncate font-semibold"
>
- <Show when={props.unread}>
- <UnreadIndicator active />
- </Show>
<div class="size-4 shrink-0">
<Entity.Icon entity={props.entity} streamState={props.streamState} />
</div>
diff --git a/apps/web/src/features/entity/composed/list-entity/shared.tsx b/apps/web/src/features/entity/composed/list-entity/shared.tsx
index 4eda4f9ce0..908d89c74c 100644
--- a/apps/web/src/features/entity/composed/list-entity/shared.tsx
+++ b/apps/web/src/features/entity/composed/list-entity/shared.tsx
@@ -9,8 +9,11 @@ import {
type JSX,
onCleanup,
type Ref,
+ Show,
useContext,
} from 'solid-js';
+import { MultiSelectCheckbox } from '../../components/MultiSelectCheckbox';
+import { UnreadIndicator } from '../../components/UnreadIndicator';
import type { EntityRowConfig } from '../../extractors-notification';
import type { EntityData, ProjectEntity } from '../../types/entity';
import type { WithNotification } from '../../types/notification';
@@ -39,6 +42,9 @@ export interface BaseListEntityProps<E extends EntityData = EntityData> {
location?: SearchLocation
) => void;
entityRowConfig?: EntityRowConfig;
+ /** The row visually closes its group (or the list) — the next row is a
+ * group header or absent. Layouts use it to drop a trailing divider. */
+ isLastInGroup?: boolean;
}
const WIDE_BREAKPOINT = 512; // @lg container query = 32rem
@@ -125,6 +131,36 @@ export function useCharacterCount(ref: Accessor<HTMLElement | undefined>) {
return chars;
}
+/**
+ * The single-line rows' indicator cell: the multi-select checkbox while the
+ * row is checked, otherwise the unread dot in an always-reserved slot so
+ * toggling selection doesn't shift the row.
+ */
+export function RowIndicator(props: {
+ checked?: boolean;
+ hideCheckbox?: boolean;
+ onChecked?: (checked: boolean, shiftKey: boolean) => void;
+ unread: boolean;
+}) {
+ return (
+ <Show
+ when={!props.hideCheckbox && props.checked}
+ fallback={
+ <div class="size-4 p-0.5 flex items-center justify-center">
+ <UnreadIndicator active={props.unread} />
+ </div>
+ }
+ >
+ <div class="w-4 overflow-hidden">
+ <MultiSelectCheckbox
+ checked={props.checked}
+ onChecked={props.onChecked}
+ />
+ </div>
+ </Show>
+ );
+}
+
export function InboxDivider() {
return (
<div class="col-span-3 ml-(--soup-inbox-left-of-content) min-w-full min-h-px max-h-px bg-edge-muted" />
diff --git a/apps/web/src/features/entity/entity.ts b/apps/web/src/features/entity/entity.ts
index 1aea7c666a..c1b89fcf22 100644
--- a/apps/web/src/features/entity/entity.ts
+++ b/apps/web/src/features/entity/entity.ts
@@ -10,7 +10,7 @@ import { EntityTimestamp } from './extractors/entity-timestamp';
import { EntityTitle } from './extractors/entity-title';
// Notification components
import {
- MobileNotificationStacks,
+ MobileNotificationStackRows,
NotificationContent,
NotificationCount,
NotificationDescription,
@@ -43,7 +43,7 @@ export const Entity = {
Notification: {
StackRow: NotificationStackRow,
Stacks: NotificationStacks,
- MobileStacks: MobileNotificationStacks,
+ MobileStackRows: MobileNotificationStackRows,
Icon: NotificationIcon,
Sender: NotificationSender,
Content: NotificationContent,
diff --git a/apps/web/src/features/entity/extractors-notification/index.ts b/apps/web/src/features/entity/extractors-notification/index.ts
index facb1a8822..332a267031 100644
--- a/apps/web/src/features/entity/extractors-notification/index.ts
+++ b/apps/web/src/features/entity/extractors-notification/index.ts
@@ -1,5 +1,5 @@
export type { EntityRowConfig } from './mobile-notification-stacks';
-export { MobileNotificationStacks } from './mobile-notification-stacks';
+export { MobileNotificationStackRows } from './mobile-notification-stacks';
export { NotificationContent } from './notification-content';
export { NotificationCount } from './notification-count';
export { NotificationDescription } from './notification-description';
diff --git a/apps/web/src/features/entity/extractors-notification/mobile-notification-stacks.tsx b/apps/web/src/features/entity/extractors-notification/mobile-notification-stacks.tsx
index 719652ffb8..8093dd3481 100644
--- a/apps/web/src/features/entity/extractors-notification/mobile-notification-stacks.tsx
+++ b/apps/web/src/features/entity/extractors-notification/mobile-notification-stacks.tsx
@@ -10,15 +10,19 @@ import {
openNotification,
} from '@notifications';
import { cn } from '@ui';
-import { createEffect, type JSX, useContext } from 'solid-js';
+import { createEffect, type JSX, Show, useContext } from 'solid-js';
import { createStore, reconcile } from 'solid-js/store';
import { CollapsibleList } from '../components/CollapsibleList';
+import { UnreadIndicator } from '../components/UnreadIndicator';
+import { InboxDivider } from '../composed/list-entity/shared';
import { Entity } from '../entity';
import { type EntityData, isChannelEntity } from '../types/entity';
import type { WithNotification } from '../types/notification';
import { isNotificationUnread } from '../utils/notification';
import { useNotificationStackActions } from './notification-actions';
import { NotificationContent } from './notification-content';
+import { NotificationDescription } from './notification-description';
+import { NotificationIcon } from './notification-icon';
import { NotificationSenderIcon } from './notification-sender-icon';
import { NotificationTimestamp } from './notification-timestamp';
@@ -29,62 +33,93 @@ export type EntityRowConfig = {
swipeRightRevealedComponent?: JSX.Element;
};
+/**
+ * One notification stack in the NarrowInboxLayout visual language: unread dot
+ * + entity avatar, entity title + stack timestamp, and a two-line body — the
+ * stack's description ("Peter: 3 replies") over its latest content preview.
+ */
function MobileStackRowLayout(props: {
stack: NotificationStack;
entity: WithNotification<EntityData>;
unread: boolean;
onClick?: (e: MouseEvent) => void;
}) {
+ const isDirectMessage = () =>
+ isChannelEntity(props.entity) &&
+ props.entity.channelType === 'direct_message';
+
return (
<Entity.Layout
class="w-full text-sm grid"
onClick={props.onClick}
style={{
- 'grid-template-columns': 'auto 1fr auto',
- 'grid-template-rows': 'auto auto',
- 'grid-template-areas': '"icon title timestamp" "icon body body"',
+ 'grid-template-columns': 'auto 1fr 8ch',
+ 'grid-template-rows': 'auto auto auto',
+ 'grid-template-areas':
+ '"icon title timestamp" "icon body body" "icon body body"',
}}
>
<Entity.Slot
placement="icon"
- class="flex flex-col items-center gap-1 pt-3.5 pl-3 pr-2"
+ class="flex items-center self-center pr-(--soup-inbox-icon-padding-r)"
>
- <Entity.Notification.Icon
- stack={props.stack}
- class={cn('size-3.5 shrink-0', {
- 'text-accent': props.unread,
- 'text-ink-muted': !props.unread,
- })}
- />
- <span
- class={cn('size-1.5 rounded-full bg-accent shrink-0 opacity-0', {
- 'opacity-100': props.unread,
- })}
+ <UnreadIndicator
+ class="mx-(--soup-inbox-unread-indicator-padding-x) size-(--soup-inbox-unread-indicator-diameter)"
+ active={props.unread}
/>
+ <Show
+ when={isDirectMessage()}
+ fallback={
+ <div class="size-(--soup-inbox-icon-diameter) shrink-0 bg-edge-muted rounded-full flex items-center justify-center">
+ <div class="size-[calc(var(--soup-inbox-icon-diameter)*var(--soup-inbox-icon-factor))]">
+ <Entity.Icon entity={props.entity} />
+ </div>
+ </div>
+ }
+ >
+ <div class="size-11 shrink-0">
+ <Entity.Icon entity={props.entity} class="bg-edge-muted text-ink" />
+ </div>
+ </Show>
</Entity.Slot>
+
<Entity.Slot
placement="title"
- class="flex items-center gap-2 overflow-hidden min-w-0 pt-3"
+ class="ph-no-capture flex items-center gap-2 truncate font-semibold pt-3"
>
- <NotificationSenderIcon stack={props.stack} size="sm" />
- <span class="truncate min-w-0 font-medium text-ink">
- <Entity.Notification.Description stack={props.stack} />
- </span>
+ <Entity.Title entity={props.entity} />
</Entity.Slot>
+
<Entity.Slot
placement="timestamp"
- class="text-xs text-right text-ink-extra-muted pt-3 pr-4 pl-2 tabular-nums"
+ class="text-xs text-right text-ink-extra-muted font-light pt-3 pr-4 tabular-nums"
>
<NotificationTimestamp stack={props.stack} />
</Entity.Slot>
+
<Entity.Slot
placement="body"
- class={cn('text-ink-muted/80 pb-2.5 min-h-lh pr-4 text-xs', {
- truncate: props.stack.type !== 'document_mention',
- })}
+ class="flex flex-col gap-0.5 pb-2 min-h-[2lh] pr-4 min-w-0"
>
- <NotificationContent stack={props.stack} />
+ <span class="flex items-center gap-1.5 min-w-0">
+ <NotificationIcon
+ stack={props.stack}
+ class="size-3 shrink-0 text-ink-muted/60"
+ />
+ <NotificationSenderIcon stack={props.stack} size="sm" />
+ <span class="ph-no-capture truncate min-w-0 font-medium text-ink-muted">
+ <NotificationDescription stack={props.stack} />
+ </span>
+ </span>
+ <span
+ class={cn('ph-no-capture text-ink-extra-muted', {
+ truncate: props.stack.type !== 'document_mention',
+ })}
+ >
+ <NotificationContent stack={props.stack} />
+ </span>
</Entity.Slot>
+ <InboxDivider />
</Entity.Layout>
);
}
@@ -169,14 +204,23 @@ function keyStack(stack: NotificationStack): KeyedStack {
return { ...stack, id: getMostRecentNotification(stack).id };
}
-interface MobileNotificationStacksProps {
+interface MobileNotificationStackRowsProps {
stacks: NotificationStack[];
entity: WithNotification<EntityData>;
entityRowConfig?: EntityRowConfig;
visibleCount?: number;
}
-export function MobileNotificationStacks(props: MobileNotificationStacksProps) {
+/**
+ * The mobile inbox rendering of an entity's notifications: one
+ * NarrowInboxLayout-styled row per stack, using the same per-thread splitting
+ * as desktop (stackNotifications) — top-level channel sends share one row,
+ * and each thread (replies + thread mentions of one parent message) gets its
+ * own. Each row swipes and opens independently.
+ */
+export function MobileNotificationStackRows(
+ props: MobileNotificationStackRowsProps
+) {
const [stacks, setStacks] = createStore<KeyedStack[]>([]);
createEffect(() => {
@@ -185,45 +229,21 @@ export function MobileNotificationStacks(props: MobileNotificationStacksProps) {
);
});
- const isDirectMessage = () =>
- isChannelEntity(props.entity) &&
- props.entity.channelType === 'direct_message';
-
return (
- <div class="pl-(--soup-stack-row-padding-l) pb-3 relative">
- {/* Non-swipeable header */}
- <div class="grid grid-cols-[calc(var(--soup-inbox-left-of-content)-var(--soup-stack-row-padding-l))_auto] w-full text-sm items-center pr-4 py-3">
- <div class="ml-(--soup-stack-header-icon-padding-l) mr-(--soup-inbox-icon-padding-r) shrink-0 size-(--soup-stack-icon-diameter) bg-edge-muted rounded-full flex items-center justify-center">
- <Entity.Icon
- entity={props.entity}
- class={cn(
- !isDirectMessage() &&
- 'size-[calc(var(--soup-stack-icon-diameter)*var(--soup-inbox-icon-factor))]'
- )}
- />
- </div>
- <span class="flex-1 truncate font-semibold text-sm">
- <Entity.Title entity={props.entity} />
- </span>
- </div>
- {/* Stack rows */}
- <div class="rounded-lg border border-ink-muted/8 bg-ink-muted/[0.025] overflow-hidden divide-y divide-ink-muted/8">
- <CollapsibleList
- items={stacks}
- visibleCount={props.visibleCount ?? 3}
- togglePosition="bottom"
- expandText={(count) => `Show ${count} more`}
- persistKey={`notif-stacks:${props.entity.id}`}
- >
- {(stack) => (
- <MobileStackRow
- stack={stack}
- entity={props.entity}
- entityRowConfig={props.entityRowConfig}
- />
- )}
- </CollapsibleList>
- </div>
- </div>
+ <CollapsibleList
+ items={stacks}
+ visibleCount={props.visibleCount ?? 3}
+ togglePosition="bottom"
+ expandText={(count) => `Show ${count} more`}
+ persistKey={`notif-stacks:${props.entity.id}`}
+ >
+ {(stack) => (
+ <MobileStackRow
+ stack={stack}
+ entity={props.entity}
+ entityRowConfig={props.entityRowConfig}
+ />
+ )}
+ </CollapsibleList>
);
}
diff --git a/apps/web/src/features/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsx b/apps/web/src/features/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsx
index 80b187f1af..7f77048713 100644
--- a/apps/web/src/features/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsx
+++ b/apps/web/src/features/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsx
@@ -72,7 +72,10 @@ function scrollAccordionItemToTop(
});
}
-export const MobileFilterDrawer = () => {
+export const MobileFilterDrawer = (props: {
+ /** Extra classes on the trigger button (rendered only when filters exist). */
+ class?: string;
+}) => {
const { consolidatedFiltersList, resetToTabDefaults, handleAssigneeChange } =
useFilterRefinements();
@@ -332,7 +335,10 @@ export const MobileFilterDrawer = () => {
variant="ghost"
size="sm"
depth={3}
- class="island bg-chrome pointer-events-auto relative size-10 shrink-0 rounded-full [&_svg]:size-5"
+ class={cn(
+ 'island bg-chrome pointer-events-auto relative size-10 shrink-0 rounded-full [&_svg]:size-5',
+ props.class
+ )}
ref={pressPulse}
>
<SlidersHorizontalIcon />
diff --git a/apps/web/src/features/next-soup/soup-view/soup-view-context.tsx b/apps/web/src/features/next-soup/soup-view/soup-view-context.tsx
index 1dd339efe6..19ed87b3f8 100644
--- a/apps/web/src/features/next-soup/soup-view/soup-view-context.tsx
+++ b/apps/web/src/features/next-soup/soup-view/soup-view-context.tsx
@@ -5,6 +5,7 @@ import {
soupItemMatchesListView,
soupItemMatchesTagFilter,
} from '@app/constants/list-views';
+import { SearchState } from '@app/features/command/mobile/mobileSearchState';
import {
createSoupState,
type GroupMeta,
@@ -58,6 +59,7 @@ import {
ENABLE_SUPPORTED_SOUP_FOREIGN_ENTITIES_OVERRIDE,
} from '@core/constant/featureFlags';
import { useUserId } from '@core/context/user';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { idToDisplayName } from '@core/user/util';
import {
COMPANY_STAGE_OPTIONS,
@@ -783,13 +785,26 @@ export const SoupViewContextProvider: FlowComponent<
default: props.initialSearchText ?? '',
});
+ // The split's effective search text — derived, never synchronized: while
+ // the dock search session is open and this split is foregrounded, it IS the
+ // session's query (the dock input lives in the stable app chrome — see
+ // Layout — so navigation never remounts it, and the query never enters
+ // per-split state: nothing to clear on close, nothing to reapply on pill
+ // navigation). Otherwise it is the split's own persisted text, which only
+ // the desktop search bar writes.
+ const effectiveSearchText = createMemo(() =>
+ isTouchDevice() && SearchState.isOpen() && panel.handle.isActive()
+ ? SearchState.query()
+ : searchText()
+ );
+
const search = createSearchState({
soup,
filters: () => applyViewFilters(queryFilters.state),
assignees: assigneeFilter,
disableLocalSearch: () => config().disableLocalSearch ?? false,
searchPaused: sourceSearchPaused,
- searchText,
+ searchText: effectiveSearchText,
setSearchText,
});
diff --git a/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx b/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx
index b4db157f00..bf680c1779 100644
--- a/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx
+++ b/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx
@@ -287,36 +287,55 @@ export const CollapsedSoupViewTabs = () => {
);
};
+/**
+ * Filter-drawer button + per-view filter pills, rendered in the mobile split
+ * header. The strip is full-bleed: negative margins cancel the header row's
+ * gutter so pills scroll to the device edges, the gutter travels inside the
+ * scroll content, and the drawer button stays pinned at the strip's start
+ * while pills pass beneath it.
+ */
export const MobileSoupViewTabs = () => {
const listView = useCurrentListView();
return (
- <div class="flex items-center px-(--mobile-chrome-gutter)">
- <MobileFilterDrawer />
- <Switch>
- <Match when={listView() === 'companies'}>
- <MobileCompanyModeTabs />
- </Match>
- <For
- each={Object.keys(VIEW_TAB_LISTS) as (keyof typeof VIEW_TAB_LISTS)[]}
- >
- {(v) => (
- <Match when={listView() === v}>
- <MobileViewTabs view={v} />
- </Match>
- )}
- </For>
- </Switch>
- </div>
+ <Switch>
+ <Match when={listView() === 'companies'}>
+ <MobileCompanyModeTabs />
+ </Match>
+ <For
+ each={Object.keys(VIEW_TAB_LISTS) as (keyof typeof VIEW_TAB_LISTS)[]}
+ >
+ {(v) => (
+ <Match when={listView() === v}>
+ <MobileViewTabs view={v} />
+ </Match>
+ )}
+ </For>
+ </Switch>
);
};
+// Full-bleed breakout for header strips: the strip sits in the header row's
+// left flex slot, whose right edge stops short of the panel edge (row gap +
+// right-side column), so sizing it there leaves a sliver the pills can't
+// scroll over (right where the list's scrollbar sits). Instead, opt out of
+// flex sizing and span the header container itself (100cqw resolves against
+// @container/split-header = the panel width): -ml cancels the row gutter so
+// the strip runs device edge to device edge, over the scrollbar.
+const MOBILE_TAB_STRIP_CLASS =
+ '-ml-(--mobile-chrome-gutter) w-[100cqw] max-w-none flex-none';
+const MOBILE_TAB_CONTENT_CLASS = 'px-(--mobile-chrome-gutter)';
+const MOBILE_TAB_DRAWER_CLASS = 'sticky left-(--mobile-chrome-gutter) z-10';
+
const MobileCompanyModeTabs = () => {
const { viewMode, setViewMode } = useSoupView();
return (
<PillTabs
- class="pl-2"
+ scrollable
+ class={MOBILE_TAB_STRIP_CLASS}
+ contentClass={MOBILE_TAB_CONTENT_CLASS}
+ leading={<MobileFilterDrawer class={MOBILE_TAB_DRAWER_CLASS} />}
items={COMPANY_MODE_TABS}
value={viewMode()}
onChange={(value) => setViewMode(value as SoupViewMode)}
@@ -331,7 +350,10 @@ const MobileViewTabs = (props: { view: TabbedListView }) => {
return (
<PillTabs
- class="pl-2"
+ scrollable
+ class={MOBILE_TAB_STRIP_CLASS}
+ contentClass={MOBILE_TAB_CONTENT_CLASS}
+ leading={<MobileFilterDrawer class={MOBILE_TAB_DRAWER_CLASS} />}
items={VIEW_TAB_LISTS[props.view]}
value={activeValue()}
onChange={(value) => applyTabPreset(props.view, value)}
diff --git a/apps/web/src/features/next-soup/soup-view/soup-view.tsx b/apps/web/src/features/next-soup/soup-view/soup-view.tsx
index 928f1fbea7..474a5d54a3 100644
--- a/apps/web/src/features/next-soup/soup-view/soup-view.tsx
+++ b/apps/web/src/features/next-soup/soup-view/soup-view.tsx
@@ -61,7 +61,6 @@ import { CrmStageIcon } from '@companies/crm/StageIcon';
import type { CrmViewConfig } from '@companies/crm/saved-views';
import { useCrmUnavailable } from '@companies/crm/team-crm-config';
import { useGlobalNotificationSource } from '@components/app/GlobalAppState';
-import { FloatRegion } from '@components/app/mobile/float-regions/FloatRegion';
import { PullToRefresh } from '@components/app/mobile/PullToRefresh';
import { SwipableRowProvider } from '@components/app/mobile/SwipableRow';
import { CollapsibleHeaderItem } from '@components/app/split-layout/components/CollapsibleItem';
@@ -81,7 +80,6 @@ import {
} from '@core/dom-selectors';
import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';
import { TOKENS } from '@core/hotkey/tokens';
-import { isMobile } from '@core/mobile/isMobile';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { openExternalUrl } from '@core/util/url';
import { useIsKeyPressActive } from '@core/util/useIsKeyPressActive';
@@ -502,7 +500,6 @@ export const SoupView = (props: SoupViewProps) => {
const isBoardRendered = createMemo(() => isBoardMode() && !crmUnavailable());
const [narrowSearchExpanded, setNarrowSearchExpanded] = createSignal(false);
- const [mobileSearchOpen, setMobileSearchOpen] = createSignal(false);
const [searchIsCollapsed, setSearchIsCollapsed] = createSignal(false);
registerHotkey({
@@ -512,11 +509,6 @@ export const SoupView = (props: SoupViewProps) => {
registrationType: 'add',
description: 'Search',
keyDownHandler: () => {
- if (isMobile()) {
- if (mobileSearchOpen()) return false;
- setMobileSearchOpen(true);
- return true;
- }
if (narrowSearchExpanded() || !searchIsCollapsed()) return false;
setNarrowSearchExpanded(true);
return true;
@@ -534,11 +526,18 @@ export const SoupView = (props: SoupViewProps) => {
class={cn(
'h-full flex gap-3 @max-[380px]/split-header:gap-2 items-center',
{
- 'shrink-0': !narrowSearchExpanded(),
- 'flex-1 min-w-0': narrowSearchExpanded(),
+ 'shrink-0': !isTouchDevice() && !narrowSearchExpanded(),
+ 'flex-1 min-w-0': !isTouchDevice() && narrowSearchExpanded(),
+ 'w-full flex-1 min-w-0': isTouchDevice(),
}
)}
>
+ {/* On mobile/tablet the header strip hosts the filter pills instead of
+ the view title (the bottom accessory region now belongs to the
+ global views row). */}
+ <Show when={isTouchDevice()}>
+ <MobileSoupViewTabs />
+ </Show>
<Show when={!isTouchDevice() && !narrowSearchExpanded()}>
<div class="flex items-center gap-1">
<span class="text-sm font-semibold">{props.viewName}</span>
@@ -686,11 +685,6 @@ export const SoupView = (props: SoupViewProps) => {
<SoupViewList />
</Show>
</Suspense>
- <Show when={isTouchDevice()}>
- <FloatRegion region="accessory">
- <MobileSoupViewTabs />
- </FloatRegion>
- </Show>
</div>
<Suspense>
{/* The board and Preview Controller hide the AI bar: it floats over
@@ -833,7 +827,20 @@ const SoupViewListContent = (props: SoupViewListProps) => {
createEffect(() => {
const ref = soupViewRef();
if (!ref) return;
- queueMicrotask(() => ref.focus());
+ queueMicrotask(() => {
+ // Claiming the hotkey scope must not yank focus from active text entry
+ // — e.g. the mobile dock search input, whose session swaps this view in
+ // via the pill row while the user keeps typing (blurring it would drop
+ // the virtual keyboard).
+ const active = document.activeElement;
+ if (
+ active instanceof HTMLElement &&
+ (active.isContentEditable || active.matches('input, textarea'))
+ ) {
+ return;
+ }
+ ref.focus();
+ });
});
const [attachHotkeys, soupViewScope] = useHotkeyDOMScope('soup-view');
@@ -1437,6 +1444,10 @@ const SoupViewListContent = (props: SoupViewListProps) => {
soup.predicates.isActive('inbox') &&
!soup.predicates.isActive('noise')
}
+ isLastInGroup={(() => {
+ const next = rows()[i() + 1];
+ return !next || next.getIsGrouped();
+ })()}
checked={row.isSelected()}
onChecked={(
next: boolean,
diff --git a/apps/web/src/features/next-soup/soup-view/views/inbox/InboxCard.tsx b/apps/web/src/features/next-soup/soup-view/views/inbox/InboxCard.tsx
index 857107a3e6..44136144b3 100644
--- a/apps/web/src/features/next-soup/soup-view/views/inbox/InboxCard.tsx
+++ b/apps/web/src/features/next-soup/soup-view/views/inbox/InboxCard.tsx
@@ -41,7 +41,12 @@ function Root(props: RootProps): JSX.Element {
// `pl-9` reserves a fixed left column for the select checkbox (rendered
// by the row wrapper) so content never reflows when it appears on hover.
'group/inbox-item relative min-h-16 grid w-full grid-cols-[2rem_minmax(0,1fr)_max-content] grid-rows-[min-content_min-content] items-start gap-x-3 rounded-lg py-2.5 pr-2 pl-9',
-
+ // Mobile renders the same cards in slightly different visual
+ // language: a full-bleed row whose left rail holds the unread dot
+ // (see the span below) instead of the checkbox gutter, with the
+ // avatar column centered against the content. The --soup-inbox-*
+ // vars come from `.soup-list-entity` on the row wrapper.
+ 'mobile:rounded-none mobile:grid-cols-[auto_minmax(0,1fr)_max-content] mobile:items-center mobile:content-center mobile:pl-(--soup-inbox-unread) mobile:pr-3',
{
'bg-list-selected': props.selected,
'bg-list-selected-highlighted': props.selected && props.highlighted,
@@ -58,6 +63,11 @@ function Root(props: RootProps): JSX.Element {
onClick={props.onClick}
onKeyDown={onKeyDown}
>
+ {/* Mobile-only unread dot in the left rail. */}
+ <span
+ aria-hidden="true"
+ class="absolute left-(--soup-inbox-unread-indicator-padding-x) top-1/2 hidden size-(--soup-inbox-unread-indicator-diameter) -translate-y-1/2 rounded-full bg-accent opacity-0 group-data-unread/inbox-item:opacity-100 mobile:block"
+ />
{props.children}
</div>
);
@@ -74,7 +84,7 @@ function Icon(props: IconProps): JSX.Element {
return (
<span
class={cn(
- 'relative grid size-8 shrink-0 place-items-center self-start overflow-visible',
+ 'relative grid size-8 shrink-0 place-items-center self-start overflow-visible mobile:size-(--soup-inbox-icon-diameter)',
props.class
)}
>
diff --git a/apps/web/src/features/next-soup/soup-view/views/inbox/InboxListEntity.tsx b/apps/web/src/features/next-soup/soup-view/views/inbox/InboxListEntity.tsx
index 70222afe3a..a53a2d136e 100644
--- a/apps/web/src/features/next-soup/soup-view/views/inbox/InboxListEntity.tsx
+++ b/apps/web/src/features/next-soup/soup-view/views/inbox/InboxListEntity.tsx
@@ -1,6 +1,10 @@
import { useChannelsContext } from '@core/context/channels';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { MaybeEntityRow, MultiSelectCheckbox, UnreadIndicator } from '@entity';
-import type { BaseListEntityProps } from '@entity/composed/list-entity/shared';
+import {
+ type BaseListEntityProps,
+ InboxDivider,
+} from '@entity/composed/list-entity/shared';
import { cn } from '@ui';
import { createMemo, Show } from 'solid-js';
import { InboxCardLayout, toInboxCardDisplayItem } from './inbox-card-layouts';
@@ -29,7 +33,12 @@ export function InboxListEntity(props: BaseListEntityProps) {
return (
<div
- class="group/inbox-item relative mx-2"
+ // `soup-list-entity` scopes the --soup-inbox-* geometry vars (defined in
+ // ListEntity.css) that the mobile narrow-inbox restyle of InboxCard
+ // reads, and opts the row into the shared touch-press highlight. On
+ // mobile the row is full-bleed with a hairline divider, like
+ // NarrowInboxLayout.
+ class="group/inbox-item soup-list-entity relative mx-2 mobile:mx-0"
ref={props.ref}
onMouseMove={props.onMouseMove}
>
@@ -41,8 +50,12 @@ export function InboxListEntity(props: BaseListEntityProps) {
onClick={props.onClick}
/>
</MaybeEntityRow>
- {/* Select checkbox lives in the gutter reserved by the card's `pl-9`. */}
- <Show when={!props.hideCheckbox}>
+ <Show when={!props.isLastInGroup}>
+ <InboxDivider />
+ </Show>
+ {/* Select checkbox lives in the gutter reserved by the card's `pl-9`;
+ mobile has no gutter — the rail shows the unread dot instead. */}
+ <Show when={!isTouchDevice() && !props.hideCheckbox}>
<div class="group/select-control absolute left-1 top-2.5 z-10 grid size-8 place-items-center">
<Show when={!props.checked}>
<div
diff --git a/apps/web/src/features/next-soup/soup-view/views/inbox/inbox-card-layouts.tsx b/apps/web/src/features/next-soup/soup-view/views/inbox/inbox-card-layouts.tsx
index 1f5e149431..6ea6c9c33f 100644
--- a/apps/web/src/features/next-soup/soup-view/views/inbox/inbox-card-layouts.tsx
+++ b/apps/web/src/features/next-soup/soup-view/views/inbox/inbox-card-layouts.tsx
@@ -14,6 +14,7 @@ import { UserIcon } from '@core/component/UserIcon';
import { isMacroAgentId } from '@core/constant/macroAgent';
import { useUserId } from '@core/context/user';
import { getDisplayName, tryMacroId } from '@core/user';
+import { formatRelativeDay } from '@core/util/dateParser';
import { plural } from '@core/util/string';
import {
DraftBadge,
@@ -48,10 +49,11 @@ import type { ItemEntity } from '@queries/preview';
import { useBulkSaveEntityPropertiesMutation } from '@queries/properties/entity';
import { EntityType } from '@service-storage/generated/schemas';
import { Avatar, cn, Tooltip } from '@ui';
+import { parseISO } from 'date-fns';
import { createMemo, For, type JSX, Match, Show, Switch } from 'solid-js';
import { Dynamic } from 'solid-js/web';
import { match, P } from 'ts-pattern';
-import { InboxCard, type InboxCardAttachment } from './InboxCard';
+import { InboxCard } from './InboxCard';
import {
formatCompactRelativeTimestamp,
getGithubTitle,
@@ -68,6 +70,10 @@ export interface InboxCardLayoutProps {
onClick?: (event: MouseEvent) => void;
}
+/** Glyph size inside the card's avatar bubble — grows with the circle on
+ * mobile, matching the narrow rows' icon factor (see InboxCard.Icon). */
+const AVATAR_GLYPH_CLASS = 'size-4 mobile:size-6';
+
type NotificationTag = ReturnType<typeof getNotificationTag>;
/** The notification driving the row's action/sender (most recent first). */
@@ -228,38 +234,42 @@ const tagBubbleIcon = (tag: NotificationTag) =>
match(tag)
.with('new_email', () => () => (
<EntityIcon
- class="size-4"
+ class={AVATAR_GLYPH_CLASS}
targetType="email"
theme="monochrome"
size="fill"
/>
))
.with('task_assigned', () => () => (
- <EntityIcon class="size-4" targetType="task" size="fill" />
+ <EntityIcon class={AVATAR_GLYPH_CLASS} targetType="task" size="fill" />
))
.with('ai_response', () => () => (
- <EntityIcon class="size-4" targetType="chat" size="fill" />
+ <EntityIcon class={AVATAR_GLYPH_CLASS} targetType="chat" size="fill" />
))
.with('channel_mention', 'mentioned_in_document_comment', () => () => (
- <AtIcon class="size-4" />
+ <AtIcon class={AVATAR_GLYPH_CLASS} />
+ ))
+ .with('document_mention', () => () => (
+ <FilesIcon class={AVATAR_GLYPH_CLASS} />
))
- .with('document_mention', () => () => <FilesIcon class="size-4" />)
.with(
'channel_message_reply',
'replied_to_document_comment_thread',
- () => () => <ArrowBendUpLeftIcon class="size-4" />
+ () => () => <ArrowBendUpLeftIcon class={AVATAR_GLYPH_CLASS} />
)
.with('commented_on_document', () => () => (
- <ChatCircleIcon class="size-4" />
+ <ChatCircleIcon class={AVATAR_GLYPH_CLASS} />
+ ))
+ .with('channel_message_send', () => () => (
+ <ChatTextIcon class={AVATAR_GLYPH_CLASS} />
))
- .with('channel_message_send', () => () => <ChatTextIcon class="size-4" />)
.with('channel_invite', 'invite_to_team', () => () => (
- <UserPlusIcon class="size-4" />
+ <UserPlusIcon class={AVATAR_GLYPH_CLASS} />
))
- .with('call_started', () => () => <PhoneIcon class="size-4" />)
- .with('reminder', () => () => <BellSimpleIcon class="size-4" />)
+ .with('call_started', () => () => <PhoneIcon class={AVATAR_GLYPH_CLASS} />)
+ .with('reminder', () => () => <BellSimpleIcon class={AVATAR_GLYPH_CLASS} />)
.with('calendar_event_reminder', () => () => (
- <CalendarBlankIcon class="size-4" />
+ <CalendarBlankIcon class={AVATAR_GLYPH_CLASS} />
))
.with(
'github_pr_status_changed',
@@ -268,11 +278,11 @@ const tagBubbleIcon = (tag: NotificationTag) =>
'github_pr_comment',
'github_pr_mention',
'github_pr_review',
- () => () => <GithubIcon class="size-4" />
+ () => () => <GithubIcon class={AVATAR_GLYPH_CLASS} />
)
.with(
P.when((value) => value?.startsWith('github_') ?? false),
- () => () => <GithubIcon class="size-4" />
+ () => () => <GithubIcon class={AVATAR_GLYPH_CLASS} />
)
.otherwise(() => undefined);
@@ -296,19 +306,19 @@ function GithubStatusIcon(props: { status?: string }) {
};
return (
- <span class="grid size-4 place-items-center">
+ <span class={cn('grid place-items-center', AVATAR_GLYPH_CLASS)}>
<Show
when={props.status === 'merged'}
fallback={
<Show
when={props.status === 'open' || props.status === 'closed'}
- fallback={<GithubIcon class="size-4" />}
+ fallback={<GithubIcon class={AVATAR_GLYPH_CLASS} />}
>
- <GitPullRequestIcon class={cn('size-4', statusClass())} />
+ <GitPullRequestIcon class={cn(AVATAR_GLYPH_CLASS, statusClass())} />
</Show>
}
>
- <GitMergeIcon class="size-4 text-note" />
+ <GitMergeIcon class={cn(AVATAR_GLYPH_CLASS, 'text-note')} />
</Show>
</span>
);
@@ -381,7 +391,7 @@ function InboxTimestamp(props: { timestamp?: string; class?: string }) {
<Show when={short()}>
{(value) => (
<Tooltip class={props.class} label={detailed() ?? value()}>
- <span class={'whitespace-nowrap text-xs text-ink-extra-muted'}>
+ <span class="whitespace-nowrap text-xs text-ink-extra-muted">
{value()}
</span>
</Tooltip>
@@ -484,74 +494,86 @@ const githubAction = (notification?: Notification): string => {
.otherwise(() => 'updated');
};
+/**
+ * The shared card scaffold: the avatar bubble (`icon` fills the circle), the
+ * title row with the timestamp at its right, and a body cell where `children`
+ * stack as lines. The grid exists only to position icon | text column |
+ * timestamp — body lines never need grid rows of their own, so every card
+ * shares this one shape and callers never touch row arithmetic. Lines are
+ * composed from `InboxCard.Content` / `CardMarkdownLine` at the call site;
+ * the body cell provides `text-sm` and `min-w-0`.
+ * (`ChannelThreadCardLayout` is the one bespoke card that stays on raw
+ * `InboxCard.Root`: its title sits inside the body row.)
+ */
function BaseCard(props: {
+ item: InboxCardDisplayItem;
selected?: boolean;
highlighted?: boolean;
onClick?: (event: MouseEvent) => void;
- unread: boolean;
- leading: JSX.Element;
- title: JSX.Element;
- preview?: string;
+ /** Contents of the avatar bubble (glyph or avatar); the circle is ours. */
+ icon: JSX.Element;
/**
- * Inline element rendered at the head of the preview line, before the text,
- * and on its own when there is no text. Must be inline-level — the line
- * truncates as one run, the way an inline mention does in a message preview.
+ * The title's text run — a string or a text-producing component. Always
+ * rendered inside the truncating wrapper; anything that isn't text (a
+ * badge, a block icon) belongs in `titleLeading`.
*/
- previewInline?: JSX.Element;
- attachments?: InboxCardAttachment[];
- entityId: string;
- properties?: PropertyT[];
- timestamp?: string;
+ title: JSX.Element;
+ /** Adornment before the title text (e.g. draft badge, block-type icon). */
+ titleLeading?: JSX.Element;
+ children?: JSX.Element;
}) {
return (
<InboxCard.Root
- dimmed={!props.unread}
+ dimmed={!props.item.unread}
selected={props.selected}
highlighted={props.highlighted}
onClick={props.onClick}
>
- <div class="col-start-1 row-start-1 row-span-2">{props.leading}</div>
+ <div class="col-start-1 row-start-1 row-span-2">
+ <InboxCard.Icon fallback={props.icon} />
+ </div>
<InboxCard.Body class="contents">
<InboxCard.Header class="col-start-2 row-start-1 self-center">
- <InboxCard.Title class="flex items-center gap-1 truncate">
- {props.title}
+ <InboxCard.Title class="flex items-center gap-1">
+ {props.titleLeading}
+ {/* A flex row can't ellipsize bare text, so the text run always
+ renders inside this truncating item. */}
+ <span class="truncate">{props.title}</span>
</InboxCard.Title>
</InboxCard.Header>
- <div class="col-start-2 row-start-2 flex min-w-0 flex-col">
- <Show when={props.previewInline || props.preview?.trim()}>
- <InboxCard.Content class="truncate text-sm">
- {props.previewInline}
- <Show when={props.preview?.trim()}>
- {(value) => (
- <StaticMarkdown
- markdown={value()}
- singleLine
- theme={unifiedListMarkdownTheme}
- />
- )}
- </Show>
- </InboxCard.Content>
- </Show>
-
- <PropertyPills
- entityId={props.entityId}
- properties={props.properties}
- />
-
- <Show when={props.attachments?.length}>
- <InboxCard.Attachments items={props.attachments!} />
- </Show>
+ <div class="col-start-2 row-start-2 flex min-w-0 flex-col text-sm">
+ {props.children}
</div>
</InboxCard.Body>
<InboxTimestamp
- timestamp={props.timestamp}
+ timestamp={props.item.timestamp}
class="col-start-3 row-start-1 self-start justify-self-end"
/>
</InboxCard.Root>
);
}
+/**
+ * A single truncating body line of markdown, rendered only when the text has
+ * content — the standard middle/bottom line of a BaseCard.
+ */
+function CardMarkdownLine(props: { text?: string; class?: string }) {
+ return (
+ <Show when={props.text?.trim()}>
+ {(value) => (
+ <InboxCard.Content class={cn('truncate', props.class)}>
+ <StaticMarkdown
+ markdown={value()}
+ singleLine
+ theme={unifiedListMarkdownTheme}
+ />
+ </InboxCard.Content>
+ )}
+ </Show>
+ );
+}
+
const inlineWrappingMarkdownTheme = createTheme(
{
root: 'md inline pr-[2px] cursor-default',
@@ -560,6 +582,32 @@ const inlineWrappingMarkdownTheme = createTheme(
twoLineClampMarkdownTheme
);
+/**
+ * The two-line clamped markdown body (the channel-style message preview),
+ * reserving its height so short previews keep the row rhythm.
+ */
+function CardClampedMarkdown(props: {
+ text?: string;
+ /** Inline run rendered ahead of the text (e.g. a sender label or
+ * attachment paperclip); wraps and clamps as part of the same lines. */
+ prefix?: JSX.Element;
+}) {
+ return (
+ <InboxCard.Content class="line-clamp-2 min-h-[2lh]">
+ {props.prefix}
+ <Show when={props.text?.trim()}>
+ {(value) => (
+ <StaticMarkdown
+ markdown={value()}
+ singleLine
+ theme={inlineWrappingMarkdownTheme}
+ />
+ )}
+ </Show>
+ </InboxCard.Content>
+ );
+}
+
/** Fallback shown in place of message text when a message is just attachments. */
const attachmentSummary = (count: number): string | undefined =>
count <= 0
@@ -641,68 +689,40 @@ export function ChannelCardLayout(props: InboxCardLayoutProps) {
});
return (
- <InboxCard.Root
- dimmed={!props.item.unread}
+ <BaseCard
+ item={props.item}
selected={props.selected}
highlighted={props.highlighted}
onClick={props.onClick}
- >
- <div class="col-start-1 row-start-1 row-span-2">
+ icon={
<Show
when={!isDM()}
- fallback={
- <InboxCard.Icon
- fallback={<InboxAvatar senderId={senderAvatarId()} />}
- />
- }
+ fallback={<InboxAvatar senderId={senderAvatarId()} />}
>
- <InboxCard.Icon
- fallback={
- <EntityIcon
- class="size-4"
- targetType={getEntityIconType(entity())}
- size="fill"
- theme="monochrome"
- />
- }
- ></InboxCard.Icon>
+ <EntityIcon
+ class={AVATAR_GLYPH_CLASS}
+ targetType={getEntityIconType(entity())}
+ size="fill"
+ theme="monochrome"
+ />
</Show>
- </div>
- <InboxCard.Body class="contents">
- <InboxCard.Header class="col-start-2 row-start-1 self-center">
- <InboxCard.Title class="flex items-center gap-1">
- {text().title}
- </InboxCard.Title>
- </InboxCard.Header>
-
- <div class="col-start-2 row-start-2 min-w-0 text-sm">
- <InboxCard.Content class="line-clamp-2 min-h-[2lh]">
+ }
+ title={text().title}
+ >
+ <CardClampedMarkdown
+ text={text().content}
+ prefix={
+ <>
<Show when={senderLabel()}>
<span class="whitespace-nowrap mr-1">{senderLabel()}:</span>
</Show>
-
- <Show when={text().content?.trim()}>
- {(value) => (
- <>
- <Show when={text().contentIsAttachmentSummary}>
- <PaperclipIcon class="mr-0.5 inline size-3.5 align-[-0.125em]" />
- </Show>
- <StaticMarkdown
- markdown={value()}
- singleLine
- theme={inlineWrappingMarkdownTheme}
- />
- </>
- )}
+ <Show when={text().contentIsAttachmentSummary}>
+ <PaperclipIcon class="mr-0.5 inline size-3.5 align-[-0.125em]" />
</Show>
- </InboxCard.Content>
- </div>
- </InboxCard.Body>
- <InboxTimestamp
- timestamp={props.item.timestamp}
- class="col-start-3 row-start-1 self-start justify-self-end"
+ </>
+ }
/>
- </InboxCard.Root>
+ </BaseCard>
);
}
@@ -727,24 +747,19 @@ export function ChannelMessageCardLayout(props: InboxCardLayoutProps) {
};
});
+ // Two-line clamped message body (like the channel card) so the row matches
+ // its three-line neighbors.
return (
<BaseCard
- entityId={props.item.entity.id}
+ item={props.item}
selected={props.selected}
highlighted={props.highlighted}
onClick={props.onClick}
- unread={props.item.unread}
- timestamp={props.item.timestamp}
- leading={
- <InboxCard.Icon
- fallback={
- <ActionBubble tag={getNotificationTag(props.item.notification)} />
- }
- ></InboxCard.Icon>
- }
+ icon={<ActionBubble tag={getNotificationTag(props.item.notification)} />}
title={text().title}
- preview={text().content}
- />
+ >
+ <CardClampedMarkdown text={text().content} />
+ </BaseCard>
);
}
@@ -850,6 +865,9 @@ export function ChannelThreadCardLayout(props: InboxCardLayoutProps) {
};
});
+ // The one bespoke card kept on raw InboxCard.Root: unlike BaseCard's shape,
+ // its title sits inside the body row (icon and timestamp align to it), with
+ // the quoted-original block stacked beneath.
return (
<InboxCard.Root
dimmed={!props.item.unread}
@@ -868,7 +886,7 @@ export function ChannelThreadCardLayout(props: InboxCardLayoutProps) {
<div class={cn('col-start-2 row-start-2')}>
<InboxCard.Header class="self-center">
<InboxCard.Title class="flex items-center gap-1">
- {text().title}
+ <span class="truncate">{text().title}</span>
</InboxCard.Title>
</InboxCard.Header>
@@ -944,78 +962,84 @@ export function DocumentCardLayout(props: InboxCardLayoutProps) {
const senderName = createSenderDisplayName(senderId, senderFallbackName);
+ // Three lines tall like the other inbox layouts: the document name (with
+ // its block-type icon) leads, the sender's action announces itself on the
+ // second line ("Peter commented"), and the comment text fills the third.
const text = createMemo(() => {
const metadata = props.item.notification?.notification_metadata;
- const location = entityLocation(props.item.entity);
const content = itemContent(props.item.entity, props.item.notification);
if (metadata?.tag === 'document_mention') {
return {
- title: buildActionLabel({
- sender: senderName(),
- action: 'shared',
- location,
- }),
+ action: buildActionLabel({ sender: senderName(), action: 'shared' }),
content: metadata.content.messageContent,
};
}
- if (metadata?.tag === 'mentioned_in_document_comment') {
- let action = 'mentioned you';
- if (location) action = 'mentioned you in';
+ if (metadata?.tag === 'commented_on_document') {
+ return {
+ action: buildActionLabel({ sender: senderName(), action: 'commented' }),
+ content,
+ };
+ }
+ if (metadata?.tag === 'mentioned_in_document_comment') {
return {
- title: buildActionLabel({
+ action: buildActionLabel({
sender: senderName(),
- action,
- location,
+ action: 'mentioned you',
}),
content,
};
}
if (metadata?.tag === 'replied_to_document_comment_thread') {
- let action = 'replied';
- if (location) action = 'replied in';
-
return {
- title: buildActionLabel({
- sender: senderName(),
- action,
- location,
- }),
+ action: buildActionLabel({ sender: senderName(), action: 'replied' }),
content,
};
}
- return { title: props.item.entity.name, content };
+ return { action: undefined, content };
});
return (
<BaseCard
- entityId={props.item.entity.id}
+ item={props.item}
selected={props.selected}
highlighted={props.highlighted}
onClick={props.onClick}
- unread={props.item.unread}
- timestamp={props.item.timestamp}
- leading={
- <InboxCard.Icon
+ icon={
+ <Show
+ when={props.item.notification}
fallback={
- <Show
- when={props.item.notification}
- fallback={
- <EntityIcon targetType={getEntityIconType(props.item.entity)} />
- }
- >
- <ActionBubble tag={getNotificationTag(props.item.notification)} />
- </Show>
+ <EntityIcon
+ class={AVATAR_GLYPH_CLASS}
+ targetType={getEntityIconType(props.item.entity)}
+ size="fill"
+ />
}
- ></InboxCard.Icon>
+ >
+ <ActionBubble tag={getNotificationTag(props.item.notification)} />
+ </Show>
}
- title={text().title}
- preview={text().content}
- />
+ titleLeading={
+ <EntityIcon
+ targetType={getEntityIconType(props.item.entity)}
+ size="xs"
+ class="shrink-0"
+ />
+ }
+ title={props.item.entity.name}
+ >
+ <Show when={text().action}>
+ {(value) => (
+ <InboxCard.Content class="truncate">{value()}</InboxCard.Content>
+ )}
+ </Show>
+
+ <CardMarkdownLine text={text().content} />
+ </BaseCard>
);
}
@@ -1048,34 +1072,32 @@ export function TaskCardLayout(props: InboxCardLayoutProps) {
return (
<BaseCard
- entityId={props.item.entity.id}
+ item={props.item}
selected={props.selected}
highlighted={props.highlighted}
onClick={props.onClick}
- unread={props.item.unread}
- timestamp={props.item.timestamp}
- leading={
- <InboxCard.Icon
+ icon={
+ <Show
+ when={props.item.notification}
fallback={
- <Show
- when={props.item.notification}
- fallback={
- <EntityIcon
- class="size-4"
- size="fill"
- targetType={getEntityIconType(props.item.entity)}
- />
- }
- >
- <ActionBubble tag={getNotificationTag(props.item.notification)} />
- </Show>
+ <EntityIcon
+ class={AVATAR_GLYPH_CLASS}
+ size="fill"
+ targetType={getEntityIconType(props.item.entity)}
+ />
}
- ></InboxCard.Icon>
+ >
+ <ActionBubble tag={getNotificationTag(props.item.notification)} />
+ </Show>
}
title={text().title}
- preview={text().content}
- properties={getInboxTaskProperties(props.item.entity)}
- />
+ >
+ <CardMarkdownLine text={text().content} />
+ <PropertyPills
+ entityId={props.item.entity.id}
+ properties={getInboxTaskProperties(props.item.entity)}
+ />
+ </BaseCard>
);
}
@@ -1094,35 +1116,32 @@ export function AiCardLayout(props: InboxCardLayoutProps) {
};
});
+ // Three lines tall like the other inbox layouts: the title row plus a
+ // two-line clamp of the response summary with its height reserved.
return (
<BaseCard
- entityId={props.item.entity.id}
+ item={props.item}
selected={props.selected}
highlighted={props.highlighted}
onClick={props.onClick}
- unread={props.item.unread}
- timestamp={props.item.timestamp}
- leading={
- <InboxCard.Icon
+ icon={
+ <Show
+ when={props.item.notification}
fallback={
- <Show
- when={props.item.notification}
- fallback={
- <EntityIcon
- class="size-4"
- targetType={getEntityIconType(props.item.entity)}
- size="fill"
- />
- }
- >
- <ActionBubble tag={getNotificationTag(props.item.notification)} />
- </Show>
+ <EntityIcon
+ class={AVATAR_GLYPH_CLASS}
+ targetType={getEntityIconType(props.item.entity)}
+ size="fill"
+ />
}
- ></InboxCard.Icon>
+ >
+ <ActionBubble tag={getNotificationTag(props.item.notification)} />
+ </Show>
}
title={text().title}
- preview={text().content}
- />
+ >
+ <CardClampedMarkdown text={text().content} />
+ </BaseCard>
);
}
@@ -1158,52 +1177,27 @@ export function EmailCardLayout(props: InboxCardLayoutProps) {
});
return (
- <InboxCard.Root
- dimmed={!props.item.unread}
+ <BaseCard
+ item={props.item}
selected={props.selected}
highlighted={props.highlighted}
onClick={props.onClick}
- >
- <div class="col-start-1 row-start-1 row-span-3">
- <InboxCard.Icon
- fallback={<ActionBubble tag="new_email" />}
- ></InboxCard.Icon>
- </div>
- <InboxCard.Body class="contents">
- <InboxCard.Header class="col-start-2 row-start-1 self-center">
- <InboxCard.Title class="flex items-center gap-1">
- <Show when={text().isDraft}>
- <DraftBadge />
- </Show>
- {text().sender}
- </InboxCard.Title>
- </InboxCard.Header>
-
- <Show when={text().subject?.trim()}>
- {(subject) => (
- <InboxCard.Content class="col-start-2 row-start-2 truncate text-sm">
- {subject()}
- </InboxCard.Content>
- )}
+ icon={<ActionBubble tag="new_email" />}
+ titleLeading={
+ <Show when={text().isDraft}>
+ <DraftBadge />
</Show>
+ }
+ title={text().sender}
+ >
+ <Show when={text().subject?.trim()}>
+ {(subject) => (
+ <InboxCard.Content class="truncate">{subject()}</InboxCard.Content>
+ )}
+ </Show>
- <Show when={text().content?.trim()}>
- {(value) => (
- <InboxCard.Content class="col-start-2 row-start-3 truncate text-sm">
- <StaticMarkdown
- markdown={value()}
- singleLine
- theme={unifiedListMarkdownTheme}
- />
- </InboxCard.Content>
- )}
- </Show>
- </InboxCard.Body>
- <InboxTimestamp
- timestamp={props.item.timestamp}
- class="col-start-3 row-start-1 self-start justify-self-end"
- />
- </InboxCard.Root>
+ <CardMarkdownLine text={text().content} />
+ </BaseCard>
);
}
@@ -1269,67 +1263,42 @@ export function GithubCardLayout(props: InboxCardLayoutProps) {
});
return (
- <InboxCard.Root
- dimmed={!props.item.unread}
+ <BaseCard
+ item={props.item}
selected={props.selected}
highlighted={props.highlighted}
onClick={props.onClick}
- >
- <div class="col-start-1 row-start-1 row-span-3">
- <InboxCard.Icon
+ icon={
+ <Show
+ when={
+ !props.item.notification ||
+ getNotificationTag(props.item.notification) ===
+ 'github_pr_status_changed'
+ }
fallback={
- <Show
- when={
- !props.item.notification ||
- getNotificationTag(props.item.notification) ===
- 'github_pr_status_changed'
+ <ActionBubble
+ tag={
+ getNotificationTag(props.item.notification) ??
+ 'github_pr_status_changed'
}
- fallback={
- <ActionBubble
- tag={
- getNotificationTag(props.item.notification) ??
- 'github_pr_status_changed'
- }
- />
- }
- >
- <GithubStatusIcon status={status()} />
- </Show>
+ />
}
- ></InboxCard.Icon>
- </div>
- <InboxCard.Body class="contents">
- <InboxCard.Header class="col-start-2 row-start-1 self-center">
- <InboxCard.Title class="flex items-center gap-1">
- {text().title}
- </InboxCard.Title>
- </InboxCard.Header>
-
- <Show when={text().content?.trim()}>
- {(value) => (
- <InboxCard.Content class="col-start-2 row-start-2 truncate text-sm text-ink/60">
- <StaticMarkdown
- markdown={value()}
- singleLine
- theme={unifiedListMarkdownTheme}
- />
- </InboxCard.Content>
- )}
+ >
+ <GithubStatusIcon status={status()} />
</Show>
+ }
+ title={text().title}
+ >
+ <CardMarkdownLine text={text().content} class="text-ink/60" />
- <Show when={text().location}>
- {(location) => (
- <InboxCard.Content class="col-start-2 row-start-3 truncate text-sm text-ink/40">
- {location()}
- </InboxCard.Content>
- )}
- </Show>
- </InboxCard.Body>
- <InboxTimestamp
- timestamp={props.item.timestamp}
- class="col-start-3 row-start-1 self-start justify-self-end"
- />
- </InboxCard.Root>
+ <Show when={text().location}>
+ {(location) => (
+ <InboxCard.Content class="truncate text-ink/40">
+ {location()}
+ </InboxCard.Content>
+ )}
+ </Show>
+ </BaseCard>
);
}
@@ -1393,94 +1362,98 @@ export function CallCardLayout(props: InboxCardLayoutProps) {
};
return (
- <InboxCard.Root
- dimmed={!props.item.unread}
+ <BaseCard
+ item={props.item}
selected={props.selected}
highlighted={props.highlighted}
onClick={props.onClick}
+ icon={
+ <EntityIcon
+ class={AVATAR_GLYPH_CLASS}
+ targetType="call"
+ size="fill"
+ theme="monochrome"
+ />
+ }
+ title={text().title}
>
- <div class="col-start-1 row-start-1 row-span-3">
- <InboxCard.Icon
- fallback={
- <EntityIcon
- class="size-4"
- targetType="call"
- size="fill"
- theme="monochrome"
- />
- }
- ></InboxCard.Icon>
- </div>
- <InboxCard.Body class="contents">
- <InboxCard.Header class="col-start-2 row-start-1 self-center">
- <InboxCard.Title class="flex items-center gap-1">
- {text().title}
- </InboxCard.Title>
- </InboxCard.Header>
-
- <Show when={participantIds().length}>
- <InboxCard.Content class="col-start-2 row-start-2 truncate text-sm">
- <For each={participantIds()}>
- {(participantId, index) => (
- <>
- {index() > 0 ? ', ' : ''}
- <CallParticipantName id={participantId} />
- </>
- )}
- </For>
- </InboxCard.Content>
- </Show>
+ <Show when={participantIds().length}>
+ <InboxCard.Content class="truncate">
+ <For each={participantIds()}>
+ {(participantId, index) => (
+ <>
+ {index() > 0 ? ', ' : ''}
+ <CallParticipantName id={participantId} />
+ </>
+ )}
+ </For>
+ </InboxCard.Content>
+ </Show>
- <Show when={duration()}>
- {(value) => (
- <InboxCard.Content class="col-start-2 row-start-3 truncate text-sm">
- {value()}
- </InboxCard.Content>
- )}
- </Show>
- </InboxCard.Body>
- <InboxTimestamp
- timestamp={props.item.timestamp}
- class="col-start-3 row-start-1 self-start justify-self-end"
- />
- </InboxCard.Root>
+ <Show when={duration()}>
+ {(value) => (
+ <InboxCard.Content class="truncate">{value()}</InboxCard.Content>
+ )}
+ </Show>
+ </BaseCard>
);
}
/**
* A calendar event row exists because its alarm fired: the event title leads,
- * and the body is the occurrence's local time — the same copy as the
- * notification that surfaced it.
+ * the occurrence's date sits on the second line, and its local time on the
+ * third — three lines tall, matching the other inbox layouts.
*/
export function CalendarEventCardLayout(props: InboxCardLayoutProps) {
- const timePreview = () => {
+ const occurrence = () => {
const meta = props.item.notification?.notification_metadata;
if (meta?.tag === 'calendar_event_reminder') {
- return formatCalendarReminderTime(meta.content);
+ return meta.content;
}
const entity = props.item.entity;
if (entity.type !== 'calendar_event' || !entity.time) return undefined;
- return formatCalendarReminderTime(
- entity.time.kind === 'timed'
- ? { startsAt: entity.time.startsAt, endsAt: entity.time.endsAt }
- : { startDate: entity.time.startDate }
- );
+ return entity.time.kind === 'timed'
+ ? { startsAt: entity.time.startsAt, endsAt: entity.time.endsAt }
+ : { startDate: entity.time.startDate };
+ };
+
+ const datePreview = () => {
+ const value = occurrence();
+ // parseISO reads a date-only string (all-day events) as local midnight,
+ // where `new Date` would shift it a day for viewers west of UTC.
+ const raw = value?.startsAt ?? value?.startDate;
+ if (!raw) return undefined;
+ const date = parseISO(raw);
+ if (Number.isNaN(date.getTime())) return undefined;
+ return formatRelativeDay(date);
+ };
+
+ const timePreview = () => {
+ const value = occurrence();
+ return value ? formatCalendarReminderTime(value) : undefined;
};
return (
<BaseCard
- entityId={props.item.entity.id}
+ item={props.item}
selected={props.selected}
highlighted={props.highlighted}
onClick={props.onClick}
- unread={props.item.unread}
- timestamp={props.item.timestamp}
- leading={
- <InboxCard.Icon fallback={<CalendarBlankIcon class="size-4" />} />
- }
+ icon={<CalendarBlankIcon class={AVATAR_GLYPH_CLASS} />}
title={props.item.entity.name || '(No title)'}
- preview={timePreview()}
- />
+ >
+ <Show when={datePreview()}>
+ {(value) => (
+ <InboxCard.Content class="truncate">{value()}</InboxCard.Content>
+ )}
+ </Show>
+
+ <Show when={timePreview()}>
+ {(value) => (
+ <InboxCard.Content class="truncate">{value()}</InboxCard.Content>
+ )}
+ </Show>
+ </BaseCard>
);
}
@@ -1505,17 +1478,13 @@ export function ReminderCardLayout(props: InboxCardLayoutProps) {
return (
<BaseCard
- entityId={props.item.entity.id}
+ item={props.item}
selected={props.selected}
highlighted={props.highlighted}
onClick={props.onClick}
- unread={props.item.unread}
- timestamp={props.item.timestamp}
- leading={
- // Always the bell, never the referenced entity's icon: the row is a
- // reminder first, and the thing it points at is named right below.
- <InboxCard.Icon fallback={<BellSimpleIcon class="size-4" />} />
- }
+ // Always the bell, never the referenced entity's icon: the row is a
+ // reminder first, and the thing it points at is named right below.
+ icon={<BellSimpleIcon class={AVATAR_GLYPH_CLASS} />}
title={
<Show when={referenced()} fallback="Reminder">
{(reference) => (
@@ -1527,19 +1496,23 @@ export function ReminderCardLayout(props: InboxCardLayoutProps) {
)}
</Show>
}
- // Shown as the body only when it isn't already the title.
- preview={referenced() ? undefined : description()}
- previewInline={
- <Show when={referenced()}>
- {(reference) => (
- <ReminderReferenceChip
- id={reference().id}
- type={reference().type}
- />
- )}
- </Show>
- }
- />
+ >
+ {/* A reminder only says one thing, so the body reserves the two lines
+ its three-line neighbors use to keep the list rhythm even. The chip
+ replaces the description when there's something to point at. */}
+ <div class="min-h-[2lh] min-w-0">
+ <InboxCard.Content class="truncate">
+ <Show when={referenced()} fallback={description()}>
+ {(reference) => (
+ <ReminderReferenceChip
+ id={reference().id}
+ type={reference().type}
+ />
+ )}
+ </Show>
+ </InboxCard.Content>
+ </div>
+ </BaseCard>
);
}
@@ -1579,7 +1552,7 @@ function ReminderReferenceChip(props: ItemEntity) {
return (
<ItemPreview
{...props}
- class="inline-flex h-auto max-w-full rounded-none px-0 align-[-0.15em] ring-0 hover:bg-transparent"
+ class="inline-flex h-auto max-w-full rounded-none px-0 align-[-0.15em] ring-0 hover:bg-transparent border-none"
iconClass="mr-1 size-3.5"
textClass="underline decoration-current/20 decoration-[max(1px,0.1em)] underline-offset-2"
/>
@@ -1596,27 +1569,22 @@ export function GenericCardLayout(props: InboxCardLayoutProps) {
return (
<BaseCard
- entityId={props.item.entity.id}
+ item={props.item}
selected={props.selected}
highlighted={props.highlighted}
onClick={props.onClick}
- unread={props.item.unread}
- timestamp={props.item.timestamp}
- leading={
- <InboxCard.Icon
- fallback={
- <EntityIcon
- class="size-4"
- targetType={getEntityIconType(props.item.entity)}
- size="fill"
- theme="monochrome"
- />
- }
+ icon={
+ <EntityIcon
+ class={AVATAR_GLYPH_CLASS}
+ targetType={getEntityIconType(props.item.entity)}
+ size="fill"
+ theme="monochrome"
/>
}
title={text().title}
- preview={text().content}
- />
+ >
+ <CardMarkdownLine text={text().content} />
+ </BaseCard>
);
}
diff --git a/apps/web/src/features/settings/Settings.tsx b/apps/web/src/features/settings/Settings.tsx
index 5c4adbb34c..333375ceef 100644
--- a/apps/web/src/features/settings/Settings.tsx
+++ b/apps/web/src/features/settings/Settings.tsx
@@ -1,6 +1,5 @@
import { Billing } from '@app/features/settings/Billing';
import { Bots } from '@app/features/settings/Bots';
-import { FloatRegion } from '@components/app/mobile/float-regions/FloatRegion';
import { PillTabs } from '@components/app/mobile/PillTabs';
import { HeaderIsland } from '@components/app/split-layout/components/HeaderIsland';
import {
@@ -215,23 +214,6 @@ export function SettingsPanel(props: SettingsPanelProps) {
const tabItems = () =>
flatTabs().map((tab) => ({ value: tab.tab, label: tab.label }));
- function BottomTabs() {
- return (
- <FloatRegion region="accessory">
- <div class="flex items-center px-(--mobile-chrome-gutter)">
- <PillTabs
- items={flatTabs().map((tab) => ({
- value: tab.tab,
- label: tab.label,
- }))}
- value={activeTabId()}
- onChange={handleTabChange}
- />
- </div>
- </FloatRegion>
- );
- }
-
// "Back to app" — the close affordance for solo settings. Laid out like a nav row.
const backToApp = () => (
<button
@@ -264,25 +246,45 @@ export function SettingsPanel(props: SettingsPanelProps) {
>
<Show when={variant() === 'split'}>
<SplitHeaderLeft>
- <HeaderIsland>
- <div class="h-full flex gap-3 items-center">
- <h1 class="font-semibold text-ink select-none text-sm shrink-0">
- Settings
- </h1>
- </div>
- </HeaderIsland>
- {/* When the sidebar collapses, tab selection moves into the split's
- top bar as a dropdown of the current tab. (Rendered directly
- rather than via CollapsibleHeaderItem so the wide segmented
- control never flashes before measuring.) */}
- <Show when={compact()}>
- <div class="mx-2 shrink-0">
- <TabsInsetDropdown
- list={tabItems()}
+ <Show
+ when={!isTouchDevice()}
+ fallback={
+ // On mobile the header strip hosts the tab pills (the bottom
+ // accessory region belongs to the global views row). Full-bleed
+ // breakout: span the header container (100cqw), opting out of
+ // the row's flex sizing, with -ml cancelling the row gutter so
+ // the pills scroll device edge to device edge — see
+ // MOBILE_TAB_STRIP_CLASS in soup-view-tabs.tsx.
+ <PillTabs
+ scrollable
+ class="-ml-(--mobile-chrome-gutter) w-[100cqw] max-w-none flex-none"
+ contentClass="px-(--mobile-chrome-gutter)"
+ items={tabItems()}
value={activeTabId()}
onChange={handleTabChange}
/>
- </div>
+ }
+ >
+ <HeaderIsland>
+ <div class="h-full flex gap-3 items-center">
+ <h1 class="font-semibold text-ink select-none text-sm shrink-0">
+ Settings
+ </h1>
+ </div>
+ </HeaderIsland>
+ {/* When the sidebar collapses, tab selection moves into the split's
+ top bar as a dropdown of the current tab. (Rendered directly
+ rather than via CollapsibleHeaderItem so the wide segmented
+ control never flashes before measuring.) */}
+ <Show when={compact()}>
+ <div class="mx-2 shrink-0">
+ <TabsInsetDropdown
+ list={tabItems()}
+ value={activeTabId()}
+ onChange={handleTabChange}
+ />
+ </div>
+ </Show>
</Show>
</SplitHeaderLeft>
{/* Collapse the other splits so settings becomes the sole one (desktop only). */}
@@ -377,7 +379,11 @@ export function SettingsPanel(props: SettingsPanelProps) {
</div>
</Show>
- <div class="relative min-h-0 flex-1 overflow-hidden touch:pt-(--mobile-content-inset-top) touch:pb-(--mobile-content-inset-bottom)">
+ {/* Full-frame on mobile: the tab pages own the chrome insets
+ inside their scrollers (see SettingsPage in primitives.tsx),
+ so content scrolls under the floating header/dock like every
+ other block instead of being boxed between them. */}
+ <div class="relative min-h-0 flex-1 overflow-hidden">
<Show when={isCurrentTab('Account')}>
<Suspense>
<Account />
@@ -433,8 +439,6 @@ export function SettingsPanel(props: SettingsPanelProps) {
</Layer>
</div>
</div>
-
- <BottomTabs />
</div>
);
}
diff --git a/apps/web/src/features/settings/primitives.tsx b/apps/web/src/features/settings/primitives.tsx
index c912c76080..99f3863318 100644
--- a/apps/web/src/features/settings/primitives.tsx
+++ b/apps/web/src/features/settings/primitives.tsx
@@ -31,7 +31,10 @@ export function SettingsPage(props: {
}) {
return (
<div class="h-full overflow-y-auto">
- <div class="mx-auto w-full max-w-[710px] px-10 pt-14 pb-24 touch:px-5 touch:pt-8 touch:pb-12">
+ {/* On mobile/tablet the page is full-frame: the chrome insets live inside the
+ scroll content (plus the usual breathing room) so pages scroll under
+ the floating header and bottom rows like every other block. */}
+ <div class="mx-auto w-full max-w-[710px] px-10 pt-14 pb-24 touch:px-5 touch:pt-[calc(var(--mobile-content-inset-top,0px)+2rem)] touch:pb-[calc(var(--mobile-content-inset-bottom,0px)+3rem)]">
{/* Headers are inset by the card's inner padding so the title and
section labels line up with the leftmost content inside the cards,
while the cards themselves stay full-width. */}
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/DateMention.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/DateMention.tsx
index b337da3d39..f827bb7014 100644
--- a/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/DateMention.tsx
+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/DateMention.tsx
@@ -1,5 +1,5 @@
import { DatePicker } from '@core/component/DatePicker';
-import { formatDate } from '@core/util/dateParser';
+import { formatRelativeDay } from '@core/util/dateParser';
import type { DateMentionDecoratorProps } from '@macro-inc/lexical-core';
import { $isDateMentionNode } from '@macro-inc/lexical-core';
import ClockIcon from '@phosphor/clock.svg';
@@ -18,24 +18,6 @@ import { MentionTooltip } from './MentionTooltip';
false && floatWithElement;
-function formatRelativeDate(date: Date): string {
- const diff = differenceInCalendarDays(date, new Date());
- switch (diff) {
- case -2:
- return '2 days ago';
- case -1:
- return 'Yesterday';
- case 0:
- return 'Today';
- case 1:
- return 'Tomorrow';
- case 2:
- return 'In 2 days';
- default:
- return formatDate(date);
- }
-}
-
function formatTooltipDate(date: Date): string {
const diff = Math.abs(differenceInCalendarDays(date, new Date()));
const options: Intl.DateTimeFormatOptions = {
@@ -62,7 +44,7 @@ export function DateMention(props: DateMentionDecoratorProps) {
let mentionRef!: HTMLSpanElement;
const displayFormat = createMemo(() => {
- return formatRelativeDate(new Date(props.date));
+ return formatRelativeDay(new Date(props.date));
});
const isSelectedAsNode = () => {
@@ -79,7 +61,7 @@ export function DateMention(props: DateMentionDecoratorProps) {
const node = $getNodeByKey(props.key);
if ($isDateMentionNode(node)) {
node.setDate(newDate.toISOString());
- node.setDisplayFormat(formatRelativeDate(newDate));
+ node.setDisplayFormat(formatRelativeDay(newDate));
}
});
diff --git a/apps/web/src/lib/core/component/MobileTabs.tsx b/apps/web/src/lib/core/component/MobileTabs.tsx
deleted file mode 100644
index aea98a4792..0000000000
--- a/apps/web/src/lib/core/component/MobileTabs.tsx
+++ /dev/null
@@ -1,59 +0,0 @@
-import { cn } from '@ui';
-import { createEffect } from 'solid-js';
-import { type TabItem, Tabs } from './Tabs';
-
-/**
- * Horizontally-scrollable tab bar for narrow/mobile layouts: the base {@link Tabs}
- * with a thin top indicator that keeps the active tab scrolled into view. Generic
- * and domain-free — wire it to whatever `list`/`value`/`onChange` you need.
- */
-export const MobileTabs = (props: {
- list: TabItem[];
- value?: string;
- defaultValue?: string;
- onChange?: (value: string) => void;
- class?: string;
-}) => {
- let wrapperRef: HTMLDivElement | undefined;
-
- // Keep the active tab scrolled into view as the selection or list changes.
- createEffect(() => {
- props.value;
- props.list;
- if (!wrapperRef) return;
- queueMicrotask(() => {
- const scrollEl = wrapperRef?.firstElementChild as HTMLElement | null;
- const active = scrollEl?.querySelector(
- '[data-checked]'
- ) as HTMLElement | null;
- if (!scrollEl || !active) return;
- const itemLeft = active.offsetLeft;
- const itemRight = itemLeft + active.offsetWidth;
- const viewRight = scrollEl.scrollLeft + scrollEl.clientWidth;
- if (itemLeft < scrollEl.scrollLeft) {
- scrollEl.scrollTo({ left: itemLeft, behavior: 'smooth' });
- } else if (itemRight > viewRight) {
- scrollEl.scrollTo({
- left: itemRight - scrollEl.clientWidth,
- behavior: 'smooth',
- });
- }
- });
- });
-
- return (
- <div ref={wrapperRef} class="h-full">
- <Tabs
- list={props.list}
- value={props.value}
- defaultValue={props.defaultValue}
- onChange={props.onChange}
- indicatorPosition="top"
- class={cn(
- '**:data-indicator:h-0.75 overflow-x-auto scrollbar-hidden [&>div]:w-max',
- props.class
- )}
- />
- </div>
- );
-};
diff --git a/apps/web/src/lib/core/util/dateParser.ts b/apps/web/src/lib/core/util/dateParser.ts
index d8aca92564..1684e71142 100644
--- a/apps/web/src/lib/core/util/dateParser.ts
+++ b/apps/web/src/lib/core/util/dateParser.ts
@@ -2,6 +2,8 @@
* Parse natural language date inputs like "today", "tomorrow", "next week", etc.
*/
+import { differenceInCalendarDays } from 'date-fns';
+
export type ParsedDate = {
date: Date;
displayFormat: string;
@@ -312,6 +314,29 @@ export function formatDate(date: Date): string {
return date.toLocaleDateString('en-US', options);
}
+/**
+ * Day-relative label for dates near now — "Today", "Yesterday", "2 days ago",
+ * "Tomorrow", "In 2 days" — falling back to `formatDate` beyond that window.
+ * (Moved from the DateMention decorator so lists can share it.)
+ */
+export function formatRelativeDay(date: Date): string {
+ const diff = differenceInCalendarDays(date, new Date());
+ switch (diff) {
+ case -2:
+ return '2 days ago';
+ case -1:
+ return 'Yesterday';
+ case 0:
+ return 'Today';
+ case 1:
+ return 'Tomorrow';
+ case 2:
+ return 'In 2 days';
+ default:
+ return formatDate(date);
+ }
+}
+
function _getDateSuggestions(input: string): ParsedDate[] {
const suggestions: ParsedDate[] = [];
const normalized = input.toLowerCase().trim();
diff --git a/apps/web/src/lib/queries/soup/useFullTextSearch.ts b/apps/web/src/lib/queries/soup/useFullTextSearch.ts
deleted file mode 100644
index 1ba51fc24b..0000000000
--- a/apps/web/src/lib/queries/soup/useFullTextSearch.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import { debouncedDependent } from '@core/util/debounce';
-import type { Accessor } from 'solid-js';
-import { useSearchSoupQuery } from './search';
-
-/**
- * Minimal full-text search hook for contexts that just need a query string →
- * results, without the filter state, local fuzzy search, featured results, and
- * soup-view wiring that `createSearchState` carries. Introduced for the mobile
- * search panel, which manages its own query state externally.
- */
-export function useFullTextSearch(query: Accessor<string>) {
- const debouncedQuery = debouncedDependent(query, 300);
-
- const searchQuery = useSearchSoupQuery(() => ({
- params: { page_size: 100 },
- body: {
- search_on: 'name_content',
- match_type: 'partial',
- query: debouncedQuery(),
- include: [],
- },
- }));
-
- return {
- results: () => searchQuery.data ?? [],
- isLoading: () => searchQuery.isFetching && !searchQuery.isFetchingNextPage,
- };
-}