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: wide-ranging UI changes, part III (#6419)

Jacob Beckerman94a6f7382a0b
diff --git a/apps/web/src/components/app/app-sidebar/sidebar.tsx b/apps/web/src/components/app/app-sidebar/sidebar.tsx
index 88b68176b3..76db627a76 100644
--- a/apps/web/src/components/app/app-sidebar/sidebar.tsx
+++ b/apps/web/src/components/app/app-sidebar/sidebar.tsx
@@ -81,7 +81,6 @@ import { AnimatedCompanyIcon } from '@icon/wide-company';
import { AnimatedEmailIcon } from '@icon/wide-email';
import { AnimatedFileMdIcon } from '@icon/wide-fileMd';
import { AnimatedHomeIcon } from '@icon/wide-home';
-import { AnimatedInboxIcon } from '@icon/wide-inbox';
import { AnimatedSearchIcon } from '@icon/wide-search';
import { AnimatedStarIcon } from '@icon/wide-star';
import { AnimatedTaskIcon } from '@icon/wide-task';
@@ -134,7 +133,7 @@ export interface SidebarItem {
icon?: Component<
JSX.SvgSVGAttributes<SVGSVGElement> & { triggerAnimation?: boolean }
>;
- hotkey: ValidHotkey;
+ hotkey?: ValidHotkey | ValidHotkey[];
hotkeyToken: HotkeyToken;
standaloneHotkey?: boolean;
hiddenFromSidebar?: boolean;
@@ -189,10 +188,10 @@ const markdownDocumentsQuery = buildDocumentTypeQuery(['doc-markdown']);
const SIDEBAR_LINKS = [
{
id: 'inbox',
- label: 'Notifications',
+ label: 'Home',
href: LIST_VIEW_PATHS.inbox,
- icon: AnimatedInboxIcon,
- hotkey: 'i',
+ icon: AnimatedHomeIcon,
+ hotkey: ['h', 'i'],
hotkeyToken: TOKENS.sidebar.goTo.inbox,
},
{
@@ -397,7 +396,7 @@ const resetGoToHotkeysState = () => {
/**
* Hosts the always-on global shortcuts that must keep working even on
* full-cover routes like solo settings: the "g" leader key with its per-link
- * "go to" nav hotkeys (e.g. "g i" for inbox), plus Send Invites. Rendered
+ * "go to" nav hotkeys (e.g. "g h" for Home), plus Send Invites. Rendered
* unconditionally from `Layout` — unlike `AppSidebar`, which unmounts on those
* routes — so none of them go dead there.
*/
@@ -463,7 +462,7 @@ export const GoToHotkeys = () => {
});
const registeredGoToKeys = () =>
- new Set<ValidHotkey>(links().map((link) => link.hotkey));
+ new Set<ValidHotkey>(links().flatMap((link) => link.hotkey ?? []));
// When the go to command scope is active, we want to prevent
// other default hotkeys from running. So doing "g" + some key
@@ -1026,10 +1025,9 @@ const COMPANIES_LINK: SidebarItem = {
const DASHBOARD_LINK: SidebarItem = {
id: 'home',
- label: 'Home',
+ label: 'Assistant',
href: '/home',
icon: AnimatedHomeIcon,
- hotkey: 'h',
hotkeyToken: TOKENS.sidebar.goTo.home,
};
@@ -1493,7 +1491,7 @@ export const AppSidebar = (props: AppSidebarProps) => {
class={cn(
'group/sidebar flex flex-col gap-0 overflow-hidden bg-surface px-3 pb-3 pt-4 text-[13px]',
isExpanded() &&
- 'relative h-full shrink-0 max-w-55 w-55 border-r border-thread-rail opacity-100',
+ 'relative h-full shrink-0 max-w-55 w-55 border-r border-edge-muted opacity-100',
props.sidebarState === 'hidden' &&
'fixed left-0 top-0 bottom-0 h-full -translate-x-full max-w-0 w-0 opacity-0 pointer-events-none',
isCollapsed() && 'fixed z-modal-content',
@@ -1871,9 +1869,11 @@ const SidebarLinkRow = (props: SidebarLinkProps) => {
onMouseEnter={() => setIsHovering(true)}
label={`Go to ${props.label}`}
hotkey={
- props.standaloneHotkey
- ? props.hotkeyToken
- : [TOKENS.sidebar.goToLeader, props.hotkeyToken]
+ props.hotkey
+ ? props.standaloneHotkey
+ ? props.hotkeyToken
+ : [TOKENS.sidebar.goToLeader, props.hotkeyToken]
+ : undefined
}
tooltipDisabled={props.sidebarState !== 'slim' || props.id === 'calendar'}
onMouseLeave={() => setIsHovering(false)}
@@ -1988,6 +1988,7 @@ const SidebarLinkRow = (props: SidebarLinkProps) => {
<Show
when={
+ props.hotkey &&
isHovering() &&
!props.hotkeyVisible &&
!(isActive() && props.trailingWhenActive !== undefined)
@@ -2011,7 +2012,7 @@ const SidebarLinkRow = (props: SidebarLinkProps) => {
</div>
</div>
</Show>
- <Show when={props.hotkeyVisible}>
+ <Show when={props.hotkey && props.hotkeyVisible}>
<div
class={cn(
'text-xs size-4 rounded-xs flex items-center justify-center overflow-hidden bg-accent/10 border border-accent/30 text-accent',
diff --git a/apps/web/src/components/app/mobile/MobileCreateMenu.tsx b/apps/web/src/components/app/mobile/MobileCreateMenu.tsx
index 12d251b9d7..eb51f70cd2 100644
--- a/apps/web/src/components/app/mobile/MobileCreateMenu.tsx
+++ b/apps/web/src/components/app/mobile/MobileCreateMenu.tsx
@@ -78,7 +78,7 @@ export function MobileCreateMenu(props: {
ref={triggerRef}
aria-label="New"
onPointerDown={() => hapticImpact('light')}
- class="relative flex h-(--mobile-chrome-button-size) items-center justify-center gap-1.5 rounded-full pl-3 pr-4 text-[15px] font-medium whitespace-nowrap"
+ class="relative flex h-(--mobile-chrome-button-size) items-center justify-center gap-1.5 rounded-full pl-3 pr-4 text-base font-medium whitespace-nowrap"
>
<PlusIcon class="size-5.5 shrink-0" />
<span>New</span>
@@ -139,7 +139,7 @@ export function MobileCreateMenu(props: {
aria-label="Close create menu"
style={{ width: `${position().width}px` }}
onPointerDown={() => hapticImpact('light')}
- class="flex h-(--mobile-chrome-button-size) items-center justify-center gap-1.5 rounded-full pl-3 pr-4 text-[15px] font-medium outline-none focus-visible:ring-2 focus-visible:ring-accent"
+ class="flex h-(--mobile-chrome-button-size) items-center justify-center gap-1.5 rounded-full pl-3 pr-4 text-base font-medium outline-none focus-visible:ring-2 focus-visible:ring-accent"
>
<PlusIcon class="mobile-create-menu-plus size-5.5 shrink-0" />
<span>New</span>
diff --git a/apps/web/src/components/app/mobile/MobilePageCreateButton.tsx b/apps/web/src/components/app/mobile/MobilePageCreateButton.tsx
index 1e71906270..65b41f5df4 100644
--- a/apps/web/src/components/app/mobile/MobilePageCreateButton.tsx
+++ b/apps/web/src/components/app/mobile/MobilePageCreateButton.tsx
@@ -83,7 +83,7 @@ export function MobilePageCreateButton() {
}
onPointerDown={() => hapticImpact('light')}
onClick={() => action().onSelect()}
- class="relative flex h-(--mobile-chrome-button-size) shrink-0 items-center justify-center gap-1.5 rounded-full pl-3 pr-4 text-[15px] font-medium whitespace-nowrap"
+ class="relative flex h-(--mobile-chrome-button-size) shrink-0 items-center justify-center gap-1.5 rounded-full pl-3 pr-4 text-base font-medium whitespace-nowrap"
>
<CreateIcon class="size-5.5 shrink-0" />
<span>{action().label}</span>
diff --git a/apps/web/src/components/app/mobile/mobile-dock-views.ts b/apps/web/src/components/app/mobile/mobile-dock-views.ts
index e599b46b07..bc5cf73837 100644
--- a/apps/web/src/components/app/mobile/mobile-dock-views.ts
+++ b/apps/web/src/components/app/mobile/mobile-dock-views.ts
@@ -2,19 +2,19 @@ import { useCalendarUiFlag } from '@app/features/calendar/hooks/use-calendar-ui-
import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { enableCrm } from '@core/constant/featureFlags';
import CompanyIcon from '@icon/wide-company.svg';
-import BellIcon from '@phosphor/bell.svg';
import CalendarIcon from '@phosphor/calendar-blank.svg';
import ChatsIcon from '@phosphor/chats-circle.svg';
import EmailIcon from '@phosphor/envelope.svg';
import FilesIcon from '@phosphor/folder-simple.svg';
+import HouseIcon from '@phosphor/house.svg';
import TasksIcon from '@phosphor/list-checks.svg';
import CallsIcon from '@phosphor/phone.svg';
import AgentsIcon from '@phosphor/sparkle.svg';
-import BellFillIcon from '@phosphor-fill/bell-fill.svg';
import CalendarFillIcon from '@phosphor-fill/calendar-blank-fill.svg';
import ChatsFillIcon from '@phosphor-fill/chats-circle-fill.svg';
import EmailFillIcon from '@phosphor-fill/envelope-fill.svg';
import FilesFillIcon from '@phosphor-fill/folder-simple-fill.svg';
+import HouseFillIcon from '@phosphor-fill/house-fill.svg';
import { createMemo } from 'solid-js';
import type { MobileDockIcon } from './MobileDockButton';
import type { MobileNavViewId } from './mobile-nav-views';
@@ -37,10 +37,10 @@ export type MobileDockView = {
const MOBILE_DOCK_VIEWS: readonly MobileDockView[] = [
{
id: 'inbox',
- label: 'Notifications',
- icon: BellIcon,
- iconActive: BellFillIcon,
- pillIcon: BellIcon,
+ label: 'Home',
+ icon: HouseIcon,
+ iconActive: HouseFillIcon,
+ pillIcon: HouseIcon,
},
{
id: 'calendar',
diff --git a/apps/web/src/components/app/sidebar-next/create-button.tsx b/apps/web/src/components/app/sidebar-next/create-button.tsx
index 7846c83889..19af48f3df 100644
--- a/apps/web/src/components/app/sidebar-next/create-button.tsx
+++ b/apps/web/src/components/app/sidebar-next/create-button.tsx
@@ -3,25 +3,15 @@ import { TOKENS } from '@core/hotkey/tokens';
import PlusIcon from '@phosphor/plus.svg';
import { Button, type ButtonProps } from '@ui';
-/**
- * The rail's create trigger, as a CTA.
- *
- * The app's canonical `cta` Button: this is the one control in the rail meant
- * to pull the eye, and the accent fill along with its hover/active scrims,
- * focus ring and contrast tokens is already themed there. Only the geometry is
- * overridden, to sit in the rail's 36px column beside the search button.
- *
- * Kobalte's trigger props arrive via `as` and are spread on, so the ref and
- * handlers land on the real element. `variant`/`size` deliberately follow that
- * spread: `Dropdown.Trigger` blanks both for a custom trigger.
+/** The rail's monochrome create trigger, with themed hover and press feedback.
+ * Kobalte forwards its trigger ref and handlers through the custom component.
*/
const RailCreateTrigger = (props: ButtonProps) => (
<Button
{...props}
- variant="cta"
- class="rounded-full"
+ variant="strong"
+ class="rounded-full bg-ink-muted"
size="icon-md"
- // class="rounded-full shadow-md shadow-drop-shadow bg-surface-2"
label="Create"
tooltipPlacement="right"
hotkey={TOKENS.global.createCommand}
diff --git a/apps/web/src/components/app/sidebar-next/list-nav.tsx b/apps/web/src/components/app/sidebar-next/list-nav.tsx
index f1dc778433..f27ead0876 100644
--- a/apps/web/src/components/app/sidebar-next/list-nav.tsx
+++ b/apps/web/src/components/app/sidebar-next/list-nav.tsx
@@ -196,29 +196,21 @@ export const ListNav = (props: ListNavProps) => {
onMouseDown={onMouseDown}
onClick={onClick}
>
- {/* Flush to the screen edge: the button sits inside the rail's own
- `px-3`, so -12px lands the bar's outer edge at x=0. Absolutely
- positioned, so activating a button never shifts its glyph, and grown
- on the Y axis only — scaling X too would pull the bar off the edge
- mid-transition. Faded rather than mounted so it arrives on the same
- curve as the glyph's outline-to-fill swap. */}
+ {/* Fixed geometry keeps the marker flush to the rail edge without
+ moving the glyph when selection changes. */}
<span
aria-hidden="true"
class={cn(
- 'absolute -left-3 top-1/2 h-3/4 w-1 -translate-y-1/2 rounded-r-full bg-accent',
- 'transition-[opacity,transform] duration-150 ease-out motion-reduce:transition-none',
- isActive() ? 'scale-y-100 opacity-100' : 'scale-y-90 opacity-0'
+ 'absolute -left-2.5 top-1/2 h-3/4 w-1 -translate-y-1/2 rounded-r-full bg-ink-muted',
+ isActive() ? 'opacity-100' : 'opacity-0'
)}
/>
- {/* The accent sits on the glyph rather than the button: `ghost`
- brightens its own text on hover, which would otherwise pull an
- active button back to `text-ink` under the cursor. */}
<NavGlyph
icon={props.item.icon}
iconActive={props.item.iconActive}
filled={isActive()}
- class={cn('size-5.5', isActive() && 'text-accent')}
+ class={cn('size-5.5', isActive() && 'text-ink-muted')}
/>
<Show
when={props.activeCall}
diff --git a/apps/web/src/components/app/sidebar-next/nav-glyph.tsx b/apps/web/src/components/app/sidebar-next/nav-glyph.tsx
index fdbdb4b841..81b5ca2843 100644
--- a/apps/web/src/components/app/sidebar-next/nav-glyph.tsx
+++ b/apps/web/src/components/app/sidebar-next/nav-glyph.tsx
@@ -5,13 +5,10 @@ import { Dynamic } from 'solid-js/web';
/** Any SVG component — in practice the Phosphor icons `nav-items` imports. */
export type NavIcon = Component<JSX.SvgSVGAttributes<SVGSVGElement>>;
-const SWAP = cn(
- 'absolute inset-0 transition-opacity duration-150 ease-out',
- 'motion-reduce:transition-none'
-);
+const SWAP = 'absolute inset-0';
/**
- * A nav glyph, optionally cross-fading to a filled counterpart.
+ * A nav glyph, instantly switching to a filled counterpart when active.
*
* Both weights are stacked in the same square box and swapped by opacity
* alone, so neither reflows its button and the outline glyph does not blink out
@@ -23,7 +20,7 @@ export const NavGlyph = (props: {
icon: NavIcon;
/** Filled counterpart of `icon`. Omit to keep one glyph in every state. */
iconActive?: NavIcon;
- /** Cross-fades `iconActive` in. Ignored when there isn't one. */
+ /** Shows `iconActive` immediately. Ignored when there isn't one. */
filled?: boolean;
/** Sizes the box and, with it, both glyphs — e.g. `size-5`. */
class: string;
diff --git a/apps/web/src/components/app/sidebar-next/nav-items.ts b/apps/web/src/components/app/sidebar-next/nav-items.ts
index 47e08cbf8a..380047f44b 100644
--- a/apps/web/src/components/app/sidebar-next/nav-items.ts
+++ b/apps/web/src/components/app/sidebar-next/nav-items.ts
@@ -1,27 +1,27 @@
import { LIST_VIEW_PATHS } from '@app/constants/list-views';
import type { SidebarItem } from '@components/app/app-sidebar/sidebar';
import { TOKENS } from '@core/hotkey/tokens';
-import BellIcon from '@phosphor/bell.svg';
import BuildingsIcon from '@phosphor/buildings.svg';
import CalendarBlankIcon from '@phosphor/calendar-blank.svg';
import ChatsCircleIcon from '@phosphor/chats-circle.svg';
import EnvelopeIcon from '@phosphor/envelope.svg';
import FolderSimpleIcon from '@phosphor/folder-simple.svg';
+import HouseIcon from '@phosphor/house.svg';
import ListChecksIcon from '@phosphor/list-checks.svg';
import SparkleIcon from '@phosphor/sparkle.svg';
-import BellFillIcon from '@phosphor-fill/bell-fill.svg';
import BuildingsFillIcon from '@phosphor-fill/buildings-fill.svg';
import CalendarBlankFillIcon from '@phosphor-fill/calendar-blank-fill.svg';
import ChatsCircleFillIcon from '@phosphor-fill/chats-circle-fill.svg';
import EnvelopeFillIcon from '@phosphor-fill/envelope-fill.svg';
import FolderSimpleFillIcon from '@phosphor-fill/folder-simple-fill.svg';
+import HouseFillIcon from '@phosphor-fill/house-fill.svg';
import ListChecksFillIcon from '@phosphor-fill/list-checks-fill.svg';
import SparkleFillIcon from '@phosphor-fill/sparkle-fill.svg';
import type { NavIcon } from './nav-glyph';
/**
* A SidebarRail nav button's definition: a `SidebarItem` plus the filled icon
- * the button cross-fades to while its view is active. Both are required here,
+ * the button switches to while its view is active. Both are required here,
* unlike `SidebarItem['icon']` — a rail button is nothing but its glyph.
*/
export type SidebarNextNavItem = SidebarItem & {
@@ -35,22 +35,22 @@ export type SidebarNextNavItem = SidebarItem & {
*
* Phosphor icons rather than the animated `wide-*` set the old sidebar uses:
* they are plain `fill="currentColor"` SVGs, so the active button's
- * `text-accent` colours the glyph.
+ * `text-ink-muted` colours the glyph.
*
* The labels are new but every destination is an existing view id, so the
- * `hotkeyToken`s are the ones `GoToHotkeys` already registers — `g i` still
- * reaches Notifications, `g f` still reaches Drive. `GoToHotkeys` is mounted from
+ * `hotkeyToken`s are the ones `GoToHotkeys` already registers — `g h`
+ * reaches Home, `g f` still reaches Drive. `GoToHotkeys` is mounted from
* `Layout` off `buildSidebarLinks` and is independent of which sidebar renders,
* so the shortcuts work unchanged; these tokens only label the tooltips.
*/
const SIDEBAR_NEXT_NAV_ITEMS = [
{
id: 'inbox',
- label: 'Notifications',
+ label: 'Home',
href: LIST_VIEW_PATHS.inbox,
- icon: BellIcon,
- iconActive: BellFillIcon,
- hotkey: 'i',
+ icon: HouseIcon,
+ iconActive: HouseFillIcon,
+ hotkey: 'h',
hotkeyToken: TOKENS.sidebar.goTo.inbox,
},
{
diff --git a/apps/web/src/components/app/sidebar-next/sidebar-rail.tsx b/apps/web/src/components/app/sidebar-next/sidebar-rail.tsx
index c4673c059f..6cd5a2c005 100644
--- a/apps/web/src/components/app/sidebar-next/sidebar-rail.tsx
+++ b/apps/web/src/components/app/sidebar-next/sidebar-rail.tsx
@@ -22,9 +22,6 @@ export type SidebarRailProps = {
onOpenChange: (open: boolean) => void;
};
-/** 36px buttons plus the 12px of padding either side. */
-const RAIL_WIDTH = 'w-15';
-
/**
* The rebuilt app sidebar, behind `enable-new-app-views`: a single always-narrow
* column of 36px icon buttons, labels in tooltips.
@@ -73,7 +70,7 @@ export const SidebarRail = (props: SidebarRailProps) => {
<div
{...hotkeyScopeNeutralAttribute}
data-ui="sidebar-rail"
- class={`relative flex h-full ${RAIL_WIDTH} shrink-0 flex-col items-center gap-2 overflow-hidden border-r border-thread-rail bg-surface px-3 pb-3 pt-3`}
+ class="relative flex h-full w-14 shrink-0 flex-col items-center gap-2 overflow-hidden border-r border-edge-muted bg-surface px-2.5 pb-3 pt-3"
>
<SidebarRailCreateButton />
<SearchRailButton />
diff --git a/apps/web/src/components/app/sidebar-next/unread-dot.tsx b/apps/web/src/components/app/sidebar-next/unread-dot.tsx
index 34843f7cb6..9c8083dcc0 100644
--- a/apps/web/src/components/app/sidebar-next/unread-dot.tsx
+++ b/apps/web/src/components/app/sidebar-next/unread-dot.tsx
@@ -9,8 +9,7 @@ export function SidebarUnreadDot(props: { active?: boolean }) {
data-sidebar-unread-dot
class={cn(
'pointer-events-none absolute right-1 top-1 rounded-full ring-2 ring-surface',
- 'transition-[opacity,transform] duration-150 ease-out motion-reduce:transition-none',
- props.active ? 'scale-100 opacity-100' : 'scale-75 opacity-0'
+ props.active ? 'opacity-100' : 'opacity-0'
)}
>
<UnreadIndicator active class="size-1.5" />
diff --git a/apps/web/src/components/app/split-layout/componentRegistry.tsx b/apps/web/src/components/app/split-layout/componentRegistry.tsx
index 9534409751..0985a89471 100644
--- a/apps/web/src/components/app/split-layout/componentRegistry.tsx
+++ b/apps/web/src/components/app/split-layout/componentRegistry.tsx
@@ -243,7 +243,7 @@ function LegacyInboxView() {
const preset = getViewPreset('inbox');
return (
<SoupView
- viewName="Notifications"
+ viewName="Home"
initialFilters={preset?.filters}
initialClientFilters={preset?.clientFilters}
initialGroupBy={preset?.groupBy}
@@ -322,11 +322,8 @@ function MyActivityViewWrapper() {
const activityFeedEnabled = useActivityFeedFlag();
const posthog = usePosthog();
- // Registered even when the flag is off so a bookmarked /activity or a
- // restored split recovers to the inbox instead of an empty split, and the
- // data-owning feed view is never mounted. The redirect replaces the split
- // irreversibly, so it must wait for PostHog to actually answer — on a
- // fresh reload the flag reads false until flags load.
+ // Wait for flags before replacing a bookmarked or restored activity split.
+ // While disabled, never mount the feed or issue its queries.
return (
<Show
when={activityFeedEnabled()}
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 a1d9550ca9..f408c550ef 100644
--- a/apps/web/src/components/app/split-layout/components/SplitPanel.tsx
+++ b/apps/web/src/components/app/split-layout/components/SplitPanel.tsx
@@ -306,7 +306,7 @@ export function SplitPanel(props: SplitPanelProps) {
>
<Panel
class={cn(
- 'rounded-none touch:rounded-none touch:after:hidden touch:border-0! bg-panel',
+ 'rounded-none touch:rounded-none touch:after:hidden touch:border-0! bg-panel transition-none',
splitUnfocusedStyling() && 'split-panel-inactive',
{
'shadow-sm shadow-drop-shadow/50': splitUnfocusedStyling(),
diff --git a/apps/web/src/components/app/split-layout/tests/activity-registration.test.tsx b/apps/web/src/components/app/split-layout/tests/activity-registration.test.tsx
new file mode 100644
index 0000000000..4bab9252f3
--- /dev/null
+++ b/apps/web/src/components/app/split-layout/tests/activity-registration.test.tsx
@@ -0,0 +1,148 @@
+import { cleanup, render, screen } from '@solidjs/testing-library';
+import { createSignal, Suspense } from 'solid-js';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { resolveComponent } from '../componentRegistry';
+
+const state = vi.hoisted(() => ({
+ authenticated: (): boolean => true,
+ enabled: (): boolean => false,
+ flagsLoaded: (): boolean => true,
+ replace: vi.fn(),
+ pageView: vi.fn(),
+ track: vi.fn(),
+ mountActivity: vi.fn(),
+}));
+
+vi.mock('@core/auth', () => ({
+ useIsAuthenticated: () => () => state.authenticated(),
+}));
+vi.mock('@app/lib/analytics/posthog', () => ({
+ usePosthog: () => ({ flagsLoaded: () => state.flagsLoaded() }),
+ useFeatureFlag: () => () => ({ enabled: state.enabled() }),
+}));
+vi.mock('@app/lib/analytics/analytics-context', () => ({
+ useAnalytics: () => ({ pageView: state.pageView, track: state.track }),
+}));
+vi.mock('../layoutUtils', () => ({
+ useSplitPanelOrThrow: () => ({ handle: { replace: state.replace } }),
+}));
+vi.mock('@core/component/LoadingBlock', () => ({
+ LoadingBlock: () => <div>Authenticating</div>,
+}));
+vi.mock('@app/features/activity/views/my-activity-view', () => ({
+ MyActivityView: () => {
+ state.mountActivity();
+ return <div>Activity feed</div>;
+ },
+}));
+vi.mock('@app/features/activity/open-entity-in-split', () => ({
+ openEntityInSplit: vi.fn(),
+}));
+
+// Quarantine unrelated registered views and their module-load side effects.
+vi.mock('@app/features/agents-view/views/AgentsView', () => ({}));
+vi.mock('@app/features/block-agent/component/ComposeAgentSession', () => ({}));
+vi.mock('@app/features/channels-view/channels-view', () => ({}));
+vi.mock('@app/features/drive-view/drive-view', () => ({}));
+vi.mock('@app/features/email-compose/email-compose', () => ({}));
+vi.mock('@app/features/email-view/email-view', () => ({}));
+vi.mock('@app/features/getting-started', () => ({}));
+vi.mock('@app/features/home', () => ({}));
+vi.mock('@app/features/inbox-view/inbox-view', () => ({}));
+vi.mock('@app/features/next-soup/filters/filter-store', () => ({}));
+vi.mock('@app/features/next-soup/filters/filter-store/query-store', () => ({}));
+vi.mock('@app/features/next-soup/sidebar/soup-filter-presets', () => ({}));
+vi.mock(
+ '@app/features/next-soup/soup-view/non-member-channel-preview',
+ () => ({})
+);
+vi.mock('@app/features/next-soup/soup-view/soup-view', () => ({}));
+vi.mock('@app/features/next-soup/use-recent-view-flag', () => ({}));
+vi.mock('@app/features/reminders/ReminderEditorSplit', () => ({}));
+vi.mock('@app/features/settings/Settings', () => ({}));
+vi.mock('@app/features/tasks-view/tasks-view', () => ({}));
+vi.mock('@app/signal/splitLayout', () => ({}));
+vi.mock('@block-calendar/components/EventComposerSplit', () => ({}));
+vi.mock('@block-channel/component/Compose', () => ({}));
+vi.mock('@block-md/component/ComposeSkill', () => ({}));
+vi.mock('@block-md/component/ComposeTask', () => ({}));
+vi.mock('@companies/crm/saved-views', () => ({}));
+vi.mock('@core/context/user', () => ({}));
+vi.mock('@core/mobile/isTouchDevice', () => ({}));
+vi.mock('@queries/agent-schedule/entities', () => ({}));
+vi.mock('@ui', () => ({}));
+vi.mock('../previewController', () => ({}));
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ state.authenticated = () => true;
+ state.enabled = () => false;
+ state.flagsLoaded = () => true;
+});
+afterEach(cleanup);
+
+function renderActivity() {
+ const activity = resolveComponent('activity');
+ return render(() => <Suspense>{activity.element()}</Suspense>);
+}
+
+describe('activity registration', () => {
+ it('redirects a disabled feed to inbox without mounting or tracking it', () => {
+ renderActivity();
+
+ expect(state.replace).toHaveBeenCalledExactlyOnceWith({
+ next: { type: 'component', id: 'inbox' },
+ });
+ expect(state.mountActivity).not.toHaveBeenCalled();
+ expect(state.pageView).not.toHaveBeenCalled();
+ });
+
+ it.each([false, true])(
+ 'waits for flags before resolving a restored split (enabled: %s)',
+ async (enabled) => {
+ const [flagEnabled, setFlagEnabled] = createSignal(false);
+ const [flagsLoaded, setFlagsLoaded] = createSignal(false);
+ state.enabled = flagEnabled;
+ state.flagsLoaded = flagsLoaded;
+ renderActivity();
+
+ expect(state.replace).not.toHaveBeenCalled();
+ expect(state.mountActivity).not.toHaveBeenCalled();
+ expect(state.pageView).not.toHaveBeenCalled();
+
+ setFlagEnabled(enabled);
+ setFlagsLoaded(true);
+
+ if (enabled) {
+ expect(await screen.findByText('Activity feed')).toBeTruthy();
+ expect(state.replace).not.toHaveBeenCalled();
+ expect(state.pageView).toHaveBeenCalledExactlyOnceWith('activity');
+ } else {
+ expect(state.replace).toHaveBeenCalledExactlyOnceWith({
+ next: { type: 'component', id: 'inbox' },
+ });
+ expect(state.mountActivity).not.toHaveBeenCalled();
+ expect(state.pageView).not.toHaveBeenCalled();
+ }
+ }
+ );
+
+ it('keeps an enabled feed behind authentication', async () => {
+ const [authenticated, setAuthenticated] = createSignal(false);
+ state.authenticated = authenticated;
+ state.enabled = () => true;
+ renderActivity();
+
+ expect(screen.getByText('Authenticating')).toBeTruthy();
+ expect(state.mountActivity).not.toHaveBeenCalled();
+ expect(state.pageView).not.toHaveBeenCalled();
+ expect(state.replace).not.toHaveBeenCalled();
+
+ setAuthenticated(true);
+
+ expect(await screen.findByText('Activity feed')).toBeTruthy();
+ expect(state.mountActivity).toHaveBeenCalledOnce();
+ expect(state.pageView).toHaveBeenCalledExactlyOnceWith('activity');
+ expect(state.replace).not.toHaveBeenCalled();
+ });
+});
diff --git a/apps/web/src/components/ui/components/Button.docs.tsx b/apps/web/src/components/ui/components/Button.docs.tsx
index 8001110b30..58b515b8b6 100644
--- a/apps/web/src/components/ui/components/Button.docs.tsx
+++ b/apps/web/src/components/ui/components/Button.docs.tsx
@@ -65,7 +65,11 @@ function SizesDemo() {
function IconOnlyDemo() {
return (
<div class="flex flex-wrap items-end gap-3">
- <For each={['icon-xs', 'icon-sm', 'icon-md', 'icon-lg'] as const}>
+ <For
+ each={
+ ['icon-xs', 'icon-sm', 'icon-md', 'icon-lg', 'icon-composer'] as const
+ }
+ >
{(size) => (
<div class="flex flex-col items-start gap-1.5">
<span class="font-mono text-xs text-ink-subtle">{size}</span>
diff --git a/apps/web/src/components/ui/components/Button.tsx b/apps/web/src/components/ui/components/Button.tsx
index b2413ff322..12b782aa7c 100644
--- a/apps/web/src/components/ui/components/Button.tsx
+++ b/apps/web/src/components/ui/components/Button.tsx
@@ -58,6 +58,8 @@ export const buttonVariants = createVariants(
"size-8 aspect-square p-1.5 [&>svg:not([class*='size-'])]:size-4",
'icon-sm':
"size-6 aspect-square p-1 [&>svg:not([class*='size-'])]:size-3.5",
+ 'icon-composer':
+ 'size-6 aspect-square not-touch:rounded-full p-1 touch:[&_svg]:size-3.5 not-touch:size-[33.75px] not-touch:p-[3.75px] not-touch:[&_svg]:size-[20.625px]',
},
},
{
diff --git a/apps/web/src/components/ui/components/ButtonGroup.tsx b/apps/web/src/components/ui/components/ButtonGroup.tsx
index ee3fb77d4b..8771226570 100644
--- a/apps/web/src/components/ui/components/ButtonGroup.tsx
+++ b/apps/web/src/components/ui/components/ButtonGroup.tsx
@@ -73,6 +73,8 @@ export const buttonGroupVariants = createVariants(
'rounded-md data-[orientation=horizontal]:h-5 data-[orientation=vertical]:w-5',
'icon-sm':
'rounded-md data-[orientation=horizontal]:h-6 data-[orientation=vertical]:w-6',
+ 'icon-composer':
+ 'rounded-md not-touch:rounded-full data-[orientation=horizontal]:h-6 data-[orientation=vertical]:w-6 not-touch:data-[orientation=horizontal]:h-[33.75px] not-touch:data-[orientation=vertical]:w-[33.75px]',
'icon-md':
'rounded-md data-[orientation=horizontal]:h-8 data-[orientation=vertical]:w-8',
'icon-lg':
diff --git a/apps/web/src/components/ui/components/CollapsedInput.tsx b/apps/web/src/components/ui/components/CollapsedInput.tsx
index 0245e22cbe..b37e3c1515 100644
--- a/apps/web/src/components/ui/components/CollapsedInput.tsx
+++ b/apps/web/src/components/ui/components/CollapsedInput.tsx
@@ -5,6 +5,7 @@ import PlusIcon from '@phosphor/plus.svg';
import { type Accessor, type JSX, Show } from 'solid-js';
import { cn } from '../utils/classname';
import { Button } from './Button';
+import { ComposerSurface } from './ComposerSurface';
import { Layer } from './Layer';
import { SendButton } from './SendButton';
@@ -50,15 +51,18 @@ export function CollapsedInput(props: CollapsedInputProps) {
return (
<Layer depth={3} data-collapsed-input>
- <div
+ <ComposerSurface
+ as="div"
+ data-composer-collapsed
class={cn(
- 'rounded-xl w-full h-12.5 island flex min-w-0 items-center gap-1.5 px-2',
+ 'w-full h-[48.75px] flex min-w-0 items-center gap-[5.625px] px-[7.5px] touch:rounded-xl touch:h-12.5 touch:island touch:gap-1.5 touch:px-2',
props.class
)}
>
<Button
variant="ghost"
- size="icon-sm"
+ size="icon-composer"
+ class="not-touch:light-mode:text-composer-ink"
aria-label="Attach files"
label="Attach files"
onClick={() => props.onAttach?.()}
@@ -68,8 +72,8 @@ export function CollapsedInput(props: CollapsedInputProps) {
<button
type="button"
class={cn(
- 'min-w-0 flex-1 overflow-hidden rounded-sm px-1.5 text-left text-sm outline-none',
- 'flex h-8 items-center text-ink focus-visible:bg-active'
+ 'min-w-0 flex-1 overflow-hidden rounded-sm px-1.5 text-left text-base outline-none',
+ 'flex h-8 items-center text-ink focus-visible:bg-active not-touch:h-[30px] not-touch:px-[5.625px] not-touch:leading-[24.375px]'
)}
ref={attachFocusInput}
onClick={() => props.onOpen?.()}
@@ -78,7 +82,7 @@ export function CollapsedInput(props: CollapsedInputProps) {
<Show
when={hasText()}
fallback={
- <span class="truncate text-ink-placeholder">
+ <span class="truncate text-ink-placeholder not-touch:text-composer-placeholder">
{props.placeholder ?? 'Message'}
</span>
}
@@ -111,6 +115,7 @@ export function CollapsedInput(props: CollapsedInputProps) {
</Show>
<Show when={!isMobile() || !props.disabled}>
<SendButton
+ appearance="composer"
pending={props.pending}
disabled={props.disabled || props.pending}
onPointerDown={(event) => {
@@ -120,7 +125,7 @@ export function CollapsedInput(props: CollapsedInputProps) {
data-collapsed-input-send
/>
</Show>
- </div>
+ </ComposerSurface>
</Layer>
);
}
diff --git a/apps/web/src/components/ui/components/ComposerSurface.test.tsx b/apps/web/src/components/ui/components/ComposerSurface.test.tsx
new file mode 100644
index 0000000000..9182640343
--- /dev/null
+++ b/apps/web/src/components/ui/components/ComposerSurface.test.tsx
@@ -0,0 +1,81 @@
+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import { createSignal } from 'solid-js';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { ComposerSurface } from './ComposerSurface';
+
+const device = vi.hoisted(() => ({ touch: false }));
+vi.mock('@core/mobile/isTouchDevice', () => ({
+ isTouchDevice: () => device.touch,
+}));
+
+beforeEach(() => {
+ device.touch = false;
+});
+afterEach(cleanup);
+
+describe('ComposerSurface', () => {
+ it.each([false, true])(
+ 'retains the default panel structure with touch=%s',
+ (touch) => {
+ device.touch = touch;
+ let root: HTMLDivElement | undefined;
+ const { container } = render(() => (
+ <ComposerSurface ref={(element) => (root = element)}>
+ <input aria-label="Message" />
+ </ComposerSurface>
+ ));
+
+ expect(container.querySelector('[data-surface]')).toBe(root);
+ expect(root?.parentElement?.getAttribute('data-depth')).toBe(
+ touch ? '3' : '2'
+ );
+ expect(root?.style.border).toBe('');
+ expect(root?.classList.contains('bg-composer')).toBe(!touch);
+ expect(screen.getByRole('textbox').parentElement).toBe(root);
+ }
+ );
+
+ it.each([false, true])(
+ 'composes a native root without changing focus or adding panel behavior with touch=%s',
+ (touch) => {
+ device.touch = touch;
+ const [className, setClassName] = createSignal('p-4');
+ const clicked = vi.fn();
+ let root: HTMLDivElement | undefined;
+ const { container } = render(() => (
+ <ComposerSurface
+ as="div"
+ ref={(element) => (root = element)}
+ class={className()}
+ data-message-body-id="message-1"
+ onClick={clicked}
+ >
+ <input aria-label="Message" />
+ </ComposerSurface>
+ ));
+
+ expect(container.firstElementChild).toBe(root);
+ expect(
+ container.querySelector('[data-layer], [data-surface]')
+ ).toBeNull();
+ expect(root?.classList.contains('overflow-clip')).toBe(false);
+ expect(root?.classList.contains('touch:island')).toBe(false);
+ expect(root?.classList.contains('bg-composer')).toBe(!touch);
+ expect(root?.getAttribute('data-message-body-id')).toBe('message-1');
+ const input = screen.getByRole('textbox') as HTMLInputElement;
+ input.value = 'Unsent draft';
+ input.focus();
+
+ setClassName('p-6');
+
+ expect(container.firstElementChild).toBe(root);
+ expect(input.parentElement).toBe(root);
+ expect(document.activeElement).toBe(input);
+ expect(input.value).toBe('Unsent draft');
+ expect(root?.classList.contains('bg-composer')).toBe(!touch);
+ expect(root?.classList.contains('p-6')).toBe(true);
+ fireEvent.click(input);
+ expect(clicked).toHaveBeenCalledTimes(1);
+ }
+ );
+});
diff --git a/apps/web/src/components/ui/components/ComposerSurface.tsx b/apps/web/src/components/ui/components/ComposerSurface.tsx
index 10e9081783..a25b225029 100644
--- a/apps/web/src/components/ui/components/ComposerSurface.tsx
+++ b/apps/web/src/components/ui/components/ComposerSurface.tsx
@@ -1,22 +1,17 @@
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { splitProps } from 'solid-js';
+import { Dynamic } from 'solid-js/web';
import { cn } from '../utils/classname';
import { Surface, type SurfaceProps } from './Surface';
-/** Shared glass chrome. Desktop radius = 14px action radius + 8px inset. */
-export function ComposerSurface(
- props: Omit<SurfaceProps, 'depth' | 'hideBorder'>
-) {
+type ComposerPanelProps = Omit<SurfaceProps, 'depth' | 'hideBorder'>;
+
+function ComposerPanel(props: ComposerPanelProps) {
const [local, rest] = splitProps(props, ['class']);
return (
<Surface
{...rest}
- class={cn(
- 'rounded-[22px] bg-surface touch:rounded-3xl touch:island',
- !isTouchDevice() && 'glass-input bg-menu-glass',
- isTouchDevice() && 'bg-chrome',
- local.class
- )}
+ class={cn('touch:rounded-3xl touch:island touch:bg-chrome', local.class)}
// Glass draws its own 1px rim; a Surface border would inset that rim
// and create a second outline around the composer.
hideBorder
@@ -25,3 +20,26 @@ export function ComposerSurface(
/>
);
}
+
+/**
+ * Shared composer chrome. Use `as="div"` to style an existing card or layout
+ * root without adding Surface sizing, clipping, depth, or touch styling.
+ */
+export function ComposerSurface(
+ props: ComposerPanelProps & {
+ as?: 'div';
+ }
+) {
+ const [local, rest] = splitProps(props, ['as', 'class']);
+ return (
+ <Dynamic
+ component={local.as ?? ComposerPanel}
+ {...rest}
+ class={cn(
+ !isTouchDevice() &&
+ 'rounded-[26.25px] border-0 bg-composer text-composer-ink dark-mode:glass-input backdrop-filter-none light-mode:after:hidden light-mode:shadow-[0_0_0_0.9375px_var(--color-drop-shadow),0_1.875px_7.5px_0_var(--color-drop-shadow),0_3.75px_75px_7.5px_color-mix(in_srgb,var(--color-drop-shadow)_60%,transparent)]',
+ local.class
+ )}
+ />
+ );
+}
diff --git a/apps/web/src/components/ui/components/Input.tsx b/apps/web/src/components/ui/components/Input.tsx
index c46dd4c63f..5ccb4c1895 100644
--- a/apps/web/src/components/ui/components/Input.tsx
+++ b/apps/web/src/components/ui/components/Input.tsx
@@ -12,7 +12,7 @@ export type InputSize = Exclude<ButtonSize, `icon-${string}`>;
const INPUT_SIZE_VARIANTS: Record<InputSize, string> = {
xs: 'h-5 px-1 text-xs',
sm: 'h-6 px-2 text-xs',
- md: 'h-8 px-2 text-sm',
+ md: 'h-8 px-2 text-base',
lg: 'h-9 px-3 text-base',
xl: 'h-12 px-4 text-base',
};
diff --git a/apps/web/src/components/ui/components/InputGroup.tsx b/apps/web/src/components/ui/components/InputGroup.tsx
index f18bc91297..db1e2b9ef1 100644
--- a/apps/web/src/components/ui/components/InputGroup.tsx
+++ b/apps/web/src/components/ui/components/InputGroup.tsx
@@ -23,7 +23,7 @@ import {
const INPUT_GROUP_SIZE_VARIANTS: Record<InputSize, string> = {
xs: 'h-5 text-xs',
sm: 'h-6 text-xs',
- md: 'h-8 text-sm',
+ md: 'h-8 text-base',
lg: 'h-9 text-base',
xl: 'h-12 text-base',
};
diff --git a/apps/web/src/components/ui/components/SendButton.tsx b/apps/web/src/components/ui/components/SendButton.tsx
index 3f2e26ac38..b59182fdcd 100644
--- a/apps/web/src/components/ui/components/SendButton.tsx
+++ b/apps/web/src/components/ui/components/SendButton.tsx
@@ -5,6 +5,7 @@ import { cn } from '../utils/classname';
import { Button, type ButtonProps } from './Button';
export type SendButtonProps = Omit<ButtonProps, 'size' | 'variant'> & {
+ appearance?: 'default' | 'composer';
/** Show a spinner instead of the arrow (e.g. while a send mutation is in-flight). */
pending?: boolean;
/** Fade the button to fully transparent — used to hide on mobile when the input is empty. */
@@ -14,6 +15,7 @@ export type SendButtonProps = Omit<ButtonProps, 'size' | 'variant'> & {
export function SendButton(props: SendButtonProps) {
const [local, rest] = splitProps(props, [
'pending',
+ 'appearance',
'hidden',
'class',
'children',
@@ -26,12 +28,15 @@ export function SendButton(props: SendButtonProps) {
<Button
depth={4}
variant="strong"
- size="icon-sm"
+ size={local.appearance === 'composer' ? 'icon-composer' : 'icon-sm'}
draggable={false}
aria-label={local['aria-label'] ?? 'Send'}
tooltip={local.tooltip ?? 'Send'}
class={cn(
- 'rounded-full size-7 touch:size-7.5',
+ 'rounded-full touch:size-7.5',
+ local.appearance === 'composer'
+ ? 'not-touch:not-disabled:bg-composer-action not-touch:not-disabled:text-composer-action-ink not-touch:light-mode:shadow-none not-touch:light-mode:backdrop-filter-none not-touch:light-mode:after:hidden'
+ : 'size-7',
'[&_svg]:stroke-[4px]',
'transition-transform ease-in-out duration-150',
'data-disabled:opacity-100 data-disabled:text-ink-extra-muted! data-disabled:bg-ink-muted/5',
diff --git a/apps/web/src/components/ui/components/TextField.tsx b/apps/web/src/components/ui/components/TextField.tsx
index 5b9c588b21..b0ad36cb3c 100644
--- a/apps/web/src/components/ui/components/TextField.tsx
+++ b/apps/web/src/components/ui/components/TextField.tsx
@@ -56,7 +56,7 @@ function TextFieldTextArea<T extends ValidComponent = 'textarea'>(
<KobalteTextField.TextArea
data-slot="text-field-textarea"
class={cn(
- 'flex min-h-20 w-full resize-none rounded-md border border-edge-muted bg-input px-2.5 py-2 text-sm text-ink caret-current outline-none transition-[border-color,box-shadow]',
+ 'flex min-h-20 w-full resize-none rounded-md border border-edge-muted bg-input px-2.5 py-2 text-base text-ink caret-current outline-none transition-[border-color,box-shadow]',
'placeholder:text-ink-placeholder',
inputOutlineFocusClasses,
'aria-invalid:border-failure aria-invalid:ring-2 aria-invalid:ring-failure/20',
diff --git a/apps/web/src/components/ui/components/UserMessageBubble.tsx b/apps/web/src/components/ui/components/UserMessageBubble.tsx
index 530cbe7b54..b4bc4f4120 100644
--- a/apps/web/src/components/ui/components/UserMessageBubble.tsx
+++ b/apps/web/src/components/ui/components/UserMessageBubble.tsx
@@ -5,7 +5,7 @@ export function UserMessageBubble(props: { children: JSX.Element }) {
return (
<div
data-user-message-bubble
- class="relative ml-auto w-fit min-w-0 max-w-[85%] rounded-3xl bg-surface-4 px-4 py-2.5 text-ink whitespace-pre-wrap wrap-break-word [&_.md>:first-child]:mt-0! [&_.md>:last-child]:mb-0!"
+ class="relative ml-auto w-fit min-w-0 max-w-[85%] rounded-3xl bg-ink px-4 py-2.5 text-panel dark-mode:bg-surface-4 dark-mode:text-ink [&_button]:text-inherit whitespace-pre-wrap wrap-break-word [&_.md>:first-child]:mt-0! [&_.md>:last-child]:mb-0!"
>
{props.children}
</div>
diff --git a/apps/web/src/components/view-shell/SidebarCreateButton.test.tsx b/apps/web/src/components/view-shell/SidebarCreateButton.test.tsx
new file mode 100644
index 0000000000..aa5716f3fb
--- /dev/null
+++ b/apps/web/src/components/view-shell/SidebarCreateButton.test.tsx
@@ -0,0 +1,97 @@
+import { SplitPanel } from '@components/app/split-panel';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
+import { fireEvent, render, within } from '@solidjs/testing-library';
+import { createSignal, type JSX } from 'solid-js';
+import { afterEach, expect, it, vi } from 'vitest';
+import { SidebarCreateHeader } from './SidebarCreateButton';
+
+vi.mock('@core/mobile/isTouchDevice', () => ({
+ isTouchDevice: vi.fn(() => false),
+}));
+
+// Keep this focused on split ownership and visibility; the shared UI barrel
+// initializes app-wide hotkey storage through its tooltip dependencies.
+vi.mock('@ui', async () => ({
+ ...(await import('../ui/utils/classname')),
+ ...(await import('../ui/utils/press')),
+ Button: (
+ props: JSX.ButtonHTMLAttributes<HTMLButtonElement> & { label?: string }
+ ) => (
+ <button
+ aria-label={props.label}
+ onMouseDown={props.onMouseDown}
+ onClick={props.onClick}
+ disabled={props.disabled}
+ >
+ {props.children}
+ </button>
+ ),
+}));
+
+afterEach(() => vi.mocked(isTouchDevice).mockReturnValue(false));
+
+function controller(canClose: () => boolean, close = vi.fn()) {
+ return {
+ canClose,
+ close,
+ canGoBack: () => false,
+ goBack: vi.fn(),
+ canGoForward: () => false,
+ goForward: vi.fn(),
+ };
+}
+
+it('closes the owning split without invoking either create action', () => {
+ const home = controller(() => true);
+ const tasks = controller(() => true);
+ const createHome = vi.fn();
+ const createTask = vi.fn();
+ const view = render(() => (
+ <>
+ <SplitPanel.Root controller={home} aria-label="Home pane">
+ <SidebarCreateHeader
+ title="Home"
+ label="New chat"
+ onCreate={createHome}
+ />
+ </SplitPanel.Root>
+ <SplitPanel.Root controller={tasks} aria-label="Tasks pane">
+ <SidebarCreateHeader
+ title="Tasks"
+ label="New task"
+ onCreate={createTask}
+ />
+ </SplitPanel.Root>
+ </>
+ ));
+ const tasksPane = within(view.getByRole('region', { name: 'Tasks pane' }));
+ fireEvent.click(tasksPane.getByRole('button', { name: 'Close' }));
+ expect(tasks.close).toHaveBeenCalledOnce();
+ expect(home.close).not.toHaveBeenCalled();
+ expect(createHome).not.toHaveBeenCalled();
+ expect(createTask).not.toHaveBeenCalled();
+});
+
+it('updates close visibility when the last remaining split cannot close', () => {
+ const [canClose, setCanClose] = createSignal(true);
+ const view = render(() => (
+ <SplitPanel.Root controller={controller(canClose)}>
+ <SidebarCreateHeader title="Email" label="New email" onCreate={vi.fn()} />
+ </SplitPanel.Root>
+ ));
+ expect(view.queryByRole('button', { name: 'Close' })).not.toBeNull();
+ setCanClose(false);
+ expect(view.queryByRole('button', { name: 'Close' })).toBeNull();
+ expect(view.queryByRole('button', { name: 'New email' })).not.toBeNull();
+});
+
+it('leaves touch headers without a desktop close control', () => {
+ vi.mocked(isTouchDevice).mockReturnValue(true);
+ const view = render(() => (
+ <SplitPanel.Root controller={controller(() => true)}>
+ <SidebarCreateHeader title="Home" label="New chat" onCreate={vi.fn()} />
+ </SplitPanel.Root>
+ ));
+ expect(view.queryByRole('button', { name: 'Close' })).toBeNull();
+ expect(view.queryByRole('button', { name: 'New chat' })).not.toBeNull();
+});
diff --git a/apps/web/src/components/view-shell/SidebarCreateButton.tsx b/apps/web/src/components/view-shell/SidebarCreateButton.tsx
new file mode 100644
index 0000000000..55ba89ee0b
--- /dev/null
+++ b/apps/web/src/components/view-shell/SidebarCreateButton.tsx
@@ -0,0 +1,52 @@
+import { SplitPanel } from '@components/app/split-panel';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
+import PlusIcon from '@phosphor/plus.svg';
+import { pressHandlers } from '@ui';
+import { Show } from 'solid-js';
+import { ViewSidebar } from './ViewSidebar';
+
+export function SidebarCreateHeader(props: {
+ title: string;
+ label: string;
+ onCreate: () => void;
+}) {
+ return (
+ <header class="flex shrink-0 flex-col">
+ <Show when={!isTouchDevice()}>
+ <ViewSidebar.Header>
+ <div class="flex min-w-0 items-center gap-1">
+ <SplitPanel.CloseButton class="shrink-0" />
+ <ViewSidebar.Title>{props.title}</ViewSidebar.Title>
+ </div>
+ </ViewSidebar.Header>
+ </Show>
+ <div class="min-w-0 px-1.5 pt-4 touch:pt-[calc(var(--safe-top,0px)+1rem)]">
+ <SidebarCreateButton label={props.label} onCreate={props.onCreate} />
+ </div>
+ </header>
+ );
+}
+
+export function SidebarCreateButton(props: {
+ label: string;
+ onCreate: () => void;
+}) {
+ return (
+ <button
+ type="button"
+ class="flex h-9 w-full shrink-0 items-center gap-2 rounded-xl bg-hover px-2.5 text-left text-sm font-medium text-ink-muted hover:bg-active hover:text-ink focus-visible:outline-2 focus-visible:outline-accent touch:h-11"
+ {...pressHandlers((event) => {
+ event.preventDefault();
+ props.onCreate();
+ })}
+ >
+ <span
+ aria-hidden="true"
+ class="flex size-5 shrink-0 items-center justify-center"
+ >
+ <PlusIcon class="size-4" />
+ </span>
+ <span class="truncate">{props.label}</span>
+ </button>
+ );
+}
diff --git a/apps/web/src/components/view-shell/ViewShell.tsx b/apps/web/src/components/view-shell/ViewShell.tsx
index 426585e130..a671cf96fb 100644
--- a/apps/web/src/components/view-shell/ViewShell.tsx
+++ b/apps/web/src/components/view-shell/ViewShell.tsx
@@ -361,7 +361,7 @@ function TopBar(props: JSX.HTMLAttributes<HTMLDivElement>) {
<div
{...rest}
class={cn(
- 'flex h-12 min-w-0 shrink-0 items-center border-b border-edge px-4 py-3 touch:hidden',
+ 'flex h-12 min-w-0 shrink-0 items-center border-b border-edge-muted px-4 py-3 touch:hidden',
local.class
)}
data-view-shell-top-bar=""
@@ -446,7 +446,7 @@ function Detail(props: JSX.HTMLAttributes<HTMLDivElement>) {
<div
{...rest}
class={cn(
- 'absolute inset-y-0 right-0 z-10 min-h-0 border-l border-edge bg-panel shadow-menu',
+ 'absolute inset-y-0 right-0 z-10 min-h-0 border-l border-edge-muted bg-panel shadow-menu',
local.class
)}
style={{ width: `${layout().width}px`, 'max-width': '100%' }}
diff --git a/apps/web/src/components/view-shell/ViewSidebar.tsx b/apps/web/src/components/view-shell/ViewSidebar.tsx
index 2b6aba093a..e21f48ac6b 100644
--- a/apps/web/src/components/view-shell/ViewSidebar.tsx
+++ b/apps/web/src/components/view-shell/ViewSidebar.tsx
@@ -21,7 +21,7 @@ function Header(props: JSX.HTMLAttributes<HTMLDivElement>) {
<div
{...rest}
class={cn(
- 'flex h-12 min-w-0 shrink-0 items-center justify-between gap-3 border-b border-edge px-4 py-3',
+ 'flex h-12 min-w-0 shrink-0 items-center justify-between gap-3 border-b border-edge-muted px-4 py-3',
local.class
)}
data-view-sidebar-header=""
@@ -51,7 +51,10 @@ function Content(props: JSX.HTMLAttributes<HTMLDivElement>) {
return (
<div
{...rest}
- class={cn('min-h-0 min-w-0 flex-1 overflow-auto px-4 pb-5', local.class)}
+ class={cn(
+ 'min-h-0 min-w-0 flex-1 overflow-auto px-1.5 pb-5',
+ local.class
+ )}
data-view-sidebar-content=""
>
{local.children}
@@ -62,7 +65,7 @@ function Content(props: JSX.HTMLAttributes<HTMLDivElement>) {
function Nav(props: JSX.HTMLAttributes<HTMLElement>) {
const [local, rest] = splitProps(props, ['children', 'class']);
return (
- <nav {...rest} class={cn('flex min-w-0 flex-col gap-0.5', local.class)}>
+ <nav {...rest} class={cn('flex min-w-0 flex-col gap-1', local.class)}>
{local.children}
</nav>
);
@@ -87,7 +90,7 @@ function Item(props: NavRowProps) {
active={local.active}
aria-current={ariaCurrent()}
class={cn(
- 'h-9 gap-2.5 rounded-xl px-3 py-2 text-sm font-medium text-ink-muted transition-none not-disabled:hover:bg-hover not-disabled:hover:text-ink',
+ 'h-8 gap-2 rounded-xl border-0 px-2.5 py-0 text-sm font-normal text-ink-muted transition-none not-disabled:hover:bg-hover not-disabled:hover:text-ink touch:h-11',
local.active && 'bg-active text-ink not-disabled:hover:bg-active',
local.class
)}
@@ -95,6 +98,22 @@ function Item(props: NavRowProps) {
);
}
+function Icon(props: JSX.HTMLAttributes<HTMLSpanElement>) {
+ const [local, rest] = splitProps(props, ['children', 'class']);
+ return (
+ <span
+ {...rest}
+ aria-hidden="true"
+ class={cn(
+ 'flex size-5 shrink-0 items-center justify-center',
+ local.class
+ )}
+ >
+ {local.children}
+ </span>
+ );
+}
+
export const ViewSidebar = Object.assign(Root, {
Root,
Header,
@@ -102,4 +121,5 @@ export const ViewSidebar = Object.assign(Root, {
Content,
Nav,
Item,
+ Icon,
});
diff --git a/apps/web/src/components/view-shell/view-shell-layout.ts b/apps/web/src/components/view-shell/view-shell-layout.ts
index 974434957e..796301b1a8 100644
--- a/apps/web/src/components/view-shell/view-shell-layout.ts
+++ b/apps/web/src/components/view-shell/view-shell-layout.ts
@@ -16,7 +16,7 @@ export type AsideLayout = {
};
export const DEFAULT_ASIDE_LAYOUT: AsideLayout = {
- width: 288,
+ width: 256,
min: 224,
max: 360,
};
diff --git a/apps/web/src/features/agents-view/components/AgentsSidebar.tsx b/apps/web/src/features/agents-view/components/AgentsSidebar.tsx
index 3062966a8f..435c20b532 100644
--- a/apps/web/src/features/agents-view/components/AgentsSidebar.tsx
+++ b/apps/web/src/features/agents-view/components/AgentsSidebar.tsx
@@ -81,13 +81,12 @@ function FavoriteRow(props: {
return (
<FavoriteContextMenu favorite={props.favorite} triggerClass="block">
<ViewSidebar.Item
- class="font-normal"
title={name()}
onClick={(event) => props.onOpen(props.favorite, event)}
>
- <span class="flex size-4 shrink-0 items-center justify-center">
+ <ViewSidebar.Icon>
<FavoriteIcon favorite={props.favorite} class="size-4" />
- </span>
+ </ViewSidebar.Icon>
<span class="truncate">{name()}</span>
</ViewSidebar.Item>
</FavoriteContextMenu>
@@ -157,13 +156,13 @@ function ConversationRow(props: {
return (
<ViewSidebar.Item
active={props.active}
- class="group/recent-chat relative font-normal"
+ class="group/recent-chat relative"
title={props.conversation.name || 'Untitled chat'}
onClick={props.onOpen}
>
- <span class="flex size-4 shrink-0 items-center justify-center">
+ <ViewSidebar.Icon>
<EntityRowIcon entity={props.conversation} class="size-4" />
- </span>
+ </ViewSidebar.Icon>
<span class="min-w-0 flex-1 truncate text-left group-hover/recent-chat:pr-12">
{props.conversation.name || 'Untitled chat'}
</span>
@@ -334,14 +333,11 @@ export function AgentsSidebar(props: AgentsSidebarProps) {
{(item) => (
<ViewSidebar.Item
active={props.page === item.id && !props.activeConversationId}
- class="font-normal"
onClick={() => props.onNavigate(item.id)}
>
- <Dynamic
- component={item.icon}
- aria-hidden="true"
- class="size-4 shrink-0"
- />
+ <ViewSidebar.Icon>
+ <Dynamic component={item.icon} class="size-4" />
+ </ViewSidebar.Icon>
<span class="truncate">{item.label}</span>
</ViewSidebar.Item>
)}
diff --git a/apps/web/src/features/block-agent/CHANNEL_BLOCK_NOTES.md b/apps/web/src/features/block-agent/CHANNEL_BLOCK_NOTES.md
index b224e15927..5edc234c48 100644
--- a/apps/web/src/features/block-agent/CHANNEL_BLOCK_NOTES.md
+++ b/apps/web/src/features/block-agent/CHANNEL_BLOCK_NOTES.md
@@ -228,8 +228,7 @@ and each `*InTargetCaches` helper applies the change to all three cache families
## 6. Input wiring
-- Component stack: `TaskModeChannelInput` (message face + task composer morph,
- `Input/TaskModeChannelInput.tsx`) → `ChannelInput` (`Input/ChannelInput.tsx`, lexical
+- Component stack: `ChannelInput` (`Input/ChannelInput.tsx`, lexical
markdown editor + mentions tracker + attachment tracker + typing tracker + hotkeys) →
`Input` primitives.
- **Contract**: `InputSnapshot = { value, mentions, attachments }` (`Input/types.ts:52`);
@@ -299,7 +298,7 @@ messages in a `Scroll` (component/Block.tsx), `AgentInput` with an unwired `onSe
not the retired Virtua cache or a second pinning loop.
6. **Entry-state captor** (`splitPanel.handle.registerEntryStateCaptor`) for scroll position +
composer-adjacent state so split history restore doesn't reset the view.
-7. **Input**: reuse `ChannelInput` (not `TaskModeChannelInput`) or keep `AgentInput` but adopt
+7. **Input**: reuse `ChannelInput` or keep `AgentInput` but adopt
the `InputSnapshot`/`InputHandle` contract, `persistenceKey` draft persistence
(`makeInputValuePersistenceKey`-style, keyed by session id), and the send/restore flow.
8. **WS routing**: nothing new needed — `SyncProvider` already routes `agent_session_log`
diff --git a/apps/web/src/features/block-agent/component/ComposeAgentSession.tsx b/apps/web/src/features/block-agent/component/ComposeAgentSession.tsx
index 6fdf7f28dd..1375bd916f 100644
--- a/apps/web/src/features/block-agent/component/ComposeAgentSession.tsx
+++ b/apps/web/src/features/block-agent/component/ComposeAgentSession.tsx
@@ -459,7 +459,7 @@ function ComposeAgentSessionContent(props: ComposeAgentSessionProps) {
rows={3}
aria-label="Task for the agent"
autofocus={shouldAutofocusPrompt()}
- class="ph-no-capture min-h-20 w-full flex-1 resize-none bg-transparent px-4 pt-4 pb-2 text-sm/6 text-ink outline-none placeholder:text-ink-placeholder touch:text-base"
+ class="ph-no-capture min-h-20 w-full flex-1 resize-none bg-transparent px-4 pt-4 pb-2 text-base/6 text-ink outline-none placeholder:text-ink-placeholder"
placeholder={`What would you like ${selectedPersona()?.name ?? MACRO_AGENT_NAME} to work on?`}
value={prompt()}
disabled={submitting()}
diff --git a/apps/web/src/features/block-agent/component/parts/TextPart.tsx b/apps/web/src/features/block-agent/component/parts/TextPart.tsx
index 0a91350a03..000bdb9a58 100644
--- a/apps/web/src/features/block-agent/component/parts/TextPart.tsx
+++ b/apps/web/src/features/block-agent/component/parts/TextPart.tsx
@@ -11,7 +11,7 @@ export function TextPart(props: { text: string; inFlight?: boolean }) {
return (
// `chat-markdown-container` is the overflow host for KaTeX display math
// (see index.css).
- <div class="chat-markdown-container whitespace-pre-wrap wrap-break-word max-w-full text-sm">
+ <div class="chat-markdown-container whitespace-pre-wrap wrap-break-word max-w-full text-base">
<StaticMarkdown
markdown={markdown()}
theme={channelTheme}
diff --git a/apps/web/src/features/block-agent/ui/AgentInput.tsx b/apps/web/src/features/block-agent/ui/AgentInput.tsx
index d8f1e6347b..e0f429cd7e 100644
--- a/apps/web/src/features/block-agent/ui/AgentInput.tsx
+++ b/apps/web/src/features/block-agent/ui/AgentInput.tsx
@@ -8,14 +8,14 @@
*/
import { buildConfig } from '@core/component/LexicalMarkdown/builder/MarkdownConfigBuilder';
-import { MarkdownShell } from '@core/component/LexicalMarkdown/builder/MarkdownShell';
+import { ComposerEditor } from '@core/component/LexicalMarkdown/component/ComposerEditor';
import type { AgentCommandItem } from '@core/component/LexicalMarkdown/plugins';
import { isMobile } from '@core/mobile/isMobile';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { useTouchOutsideToDismissKeyboard } from '@core/mobile/useTouchOutsideToDismissKeyboard';
import { $insertReferencedPaste } from '@macro-inc/lexical-core';
import EnterIcon from '@phosphor-icons/core/regular/arrow-bend-down-left.svg?component-solid';
-import { Button, ComposerSurface, cn, SendButton } from '@ui';
+import { Button, ComposerSurface, SendButton } from '@ui';
import { createSignal, type JSX, onCleanup, onMount, Show } from 'solid-js';
/**
@@ -183,20 +183,14 @@ export function AgentInput(props: AgentInputProps) {
the whole width and the controls drop to a footer row (model
left, send right) — the chat-tall / channel footer shape. */}
<div
- class="flex items-end gap-1 px-2 py-1.5 touch:flex-col touch:items-stretch touch:gap-0 touch:p-0"
+ class="flex items-end gap-[3.75px] p-[7.5px] min-h-[48.75px] touch:min-h-0 touch:flex-col touch:items-stretch touch:gap-0 touch:p-0"
onPointerDown={focusEditor}
onMouseDown={focusEditor}
>
- {/* No vertical padding of its own: the shell is min-h-8 and editor
- paragraphs carry my-1.5, so the row's py-1.5 is the whole frame —
- the same 44px single-line height as ChatInput. */}
<div
id={AGENT_INPUT_TEXT_AREA_ID}
ref={bodyRef}
- class={cn(
- 'min-w-0 flex-1 pl-1 text-sm text-ink touch:px-3 touch:py-2',
- !isTouchDevice() && isMultiline() && 'pl-3'
- )}
+ class="min-w-0 flex-1 text-base text-ink not-touch:px-[9.375px] not-touch:py-[4.6875px] not-touch:leading-[24.375px] not-touch:min-h-[24.375px] not-touch:text-composer-ink touch:px-3 touch:py-2"
classList={{
// While empty only the placeholder renders; keep it to one clipped
// line so it doesn't wrap into the single-line height.
@@ -207,7 +201,7 @@ export function AgentInput(props: AgentInputProps) {
isMultiline() && isMobile(),
}}
>
- <MarkdownShell
+ <ComposerEditor
config={editor}
placeholder={
props.placeholder ?? 'Message the agent, @mention anything'
@@ -217,7 +211,7 @@ export function AgentInput(props: AgentInputProps) {
</div>
{/* In-flow — never absolute over the text. */}
- <div class="flex shrink-0 items-center gap-1 pb-0.5 touch:h-8 touch:gap-2 touch:p-2 touch:mb-2">
+ <div class="flex shrink-0 items-center gap-[3.75px] touch:h-8 touch:gap-2 touch:p-2 touch:mb-2">
<Show when={isTouchDevice() && props.modelControl}>
<div class="min-w-0">{props.modelControl}</div>
</Show>
@@ -226,6 +220,7 @@ export function AgentInput(props: AgentInputProps) {
when={props.busy && props.onStop}
fallback={
<SendButton
+ appearance="composer"
tooltip="Send"
disabled={!canSend()}
onClick={send}
@@ -237,20 +232,21 @@ export function AgentInput(props: AgentInputProps) {
fallback={
<Button
variant={isTouchDevice() ? 'ghost' : 'strong'}
- size="icon-sm"
+ size="icon-composer"
label="Stop"
onClick={() => props.onStop?.()}
class={
isTouchDevice()
? 'rounded-full size-7.5 text-ink-extra-muted not-disabled:bg-ink/5 not-disabled:hover:bg-ink/10'
- : 'rounded-full size-7'
+ : undefined
}
>
- <div class="size-3.5 rounded-sm bg-current" />
+ <div class="size-3.5 not-touch:size-[13.125px] rounded-sm bg-current" />
</Button>
}
>
<SendButton
+ appearance="composer"
aria-label="Send next queued message"
tooltip="Send next queued message"
shortcut="Enter"
diff --git a/apps/web/src/features/block-channel/component/Compose.tsx b/apps/web/src/features/block-channel/component/Compose.tsx
index 262c3696bb..854efd3a4a 100644
--- a/apps/web/src/features/block-channel/component/Compose.tsx
+++ b/apps/web/src/features/block-channel/component/Compose.tsx
@@ -19,7 +19,8 @@ import {
StaticSplitLabel,
} from '@components/app/split-layout/components/SplitLabel';
import { SplitToolbarLeft } from '@components/app/split-layout/components/SplitToolbar';
-import { MarkdownShell } from '@core/component/LexicalMarkdown/builder/MarkdownShell';
+import { ComposerEditor } from '@core/component/LexicalMarkdown/component/ComposerEditor';
+import { createHasLineBreaks } from '@core/component/LexicalMarkdown/utils/create-has-line-breaks';
import { RecipientSelector } from '@core/component/RecipientSelector';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { useCombinedRecipients } from '@core/signal/useCombinedRecipient';
@@ -196,6 +197,9 @@ export function ChannelCompose() {
},
});
clearComposer = () => markdownEditor.controls.clear();
+ const hasLineBreaks = createHasLineBreaks(
+ markdownEditor.buildHandle().lexical
+ );
const placeholder = createMemo(() => {
const name = channelName();
@@ -276,55 +280,59 @@ export function ChannelCompose() {
onDragStart={(valid) => inputState.setIsDraggedOver(valid)}
onDragEnd={() => inputState.setIsDraggedOver(false)}
>
- <Input.Layout>
+ <Input.Layout
+ oneLineInput={
+ !inputState.view().showFormatRibbon &&
+ !inputState.view().attachments?.length &&
+ !hasLineBreaks()
+ }
+ >
<Input.DropOverlay />
- <Input.FormatRibbon>
- <FormatButtons
- selectionState={() => markdownEditor.selection}
- onInlineFormat={(format) =>
- applyInlineFormat(markdownEditor.lexical, format)
- }
- onNodeFormat={(format) =>
- applyNodeFormat(markdownEditor.lexical, format)
- }
- />
- </Input.FormatRibbon>
- <Input.EditorShell
- ref={setScrollContainer}
- on:click={(event) => {
- if (!isTouchDevice()) {
- event.stopPropagation();
- markdownEditor.controls.focus();
- }
- }}
- >
- <Input.Editor>
- <MarkdownShell
- config={markdownEditor}
- placeholder={placeholder()}
- autofocus={false}
- class="text-sm"
+ <Input.Layout.Body>
+ <Input.FormatRibbon>
+ <FormatButtons
+ selectionState={() => markdownEditor.selection}
+ onInlineFormat={(format) =>
+ applyInlineFormat(markdownEditor.lexical, format)
+ }
+ onNodeFormat={(format) =>
+ applyNodeFormat(markdownEditor.lexical, format)
+ }
/>
- </Input.Editor>
- </Input.EditorShell>
- <Input.Attachments kind="media" />
- <Input.Attachments kind="document" />
- <Input.Footer>
- <Input.Actions>
- <Input.Actions.Left>
- <Show
- when={!isPlatform('ios')}
- fallback={<Input.AttachNativeMediaAction />}
- >
- <Input.AttachFilesAction />
- </Show>
- <Input.ToggleFormatAction />
- </Input.Actions.Left>
- <Input.Actions.Right>
- <Input.SendAction />
- </Input.Actions.Right>
- </Input.Actions>
- </Input.Footer>
+ </Input.FormatRibbon>
+ <Input.Layout.Editor
+ ref={setScrollContainer}
+ on:click={(event) => {
+ if (!isTouchDevice()) {
+ event.stopPropagation();
+ markdownEditor.controls.focus();
+ }
+ }}
+ >
+ <Input.Editor>
+ <ComposerEditor
+ config={markdownEditor}
+ placeholder={placeholder()}
+ autofocus={false}
+ class="text-base"
+ />
+ </Input.Editor>
+ </Input.Layout.Editor>
+ <Input.Attachments kind="media" />
+ <Input.Attachments kind="document" />
+ </Input.Layout.Body>
+
+ <Input.Layout.ActionsLeft>
+ <Show
+ when={!isPlatform('ios')}
+ fallback={<Input.AttachNativeMediaAction />}
+ >
+ <Input.AttachFilesAction />
+ </Show>
+ </Input.Layout.ActionsLeft>
+ <Input.Layout.ActionsRight>
+ <Input.SendAction />
+ </Input.Layout.ActionsRight>
</Input.Layout>
</Input.DropZone>
</ComposerSurface>
diff --git a/apps/web/src/features/block-email/EmailBlockAdapter.tsx b/apps/web/src/features/block-email/EmailBlockAdapter.tsx
index e594547ab0..4c65722723 100644
--- a/apps/web/src/features/block-email/EmailBlockAdapter.tsx
+++ b/apps/web/src/features/block-email/EmailBlockAdapter.tsx
@@ -120,7 +120,7 @@ export function EmailBlockAdapter(props: {
actions={<ThreadActions title={props.title} onCreateTask={createTask} />}
frame={(content) => (
<ModalsProvider subject={props.title}>
- <SidePanel.Layout>
+ <SidePanel.Layout defaultOpen={false}>
{content()}
<EmailSidePanelSections
threadId={props.threadId()}
diff --git a/apps/web/src/features/block-md/comments/CommentThreadDrawer.tsx b/apps/web/src/features/block-md/comments/CommentThreadDrawer.tsx
index 72bd2d5de4..1f1c05a3ac 100644
--- a/apps/web/src/features/block-md/comments/CommentThreadDrawer.tsx
+++ b/apps/web/src/features/block-md/comments/CommentThreadDrawer.tsx
@@ -16,7 +16,7 @@ import type { UserMentionRecord } from '@core/component/LexicalMarkdown/utils/me
import { virtualKeyboardVisible } from '@core/mobile/virtualKeyboard';
import CaretLeftIcon from '@phosphor/caret-left.svg';
import CaretRightIcon from '@phosphor/caret-right.svg';
-import { Button } from '@ui';
+import { Button, cn } from '@ui';
import { $setSelection } from 'lexical';
import { createMemo, createSignal, Show, useContext } from 'solid-js';
import { useMarkdownDocument } from '../context/markdown-document-context';
@@ -29,7 +29,7 @@ import { useMarkdownDocument } from '../context/markdown-document-context';
* spans would win over the parent's select-none, so the theme must not
* stamp it. Typing areas opt back in via the drawer's contenteditable rule.
*/
-const drawerCommentTheme = createTheme({ root: 'text-sm' });
+const drawerCommentTheme = createTheme({ root: 'text-base' });
/**
* Focus target for the drawer's opening focus pass: the draft composer's
@@ -61,8 +61,12 @@ function PinnedReplyComposer(props: {
<ThreadContext.Provider value={{ mentionsSignal }}>
<StaticMarkdownContext theme={drawerCommentTheme}>
<div
- class="shrink-0 px-3"
- classList={{ 'pb-(--safe-bottom)': !virtualKeyboardVisible() }}
+ class={cn(
+ 'shrink-0 px-3',
+ virtualKeyboardVisible()
+ ? 'pb-4'
+ : 'pb-[max(16px,var(--mobile-sheet-safe-padding))]'
+ )}
>
<NewReplyInput
textValue={text()}
diff --git a/apps/web/src/features/block-md/component/ComposeTask.tsx b/apps/web/src/features/block-md/component/ComposeTask.tsx
index c0bf6d33eb..9014dfeca0 100644
--- a/apps/web/src/features/block-md/component/ComposeTask.tsx
+++ b/apps/web/src/features/block-md/component/ComposeTask.tsx
@@ -25,6 +25,7 @@ import type { PortalScope } from '@core/component/ScopedPortal';
import { toast } from '@core/component/Toast/Toast';
import { useUserId } from '@core/context/user';
import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { buildSimpleEntityUrl } from '@core/util/url';
import { mergeRegister } from '@lexical/utils';
import ArrowSquareOutIcon from '@phosphor/arrow-square-out.svg';
@@ -39,7 +40,7 @@ import type { PropertyApiValues } from '@property/types';
import { useUpsertToHistoryMutation } from '@queries/history/history';
import { onElementConnect } from '@solid-primitives/lifecycle';
import { debounce } from '@solid-primitives/scheduled';
-import { Button, Hotkey, Scroll, ToggleSwitch } from '@ui';
+import { Button, cn, Hotkey, Scroll, ToggleSwitch } from '@ui';
import {
$getRoot,
$getSelection,
@@ -819,7 +820,7 @@ export function ComposeTask(props: ComposeTaskProps) {
disabled={isCreating()}
tabIndex={-1}
tooltip="Continue editing in split"
- size="icon-sm"
+ size="icon-composer"
>
<ArrowsOutIcon />
</Button>
@@ -843,7 +844,7 @@ export function ComposeTask(props: ComposeTaskProps) {
onMouseDown={handleClose}
tabIndex={-1}
tooltip="Close"
- size="icon-sm"
+ size="icon-composer"
>
<XIcon />
</Button>
@@ -984,7 +985,7 @@ export function ComposeTask(props: ComposeTaskProps) {
onMouseDown={() => attachInputRef?.click()}
tabIndex={-1}
tooltip="Attach image or video"
- size="icon-sm"
+ size="icon-composer"
>
<PaperclipIcon />
</Button>
@@ -1000,7 +1001,10 @@ export function ComposeTask(props: ComposeTaskProps) {
disabled={title().trim().length === 0 || isCreating()}
variant={title().trim().length === 0 ? 'ghost' : 'accent'}
depth={3}
- class="gap-3 rounded-lg border-0"
+ class={cn(
+ 'gap-3 rounded-lg border-0',
+ !isTouchDevice() && 'rounded-full h-[33.75px] px-[15px]'
+ )}
>
Create Task
<Hotkey shortcut="cmd+enter" theme="current" />
diff --git a/apps/web/src/features/block-md/component/DocumentAiEditBar.tsx b/apps/web/src/features/block-md/component/DocumentAiEditBar.tsx
index 0892a91100..39ab6dfedf 100644
--- a/apps/web/src/features/block-md/component/DocumentAiEditBar.tsx
+++ b/apps/web/src/features/block-md/component/DocumentAiEditBar.tsx
@@ -133,7 +133,7 @@ export function DocumentAiEditBar(props: { documentId: string }) {
<span class="flex h-8 w-4 shrink-0 items-center justify-center text-accent">
<AnimatedStarIcon triggerAnimation={focused()} />
</span>
- <div class="min-w-0 grow text-sm text-ink">
+ <div class="min-w-0 grow text-base text-ink">
<MarkdownShell
config={editor}
placeholder="Describe the edit…"
diff --git a/apps/web/src/features/block-md/component/InstructionsEditor.tsx b/apps/web/src/features/block-md/component/InstructionsEditor.tsx
index 8cbe660dcb..97d0c9c81f 100644
--- a/apps/web/src/features/block-md/component/InstructionsEditor.tsx
+++ b/apps/web/src/features/block-md/component/InstructionsEditor.tsx
@@ -349,7 +349,7 @@ export function InstructionsEditor(props: {
</EditorSystemMessage>
)}
</Show>
- <div class="relative" ref={editorContainerRef}>
+ <div class="relative text-base" ref={editorContainerRef}>
<div
ref={(el) => {
onElementConnect(el, () => {
diff --git a/apps/web/src/features/block-md/component/MarkdownEditor.tsx b/apps/web/src/features/block-md/component/MarkdownEditor.tsx
index 179f338364..db68da7e45 100644
--- a/apps/web/src/features/block-md/component/MarkdownEditor.tsx
+++ b/apps/web/src/features/block-md/component/MarkdownEditor.tsx
@@ -979,7 +979,7 @@ export function MarkdownEditor(props: {
</Show>
{/* Note: the mt-1.5 here is to preserve markdown node margin tops. which means this div should avoid padding and border. */}
<div
- class="relative mt-1.5"
+ class="relative mt-1.5 text-base"
ref={editorContainerRef}
use:fileFolderDrop={{
onDrop: (fileEntries, folderEntries, e) => {
diff --git a/apps/web/src/features/channel/Channel/Channel.tsx b/apps/web/src/features/channel/Channel/Channel.tsx
index 1f3f3dd692..53a88dc636 100644
--- a/apps/web/src/features/channel/Channel/Channel.tsx
+++ b/apps/web/src/features/channel/Channel/Channel.tsx
@@ -1,16 +1,14 @@
import { openChatWithInput } from '@app/features/chat/ChatWithAgentButton';
import { createActivityTracker } from '@channel/activity-tracker';
import { DebugSuspense } from '@channel/DebugSuspense';
-import type { ChannelInputProps } from '@channel/Input/ChannelInput';
-import { buildPostMessageSendPayload } from '@channel/Input/message-payload';
import {
- TaskModeChannelInput,
- type TaskModeChannelInputProps,
-} from '@channel/Input/TaskModeChannelInput';
+ ChannelInput,
+ type ChannelInputProps,
+} from '@channel/Input/ChannelInput';
+import { buildPostMessageSendPayload } from '@channel/Input/message-payload';
import {
makeAttachmentTrackerPersistenceKey,
makeInputValuePersistenceKey,
- makeTaskPersistence,
} from '@channel/Input/utils/persistence';
import {
type MessageData,
@@ -348,7 +346,7 @@ export function Channel(props: ChannelProps) {
const channelName = useChannelName(props.channelId);
const channelType = useChannelType(props.channelId);
- const { popoverSplit, openWithSplit } = useSplitLayout();
+ const { popoverSplit } = useSplitLayout();
// Placeholder name: channels render as "#name"; a 1:1 DM named "First Last"
// shortens to the first name, and group DMs like "A, B" keep their full name.
@@ -642,50 +640,6 @@ export function Channel(props: ChannelProps) {
);
};
- // Task mode: post the freshly created task into the channel as a message
- // carrying a task mention.
- const onSendTask: TaskModeChannelInputProps['onSendTask'] = (task) => {
- const senderId = userId();
- if (!senderId) return;
- sendMessageMutation.mutate(
- {
- channelID: props.channelId,
- senderId,
- optimisticId: crypto.randomUUID(),
- message: {
- content: buildMentionMarkdownString({
- type: 'document',
- documentId: task.documentId,
- documentName: task.title,
- blockName: 'task',
- }),
- mentions: [{ entity_type: 'document', entity_id: task.documentId }],
- attachments: [],
- },
- optimisticAttachments: [],
- },
- {
- // The task itself was created before this send, so don't restore the
- // composer (retrying there would create a duplicate) — point at the
- // task instead.
- onError: () => {
- toast.failure('Task created, but sharing it to the channel failed', {
- actions: [
- {
- label: 'Open task',
- onClick: () =>
- openWithSplit(
- { type: 'task', id: task.documentId },
- { referredFrom: null }
- ),
- },
- ],
- });
- },
- }
- );
- };
-
const onThreadListReady = (navigation: ThreadListNavigation) => {
setThreadListNavigation(navigation);
finishLatestNavigation();
@@ -931,7 +885,7 @@ export function Channel(props: ChannelProps) {
)}
</Match>
<Match when={true}>
- <TaskModeChannelInput
+ <ChannelInput
autofocus={props.autofocus}
collapsible
input={{
@@ -956,10 +910,6 @@ export function Channel(props: ChannelProps) {
void setChannelInputSnapshot(snapshot)
}
onSend={onSend}
- onSendTask={onSendTask}
- taskPersistence={makeTaskPersistence({
- channelId: props.channelId,
- })}
onStartTyping={() =>
typingMutation.mutate({
channelId: props.channelId,
diff --git a/apps/web/src/features/channel/Channel/InlineMessageEditor.tsx b/apps/web/src/features/channel/Channel/InlineMessageEditor.tsx
index 3fe46a917a..92ce128a0c 100644
--- a/apps/web/src/features/channel/Channel/InlineMessageEditor.tsx
+++ b/apps/web/src/features/channel/Channel/InlineMessageEditor.tsx
@@ -78,15 +78,13 @@ export function MessageEditorContent(props: MessageEditorContentProps) {
props.messageEditor.save(props.message, nextSnapshot)
}
>
- <Input.Actions>
- <Input.Actions.Left>
- <Input.ToggleFormatAction />
- <Input.DiscardDraftAction />
- </Input.Actions.Left>
- <Input.Actions.Right>
- <Input.SendAction />
- </Input.Actions.Right>
- </Input.Actions>
+ <Input.Layout.ActionsLeft>
+ <Input.ToggleFormatAction />
+ <Input.DiscardDraftAction />
+ </Input.Layout.ActionsLeft>
+ <Input.Layout.ActionsRight>
+ <Input.SendAction />
+ </Input.Layout.ActionsRight>
</ChannelInput>
</div>
);
diff --git a/apps/web/src/features/channel/Input/ActionButton.tsx b/apps/web/src/features/channel/Input/ActionButton.tsx
index 801dc13342..a87518084d 100644
--- a/apps/web/src/features/channel/Input/ActionButton.tsx
+++ b/apps/web/src/features/channel/Input/ActionButton.tsx
@@ -1,10 +1,11 @@
-import { Button } from '@ui';
+import { Button, cn } from '@ui';
import type { JSX } from 'solid-js';
export function InputActionButton(props: {
label: string;
onClick?: (event: MouseEvent) => void;
active?: boolean;
+ class?: string;
children: JSX.Element;
}) {
return (
@@ -13,8 +14,8 @@ export function InputActionButton(props: {
aria-label={props.label}
label={props.label}
variant={props.active ? 'accent' : 'ghost'}
- size="icon-sm"
- class="rounded-full size-7 touch:size-6"
+ size="icon-composer"
+ class={cn('rounded-full touch:size-6', props.class)}
onPointerDown={(event: PointerEvent) => event.preventDefault()}
onClick={(event) => props.onClick?.(event)}
>
diff --git a/apps/web/src/features/channel/Input/Actions.tsx b/apps/web/src/features/channel/Input/Actions.tsx
deleted file mode 100644
index e2d2b4e680..0000000000
--- a/apps/web/src/features/channel/Input/Actions.tsx
+++ /dev/null
@@ -1,52 +0,0 @@
-import { cn } from '@ui';
-import { type JSX, splitProps } from 'solid-js';
-
-function ActionsRoot(props: JSX.HTMLAttributes<HTMLDivElement>) {
- const [local, rest] = splitProps(props, ['class', 'children']);
-
- return (
- <div
- class={cn(
- 'flex flex-row w-full justify-between items-center',
- local.class
- )}
- data-input-actions
- {...rest}
- >
- {local.children}
- </div>
- );
-}
-
-function ActionsLeft(props: JSX.HTMLAttributes<HTMLDivElement>) {
- const [local, rest] = splitProps(props, ['class', 'children']);
-
- return (
- <div
- class={cn('flex flex-row items-center gap-2', local.class)}
- data-input-actions-left
- {...rest}
- >
- {local.children}
- </div>
- );
-}
-
-function ActionsRight(props: JSX.HTMLAttributes<HTMLDivElement>) {
- const [local, rest] = splitProps(props, ['class', 'children']);
-
- return (
- <div
- class={cn('flex flex-row items-center gap-2', local.class)}
- data-input-actions-right
- {...rest}
- >
- {local.children}
- </div>
- );
-}
-
-export const Actions = Object.assign(ActionsRoot, {
- Left: ActionsLeft,
- Right: ActionsRight,
-});
diff --git a/apps/web/src/features/channel/Input/ChannelInput.tsx b/apps/web/src/features/channel/Input/ChannelInput.tsx
index 7f4b246961..7024bdbaab 100644
--- a/apps/web/src/features/channel/Input/ChannelInput.tsx
+++ b/apps/web/src/features/channel/Input/ChannelInput.tsx
@@ -1,5 +1,5 @@
import { useCodexAgentsAccess } from '@core/codex/flag';
-import { MarkdownShell } from '@core/component/LexicalMarkdown/builder/MarkdownShell';
+import { ComposerEditor } from '@core/component/LexicalMarkdown/component/ComposerEditor';
import { StaticMarkdown } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';
import { DragInsertIndicator } from '@core/component/LexicalMarkdown/component/misc/DragInsertIndicator';
import {
@@ -7,6 +7,7 @@ import {
INSERT_DOCUMENT_MENTION_COMMAND,
} from '@core/component/LexicalMarkdown/plugins';
import { singleLineMarkdownTheme } from '@core/component/LexicalMarkdown/theme';
+import { createHasLineBreaks } from '@core/component/LexicalMarkdown/utils/create-has-line-breaks';
import {
clearDragInsertPreview,
insertDocumentMentionAtDragCoordinates,
@@ -96,51 +97,37 @@ export type ChannelInputProps = InputCallbacks & {
* Defaults to `false`.
*/
collapsible?: boolean;
- /**
- * Whether focus leaving the input may collapse it. Defaults to `true`.
- * Composed alternate input faces can disable this while the message face is
- * hidden so it remains expanded for the return transition.
- */
- collapseOnFocusOut?: boolean;
- /**
- * Optional composition slot around the message face inside the shared input
- * surface. Used by alternate input modes that need to preserve the surface
- * while switching content.
- */
- renderContent?: (messageFace: JSX.Element) => JSX.Element;
};
function WebDefaultActions(props: { input: InputData }) {
return (
- <Input.Actions>
- <Input.Actions.Left>
+ <>
+ <Input.Layout.ActionsLeft>
<Input.AttachFilesAction />
- <Input.ToggleFormatAction />
<Show when={isReplyInput(props.input)}>
<Input.CloseReplyAction />
</Show>
- </Input.Actions.Left>
- <Input.Actions.Right>
+ </Input.Layout.ActionsLeft>
+ <Input.Layout.ActionsRight>
<Input.SendAction />
- </Input.Actions.Right>
- </Input.Actions>
+ </Input.Layout.ActionsRight>
+ </>
);
}
function IosDefaultActions(props: { input: InputData }) {
return (
- <Input.Actions>
- <Input.Actions.Left>
+ <>
+ <Input.Layout.ActionsLeft>
<Input.AttachNativeMediaAction />
- <Input.ToggleFormatAction />
<Show when={isReplyInput(props.input)}>
<Input.CloseReplyAction />
</Show>
- </Input.Actions.Left>
- <Input.Actions.Right>
+ </Input.Layout.ActionsLeft>
+ <Input.Layout.ActionsRight>
<Input.SendAction />
- </Input.Actions.Right>
- </Input.Actions>
+ </Input.Layout.ActionsRight>
+ </>
);
}
@@ -357,6 +344,7 @@ export function ChannelInput(props: ChannelInputProps) {
});
const markdownHandle = markdownEditor.buildHandle();
const lexicalEditor = () => markdownHandle.lexical;
+ const hasLineBreaks = createHasLineBreaks(lexicalEditor());
const [entityDragInsertStore, setEntityDragInsertStore] =
createDragInsertStore();
@@ -465,72 +453,76 @@ export function ChannelInput(props: ChannelInputProps) {
});
const renderSurfaceContent = () => {
- const messageFace = (
+ return (
<Input.DropZone
onDragStart={(valid) => inputState.setIsDraggedOver(valid)}
onDragEnd={() => inputState.setIsDraggedOver(false)}
>
- <Input.Layout>
+ <Input.Layout
+ oneLineInput={
+ !inputState.view().showFormatRibbon &&
+ !inputState.view().attachments?.length &&
+ !hasLineBreaks()
+ }
+ >
<Input.DropOverlay />
- <Input.FormatRibbon>
- <FormatButtons
- selectionState={() => markdownEditor.selection}
- onInlineFormat={(format) =>
- applyInlineFormat(markdownEditor.lexical, format)
- }
- onNodeFormat={(format) =>
- applyNodeFormat(markdownEditor.lexical, format)
- }
- />
- </Input.FormatRibbon>
- <Input.EditorShell
- ref={setScrollContainer}
- on:click={(event) => {
- if (!isTouchDevice()) {
- event.stopPropagation();
- markdownEditor.controls.focus();
- }
- }}
- >
- <Input.Editor>
- <MarkdownShell
- config={markdownEditor}
- placeholder={props.input.placeholder}
- initialValue={inputState.view().value}
- autofocus={!isTouchDevice() && (props.autofocus ?? true)}
- class="text-sm"
- refFn={attach}
- onConnect={() => {
- isEditorConnected = true;
- flushPendingRestore();
- flushPendingFocus();
- queueMicrotask(() => {
- acceptTyping = true;
- });
- }}
+ <Input.Layout.Body>
+ <Input.FormatRibbon>
+ <FormatButtons
+ selectionState={() => markdownEditor.selection}
+ onInlineFormat={(format) =>
+ applyInlineFormat(markdownEditor.lexical, format)
+ }
+ onNodeFormat={(format) =>
+ applyNodeFormat(markdownEditor.lexical, format)
+ }
/>
- <DragInsertIndicator
- editor={lexicalEditor()}
- state={entityDragInsertStore}
- active
- />
- </Input.Editor>
- </Input.EditorShell>
- <Input.Attachments kind="media" />
- <Input.Attachments kind="document" />
- <Input.Footer>
- <Switch>
- <Match when={props.children}>{props.children}</Match>
- <Match when>
- <DefaultActions input={inputState.view()} />
- </Match>
- </Switch>
- </Input.Footer>
+ </Input.FormatRibbon>
+ <Input.Layout.Editor
+ ref={setScrollContainer}
+ on:click={(event) => {
+ if (!isTouchDevice()) {
+ event.stopPropagation();
+ markdownEditor.controls.focus();
+ }
+ }}
+ >
+ <Input.Editor>
+ <ComposerEditor
+ config={markdownEditor}
+ placeholder={props.input.placeholder}
+ initialValue={inputState.view().value}
+ autofocus={!isTouchDevice() && (props.autofocus ?? true)}
+ class="text-base"
+ refFn={attach}
+ onConnect={() => {
+ isEditorConnected = true;
+ flushPendingRestore();
+ flushPendingFocus();
+ queueMicrotask(() => {
+ acceptTyping = true;
+ });
+ }}
+ />
+ <DragInsertIndicator
+ editor={lexicalEditor()}
+ state={entityDragInsertStore}
+ active
+ />
+ </Input.Editor>
+ </Input.Layout.Editor>
+ <Input.Attachments kind="media" />
+ <Input.Attachments kind="document" />
+ </Input.Layout.Body>
+ <Switch>
+ <Match when={props.children}>{props.children}</Match>
+ <Match when>
+ <DefaultActions input={inputState.view()} />
+ </Match>
+ </Switch>
</Input.Layout>
</Input.DropZone>
);
-
- return props.renderContent?.(messageFace) ?? messageFace;
};
return (
@@ -573,7 +565,6 @@ export function ChannelInput(props: ChannelInputProps) {
const next = e.relatedTarget as Node | null;
if (next && e.currentTarget.contains(next)) return;
if (isInternalRefocus) return;
- if (props.collapseOnFocusOut === false) return;
collapsedInput.collapse();
}}
class={isCollapsed() ? 'hidden' : undefined}
diff --git a/apps/web/src/features/channel/Input/Editor.tsx b/apps/web/src/features/channel/Input/Editor.tsx
index 20264df7b9..4e71311584 100644
--- a/apps/web/src/features/channel/Input/Editor.tsx
+++ b/apps/web/src/features/channel/Input/Editor.tsx
@@ -10,7 +10,8 @@ export function Editor(props: JSX.HTMLAttributes<HTMLDivElement>) {
return (
<div
class={cn(
- 'ph-no-capture min-h-6 text-sm whitespace-pre-wrap wrap-break-word',
+ 'ph-no-capture min-h-6 text-base whitespace-pre-wrap wrap-break-word',
+ 'not-touch:min-h-[24.375px]',
local.class
)}
data-input-editor
diff --git a/apps/web/src/features/channel/Input/EditorShell.tsx b/apps/web/src/features/channel/Input/EditorShell.tsx
deleted file mode 100644
index 15ffae6350..0000000000
--- a/apps/web/src/features/channel/Input/EditorShell.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import { cn } from '@ui';
-import { type JSX, splitProps } from 'solid-js';
-
-export function EditorShell(props: JSX.HTMLAttributes<HTMLDivElement>) {
- const [local, rest] = splitProps(props, ['class', 'children']);
-
- return (
- <div
- class={cn(
- 'transition-all duration-150 px-4 touch:px-3 py-2 touch:@min-[40rem]:pb-4 overflow-y-auto placeholder:text-ink-placeholder text-ink w-full text-sm',
- local.class
- )}
- data-input-editor-shell
- {...rest}
- >
- {local.children}
- </div>
- );
-}
diff --git a/apps/web/src/features/channel/Input/Footer.tsx b/apps/web/src/features/channel/Input/Footer.tsx
deleted file mode 100644
index 4d70373a63..0000000000
--- a/apps/web/src/features/channel/Input/Footer.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import { cn } from '@ui';
-import { type JSX, splitProps } from 'solid-js';
-
-export function Footer(props: JSX.HTMLAttributes<HTMLDivElement>) {
- const [local, rest] = splitProps(props, ['class', 'children']);
-
- return (
- <div
- class={cn(
- 'flex flex-row w-full justify-between items-center gap-2 px-2 pb-2 touch:h-8 touch:p-2 touch:mb-2',
- local.class
- )}
- data-input-footer
- {...rest}
- >
- {local.children}
- </div>
- );
-}
diff --git a/apps/web/src/features/channel/Input/Input.ts b/apps/web/src/features/channel/Input/Input.ts
index 77e32f0b82..f8872d4834 100644
--- a/apps/web/src/features/channel/Input/Input.ts
+++ b/apps/web/src/features/channel/Input/Input.ts
@@ -1,10 +1,7 @@
-import { Actions } from './Actions';
import { Attachments } from './Attachments';
import { DropOverlay } from './DropOverlay';
import { DropZone } from './DropZone';
import { Editor } from './Editor';
-import { EditorShell } from './EditorShell';
-import { Footer } from './Footer';
import { FormatRibbon } from './FormatRibbon';
import {
AttachFilesAction,
@@ -23,11 +20,8 @@ export const Input = {
DropOverlay,
DropZone,
FormatRibbon,
- EditorShell,
Editor,
Attachments,
- Footer,
- Actions,
AttachFilesAction,
AttachNativeMediaAction,
ToggleFormatAction,
diff --git a/apps/web/src/features/channel/Input/Layout.tsx b/apps/web/src/features/channel/Input/Layout.tsx
index ccee8db6ce..3394915829 100644
--- a/apps/web/src/features/channel/Input/Layout.tsx
+++ b/apps/web/src/features/channel/Input/Layout.tsx
@@ -1,12 +1,100 @@
-import { cn } from '@ui';
+import { cn } from '@ui/utils/classname';
import { type JSX, splitProps } from 'solid-js';
-export function Layout(props: JSX.HTMLAttributes<HTMLDivElement>) {
- const [local, rest] = splitProps(props, ['class', 'children']);
+function LayoutRoot(
+ props: JSX.HTMLAttributes<HTMLDivElement> & { oneLineInput?: boolean }
+) {
+ const [local, rest] = splitProps(props, [
+ 'class',
+ 'children',
+ 'oneLineInput',
+ ]);
return (
- <div class={cn('flex flex-col w-full', local.class)} {...rest}>
+ <div
+ data-input-layout
+ data-one-line-input={local.oneLineInput ? '' : undefined}
+ class={cn(
+ 'grid grid-cols-[auto_minmax(0,1fr)_auto] w-full',
+ local.oneLineInput
+ ? "[grid-template-areas:'left_body_right'] items-end gap-[3.75px] min-h-[48.75px] p-[7.5px] [--input-editor-padding:4.6875px_3.75px]"
+ : [
+ "[grid-template-areas:'body_body_body'_'left_._right'] items-center",
+ 'not-touch:gap-y-[3.75px] not-touch:p-[7.5px] not-touch:[--input-editor-padding:4.6875px_9.375px]',
+ 'touch:pb-2 touch:[--input-editor-padding:0.5rem_0.75rem] touch:@[40rem]:[--input-editor-padding:0.5rem_0.75rem_1rem]',
+ 'touch:[&>[data-input-actions-left]]:h-8 touch:[&>[data-input-actions-left]]:pl-2',
+ 'touch:[&>[data-input-actions-right]]:h-8 touch:[&>[data-input-actions-right]]:pr-2',
+ ],
+ local.class
+ )}
+ {...rest}
+ >
{local.children}
</div>
);
}
+
+function Body(props: JSX.HTMLAttributes<HTMLDivElement>) {
+ const [local, rest] = splitProps(props, ['class']);
+
+ return (
+ <div
+ {...rest}
+ data-input-body
+ class={cn('[grid-area:body] flex flex-col min-w-0', local.class)}
+ />
+ );
+}
+
+function Editor(props: JSX.HTMLAttributes<HTMLDivElement>) {
+ const [local, rest] = splitProps(props, ['class']);
+
+ return (
+ <div
+ {...rest}
+ data-input-editor-shell
+ class={cn(
+ 'transition-all duration-150 overflow-y-auto placeholder:text-ink-placeholder text-ink w-full text-sm',
+ 'p-(--input-editor-padding) not-touch:max-h-[225px]',
+ local.class
+ )}
+ />
+ );
+}
+
+function ActionsLeft(props: JSX.HTMLAttributes<HTMLDivElement>) {
+ const [local, rest] = splitProps(props, ['class']);
+
+ return (
+ <div
+ {...rest}
+ data-input-actions-left
+ class={cn(
+ '[grid-area:left] flex items-center not-touch:gap-[3.75px] touch:gap-2',
+ local.class
+ )}
+ />
+ );
+}
+
+function ActionsRight(props: JSX.HTMLAttributes<HTMLDivElement>) {
+ const [local, rest] = splitProps(props, ['class']);
+
+ return (
+ <div
+ {...rest}
+ data-input-actions-right
+ class={cn(
+ '[grid-area:right] flex items-center not-touch:gap-[3.75px] touch:gap-2',
+ local.class
+ )}
+ />
+ );
+}
+
+export const Layout = Object.assign(LayoutRoot, {
+ Body,
+ Editor,
+ ActionsLeft,
+ ActionsRight,
+});
diff --git a/apps/web/src/features/channel/Input/SendAction.tsx b/apps/web/src/features/channel/Input/SendAction.tsx
index 36a58391be..79f7a0264d 100644
--- a/apps/web/src/features/channel/Input/SendAction.tsx
+++ b/apps/web/src/features/channel/Input/SendAction.tsx
@@ -27,6 +27,7 @@ export function SendAction(props: SendActionProps) {
return (
<SendButton
+ appearance="composer"
tooltip={tooltipText()}
shortcut="enter"
aria-label={tooltipText()}
diff --git a/apps/web/src/features/channel/Input/TaskComposer.tsx b/apps/web/src/features/channel/Input/TaskComposer.tsx
deleted file mode 100644
index f513ba819a..0000000000
--- a/apps/web/src/features/channel/Input/TaskComposer.tsx
+++ /dev/null
@@ -1,413 +0,0 @@
-import {
- COMPOSER_TITLE_LINE_CLASS,
- ComposeTaskTitleEditor,
-} from '@block-md/component/ComposeTask';
-import { InlinePropertyValue } from '@block-md/component/InlinePropertyValue';
-import {
- createTaskComposerProperties,
- createTaskWithProperties,
- defaultTaskPropertyValues,
-} from '@block-md/util/taskComposerProperties';
-import {
- loadTaskComposerDraft,
- saveTaskComposerDraft,
- type TaskComposerDraft,
- type TaskComposerDraftStorage,
-} from '@block-md/util/taskComposerStorage';
-import { buildConfig } from '@core/component/LexicalMarkdown/builder/MarkdownConfigBuilder';
-import { MarkdownShell } from '@core/component/LexicalMarkdown/builder/MarkdownShell';
-import { addMediaFromFile } from '@core/component/LexicalMarkdown/plugins/media';
-import { initializeEditorEmpty } from '@core/component/LexicalMarkdown/utils';
-import { useUserId } from '@core/context/user';
-import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';
-import PaperclipIcon from '@phosphor-icons/core/regular/paperclip.svg?component-solid';
-import { Modals } from '@property/component/modal';
-import { PropertiesProvider } from '@property/context/PropertiesContext';
-import { InlineTagsPill } from '@property/tags';
-import { useUpsertToHistoryMutation } from '@queries/history/history';
-import { debounce } from '@solid-primitives/scheduled';
-import { Scroll, SendButton } from '@ui';
-import type { LexicalEditor } from 'lexical';
-import {
- createEffect,
- createSignal,
- For,
- type JSX,
- on,
- onCleanup,
- onMount,
- Show,
- Suspense,
-} from 'solid-js';
-import { reconcile, unwrap } from 'solid-js/store';
-import { InputActionButton } from './ActionButton';
-
-export type TaskComposerSendPayload = {
- documentId: string;
- title: string;
- content: string;
-};
-
-/**
- * The channel input's task face: a slimmed-down task compose dialog
- * (title, description, property pills) that swaps in for the message
- * editor when the input is toggled into task mode. Sending creates the
- * task and hands it to the host, which posts it into the channel.
- */
-export function TaskComposer(props: {
- /** Whether the composer is the visible face of the input. */
- active: boolean;
- /** Fires after the task is created; the host posts it to the channel. */
- onSend: (task: TaskComposerSendPayload) => void;
- /** The message/task mode switch, rendered in the composer footer. */
- modeSwitch?: JSX.Element;
- /**
- * Whether to focus the title editor when the composer mounts already
- * active (e.g. a restored task-mode draft). Later activations always
- * focus. Defaults to `true`.
- */
- autofocus?: boolean;
- /**
- * localStorage key to persist the draft under, scoped by the host (e.g.
- * per channel). Without it the draft only lives as long as the composer.
- */
- draftPersistenceKey?: string;
-}) {
- const currentUserId = useUserId();
-
- // Per-host drafts follow the message input's persistence semantics (kept
- // until sent) rather than the compose dialog's short expiry window.
- const draftStorage: TaskComposerDraftStorage | undefined =
- props.draftPersistenceKey
- ? { storageKey: props.draftPersistenceKey, expiryMs: null }
- : undefined;
- const restoredDraft = draftStorage
- ? loadTaskComposerDraft(draftStorage)
- : null;
-
- const [title, setTitle] = createSignal(restoredDraft?.title ?? '');
- const [content, setContent] = createSignal(restoredDraft?.content ?? '');
- const [bodyEditor, setBodyEditor] = createSignal<LexicalEditor>();
- const [containerRef, setContainerRef] = createSignal<HTMLDivElement>();
- const [isCreating, setIsCreating] = createSignal(false);
- const [tagLayoutMode, setTagLayoutMode] = createSignal<'bottom' | 'title'>(
- 'bottom'
- );
- let titleEditorRoot: HTMLDivElement | undefined;
- let attachInputRef: HTMLInputElement | undefined;
-
- const defaultPropertyValues = () => {
- const id = currentUserId();
- return defaultTaskPropertyValues(id ? [id] : []);
- };
-
- const {
- propertyValues,
- setPropertyValues,
- properties,
- saveHandler,
- composerTags,
- clearComposerTags,
- createDefinitions,
- } = createTaskComposerProperties({
- initialValues: restoredDraft?.propertyValues ?? defaultPropertyValues(),
- });
-
- const upsertToHistoryMutation = useUpsertToHistoryMutation();
-
- if (draftStorage) {
- const snapshotDraft = (): Omit<TaskComposerDraft, 'timestamp'> => ({
- title: title(),
- content: content(),
- editorState: bodyEditor()?.getEditorState().toJSON(),
- propertyValues: structuredClone(unwrap(propertyValues)),
- });
-
- // Mirrors the compose dialog's draft autosave: skip the first run (it
- // would just rewrite what was restored), subscribe deeply to property
- // edits, and debounce the localStorage writes.
- let hasInitializedFromDraft = restoredDraft !== null;
- const debouncedSave = debounce(
- (draft: Omit<TaskComposerDraft, 'timestamp'>) =>
- saveTaskComposerDraft(draft, draftStorage),
- 300
- );
- createEffect(() => {
- title();
- content();
- JSON.stringify(propertyValues);
- if (hasInitializedFromDraft) {
- hasInitializedFromDraft = false;
- return;
- }
- debouncedSave(snapshotDraft());
- });
- onCleanup(() => {
- // Flush the latest state so navigating away never drops keystrokes
- // that were still inside the debounce window.
- debouncedSave.clear();
- saveTaskComposerDraft(snapshotDraft(), draftStorage);
- });
- }
-
- // A title-mode pill that ends a picker session with no tags left has nothing
- // to show, so drop it back to the property row instead of leaving an empty
- // "Tags" chip beside the title. Collapsing on the session end rather than on
- // the tag removal itself keeps the open picker from unmounting under the user.
- const handleTitleTagPickerActive = (active: boolean) => {
- if (active) return;
- if (composerTags.appliedTags().length > 0) return;
- setTagLayoutMode('bottom');
- };
-
- const deleteTitleTagsAtStart = () => {
- if (tagLayoutMode() !== 'title') return false;
- clearComposerTags();
- setTagLayoutMode('bottom');
- return true;
- };
-
- const handleAttachFiles = async (event: Event) => {
- const input = event.currentTarget as HTMLInputElement;
- const files = Array.from(input.files ?? []);
- input.value = '';
- const editor = bodyEditor();
- if (!editor || files.length === 0) return;
- for (const file of files) {
- const mediaType = file.type.startsWith('video/') ? 'video' : 'image';
- await addMediaFromFile(editor, file, mediaType);
- }
- };
-
- const canSend = () => title().trim().length > 0 && !isCreating();
-
- const resetComposer = () => {
- setTitle('');
- setContent('');
- setTagLayoutMode('bottom');
- setPropertyValues(reconcile(defaultPropertyValues()));
- const editor = bodyEditor();
- editor && initializeEditorEmpty(editor);
- };
-
- const handleSend = async () => {
- if (!canSend()) return;
- const taskTitle = title().trim();
- const taskContent = content().trim();
- setIsCreating(true);
- const taskProperties = structuredClone(
- Object.entries(unwrap(propertyValues))
- );
- const createdTask = await createTaskWithProperties(
- taskTitle,
- taskContent,
- taskProperties,
- createDefinitions(),
- (params) => upsertToHistoryMutation.mutate(params)
- );
- setIsCreating(false);
- // createTaskWithProperties surfaces its own failure toast; keep the
- // draft so the user can retry.
- if (!createdTask) return;
- resetComposer();
- props.onSend({
- documentId: createdTask.documentId,
- title: taskTitle,
- content: taskContent,
- });
- };
-
- const [attachHotkeys, composerHotkeyScope] = useHotkeyDOMScope(
- 'channel-input-task-composer',
- true
- );
- onMount(() => {
- const container = containerRef();
- if (container) attachHotkeys(container);
- });
-
- registerHotkey({
- hotkey: 'cmd+enter',
- scopeId: composerHotkeyScope,
- description: 'Create task and send',
- keyDownHandler: () => {
- void handleSend();
- return true;
- },
- runWithInputFocused: true,
- });
-
- const editorConfig = buildConfig('markdown')
- .withMentions()
- .withTags({
- applyTargetLabel: 'Task',
- isApplied: (tag) => composerTags.isApplied(tag.optionId),
- onCreate: (tag) => {
- void composerTags.applyTag(tag.scope, tag.optionId);
- },
- })
- .withEmojis()
- .withActions()
- .withCode()
- .withMedia({ fileDrop: true })
- .withSelectionData()
- .withFloatingFormatMenu()
- .withHistory()
- .onChange(setContent)
- .onEscape(() => {
- containerRef()?.focus();
- return true;
- });
-
- const editor = editorConfig.buildHandle().lexical;
- setBodyEditor(editor);
-
- // Imperative DOM focus: entering task mode focuses the title editor. The
- // first activation is the mount itself — a restored task-mode draft — and
- // only focuses when the host's autofocus allows it.
- let isFirstActivation = true;
- createEffect(
- on(
- () => props.active,
- (active) => {
- if (!active) return;
- const shouldFocus = isFirstActivation
- ? (props.autofocus ?? true)
- : true;
- isFirstActivation = false;
- if (!shouldFocus) return;
- requestAnimationFrame(() => titleEditorRoot?.focus());
- }
- )
- );
-
- return (
- // Compact edges matching the message face (content at px-3/pt-2), with
- // roomier gap-4 spacing between title, description, and property pills.
- // The property pills and footer share the footer's 8px inset so the pills,
- // the action buttons, and the composer's edges are evenly spaced.
- <div
- class="relative flex flex-col"
- tabIndex={-1}
- ref={setContainerRef}
- data-input-task-composer
- >
- <div class="flex flex-col gap-4 px-3 pt-2">
- <div class="shrink-0 flex gap-2 items-start">
- <Show when={tagLayoutMode() === 'title'}>
- <div class={COMPOSER_TITLE_LINE_CLASS}>
- <InlineTagsPill
- docTags={composerTags}
- showPlaceholder
- class="shrink-0"
- onActiveChange={handleTitleTagPickerActive}
- />
- </div>
- </Show>
- <ComposeTaskTitleEditor
- value={title}
- onChange={setTitle}
- disabled={isCreating}
- bodyEditor={bodyEditor}
- containerRef={containerRef}
- onUserInput={() => {}}
- onTagSelected={(tag) => {
- setTagLayoutMode('title');
- void composerTags.applyTag(tag.scope, tag.optionId);
- }}
- onDeleteTagsAtStart={deleteTitleTagsAtStart}
- ref={(el) => {
- titleEditorRoot = el;
- }}
- />
- </div>
-
- <div class="overflow-y-auto scrollbar-hidden min-h-24 max-h-[calc(30*var(--dvh,1dvh))]">
- <Scroll>
- <MarkdownShell
- config={editorConfig}
- initialState={restoredDraft?.editorState}
- initialValue={
- restoredDraft?.editorState
- ? undefined
- : restoredDraft?.content || undefined
- }
- placeholder="Add description, type @ to insert or / for commands"
- class="text-sm"
- />
- </Scroll>
- </div>
- </div>
-
- {/* Property pills line up with the footer's action row (px-2) rather
- than the text above it, so the leading pill is flush with the attach
- button, and pt-4 keeps the gap-4 rhythm of the content above. */}
- <div class="px-2 pt-4">
- <Suspense fallback={<div class="h-7" />}>
- <PropertiesProvider
- entityType="TASK"
- canEdit={true}
- properties={properties}
- onRefresh={() => {}}
- onPropertyAdded={() => {}}
- onPropertyDeleted={() => {}}
- saveHandler={saveHandler}
- >
- <div class="flex min-h-7 flex-row flex-wrap items-center gap-2 text-sm">
- <For each={properties()}>
- {(property) => (
- <InlinePropertyValue
- property={property}
- emptyLabel={property.displayName}
- />
- )}
- </For>
- <Show when={tagLayoutMode() === 'bottom'}>
- <InlineTagsPill docTags={composerTags} showPlaceholder />
- </Show>
- </div>
- <Modals />
- </PropertiesProvider>
- </Suspense>
- </div>
-
- {/* A plain p-2 box (no fixed height, no extra bottom margin) puts an
- even 8px between the action row and the composer's bottom-left edges
- and the property pills above it. */}
- <div class="shrink-0 flex w-full flex-row justify-between items-center p-2 space-x-2">
- <div class="flex items-center gap-2">
- <input
- ref={(el) => {
- attachInputRef = el;
- }}
- type="file"
- class="hidden"
- multiple
- accept="image/*,video/*"
- onChange={handleAttachFiles}
- data-input-task-attach-picker
- />
- <InputActionButton
- label="Attach image or video"
- onClick={() => attachInputRef?.click()}
- >
- <PaperclipIcon />
- </InputActionButton>
- {props.modeSwitch}
- </div>
- <SendButton
- tooltip="Create task and send"
- shortcut="cmd+enter"
- aria-label="Create task and send"
- data-input-action="send-task"
- pending={isCreating()}
- disabled={!canSend()}
- onPointerDown={(event) => {
- event.preventDefault();
- void handleSend();
- }}
- />
- </div>
- </div>
- );
-}
diff --git a/apps/web/src/features/channel/Input/TaskModeChannelInput.tsx b/apps/web/src/features/channel/Input/TaskModeChannelInput.tsx
deleted file mode 100644
index 28f883bcce..0000000000
--- a/apps/web/src/features/channel/Input/TaskModeChannelInput.tsx
+++ /dev/null
@@ -1,190 +0,0 @@
-import { isMobile } from '@core/mobile/isMobile';
-import { isPlatform } from '@core/util/platform';
-import { makePersisted } from '@solid-primitives/storage';
-import { cn } from '@ui';
-import { createSignal, onCleanup, Show, splitProps } from 'solid-js';
-import { ChannelInput, type ChannelInputProps } from './ChannelInput';
-import { Input } from './Input';
-import { TaskComposer, type TaskComposerSendPayload } from './TaskComposer';
-import { TaskModeSwitch } from './TaskModeSwitch';
-import type { InputHandle } from './types';
-import type { InputTaskPersistence } from './utils/persistence';
-
-/** Props for a full channel input with message and task composition modes. */
-export type TaskModeChannelInputProps = Omit<
- ChannelInputProps,
- 'children' | 'collapseOnFocusOut' | 'renderContent'
-> & {
- /** Called after the task composer creates a task. */
- onSendTask: (task: TaskComposerSendPayload) => void;
- /** Persistence keys for the task draft and selected input mode. */
- taskPersistence?: InputTaskPersistence;
-};
-
-function MessageModeActions(props: {
- canUseTaskMode: boolean;
- onEnterTaskMode: () => void;
-}) {
- return (
- <Show
- when={isPlatform('ios')}
- fallback={
- <Input.Actions>
- <Input.Actions.Left>
- <Input.AttachFilesAction />
- <Input.ToggleFormatAction />
- <Show when={props.canUseTaskMode}>
- <TaskModeSwitch
- checked={false}
- onChange={props.onEnterTaskMode}
- />
- </Show>
- </Input.Actions.Left>
- <Input.Actions.Right>
- <Input.SendAction />
- </Input.Actions.Right>
- </Input.Actions>
- }
- >
- <Input.Actions>
- <Input.Actions.Left>
- <Input.AttachNativeMediaAction />
- <Input.ToggleFormatAction />
- </Input.Actions.Left>
- <Input.Actions.Right>
- <Input.SendAction />
- </Input.Actions.Right>
- </Input.Actions>
- </Show>
- );
-}
-
-/**
- * Composes the message-only ChannelInput with the task composer for full
- * channel and DM views. Import this module directly; exporting it from the
- * general Input barrel would pull the task/entity graph into thread inputs.
- */
-export function TaskModeChannelInput(props: TaskModeChannelInputProps) {
- const [local, inputProps] = splitProps(props, [
- 'autofocus',
- 'onReady',
- 'onSendTask',
- 'taskPersistence',
- ]);
-
- const canUseTaskMode = () => !isPlatform('ios') && !isMobile();
- const taskModeSignal = createSignal(false);
- const [taskModeRequested, setTaskModeRequested] = local.taskPersistence
- ? makePersisted(taskModeSignal, { name: local.taskPersistence.modeKey })
- : taskModeSignal;
- const taskModeRestored = taskModeRequested() === true;
- const [taskComposerMounted, setTaskComposerMounted] =
- createSignal(taskModeRestored);
- const isTaskMode = () => canUseTaskMode() && taskModeRequested();
-
- let messageInputHandle: InputHandle | undefined;
- let morphWrapperEl: HTMLDivElement | undefined;
- let morphContentEl: HTMLDivElement | undefined;
- const [morphHeight, setMorphHeight] = createSignal<number>();
- let morphTimer: ReturnType<typeof setTimeout> | undefined;
- onCleanup(() => clearTimeout(morphTimer));
-
- const setTaskMode = (task: boolean) => {
- if (task === taskModeRequested()) return;
- if (task) setTaskComposerMounted(true);
-
- const from = morphWrapperEl?.offsetHeight;
- setTaskModeRequested(task);
- if (!task) messageInputHandle?.focus();
- if (from === undefined) return;
-
- setMorphHeight(from);
- requestAnimationFrame(() => {
- const to = morphContentEl?.offsetHeight;
- if (to === undefined) return;
- setMorphHeight(to);
- clearTimeout(morphTimer);
- morphTimer = setTimeout(() => setMorphHeight(undefined), 350);
- });
- };
-
- const handleTaskSend = (task: TaskComposerSendPayload) => {
- local.onSendTask(task);
- setTaskMode(false);
- };
-
- const setMessageInputHandle = (handle: InputHandle) => {
- messageInputHandle = handle;
- local.onReady?.(handle);
- };
-
- return (
- <ChannelInput
- {...inputProps}
- autofocus={taskModeRestored ? false : local.autofocus}
- collapseOnFocusOut={!isTaskMode()}
- onReady={setMessageInputHandle}
- renderContent={(messageFace) => (
- <div
- ref={(el) => {
- morphWrapperEl = el;
- }}
- class={cn(
- morphHeight() !== undefined &&
- 'overflow-hidden transition-[height] duration-300 ease-in-out'
- )}
- style={{
- height:
- morphHeight() !== undefined ? `${morphHeight()}px` : undefined,
- }}
- >
- <div
- ref={(el) => {
- morphContentEl = el;
- }}
- >
- <div
- class={cn(
- isTaskMode() && 'hidden',
- taskComposerMounted() &&
- 'animate-[dialog-fullscreen-open_200ms_ease-out]'
- )}
- data-input-face="message"
- >
- {messageFace}
- </div>
- <Show when={taskComposerMounted()}>
- <div
- class={cn(
- !isTaskMode() && 'hidden',
- 'animate-[dialog-fullscreen-open_200ms_ease-out]'
- )}
- data-input-face="task"
- >
- <TaskComposer
- active={isTaskMode()}
- autofocus={
- taskModeRestored ? (local.autofocus ?? true) : true
- }
- draftPersistenceKey={local.taskPersistence?.draftKey}
- modeSwitch={
- <TaskModeSwitch
- checked={true}
- onChange={() => setTaskMode(false)}
- />
- }
- onSend={handleTaskSend}
- />
- </div>
- </Show>
- </div>
- </div>
- )}
- >
- <MessageModeActions
- canUseTaskMode={canUseTaskMode()}
- onEnterTaskMode={() => setTaskMode(true)}
- />
- </ChannelInput>
- );
-}
diff --git a/apps/web/src/features/channel/Input/TaskModeSwitch.tsx b/apps/web/src/features/channel/Input/TaskModeSwitch.tsx
deleted file mode 100644
index 4ed0fc8068..0000000000
--- a/apps/web/src/features/channel/Input/TaskModeSwitch.tsx
+++ /dev/null
@@ -1,25 +0,0 @@
-import { ToggleSwitch } from '@ui';
-
-/**
- * The message/task mode switch shown in the input footer, next to the
- * format (`Aa`) button in message mode and next to the attach button in
- * task mode. Checked means the input is composing a task. Outlined as a
- * pill so the label and switch read as one control.
- */
-export function TaskModeSwitch(props: {
- checked: boolean;
- onChange: (checked: boolean) => void;
-}) {
- return (
- <ToggleSwitch
- checked={props.checked}
- onChange={props.onChange}
- label="Task"
- // Concentric rounding: the h-4 switch has an 8px radius, so a uniform
- // 6px ring around it needs a 14px outer radius (h-7 rounded-full) and
- // matching 6px padding on the switch side.
- class="h-7 gap-1.5 rounded-full border border-edge-muted bg-surface pl-1.5 pr-2.5 hover:bg-hover"
- labelClass="text-xs text-ink-muted font-normal whitespace-nowrap"
- />
- );
-}
diff --git a/apps/web/src/features/channel/Input/index.ts b/apps/web/src/features/channel/Input/index.ts
index b2be5344f7..42d57b52a4 100644
--- a/apps/web/src/features/channel/Input/index.ts
+++ b/apps/web/src/features/channel/Input/index.ts
@@ -1,5 +1,4 @@
export { InputActionButton } from './ActionButton';
-export { Actions } from './Actions';
export { Attachments } from './Attachments';
export { createInputAttachmentTracker } from './attachment-tracker';
export { ChannelInput } from './ChannelInput';
@@ -10,8 +9,6 @@ export { createInputState } from './create-input-state';
export { DropOverlay } from './DropOverlay';
export { DropZone } from './DropZone';
export { Editor } from './Editor';
-export { EditorShell } from './EditorShell';
-export { Footer } from './Footer';
export { FormatButtons } from './FormatButtons';
export { FormatRibbon } from './FormatRibbon';
export { Input } from './Input';
diff --git a/apps/web/src/features/channel/Input/tests/input-slots.test.tsx b/apps/web/src/features/channel/Input/tests/input-slots.test.tsx
index 893d2073da..11dfeecf13 100644
--- a/apps/web/src/features/channel/Input/tests/input-slots.test.tsx
+++ b/apps/web/src/features/channel/Input/tests/input-slots.test.tsx
@@ -31,6 +31,10 @@ vi.hoisted(() => {
});
});
+vi.mock('@core/component/LexicalMarkdown/utils/create-has-line-breaks', () => ({
+ createHasLineBreaks: () => () => false,
+}));
+
vi.mock('@core/util/upload', () => ({
chatRuleset: {},
uploadFile: vi.fn(),
@@ -357,20 +361,25 @@ describe('Input slots', () => {
})()
);
- expect(container.querySelector('[data-input-actions]')).toBeTruthy();
- expect(container.querySelector('[data-input-actions-left]')).toBeTruthy();
- expect(container.querySelector('[data-input-actions-right]')).toBeTruthy();
+ const layout = container.querySelector('[data-input-layout]');
+ expect(
+ container.querySelector('[data-input-actions-left]')?.parentElement
+ ).toBe(layout);
+ expect(
+ container.querySelector('[data-input-actions-right]')?.parentElement
+ ).toBe(layout);
await user.click(screen.getByRole('button', { name: 'Send message' }));
const clickSpy = vi.spyOn(HTMLInputElement.prototype, 'click');
await user.click(screen.getByRole('button', { name: 'Attach files' }));
- await user.click(screen.getByRole('button', { name: 'Format' }));
+ expect(screen.queryByRole('menu')).toBeNull();
+ expect(screen.queryByRole('button', { name: 'Format' })).toBeNull();
await user.click(screen.getByRole('button', { name: 'Delete reply' }));
expect(onSend).toHaveBeenCalledOnce();
expect(clickSpy).toHaveBeenCalledOnce();
clickSpy.mockRestore();
- expect(onToggleFormatRibbon).toHaveBeenCalledOnce();
+ expect(onToggleFormatRibbon).not.toHaveBeenCalled();
expect(onClose).toHaveBeenCalledOnce();
expect(onSend.mock.calls[0]?.[0]?.value).toBe('reply');
});
diff --git a/apps/web/src/features/channel/Input/tests/layout.test.tsx b/apps/web/src/features/channel/Input/tests/layout.test.tsx
new file mode 100644
index 0000000000..1c2268b290
--- /dev/null
+++ b/apps/web/src/features/channel/Input/tests/layout.test.tsx
@@ -0,0 +1,50 @@
+/** @vitest-environment jsdom */
+
+import { render, screen } from '@solidjs/testing-library';
+import userEvent from '@testing-library/user-event';
+import { createSignal } from 'solid-js';
+import { expect, it } from 'vitest';
+import { Layout } from '../Layout';
+
+it('preserves the editor, selection, file picker, and focused actions when the layout changes', async () => {
+ const user = userEvent.setup();
+ const [oneLineInput, setOneLineInput] = createSignal(true);
+ render(() => (
+ <Layout oneLineInput={oneLineInput()}>
+ <Layout.Body>
+ <Layout.Editor>
+ <textarea aria-label="Message" />
+ </Layout.Editor>
+ </Layout.Body>
+ <Layout.ActionsLeft>
+ <input type="file" aria-label="Attachment" />
+ </Layout.ActionsLeft>
+ <Layout.ActionsRight>
+ <button type="button">Send</button>
+ </Layout.ActionsRight>
+ </Layout>
+ ));
+
+ const editor = screen.getByRole<HTMLTextAreaElement>('textbox');
+ const picker = screen.getByLabelText<HTMLInputElement>('Attachment');
+ const send = screen.getByRole('button', { name: 'Send' });
+ const file = new File(['draft'], 'draft.txt', { type: 'text/plain' });
+ await user.upload(picker, file);
+ await user.type(editor, 'Hello world');
+ editor.setSelectionRange(2, 7);
+
+ for (const next of [false, true]) {
+ setOneLineInput(next);
+ expect(screen.getByRole('textbox')).toBe(editor);
+ expect(document.activeElement).toBe(editor);
+ expect(editor.value).toBe('Hello world');
+ expect([editor.selectionStart, editor.selectionEnd]).toEqual([2, 7]);
+ expect(screen.getByLabelText('Attachment')).toBe(picker);
+ expect(picker.files?.[0]).toBe(file);
+ }
+
+ send.focus();
+ setOneLineInput(false);
+ expect(screen.getByRole('button', { name: 'Send' })).toBe(send);
+ expect(document.activeElement).toBe(send);
+});
diff --git a/apps/web/src/features/channel/Input/tests/task-mode.test.tsx b/apps/web/src/features/channel/Input/tests/task-mode.test.tsx
deleted file mode 100644
index fde5436b44..0000000000
--- a/apps/web/src/features/channel/Input/tests/task-mode.test.tsx
+++ /dev/null
@@ -1,392 +0,0 @@
-/**
- * @vitest-environment jsdom
- */
-
-import { render as renderBare, screen, within } from '@solidjs/testing-library';
-import { QueryClient, QueryClientProvider } from '@tanstack/solid-query';
-import userEvent from '@testing-library/user-event';
-import type { JSX } from 'solid-js';
-import { describe, expect, it, vi } from 'vitest';
-
-vi.hoisted(() => {
- Object.defineProperty(window, 'matchMedia', {
- writable: true,
- value: (query: string) => ({
- matches: false,
- media: query,
- onchange: null,
- addListener: () => {},
- removeListener: () => {},
- addEventListener: () => {},
- removeEventListener: () => {},
- dispatchEvent: () => true,
- }),
- });
-});
-
-vi.mock('@core/util/upload', () => ({
- chatRuleset: {},
- uploadFile: vi.fn(),
-}));
-
-vi.mock('@core/cursor/flag', () => ({
- useCursorAgentsAccess: () => () => true,
-}));
-
-vi.mock('@core/codex/flag', () => ({
- useCodexAgentsAccess: () => () => false,
-}));
-
-// Several service clients in StaticMarkdown's import graph build websocket
-// connections at module scope, which jsdom cannot do. Stub the builder so
-// every module-scope socket is inert.
-vi.mock('@macro-inc/collaboration/websocket', async (importOriginal) => {
- const actual = await importOriginal<object>();
- const socket = {
- addEventListener: () => {},
- removeEventListener: () => {},
- send: () => {},
- close: () => {},
- };
- const builder: object = new Proxy(
- {},
- {
- get: (_target, prop) => {
- if (typeof prop === 'symbol' || prop === 'then') return undefined;
- return prop === 'build' ? () => socket : () => builder;
- },
- }
- );
- return {
- ...actual,
- WebsocketBuilder: function WebsocketBuilder() {
- return builder;
- },
- };
-});
-
-vi.mock('@core/constant/allBlocks', () => ({
- fileTypeToBlockName: (type?: string | null) => type ?? 'unknown',
-}));
-
-vi.mock('@phosphor-icons/core/regular/paperclip.svg?component-solid', () => ({
- default: () => <span data-testid="paperclip-icon" />,
-}));
-
-vi.mock('@phosphor/text-aa.svg', () => ({
- default: () => <span data-testid="format-icon" />,
-}));
-
-vi.mock('@phosphor/trash.svg', () => ({
- default: () => <span data-testid="trash-icon" />,
-}));
-
-vi.mock('@phosphor/x.svg', () => ({
- default: () => <span data-testid="close-icon" />,
-}));
-
-vi.mock('@phosphor/arrow-up.svg', () => ({
- default: () => <span data-testid="send-icon" />,
-}));
-
-vi.mock(
- '@phosphor-icons/core/regular/paper-plane-right.svg?component-solid',
- () => ({
- default: () => <span data-testid="paper-plane-icon" />,
- })
-);
-
-vi.mock('@phosphor/spinner-gap.svg', () => ({
- default: () => <span data-testid="spinner-icon" />,
-}));
-
-vi.mock('@core/component/EntityIcon', () => ({
- EntityIcon: () => <span data-testid="entity-icon" />,
-}));
-
-vi.mock('@core/component/LexicalMarkdown/builder/MarkdownShell', () => ({
- MarkdownShell: (props: { placeholder?: string; initialValue?: string }) => (
- <div
- data-testid="markdown-shell"
- data-initial-value={props.initialValue ?? ''}
- >
- {props.placeholder}
- </div>
- ),
-}));
-
-vi.mock(
- '@core/component/LexicalMarkdown/builder/MarkdownConfigBuilder',
- () => ({
- buildConfig: () => {
- const controls = {
- clear: vi.fn(),
- focus: vi.fn(),
- };
- const lexical = {
- focus: vi.fn(),
- dispatchCommand: vi.fn(),
- getElementByKey: vi.fn(),
- getRootElement: vi.fn(),
- update: vi.fn((callback: () => void) => callback()),
- };
- const handle = {
- controls,
- lexical,
- plugins: { use: vi.fn() },
- selection: undefined,
- _internal: {},
- };
- type BuilderMock = Record<
- | 'namespace'
- | 'withMentions'
- | 'withEmojis'
- | 'withActions'
- | 'withLinks'
- | 'withHistory'
- | 'withCode'
- | 'withFilePaste'
- | 'withRestoreFocus'
- | 'withSelectionData'
- | 'withFloatingFormatMenu'
- | 'use'
- | 'onChange'
- | 'onEnter',
- () => BuilderMock
- > & {
- buildHandle: () => typeof handle;
- controls: typeof controls;
- lexical: typeof lexical;
- selection: undefined;
- };
- const builder: BuilderMock = {
- namespace: () => builder,
- withMentions: () => builder,
- withEmojis: () => builder,
- withActions: () => builder,
- withLinks: () => builder,
- withHistory: () => builder,
- withCode: () => builder,
- withFilePaste: () => builder,
- withRestoreFocus: () => builder,
- withSelectionData: () => builder,
- withFloatingFormatMenu: () => builder,
- use: () => builder,
- onChange: () => builder,
- onEnter: () => builder,
- buildHandle: () => handle,
- controls,
- lexical,
- selection: undefined,
- };
- return builder;
- },
- })
-);
-
-vi.mock('@core/component/LexicalMarkdown/plugins', () => ({
- createDragInsertStore: () => [
- { nodeKey: null, position: null, visible: false },
- vi.fn(),
- ],
- DefaultShortcuts: {},
- INSERT_DOCUMENT_MENTION_COMMAND: 'INSERT_DOCUMENT_MENTION_COMMAND',
- NODE_TRANSFORM: 'NODE_TRANSFORM',
- keyboardShortcutsPlugin: () => () => () => {},
-}));
-
-vi.mock('@core/component/LexicalMarkdown/plugins/tables/tablePlugin', () => ({
- tablePlugin: () => () => () => {},
-}));
-
-vi.mock(
- '@core/component/LexicalMarkdown/plugins/tables/tableCellResizerPlugin',
- () => ({
- tableCellResizerPlugin: () => () => () => {},
- })
-);
-
-vi.mock('../FormatButtons', () => ({
- FormatButtons: () => <div data-testid="format-buttons" />,
-}));
-
-// The real composer drags in the compose-task dialog's editor and property
-// stack; these tests only exercise the mode switch wiring around it.
-vi.mock('../TaskComposer', () => ({
- TaskComposer: (props: {
- active: boolean;
- onSend: (task: {
- documentId: string;
- title: string;
- content: string;
- }) => void;
- modeSwitch?: JSX.Element;
- }) => (
- <div data-testid="task-composer">
- {props.modeSwitch}
- <button
- type="button"
- data-testid="task-composer-send"
- onClick={() =>
- props.onSend({ documentId: 'task-1', title: 'A task', content: '' })
- }
- >
- send task
- </button>
- </div>
- ),
-}));
-
-import { ChannelInput } from '../ChannelInput';
-import { TaskModeChannelInput } from '../TaskModeChannelInput';
-import type { InputData } from '../types';
-
-const baseInput: InputData = {
- mode: 'channel',
- id: 'input-1',
- placeholder: 'Message channel',
- value: '',
- showFormatRibbon: false,
- hasPendingAttachments: false,
- attachments: [],
-};
-
-/**
- * `ChannelInput` reads the stored Cursor API key status to decide whether to
- * offer `@cursor` in the mention typeahead, so it needs a query client even
- * though none of these tests care about that entry. Shadowing `render` keeps
- * every call site below unchanged.
- */
-const testQueryClient = new QueryClient({
- defaultOptions: { queries: { retry: false } },
-});
-
-function render(ui: () => JSX.Element) {
- return renderBare(() => (
- <QueryClientProvider client={testQueryClient}>{ui()}</QueryClientProvider>
- ));
-}
-
-describe('Channel input task mode', () => {
- it('keeps the base channel input message-only', () => {
- render(() => <ChannelInput input={baseInput} />);
-
- expect(screen.queryByRole('switch', { name: 'Task' })).toBeNull();
- expect(screen.queryByTestId('task-composer')).toBeNull();
- });
-
- it('shows an unchecked task mode switch at the normal input width', () => {
- const { container } = render(() => (
- <TaskModeChannelInput input={baseInput} onSendTask={() => {}} />
- ));
-
- expect(container.firstElementChild?.classList).toContain(
- 'macro-message-width'
- );
- const modeSwitch = screen.getByRole('switch', { name: 'Task' });
- expect(modeSwitch).toHaveProperty('checked', false);
- expect(screen.queryByTestId('task-composer')).toBeNull();
- });
-
- it('swaps the input faces when toggling task mode on and off', async () => {
- const user = userEvent.setup();
- const { container } = render(() => (
- <TaskModeChannelInput input={baseInput} onSendTask={() => {}} />
- ));
-
- await user.click(screen.getByRole('switch', { name: 'Task' }));
-
- expect(screen.getByTestId('task-composer')).toBeTruthy();
- const messageFace = container.querySelector('[data-input-face="message"]');
- const taskFace = container.querySelector('[data-input-face="task"]');
- expect(messageFace?.classList.contains('hidden')).toBe(true);
- expect(taskFace?.classList.contains('hidden')).toBe(false);
-
- // The switch rendered inside the composer footer is checked; toggling it
- // returns to message mode but keeps the composer mounted for its draft.
- const composerSwitch = within(taskFace as HTMLElement).getByRole('switch', {
- name: 'Task',
- });
- expect(composerSwitch).toHaveProperty('checked', true);
- await user.click(composerSwitch);
-
- expect(messageFace?.classList.contains('hidden')).toBe(false);
- expect(taskFace?.classList.contains('hidden')).toBe(true);
- expect(screen.getByTestId('task-composer')).toBeTruthy();
- });
-
- it('enters task mode from clicks on the switch pill itself, not just the control', async () => {
- const user = userEvent.setup();
- render(() => (
- <TaskModeChannelInput input={baseInput} onSendTask={() => {}} />
- ));
-
- // The pill (Kobalte switch root) is the label's parent; clicking its
- // padding must toggle just like clicking the control or label.
- const pill = screen.getByText('Task').parentElement as HTMLElement;
- await user.click(pill);
-
- expect(screen.getByTestId('task-composer')).toBeTruthy();
- });
-
- it('restores a persisted task mode on remount', async () => {
- const user = userEvent.setup();
- const taskPersistence = {
- draftKey: 'task-composer-draft-channel:c1-persist-v0' as const,
- modeKey: 'input-task-mode-channel:c1-persist-v0' as const,
- };
- localStorage.removeItem(taskPersistence.modeKey);
-
- const first = render(() => (
- <TaskModeChannelInput
- input={baseInput}
- onSendTask={() => {}}
- taskPersistence={taskPersistence}
- />
- ));
- await user.click(screen.getByRole('switch', { name: 'Task' }));
- expect(
- first.container
- .querySelector('[data-input-face="task"]')
- ?.classList.contains('hidden')
- ).toBe(false);
- first.unmount();
-
- const second = render(() => (
- <TaskModeChannelInput
- input={baseInput}
- onSendTask={() => {}}
- taskPersistence={taskPersistence}
- />
- ));
- const taskFace = second.container.querySelector('[data-input-face="task"]');
- expect(taskFace).toBeTruthy();
- expect(taskFace?.classList.contains('hidden')).toBe(false);
- expect(
- second.container
- .querySelector('[data-input-face="message"]')
- ?.classList.contains('hidden')
- ).toBe(true);
- localStorage.removeItem(taskPersistence.modeKey);
- });
-
- it('forwards the created task and returns to message mode on send', async () => {
- const user = userEvent.setup();
- const onSendTask = vi.fn();
- const { container } = render(() => (
- <TaskModeChannelInput input={baseInput} onSendTask={onSendTask} />
- ));
-
- await user.click(screen.getByRole('switch', { name: 'Task' }));
- await user.click(screen.getByTestId('task-composer-send'));
-
- expect(onSendTask).toHaveBeenCalledOnce();
- expect(onSendTask.mock.calls[0]?.[0]).toEqual({
- documentId: 'task-1',
- title: 'A task',
- content: '',
- });
- const messageFace = container.querySelector('[data-input-face="message"]');
- expect(messageFace?.classList.contains('hidden')).toBe(false);
- });
-});
diff --git a/apps/web/src/features/channel/Input/utils/persistence.ts b/apps/web/src/features/channel/Input/utils/persistence.ts
index fa2919e229..081cd2b233 100644
--- a/apps/web/src/features/channel/Input/utils/persistence.ts
+++ b/apps/web/src/features/channel/Input/utils/persistence.ts
@@ -12,10 +12,6 @@ const ATTACHMENT_TRACKER_PREFIX = 'attachment-tracker';
const ATTACHMENT_TRACKER_VERSION = 0;
const INPUT_VALUE_PREFIX = 'input-value';
const INPUT_VALUE_VERSION = 0;
-const TASK_DRAFT_PREFIX = 'task-composer-draft';
-const TASK_DRAFT_VERSION = 0;
-const TASK_MODE_PREFIX = 'input-task-mode';
-const TASK_MODE_VERSION = 0;
function makeScopedPersistenceName(prefix: string, props: PersistenceProps) {
return `${prefix}-channel:${props.channelId}${props.threadId ? `-thread:${props.threadId}` : ''}`;
@@ -38,26 +34,3 @@ export function makeInputValuePersistenceKey(
INPUT_VALUE_VERSION
);
}
-
-export type InputTaskPersistence = {
- /** localStorage key for the task composer's draft blob. */
- draftKey: PersistenceKey;
- /** `makePersisted` key for the message/task mode flag. */
- modeKey: PersistenceKey;
-};
-
-/** Keys that persist a channel input's task draft and mode across visits. */
-export function makeTaskPersistence(
- props: PersistenceProps
-): InputTaskPersistence {
- return {
- draftKey: createPersistenceKey(
- makeScopedPersistenceName(TASK_DRAFT_PREFIX, props),
- TASK_DRAFT_VERSION
- ),
- modeKey: createPersistenceKey(
- makeScopedPersistenceName(TASK_MODE_PREFIX, props),
- TASK_MODE_VERSION
- ),
- };
-}
diff --git a/apps/web/src/features/channel/Message/Content.tsx b/apps/web/src/features/channel/Message/Content.tsx
index aa4bdd9e03..ed2d24881f 100644
--- a/apps/web/src/features/channel/Message/Content.tsx
+++ b/apps/web/src/features/channel/Message/Content.tsx
@@ -29,7 +29,7 @@ export function Content(props: ContentProps) {
data-message-content
class={cn(
'whitespace-pre-wrap wrap-break-word max-w-full',
- bigEmoji() ? 'text-4xl' : 'text-sm',
+ bigEmoji() ? 'text-4xl' : 'text-base',
props.class
)}
>
diff --git a/apps/web/src/features/channels-view/constants.ts b/apps/web/src/features/channels-view/constants.ts
index e6c06686b0..9c45a436a7 100644
--- a/apps/web/src/features/channels-view/constants.ts
+++ b/apps/web/src/features/channels-view/constants.ts
@@ -1,7 +1,7 @@
import type { ChannelListSort, ChannelsGroup } from './types';
export const CHANNELS_NARROW_RAIL_WIDTH = 64;
-export const CHANNELS_DEFAULT_RAIL_WIDTH = 360;
+export const CHANNELS_DEFAULT_RAIL_WIDTH = 256;
export const CHANNELS_MIN_RAIL_WIDTH = 224;
export const CHANNELS_MAX_RAIL_WIDTH = 420;
diff --git a/apps/web/src/features/email-compose/components/email-date-selector.tsx b/apps/web/src/features/email-compose/components/email-date-selector.tsx
index 3b47e728e8..2b68a33209 100644
--- a/apps/web/src/features/email-compose/components/email-date-selector.tsx
+++ b/apps/web/src/features/email-compose/components/email-date-selector.tsx
@@ -59,14 +59,14 @@ export const EmailDateSelector: VoidComponent<EmailDateSelectorProps> = (
: 'Schedule this email'
}
>
- <Button size="icon-sm" disabled={props.disabled}>
+ <Button size="icon-composer" disabled={props.disabled}>
<ClockIcon class={state.selectedDate ? 'text-accent' : ''} />
</Button>
</Tooltip>
}
>
<Button
- size="icon-sm"
+ size="icon-composer"
disabled={props.disabled}
class="size-auto gap-1 bg-accent/20 text-accent hover:bg-accent/15! hover:text-accent!"
>
diff --git a/apps/web/src/features/email-compose/components/signature-preview.tsx b/apps/web/src/features/email-compose/components/signature-preview.tsx
index aeacfe4710..90b682b378 100644
--- a/apps/web/src/features/email-compose/components/signature-preview.tsx
+++ b/apps/web/src/features/email-compose/components/signature-preview.tsx
@@ -97,7 +97,7 @@ export function SignaturePreview(props: {
</div>
<div
ref={mountEl}
- class="rounded-b-lg bg-[white] px-3 py-2 text-sm"
+ class="rounded-b-lg bg-[white] px-3 py-2 text-base"
classList={{ hidden: !expanded() }}
/>
</div>
diff --git a/apps/web/src/features/email-compose/views/compose-body.tsx b/apps/web/src/features/email-compose/views/compose-body.tsx
index 7aba8e4483..0bfa85754f 100644
--- a/apps/web/src/features/email-compose/views/compose-body.tsx
+++ b/apps/web/src/features/email-compose/views/compose-body.tsx
@@ -118,7 +118,7 @@ export function ComposeBody(props: {
scrollRef={props.mobileScrollRef}
initialHtml={ctx.initialHtml()}
initialValue={ctx.initialMarkdown?.()}
- class="text-sm wrap-break-word text-ink h-auto overflow-visible"
+ class="text-base wrap-break-word text-ink h-auto overflow-visible"
editable={() => !ctx.disabled()}
placeholder="Use `@` to reference files"
watermark={
diff --git a/apps/web/src/features/email-compose/views/compose-layout.test.tsx b/apps/web/src/features/email-compose/views/compose-layout.test.tsx
new file mode 100644
index 0000000000..9335e6067e
--- /dev/null
+++ b/apps/web/src/features/email-compose/views/compose-layout.test.tsx
@@ -0,0 +1,73 @@
+import { cleanup, render, screen } from '@solidjs/testing-library';
+import { ComposerSurface } from '@ui/components/ComposerSurface';
+import { type ComponentProps, createSignal } from 'solid-js';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { ComposeLayout } from './compose-layout';
+
+const attachHotkeys = vi.hoisted(() => vi.fn());
+vi.mock('@core/hotkey/hotkeys', () => ({
+ registerHotkey: vi.fn(),
+ useHotkeyDOMScope: () => [attachHotkeys, 'compose-email'],
+}));
+vi.mock('@core/mobile/isTouchDevice', () => ({ isTouchDevice: () => false }));
+vi.mock('@ui', async () => ({
+ cn: (await import('@ui/utils/classname')).cn,
+ Button: (props: ComponentProps<'button'>) => <button {...props} />,
+}));
+vi.mock('../context/compose-context', () => ({
+ useCompose: () => ({
+ recipients: () => ({ cc: [], bcc: [] }),
+ disabled: () => false,
+ isMobile: () => false,
+ }),
+}));
+vi.mock('../components/from-inbox-selector', () => ({
+ FromInboxSelector: () => null,
+}));
+vi.mock('./compose-recipients', () => ({ ComposeRecipients: () => null }));
+vi.mock('./compose-subject', () => ({ ComposeSubject: () => null }));
+vi.mock('./compose-body', () => ({
+ ComposeBody: (props: { inputRef: (element: HTMLElement) => void }) => (
+ <input aria-label="Email body" ref={props.inputRef} />
+ ),
+}));
+
+function DraftSurface(props: ComponentProps<typeof ComposerSurface>) {
+ return <ComposerSurface {...props} as="div" />;
+}
+
+beforeEach(() => attachHotkeys.mockClear());
+afterEach(cleanup);
+
+describe('ComposeLayout root composition', () => {
+ it.each([undefined, DraftSurface])(
+ 'keeps the editor and hotkey scope on the same root when layout props change (%s)',
+ (as) => {
+ const [header, setHeader] = createSignal('Draft');
+ const [className, setClassName] = createSignal('p-4');
+ const { container } = render(() => (
+ <ComposeLayout as={as} header={header()} class={className()} />
+ ));
+ const root = container.firstElementChild;
+ expect(attachHotkeys).toHaveBeenCalledExactlyOnceWith(root);
+ expect(
+ container.querySelector('[data-layer], [data-surface]')
+ ).toBeNull();
+ expect(root?.classList.contains('bg-composer')).toBe(Boolean(as));
+ const input = screen.getByRole('textbox') as HTMLInputElement;
+ input.value = 'Keep this draft';
+ input.focus();
+
+ setHeader('Updated draft');
+ setClassName('p-6');
+
+ expect(container.firstElementChild).toBe(root);
+ expect(root?.classList.contains('p-6')).toBe(true);
+ expect(screen.getByText('Updated draft')).toBeTruthy();
+ expect(screen.getByRole('textbox')).toBe(input);
+ expect(input.value).toBe('Keep this draft');
+ expect(document.activeElement).toBe(input);
+ expect(attachHotkeys).toHaveBeenCalledTimes(1);
+ }
+ );
+});
diff --git a/apps/web/src/features/email-compose/views/compose-layout.tsx b/apps/web/src/features/email-compose/views/compose-layout.tsx
index 82d85f061c..715fe53b46 100644
--- a/apps/web/src/features/email-compose/views/compose-layout.tsx
+++ b/apps/web/src/features/email-compose/views/compose-layout.tsx
@@ -3,7 +3,15 @@ import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';
import { TOKENS } from '@core/hotkey/tokens';
import { Button, cn } from '@ui';
-import { createSignal, type JSX, onMount, Show, Suspense } from 'solid-js';
+import {
+ type Component,
+ createSignal,
+ type JSX,
+ onMount,
+ Show,
+ Suspense,
+} from 'solid-js';
+import { Dynamic } from 'solid-js/web';
import { FromInboxSelector } from '../components/from-inbox-selector';
import { useCompose } from '../context/compose-context';
import { ComposeBody } from './compose-body';
@@ -25,6 +33,9 @@ type ComposeLayoutRefs = {
* Does NOT render any split-panel chrome — the caller is responsible for that.
*/
export function ComposeLayout(props: {
+ as?: Component<
+ Pick<JSX.HTMLAttributes<HTMLDivElement>, 'children' | 'class' | 'ref'>
+ >;
toolbar?: JSX.Element;
header?: JSX.Element;
notice?: JSX.Element;
@@ -181,7 +192,8 @@ export function ComposeLayout(props: {
};
return (
- <div
+ <Dynamic
+ component={props.as ?? 'div'}
ref={registerRef('containerRef')}
class={cn(
'touch:pt-[calc(var(--mobile-content-inset-top)+.5rem)]',
@@ -284,6 +296,6 @@ export function ComposeLayout(props: {
/>
{props.toolbar}
</div>
- </div>
+ </Dynamic>
);
}
diff --git a/apps/web/src/features/email-compose/views/compose-recipients.tsx b/apps/web/src/features/email-compose/views/compose-recipients.tsx
index 2941cdd890..ecb09d2702 100644
--- a/apps/web/src/features/email-compose/views/compose-recipients.tsx
+++ b/apps/web/src/features/email-compose/views/compose-recipients.tsx
@@ -236,7 +236,7 @@ export function ComposeRecipients(props: {
fallback={
<button
type="button"
- class="ph-no-capture w-full min-h-9 flex items-center text-sm text-ink text-left"
+ class="ph-no-capture w-full min-h-9 flex items-center text-base text-ink text-left"
onClick={() => activate(field)}
>
<span class="truncate">{summaryParts(field).names}</span>
diff --git a/apps/web/src/features/email-compose/views/compose-subject.tsx b/apps/web/src/features/email-compose/views/compose-subject.tsx
index 579fbccdc9..0c38b03f71 100644
--- a/apps/web/src/features/email-compose/views/compose-subject.tsx
+++ b/apps/web/src/features/email-compose/views/compose-subject.tsx
@@ -52,7 +52,7 @@ export function ComposeSubject(props: {
type="text"
value={ctx.subject()}
placeholder="Subject"
- class="w-full resize-none text-sm placeholder:text-ink-placeholder p-1"
+ class="w-full resize-none text-base placeholder:text-ink-placeholder p-1"
onInput={(e) => ctx.setSubject(e.currentTarget.value)}
onKeyDown={blurOnEscape}
disabled={ctx.disabled()}
@@ -64,7 +64,7 @@ export function ComposeSubject(props: {
fallback={
<button
type="button"
- class="ph-no-capture w-full min-h-7 flex items-center text-sm text-ink text-left"
+ class="ph-no-capture w-full min-h-7 flex items-center text-base text-ink text-left"
onClick={() => {
setEditing(true);
requestAnimationFrame(() => textareaRef?.focus());
@@ -82,7 +82,7 @@ export function ComposeSubject(props: {
}}
rows="1"
value={ctx.subject()}
- class="w-full resize-none overflow-hidden text-sm p-1"
+ class="w-full resize-none overflow-hidden text-base p-1"
onInput={(e) => {
ctx.setSubject(e.currentTarget.value.replace(/\n/g, ' '));
autosize(e.currentTarget);
diff --git a/apps/web/src/features/email-compose/views/compose-toolbar.tsx b/apps/web/src/features/email-compose/views/compose-toolbar.tsx
index fea38fb161..d1f431c756 100644
--- a/apps/web/src/features/email-compose/views/compose-toolbar.tsx
+++ b/apps/web/src/features/email-compose/views/compose-toolbar.tsx
@@ -8,7 +8,6 @@ import {
type NodeTransformType,
} from '@core/component/LexicalMarkdown/plugins/node-transform/nodeTransformPlugin';
import { fileSelector } from '@core/directive/fileSelector';
-
import { plural } from '@core/util/string';
import PaperclipIcon from '@phosphor/paperclip.svg?component-solid';
import TextAa from '@phosphor/text-aa.svg';
@@ -24,7 +23,6 @@ export function EmailComposeToolbar(props: {
}) {
const ctx = useCompose();
const [showFormatRibbon, setShowFormatRibbon] = createSignal(false);
- let attachButtonRef!: HTMLDivElement;
const handleAddAttachments = (files: File[]) => {
const currentAttachments = ctx.attachments();
@@ -62,7 +60,10 @@ export function EmailComposeToolbar(props: {
};
return (
- <>
+ <Show
+ when={!ctx.isMobile()}
+ fallback={<MobileToolbar handleAddAttachments={handleAddAttachments} />}
+ >
<Show when={showFormatRibbon()}>
<div class="flex flex-row w-full gap-2 items-center p-2 -ml-3">
<FormatButtons
@@ -76,88 +77,68 @@ export function EmailComposeToolbar(props: {
/>
</div>
</Show>
- <div class="flex flex-row w-full h-8 justify-between items-center space-x-2 mt-2">
- <Show
- when={!ctx.isMobile()}
- fallback={
- <MobileToolbar
- attachButtonRef={attachButtonRef}
- handleAddAttachments={handleAddAttachments}
- />
- }
+ <div class="mt-2 flex items-center justify-end gap-1">
+ <Show when={ctx.hasDraft()}>
+ <Button
+ onClick={ctx.onDelete}
+ tooltip="Delete draft"
+ size="icon-composer"
+ >
+ <Trash />
+ </Button>
+ </Show>
+ <Show when={!ctx.hideAttachments}>
+ <Button
+ ref={(el) =>
+ fileSelector(el, () => ({
+ multiple: true,
+ onSelect: handleAddAttachments,
+ }))
+ }
+ tooltip="Attach"
+ size="icon-composer"
+ disabled={ctx.disabled()}
+ >
+ <PaperclipIcon />
+ </Button>
+ </Show>
+ <Button
+ tooltip="Format"
+ size="icon-composer"
+ disabled={ctx.disabled()}
+ onClick={() => setShowFormatRibbon(!showFormatRibbon())}
>
- <div class="flex flex-row items-center gap-1">
- <Show when={!ctx.hideAttachments}>
- <div class="relative" ref={attachButtonRef}>
- <Button
- ref={(el) =>
- fileSelector(el, () => ({
- multiple: true,
- onSelect: handleAddAttachments,
- }))
- }
- tooltip="Attach"
- size="icon-sm"
- disabled={ctx.disabled()}
- >
- <PaperclipIcon />
- </Button>
- </div>
- </Show>
- <Button
- tooltip="Format"
- size="icon-sm"
- disabled={ctx.disabled()}
- onClick={() => {
- setShowFormatRibbon(!showFormatRibbon());
- }}
- >
- <TextAa />
- </Button>
- <Show when={ctx.hasDraft()}>
- <div aria-hidden="true" class="mx-1 h-4 w-px bg-edge-muted/70" />
- <Button
- onclick={ctx.onDelete}
- tooltip="Delete draft"
- size="icon-sm"
- >
- <Trash />
- </Button>
- </Show>
- </div>
-
- <div class="flex items-center gap-1">
- <Show when={ctx.scheduleEnabled && ctx.onSendTimeChange}>
- <EmailDateSelector
- mobile={ctx.isMobile()}
- sendTime={ctx.sendTime()}
- onSendTimeChange={ctx.onSendTimeChange}
- disabled={ctx.scheduleSendDisabled?.()}
- />
- </Show>
- <Tooltip label={ctx.sendTime() ? 'Send time is scheduled' : ''}>
- <SendButton
- onClick={() => ctx.onSend()}
- disabled={
- ctx.isSavingDraft?.() ||
- !!ctx.sendTime() ||
- ctx.isSending() ||
- ctx.disabled()
- }
- pending={ctx.isSending()}
- tooltip="Send email"
- shortcut="cmd+enter"
- />
- </Tooltip>
- </div>
+ <TextAa />
+ </Button>
+ <Show when={ctx.scheduleEnabled && ctx.onSendTimeChange}>
+ <EmailDateSelector
+ mobile={false}
+ sendTime={ctx.sendTime()}
+ onSendTimeChange={ctx.onSendTimeChange}
+ disabled={ctx.scheduleSendDisabled?.()}
+ />
</Show>
+ <Tooltip label={ctx.sendTime() ? 'Send time is scheduled' : ''}>
+ <SendButton
+ appearance="composer"
+ onClick={() => ctx.onSend()}
+ disabled={
+ ctx.isSavingDraft?.() ||
+ !!ctx.sendTime() ||
+ ctx.isSending() ||
+ ctx.disabled()
+ }
+ pending={ctx.isSending()}
+ tooltip="Send email"
+ shortcut="cmd+enter"
+ />
+ </Tooltip>
</div>
- </>
+ </Show>
);
}
function MobileToolbar(props: {
- attachButtonRef: HTMLDivElement;
handleAddAttachments: (files: File[]) => void;
}) {
const ctx = useCompose();
@@ -166,7 +147,7 @@ function MobileToolbar(props: {
<SplitHeaderRight>
<HeaderIsland class="h-(--mobile-chrome-button-size) p-[5px]">
<Show when={!ctx.hideAttachments}>
- <div class="relative" ref={props.attachButtonRef}>
+ <div class="relative">
<Button
ref={(el) =>
fileSelector(el, () => ({
diff --git a/apps/web/src/features/email-compose/views/reply-envelope.tsx b/apps/web/src/features/email-compose/views/reply-envelope.tsx
index 9156c94b9a..d04b8b5469 100644
--- a/apps/web/src/features/email-compose/views/reply-envelope.tsx
+++ b/apps/web/src/features/email-compose/views/reply-envelope.tsx
@@ -218,7 +218,7 @@ export function ReplyEnvelope(props: ReplyEnvelopeProps) {
<div class="text-sm min-w-16 pl-4">Subject</div>
<input
type="text"
- class="flex-1 text-sm bg-transparent outline-none border-0 px-3 py-1"
+ class="flex-1 text-base bg-transparent outline-none border-0 px-3 py-1"
value={props.subject()}
onInput={(e) => {
props.onSubjectChange(e.currentTarget.value);
diff --git a/apps/web/src/features/email-compose/views/reply-input.tsx b/apps/web/src/features/email-compose/views/reply-input.tsx
index cfbbfa8c22..d913360a79 100644
--- a/apps/web/src/features/email-compose/views/reply-input.tsx
+++ b/apps/web/src/features/email-compose/views/reply-input.tsx
@@ -293,7 +293,7 @@ export function ReplyInputView(props: ReplyInputViewProps) {
onSelect: handleAddAttachments,
}))
}
- size="icon-sm"
+ size="icon-composer"
tooltip="Attach"
>
<Paperclip />
@@ -411,8 +411,7 @@ export function ReplyInputView(props: ReplyInputViewProps) {
<MarkdownShell
config={editorConfig}
class={cn(
- 'ph-no-capture cursor-text wrap-break-word text-ink h-auto overflow-visible',
- isMobileDrawer() ? 'text-[17px] leading-6' : 'text-sm',
+ 'ph-no-capture cursor-text wrap-break-word text-base text-ink h-auto overflow-visible',
// Quoted thread collapses behind the "⋯" pill below
// (rule lives in LexicalMarkdown/styles.css — Tailwind arbitrary
// variants turn the underscore in .macro_quote into a space)
@@ -527,49 +526,39 @@ export function ReplyInputView(props: ReplyInputViewProps) {
/>
)}
</Show>
- {/* No fixed height: the send button (size-7.5) is taller than the icon
- buttons, and a fixed h-9 minus the vertical padding left it 4px short
- — with items-end it bled upward over the signature bar above. */}
+ {/* Keep the footer intrinsic-height so it cannot overlap the signature. */}
<div
ref={bottomBarRef}
- class="shrink-0 flex flex-row w-full justify-between items-end space-x-2 px-0 pb-0 pt-1.5"
+ class="shrink-0 flex items-center justify-end gap-1 pt-1.5"
>
- <div class="flex flex-row items-center gap-1">
- <div class="relative flex">
- <AttachButton />
- </div>
-
- <Button
- onclick={deleteDraftAndReset}
- tooltip={savedDraftId() ? 'Delete draft' : 'Discard'}
- size="icon-sm"
- >
- <Trash />
- </Button>
- </div>
-
- <div class="flex flex-row items-center gap-1">
- <Show
- when={
- composeContext.presentation.scheduleEnabled &&
- !sendActionHidden()
- }
- >
- <EmailDateSelector
- mobile={composeContext.presentation.isMobile()}
- sendTime={form.sendTime() ?? null}
- onSendTimeChange={handleSendTimeChange}
- disabled={scheduleSendDisabled()}
- disablePortal={composeContext.presentation.isTouch()}
- />
- </Show>
- <SendButton
- disabled={sendActionDisabled()}
- pending={isSending()}
- hidden={sendActionHidden()}
- onClick={() => sendEmail()}
+ <Button
+ onClick={deleteDraftAndReset}
+ tooltip={savedDraftId() ? 'Delete draft' : 'Discard'}
+ size="icon-composer"
+ >
+ <Trash />
+ </Button>
+ <AttachButton />
+ <Show
+ when={
+ composeContext.presentation.scheduleEnabled &&
+ !sendActionHidden()
+ }
+ >
+ <EmailDateSelector
+ mobile={false}
+ sendTime={form.sendTime() ?? null}
+ onSendTimeChange={handleSendTimeChange}
+ disabled={scheduleSendDisabled()}
/>
- </div>
+ </Show>
+ <SendButton
+ appearance="composer"
+ disabled={sendActionDisabled()}
+ pending={isSending()}
+ hidden={sendActionHidden()}
+ onClick={() => sendEmail()}
+ />
</div>
</Show>
</div>
diff --git a/apps/web/src/features/email-message/components/collapsed-message.tsx b/apps/web/src/features/email-message/components/collapsed-message.tsx
index 6c77f119aa..178a61450e 100644
--- a/apps/web/src/features/email-message/components/collapsed-message.tsx
+++ b/apps/web/src/features/email-message/components/collapsed-message.tsx
@@ -45,7 +45,7 @@ export function CollapsedMessage(props: CollapsedMessageProps) {
</EmailUserTooltip>
</div>
</div>
- <div class="min-w-0 text-sm text-ink-extra-muted overflow-hidden text-ellipsis whitespace-nowrap @max-[480px]/message:col-span-full @max-[480px]/message:row-start-2 @max-[480px]/message:whitespace-normal @max-[480px]/message:line-clamp-2 mobile:line-clamp-1">
+ <div class="min-w-0 text-base text-ink-extra-muted overflow-hidden text-ellipsis whitespace-nowrap @max-[480px]/message:col-span-full @max-[480px]/message:row-start-2 @max-[480px]/message:whitespace-normal @max-[480px]/message:line-clamp-2 mobile:line-clamp-1">
{snippet()}
</div>
<Show when={props.message.internal_date_ts}>
diff --git a/apps/web/src/features/email-message/components/message-card.test.tsx b/apps/web/src/features/email-message/components/message-card.test.tsx
new file mode 100644
index 0000000000..5577b5df9c
--- /dev/null
+++ b/apps/web/src/features/email-message/components/message-card.test.tsx
@@ -0,0 +1,65 @@
+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import { createSignal } from 'solid-js';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { MessageCard } from './message-card';
+
+const device = vi.hoisted(() => ({ touch: false }));
+vi.mock('@core/mobile/isTouchDevice', () => ({
+ isTouchDevice: () => device.touch,
+}));
+vi.mock('@ui', async () => ({
+ cn: (await import('@ui/utils/classname')).cn,
+ ComposerSurface: (await import('@ui/components/ComposerSurface'))
+ .ComposerSurface,
+}));
+
+afterEach(cleanup);
+
+describe('MessageCard', () => {
+ it.each([false, true])(
+ 'preserves the interactive card root and selection behavior with touch=%s',
+ (touch) => {
+ device.touch = touch;
+ const [selected, setSelected] = createSignal(false);
+ const activate = vi.fn();
+ const focus = vi.fn();
+ const select = vi.fn(() => setSelected(true));
+ const { container } = render(() => (
+ <MessageCard
+ messageId="message-1"
+ isSelected={selected()}
+ allowHover
+ isTouch={touch}
+ onSelect={select}
+ onActivate={activate}
+ onFocus={focus}
+ >
+ <button data-button type="button">
+ Reply
+ </button>
+ </MessageCard>
+ ));
+ const card = container.querySelector<HTMLDivElement>(
+ '[data-message-body-id="message-1"]'
+ )!;
+ expect(card.classList.contains('bg-composer')).toBe(!touch);
+ expect(card.classList.contains('bg-message')).toBe(touch);
+ expect(
+ container.querySelector('[data-layer], [data-surface]')
+ ).toBeNull();
+ const reply = screen.getByRole('button', { name: 'Reply' });
+ expect(reply.parentElement).toBe(card);
+
+ fireEvent.click(reply);
+
+ expect(select).toHaveBeenCalledTimes(1);
+ expect(activate).not.toHaveBeenCalled();
+ expect(container.querySelector('[data-message-body-id]')).toBe(card);
+ card.focus();
+ expect(focus).toHaveBeenCalledWith(card);
+ fireEvent.keyDown(card, { key: 'Enter' });
+ expect(activate).toHaveBeenCalledTimes(1);
+ expect(document.activeElement).toBe(card);
+ }
+ );
+});
diff --git a/apps/web/src/features/email-message/components/message-card.tsx b/apps/web/src/features/email-message/components/message-card.tsx
index 213be8305f..a0307ce3d6 100644
--- a/apps/web/src/features/email-message/components/message-card.tsx
+++ b/apps/web/src/features/email-message/components/message-card.tsx
@@ -1,10 +1,11 @@
-import { cn } from '@ui';
+import { ComposerSurface, cn } from '@ui';
import type { JSX } from 'solid-js';
interface MessageCardProps {
messageId: string | null | undefined;
isSelected: boolean;
allowHover: boolean;
+ isTouch: boolean;
/**
* Click or Enter on the row. Clicks landing on a control inside the card are
* excluded so row activation never fights an inner button.
@@ -23,29 +24,31 @@ interface MessageCardProps {
* so both content shapes read identically and a single DOM node carries
* `data-message-body-id` across an expand.
*
- * Selection (one message at a time) reads as depth rather than an accent ring:
- * a drop shadow in light mode, an accent-tinted border in dark mode where a
- * shadow would be invisible. The border is present in every state so moving the
- * selection never reflows the list. Hover is the `hover` tint painted *over*
- * the card background (see the `overlay-*` utility) rather than replacing it,
- * so the card keeps its lift; the selected card skips the tint so selection
- * always reads as one settled state.
- *
- * There is no focus ring: focusing the card selects it, so the selected styling
- * is already the focus indicator. A ring would also linger after a collapse,
- * since this node keeps DOM focus while its content swaps.
+ * Desktop shares the chat composer's rounded surface, soft shadow and dark
+ * rim. Hover adds only a faint tint; keyboard focus uses a neutral outline.
+ * Touch devices retain their existing card and selection treatment.
*/
export function MessageCard(props: MessageCardProps) {
return (
<div class="shrink-0 flex justify-center w-full">
<div class="@container/message macro-message-width macro-message-padding mobile:px-0 w-full">
- <div
+ <ComposerSurface
+ as="div"
class={cn(
- 'relative p-4 rounded-lg bg-message border border-edge-muted outline-none',
+ 'relative p-4 outline-none',
+ props.isTouch && 'rounded-lg bg-message border border-edge-muted',
'mobile:rounded-none mobile:border-0 mobile:border-t mobile:bg-transparent mobile:px-4 mobile:ring-0 mobile:shadow-none mobile:focus-visible:bg-hover',
- props.isSelected
- ? 'z-1 light-mode:shadow-lg light-mode:shadow-drop-shadow dark-mode:ring-1 dark-mode:ring-accent/40'
- : props.allowHover && 'hover:overlay-hover'
+ props.isTouch
+ ? props.isSelected
+ ? 'z-1 light-mode:shadow-lg light-mode:shadow-drop-shadow dark-mode:ring-1 dark-mode:ring-accent/40'
+ : props.allowHover && 'hover:overlay-hover'
+ : [
+ 'focus-visible:outline-1 focus-visible:outline-ink/20 focus-visible:outline-offset-2',
+ props.isSelected && 'z-1',
+ !props.isSelected &&
+ props.allowHover &&
+ 'hover:overlay-[color-mix(in_srgb,var(--color-ink)_1%,transparent)]',
+ ]
)}
style={{ '--user-icon-width': '1rem' }}
data-message-body-id={props.messageId}
@@ -74,7 +77,7 @@ export function MessageCard(props: MessageCardProps) {
}}
>
{props.children}
- </div>
+ </ComposerSurface>
</div>
</div>
);
diff --git a/apps/web/src/features/email-message/views/email-message.tsx b/apps/web/src/features/email-message/views/email-message.tsx
index 13b2833d28..3be7d71b12 100644
--- a/apps/web/src/features/email-message/views/email-message.tsx
+++ b/apps/web/src/features/email-message/views/email-message.tsx
@@ -82,6 +82,7 @@ export function EmailMessageView(props: EmailMessageViewProps) {
messageId={props.message.db_id}
isSelected={props.isSelected}
allowHover={props.allowHover}
+ isTouch={props.isTouch}
onActivate={isBodyExpanded() ? undefined : props.onExpand}
onSelect={props.onSelect}
onHover={props.onHover}
@@ -121,7 +122,7 @@ export function EmailMessageView(props: EmailMessageViewProps) {
</div>
}
/>
- <div class="ph-no-capture text-sm text-ink pr-4 mobile:pr-0">
+ <div class="ph-no-capture text-base text-ink pr-4 mobile:pr-0">
<EmailMessageBody
message={props.message}
isPersonal={props.isPersonal}
diff --git a/apps/web/src/features/email-view/components/EmailInboxSelector.tsx b/apps/web/src/features/email-view/components/EmailInboxSelector.tsx
index 69472380f6..5693c4a01c 100644
--- a/apps/web/src/features/email-view/components/EmailInboxSelector.tsx
+++ b/apps/web/src/features/email-view/components/EmailInboxSelector.tsx
@@ -73,32 +73,23 @@ function useInboxSelection() {
};
}
-function InboxAvatar(props: { option: InboxOption; size: UserIconSize }) {
+function InboxAvatar(props: {
+ option: InboxOption;
+ size: UserIconSize;
+ class?: string;
+}) {
return (
<UserIcon
{...inboxIconProps(props.option.label)}
photoUrl={props.option.photoUrl}
size={props.size}
+ class={props.class}
suppressClick
showTooltip={false}
/>
);
}
-function AllInboxesIcon(props: { class?: string }) {
- return (
- <span
- aria-hidden="true"
- class={cn(
- 'flex size-6 shrink-0 items-center justify-center',
- props.class
- )}
- >
- <TrayIcon class="size-5" />
- </span>
- );
-}
-
/**
* The inbox list at the top of the Email sidebar: `All inboxes` (with a
* `Connect another account` button beside it) followed by one row per inbox.
@@ -111,7 +102,7 @@ export function EmailInboxList(props: { class?: string }) {
<Show when={selection.visible()}>
<ViewSidebar.Nav
aria-label="Inboxes"
- class={cn('border-b border-edge pb-3', props.class)}
+ class={cn('border-b border-edge-muted pb-3', props.class)}
>
<div class="flex min-w-0 items-center gap-1">
<ViewSidebar.Item
@@ -120,7 +111,9 @@ export function EmailInboxList(props: { class?: string }) {
class="min-w-0 flex-1"
{...pressHandlers(selection.selectAll)}
>
- <AllInboxesIcon />
+ <ViewSidebar.Icon>
+ <TrayIcon class="size-4" />
+ </ViewSidebar.Icon>
<span class="truncate">All inboxes</span>
</ViewSidebar.Item>
<Show when={selection.canAddInbox()}>
@@ -146,12 +139,9 @@ export function EmailInboxList(props: { class?: string }) {
}
{...pressHandlers(() => selection.select(option.id))}
>
- <span
- aria-hidden="true"
- class="flex size-6 shrink-0 items-center"
- >
- <InboxAvatar option={option} size="md" />
- </span>
+ <ViewSidebar.Icon>
+ <InboxAvatar option={option} size="sm" class="size-5" />
+ </ViewSidebar.Icon>
<span class="truncate">{option.label}</span>
</ViewSidebar.Item>
)}
diff --git a/apps/web/src/features/email-view/components/EmailSidebar.tsx b/apps/web/src/features/email-view/components/EmailSidebar.tsx
index 236ac4aa5c..9874b0d902 100644
--- a/apps/web/src/features/email-view/components/EmailSidebar.tsx
+++ b/apps/web/src/features/email-view/components/EmailSidebar.tsx
@@ -1,16 +1,15 @@
import { useViewTabHotkeys, ViewSidebar } from '@app/components/view-shell';
+import { SidebarCreateHeader } from '@app/components/view-shell/SidebarCreateButton';
import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
-import { SplitPanel } from '@components/app/split-panel';
import { AnimatedNoiseIcon } from '@icon/wide-noise';
import { AnimatedSignalIcon } from '@icon/wide-signal';
import CalendarBlankIcon from '@phosphor/calendar-blank.svg';
import EnvelopeIcon from '@phosphor/envelope.svg';
import FileIcon from '@phosphor/file.svg';
-import ComposeIcon from '@phosphor/note-pencil.svg';
import PaperPlaneTiltIcon from '@phosphor/paper-plane-tilt.svg';
import UsersThreeIcon from '@phosphor/users-three.svg';
import { SidebarTagsSection } from '@property/tags/SidebarTagsSection';
-import { Button, pressHandlers } from '@ui';
+import { pressHandlers } from '@ui';
import { type Component, For } from 'solid-js';
import { Dynamic } from 'solid-js/web';
import { composeEmail } from '../compose-email';
@@ -40,9 +39,9 @@ function Tab(props: { item: EmailTabItem; onNavigate?: () => void }) {
props.onNavigate?.();
})}
>
- <span aria-hidden="true" class="flex size-4 shrink-0 items-center">
+ <ViewSidebar.Icon>
<Dynamic component={TAB_ICONS[props.item.id]} class="size-4" />
- </span>
+ </ViewSidebar.Icon>
<span class="truncate">{props.item.label}</span>
</ViewSidebar.Item>
);
@@ -85,27 +84,14 @@ export function EmailSidebar() {
return (
<ViewSidebar.Root aria-label="Email navigation" class="gap-4">
- <ViewSidebar.Header>
- <div class="flex min-w-0 items-center gap-1">
- <SplitPanel.CloseButton />
- <ViewSidebar.Title>Email</ViewSidebar.Title>
- </div>
- </ViewSidebar.Header>
+ <SidebarCreateHeader
+ title="Email"
+ label="New email"
+ onCreate={() => composeEmail()}
+ />
<ViewSidebar.Content class="flex flex-col gap-6">
- <div class="flex flex-col gap-3">
- <EmailInboxList />
- <Button
- type="button"
- variant="ghost"
- depth={2}
- class="h-10 shrink-0 justify-start gap-3 rounded-xl bg-surface px-3"
- {...pressHandlers(() => composeEmail())}
- >
- <ComposeIcon class="size-4 shrink-0" />
- Compose
- </Button>
- </div>
+ <EmailInboxList />
<EmailNavigation />
</ViewSidebar.Content>
diff --git a/apps/web/src/features/entity/extractors/entity-icon.tsx b/apps/web/src/features/entity/extractors/entity-icon.tsx
index 122bc5f7a3..e197a66e25 100644
--- a/apps/web/src/features/entity/extractors/entity-icon.tsx
+++ b/apps/web/src/features/entity/extractors/entity-icon.tsx
@@ -1,31 +1,13 @@
import {
EntityIcon as CoreEntityIcon,
- type EntityIconProps as CoreEntityIconProps,
- getIconConfig,
+ getEntityIconType,
} from '@core/component/EntityIcon';
import { UserIcon } from '@core/component/UserIcon';
import { useUserId } from '@core/context/user';
-import GitMerge from '@phosphor/git-merge.svg';
-import GitPullRequest from '@phosphor/git-pull-request.svg';
import type { StreamEvent } from '@service-connection/generated/schemas';
import { Match, Show, Switch } from 'solid-js';
-import { Dynamic } from 'solid-js/web';
-import { match } from 'ts-pattern';
import { ChatProviderIcon } from '../components/ChatProviderIcon';
-import type {
- ChannelEntity,
- ChatEntity,
- EntityData,
- GithubPullRequestEntity,
-} from '../types/entity';
-import {
- isCallEntity,
- isChannelEntity,
- isChannelMessageEntity,
- isSkillEntity,
- isSnippetEntity,
- isTaskEntity,
-} from '../types/entity';
+import type { ChannelEntity, ChatEntity, EntityData } from '../types/entity';
interface EntityIconProps {
entity: EntityData;
@@ -74,81 +56,11 @@ function DirectMessageIcon(props: {
);
}
-function GithubPullRequestIcon(props: {
- entity: GithubPullRequestEntity;
- class?: string;
-}) {
- function config() {
- const status = props.entity.metadata.status;
-
- switch (status) {
- case 'open':
- return {
- icon: GitPullRequest,
- iconClass: 'text-success',
- };
- case 'merged':
- return {
- icon: GitMerge,
- iconClass: 'text-note',
- };
- case 'closed':
- return {
- icon: GitPullRequest,
- iconClass: 'text-failure',
- };
- }
- }
-
- return (
- <div class="size-full flex">
- <Dynamic component={config().icon} class={config().iconClass} />
- </div>
- );
-}
-
export function EntityIcon(props: EntityIconProps) {
- const iconType = () => {
- return (
- match(props.entity)
- .when(isChannelEntity, ({ channelType }) => channelType)
- .when(isChannelMessageEntity, ({ channelType }) => channelType)
- .when(isTaskEntity, () => 'task')
- .when(isSnippetEntity, () => 'snippet')
- .when(isSkillEntity, () => 'skill')
- .with({ type: 'document' }, ({ fileType }) => {
- return fileType ?? 'default';
- })
- .with({ type: 'agent_session' }, () => 'agent')
- .with({ type: 'chat' }, () => 'chat')
- .with({ type: 'project' }, () => 'project')
- .with({ type: 'email' }, ({ isRead, hasIcsAttachment }) =>
- hasIcsAttachment ? 'emailInvite' : isRead ? 'emailRead' : 'email'
- )
- .when(isCallEntity, () => 'call')
- .with({ type: 'automation' }, () => 'automation')
- .with(
- { type: 'foreign', foreignSource: 'github_pull_request' },
- () => 'githubPullRequest'
- )
- .with({ type: 'foreign' }, () => 'default')
- .with({ type: 'crm_company' }, () => 'crm_company')
- .with({ type: 'calendar_event' }, () => 'calendar')
- // Always the bell, never the referenced entity's icon: the row is a
- // reminder first, and what it points at is iconed beside its name
- // instead — see `reminderReferenceIconType`.
- .with({ type: 'reminder' }, () => 'reminder')
- .otherwise(() => 'default')
- );
- };
-
- const validIconType = () => {
- const type = iconType();
- if (getIconConfig(type)) return type as CoreEntityIconProps['targetType'];
- else return 'default' as const;
- };
-
- const isDirectMessage = () => iconType() === 'direct_message';
+ const iconType = () => getEntityIconType(props.entity);
+ const isDirectMessage = () =>
+ props.entity.type === 'channel' &&
+ props.entity.channelType === 'direct_message';
const isChatEntity = () => props.entity.type === 'chat';
@@ -156,18 +68,12 @@ export function EntityIcon(props: EntityIconProps) {
<Switch
fallback={
<CoreEntityIcon
- targetType={validIconType()}
+ targetType={iconType()}
size="fill"
class={props.class}
/>
}
>
- <Match when={iconType() === 'githubPullRequest'}>
- <GithubPullRequestIcon
- entity={props.entity as GithubPullRequestEntity}
- class={props.class}
- />
- </Match>
<Match when={isDirectMessage()}>
<DirectMessageIcon
entity={props.entity as ChannelEntity}
diff --git a/apps/web/src/features/entity/tests/channel-thread-name.test.ts b/apps/web/src/features/entity/tests/channel-thread-name.test.ts
new file mode 100644
index 0000000000..3b83158eda
--- /dev/null
+++ b/apps/web/src/features/entity/tests/channel-thread-name.test.ts
@@ -0,0 +1,155 @@
+import { createMemo, createRoot, createSignal } from 'solid-js';
+import { describe, expect, it } from 'vitest';
+import type { Notification } from '../types/notification';
+import { getChannelThreadName } from '../utils/channel-thread-name';
+
+function reply(overrides: Partial<Notification> = {}): Notification {
+ return {
+ id: 'notification-1',
+ entity_id: 'channel-1',
+ entity_type: 'channel',
+ created_at: '2026-09-15T18:00:00Z',
+ updated_at: '2026-09-15T18:00:00Z',
+ state: 'unseen',
+ sent: true,
+ notification_event_type: 'channel_message_reply',
+ notification_metadata: {
+ tag: 'channel_message_reply',
+ content: {
+ channelName: 'Design',
+ channelType: 'public',
+ threadId: 'thread-1',
+ messageId: 'reply-1',
+ messageContent: 'A reply',
+ },
+ },
+ ...overrides,
+ };
+}
+
+const thread = (notifications: Notification[] = [reply()]) => ({
+ channelId: 'channel-1',
+ threadId: 'thread-1',
+ notifications: () => notifications,
+});
+
+describe('getChannelThreadName', () => {
+ it('prefers the current channel name over the notification snapshot', () => {
+ expect(
+ getChannelThreadName(thread(), { 'channel-1': { name: 'Product' } })
+ ).toBe('Product');
+ });
+
+ it.each([undefined, null, '', ' '])(
+ 'uses notification metadata when the cached name is %s',
+ (name) => {
+ expect(getChannelThreadName(thread(), { 'channel-1': { name } })).toBe(
+ 'Design'
+ );
+ }
+ );
+
+ it('skips replies from other channels and threads', () => {
+ const entity = thread([
+ reply({ entity_id: 'channel-2' }),
+ reply({
+ notification_metadata: {
+ tag: 'channel_message_reply',
+ content: {
+ channelName: 'An old name',
+ channelType: 'public',
+ threadId: 'thread-2',
+ messageId: 'reply-2',
+ messageContent: 'Another thread',
+ },
+ },
+ }),
+ ]);
+ expect(getChannelThreadName(entity, {})).toBe('Unknown channel');
+ expect(
+ getChannelThreadName(thread([...entity.notifications(), reply()]), {})
+ ).toBe('Design');
+ });
+
+ it('skips empty notification names to find a usable snapshot', () => {
+ const emptyName = reply({
+ notification_metadata: {
+ tag: 'channel_message_reply',
+ content: {
+ channelName: ' ',
+ channelType: 'public',
+ threadId: 'thread-1',
+ messageId: 'reply-2',
+ messageContent: 'Another reply',
+ },
+ },
+ });
+ expect(getChannelThreadName(thread([emptyName, reply()]), {})).toBe(
+ 'Design'
+ );
+ });
+
+ it.each([undefined, 'thread-1'])(
+ 'uses mentions of the thread root or its replies (threadId: %s)',
+ (threadId) => {
+ const mention = reply({
+ notification_metadata: {
+ tag: 'channel_mention',
+ content: {
+ channelName: 'Design',
+ channelType: 'public',
+ threadId,
+ messageId: threadId ? 'reply-1' : 'thread-1',
+ messageContent: 'A mention',
+ },
+ },
+ });
+ expect(getChannelThreadName(thread([mention]), {})).toBe('Design');
+ }
+ );
+
+ it('uses a send notification only for the thread root', () => {
+ const send = (messageId: string) =>
+ reply({
+ notification_metadata: {
+ tag: 'channel_message_send',
+ content: {
+ channelName: 'Design',
+ channelType: 'public',
+ messageId,
+ messageContent: 'A message',
+ },
+ },
+ });
+ expect(getChannelThreadName(thread([send('thread-1')]), {})).toBe('Design');
+ expect(getChannelThreadName(thread([send('other-message')]), {})).toBe(
+ 'Unknown channel'
+ );
+ });
+
+ it('uses a neutral fallback when no channel name is available', () => {
+ expect(getChannelThreadName(thread([]), {})).toBe('Unknown channel');
+ expect(
+ getChannelThreadName({ channelId: 'channel-1', threadId: 'thread-1' }, {})
+ ).toBe('Unknown channel');
+ });
+
+ it('updates when notifications arrive, the cache loads, or the row changes', () => {
+ createRoot((dispose) => {
+ const [entity, setEntity] = createSignal(thread([]));
+ const [channels, setChannels] = createSignal<
+ Record<string, { name: string }>
+ >({});
+ const name = createMemo(() => getChannelThreadName(entity(), channels()));
+
+ expect(name()).toBe('Unknown channel');
+ setEntity(thread());
+ expect(name()).toBe('Design');
+ setChannels({ 'channel-1': { name: 'Renamed channel' } });
+ expect(name()).toBe('Renamed channel');
+ setEntity({ ...thread(), channelId: 'channel-2', threadId: 'thread-2' });
+ expect(name()).toBe('Unknown channel');
+ dispose();
+ });
+ });
+});
diff --git a/apps/web/src/features/entity/tests/entity-icon.test.tsx b/apps/web/src/features/entity/tests/entity-icon.test.tsx
new file mode 100644
index 0000000000..1134f7dd59
--- /dev/null
+++ b/apps/web/src/features/entity/tests/entity-icon.test.tsx
@@ -0,0 +1,162 @@
+import WideUnknown from '@icon/wide-unknown.svg';
+import CalendarIcon from '@phosphor/calendar-blank.svg';
+import EnvelopeIcon from '@phosphor/envelope.svg';
+import EnvelopeOpenIcon from '@phosphor/envelope-open.svg';
+import FileIcon from '@phosphor/file.svg';
+import GitMergeIcon from '@phosphor/git-merge.svg';
+import GitPullRequestIcon from '@phosphor/git-pull-request.svg';
+import { cleanup, render } from '@solidjs/testing-library';
+import { createSignal } from 'solid-js';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { HomeEntityIcon } from '../../inbox-view/components/HomeEntityIcon';
+import { EntityIcon } from '../extractors/entity-icon';
+import type {
+ EmailEntity,
+ GithubPullRequestEntity,
+ UnknownForeignEntity,
+} from '../types/entity';
+
+const flags = vi.hoisted(() => ({ wideIcons: false }));
+vi.mock('@core/constant/featureFlags', () => ({
+ get USE_WIDE_ICONS() {
+ return flags.wideIcons;
+ },
+}));
+vi.mock('@core/constant/allBlocks', () => ({
+ blockAcceptedFileExtensionSet: new Set(),
+ fileTypeToBlockName: vi.fn(),
+ isBlockAlias: () => false,
+ itemToBlockName: vi.fn(),
+}));
+vi.mock('@core/context/user', () => ({ useUserId: () => () => 'user' }));
+vi.mock('@core/component/UserIcon', () => ({ UserIcon: () => null }));
+vi.mock('../components/ChatProviderIcon', () => ({
+ ChatProviderIcon: () => null,
+}));
+vi.mock('@ui', async () => ({
+ cn: (await import('@ui/utils/classname')).cn,
+}));
+
+const foreignBase = {
+ type: 'foreign',
+ id: 'foreign-id',
+ name: 'Foreign entity',
+ ownerId: 'user',
+ foreignId: 'external-id',
+ storedForId: 'team-id',
+ storedForAuthEntity: 'team',
+} as const;
+
+function pullRequest(
+ status: GithubPullRequestEntity['metadata']['status']
+): GithubPullRequestEntity {
+ return {
+ ...foreignBase,
+ foreignSource: 'github_pull_request',
+ metadata: {
+ number: 42,
+ name: 'Update icons',
+ owner: 'macro-inc',
+ repo: 'macro',
+ url: 'https://github.com/macro-inc/macro/pull/42',
+ status,
+ additions: 1,
+ deletions: 1,
+ comments: [],
+ checks: [],
+ },
+ };
+}
+
+function expectGlyph(container: HTMLElement, Glyph: typeof FileIcon) {
+ const expected = render(() => <Glyph />);
+ const svg = container.querySelector('svg');
+ expect(svg).not.toBeNull();
+ expect(svg?.innerHTML).toBe(
+ expected.container.querySelector('svg')?.innerHTML
+ );
+}
+
+afterEach(cleanup);
+
+describe.each([false, true])('Entity.Icon with wide icons %s', (wideIcons) => {
+ beforeEach(() => {
+ flags.wideIcons = wideIcons;
+ });
+
+ it.each([
+ [false, false, EnvelopeIcon, 'text-email'],
+ [true, false, EnvelopeOpenIcon, 'text-default'],
+ [false, true, CalendarIcon, 'text-calendar'],
+ [true, true, CalendarIcon, 'text-calendar'],
+ ] as const)(
+ 'distinguishes read=%s and invite=%s emails',
+ (isRead, hasIcsAttachment, Glyph, color) => {
+ const entity: EmailEntity = {
+ type: 'email',
+ id: 'email-id',
+ name: 'Email',
+ ownerId: 'user',
+ isRead,
+ hasIcsAttachment,
+ isDraft: false,
+ isImportant: false,
+ done: false,
+ };
+ const { container } = render(() => <EntityIcon entity={entity} />);
+ expectGlyph(container, Glyph);
+ expect(container.firstElementChild?.classList.contains(color)).toBe(true);
+ }
+ );
+
+ it.each([
+ ['open', GitPullRequestIcon, 'text-success'],
+ ['merged', GitMergeIcon, 'text-note'],
+ ['closed', GitPullRequestIcon, 'text-failure'],
+ ] as const)('renders the %s pull request state', (status, Glyph, color) => {
+ const { container } = render(() => (
+ <EntityIcon entity={pullRequest(status)} />
+ ));
+ expectGlyph(container, Glyph);
+ expect(container.firstElementChild?.classList.contains(color)).toBe(true);
+ });
+
+ it('uses a generic file for unknown foreign sources even with PR-like metadata', () => {
+ const entity: UnknownForeignEntity = {
+ ...foreignBase,
+ foreignSource: 'unknown',
+ rawForeignSource: 'another-provider',
+ metadata: { status: 'merged' },
+ };
+ const { container } = render(() => <EntityIcon entity={entity} />);
+ expectGlyph(container, wideIcons ? WideUnknown : FileIcon);
+ expect(
+ container.firstElementChild?.classList.contains('text-default')
+ ).toBe(true);
+ });
+
+ it('updates the pull request glyph and color when its status changes', () => {
+ const [entity, setEntity] = createSignal(pullRequest('open'));
+ const { container } = render(() => <EntityIcon entity={entity()} />);
+
+ setEntity(pullRequest('merged'));
+
+ expectGlyph(container, GitMergeIcon);
+ expect(container.firstElementChild?.classList.contains('text-note')).toBe(
+ true
+ );
+ expect(
+ container.firstElementChild?.classList.contains('text-success')
+ ).toBe(false);
+ });
+
+ it('preserves pull request status colors in compact Home rows', () => {
+ const { container } = render(() => (
+ <HomeEntityIcon entity={pullRequest('merged')} />
+ ));
+ expectGlyph(container, GitMergeIcon);
+ const classes = container.querySelector('svg')?.parentElement?.classList;
+ expect(classes?.contains('text-note')).toBe(true);
+ expect(classes?.contains('text-current')).toBe(false);
+ });
+});
diff --git a/apps/web/src/features/entity/utils/channel-thread-name.ts b/apps/web/src/features/entity/utils/channel-thread-name.ts
new file mode 100644
index 0000000000..bfe05611dd
--- /dev/null
+++ b/apps/web/src/features/entity/utils/channel-thread-name.ts
@@ -0,0 +1,41 @@
+import { channelThreadRootId } from '@notifications/channel-thread-root';
+import type { ChannelThreadEntity } from '../types/entity';
+import type { WithNotification } from '../types/notification';
+
+/** Prefer current channel names over notification snapshots and thread placeholders. */
+export function getChannelThreadName(
+ entity: WithNotification<Pick<ChannelThreadEntity, 'channelId' | 'threadId'>>,
+ channelsById: Readonly<Record<string, { name?: string | null } | undefined>>
+): string {
+ const currentName = channelsById[entity.channelId]?.name?.trim();
+ if (currentName) return currentName;
+
+ for (const notification of entity.notifications?.() ?? []) {
+ if (
+ notification.entity_type !== 'channel' ||
+ notification.entity_id !== entity.channelId
+ ) {
+ continue;
+ }
+
+ const metadata = notification.notification_metadata;
+ if (
+ metadata.tag !== 'channel_message_reply' &&
+ metadata.tag !== 'channel_mention' &&
+ metadata.tag !== 'channel_message_send'
+ ) {
+ continue;
+ }
+
+ const rootId =
+ metadata.tag === 'channel_message_send'
+ ? metadata.content.messageId
+ : channelThreadRootId(notification);
+ if (rootId !== entity.threadId) continue;
+
+ const name = metadata.content.channelName?.trim();
+ if (name) return name;
+ }
+
+ return 'Unknown channel';
+}
diff --git a/apps/web/src/features/home/components/home-recommended-actions.tsx b/apps/web/src/features/home/components/home-recommended-actions.tsx
new file mode 100644
index 0000000000..9eaea0e92d
--- /dev/null
+++ b/apps/web/src/features/home/components/home-recommended-actions.tsx
@@ -0,0 +1,25 @@
+import { HomeSectionBoundary } from '../home-section-boundary';
+import { useHomeRecommendations } from '../use-home-recommendations';
+import { HomeSuggestions } from './home-suggestions';
+
+function RecommendedActions() {
+ const recommendations = useHomeRecommendations();
+ return (
+ <HomeSuggestions
+ view={recommendations.view()}
+ onSelect={recommendations.selectRecommendation}
+ onOpen={(item) => void recommendations.openRecommendation(item)}
+ onRetry={recommendations.retry}
+ onConnect={() => recommendations.openSettings('Email')}
+ />
+ );
+}
+
+/** Keep recommendation loading and errors isolated from the composer. */
+export function HomeRecommendedActions() {
+ return (
+ <HomeSectionBoundary title="suggestions" fallback={null}>
+ <RecommendedActions />
+ </HomeSectionBoundary>
+ );
+}
diff --git a/apps/web/src/features/home/components/home-start-layout.tsx b/apps/web/src/features/home/components/home-start-layout.tsx
new file mode 100644
index 0000000000..88fc7fcf98
--- /dev/null
+++ b/apps/web/src/features/home/components/home-start-layout.tsx
@@ -0,0 +1,22 @@
+import MacroLogo from '@icon/macro-logo.svg';
+import type { JSX } from 'solid-js';
+
+export function HomeStartLayout(props: {
+ composer: JSX.Element;
+ suggestions: JSX.Element;
+}) {
+ return (
+ <div class="size-full overflow-y-auto font-sans">
+ <main class="mx-auto flex min-h-full w-full max-w-[816px] flex-col justify-center gap-0 px-6 py-16">
+ <header class="mb-8 flex flex-wrap items-center justify-center gap-3 text-center">
+ <MacroLogo class="size-9 shrink-0 text-accent" aria-hidden="true" />
+ <h1 class="text-[clamp(24px,2.5vw,32px)] font-medium leading-tight tracking-tight text-ink">
+ What should we work on?
+ </h1>
+ </header>
+ {props.composer}
+ {props.suggestions}
+ </main>
+ </div>
+ );
+}
diff --git a/apps/web/src/features/home/components/home-suggestions.test.tsx b/apps/web/src/features/home/components/home-suggestions.test.tsx
new file mode 100644
index 0000000000..c24057000b
--- /dev/null
+++ b/apps/web/src/features/home/components/home-suggestions.test.tsx
@@ -0,0 +1,48 @@
+import type { RecommendedItem } from '@queries/ai/homeRecommendations';
+import { cleanup, fireEvent, render } from '@solidjs/testing-library';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { HomeSuggestions } from './home-suggestions';
+
+afterEach(cleanup);
+
+const items: RecommendedItem[] = [1, 2, 3, 4].map((id) => ({
+ entityType: 'email_thread',
+ entityId: `email-${id}`,
+ title: `Email subject ${id}`,
+ source: 'Email',
+ action: 'reply_now',
+ reason: `Confirm the requested deadline ${id}`,
+ prompt: `Draft a reply to email ${id}`,
+}));
+
+describe('HomeSuggestions', () => {
+ it('shows three item names and reasons with separate draft and Open actions', () => {
+ const onSelect = vi.fn();
+ const onOpen = vi.fn();
+ const view = render(() => (
+ <HomeSuggestions
+ view={{ kind: 'items', items }}
+ onSelect={onSelect}
+ onOpen={onOpen}
+ onRetry={vi.fn()}
+ onConnect={vi.fn()}
+ />
+ ));
+
+ expect(view.getAllByText('Open')).toHaveLength(3);
+ expect(view.queryByText(items[3].reason)).toBeNull();
+ expect(view.getByText(items[0].title)).toBeTruthy();
+ expect(view.queryByText(items[3].title)).toBeNull();
+ fireEvent.click(view.getByText(items[0].reason));
+ expect(onSelect).toHaveBeenCalledExactlyOnceWith(items[0]);
+ expect(onOpen).not.toHaveBeenCalled();
+
+ fireEvent.click(
+ view.getByRole('button', {
+ name: `Open ${items[1].title} in a new split`,
+ })
+ );
+ expect(onOpen).toHaveBeenCalledExactlyOnceWith(items[1]);
+ expect(onSelect).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/apps/web/src/features/home/components/home-suggestions.tsx b/apps/web/src/features/home/components/home-suggestions.tsx
new file mode 100644
index 0000000000..2a1545b583
--- /dev/null
+++ b/apps/web/src/features/home/components/home-suggestions.tsx
@@ -0,0 +1,112 @@
+import ArrowUpRightIcon from '@phosphor/arrow-up-right.svg';
+import ArticleIcon from '@phosphor/article.svg';
+import EnvelopeIcon from '@phosphor/envelope.svg';
+import FolderIcon from '@phosphor/folder-simple.svg';
+import HashIcon from '@phosphor/hash.svg';
+import PhoneIcon from '@phosphor/phone.svg';
+import SparkleIcon from '@phosphor/sparkle.svg';
+import {
+ MAX_RECOMMENDATIONS,
+ type RecommendedItem,
+ type RecommendedView,
+} from '@queries/ai/homeRecommendations';
+import { For, Match, Switch } from 'solid-js';
+import { Dynamic } from 'solid-js/web';
+import { match } from 'ts-pattern';
+
+function suggestionIcon(entityType: RecommendedItem['entityType']) {
+ return match(entityType)
+ .with('email_thread', () => EnvelopeIcon)
+ .with('channel', () => HashIcon)
+ .with('document', () => ArticleIcon)
+ .with('project', () => FolderIcon)
+ .with('call', () => PhoneIcon)
+ .otherwise(() => SparkleIcon);
+}
+
+export function HomeSuggestions(props: {
+ view: RecommendedView;
+ onSelect: (item: RecommendedItem) => void;
+ onOpen: (item: RecommendedItem) => void;
+ onRetry: () => void;
+ onConnect: () => void;
+}) {
+ const items = () =>
+ props.view.kind === 'items'
+ ? props.view.items.slice(0, MAX_RECOMMENDATIONS)
+ : [];
+ return (
+ <section
+ aria-label="Suggested actions"
+ class="mx-[15px] flex flex-col gap-[5px] pt-9 pb-2"
+ >
+ <Switch>
+ <Match when={props.view.kind === 'items'}>
+ <For each={items()}>
+ {(item) => (
+ <div class="group flex min-w-0 items-center text-sm rounded-lg opacity-65 transition-[color,background-color,opacity] hover:opacity-100 focus-within:opacity-100 hover:bg-hover focus-within:bg-hover">
+ <button
+ type="button"
+ class="flex min-h-9 min-w-0 flex-1 items-center gap-2 rounded-lg py-2 px-3 text-left text-sm leading-5 text-ink-extra-muted transition-colors hover:text-ink focus-visible:outline-2 focus-visible:outline-accent"
+ onClick={() => props.onSelect(item)}
+ aria-label={`Ask AI about ${item.title}`}
+ >
+ <span class="truncate">{item.reason}</span>
+ <span aria-hidden="true">—</span>
+ <Dynamic
+ component={suggestionIcon(item.entityType)}
+ class="size-4 shrink-0"
+ aria-hidden="true"
+ />
+ <span class="min-w-0 truncate text-ink-muted">
+ {item.title}
+ </span>
+ </button>
+ <button
+ type="button"
+ aria-label={`Open ${item.title} in a new split`}
+ class="mr-2 flex h-7 shrink-0 items-center justify-center gap-1 rounded-md px-2 text-sm leading-5 text-ink-extra-muted transition-colors hover:bg-active hover:text-ink focus-visible:outline-2 focus-visible:outline-accent"
+ onClick={() => props.onOpen(item)}
+ >
+ <span>Open</span>
+ <ArrowUpRightIcon class="size-3.5" aria-hidden="true" />
+ </button>
+ </div>
+ )}
+ </For>
+ </Match>
+ <Match when={props.view.kind === 'loading'}>
+ <For each={Array.from({ length: MAX_RECOMMENDATIONS })}>
+ {() => (
+ <div
+ aria-hidden="true"
+ class="mx-3 my-3 h-3 rounded-full bg-skeleton opacity-25 skeleton-shimmer after:opacity-40"
+ />
+ )}
+ </For>
+ </Match>
+ <Match when={props.view.kind === 'error'}>
+ <div class="flex flex-wrap items-center justify-between gap-3 px-4 py-3 text-sm text-ink-muted">
+ <span>Suggestions are unavailable right now.</span>
+ <button
+ type="button"
+ class="rounded-lg px-2 py-1 text-accent hover:bg-hover"
+ onClick={props.onRetry}
+ >
+ Try again
+ </button>
+ </div>
+ </Match>
+ <Match when={props.view.kind === 'connect-inbox'}>
+ <button
+ type="button"
+ class="rounded-2xl px-4 py-3 text-left text-sm text-ink-muted hover:bg-hover"
+ onClick={props.onConnect}
+ >
+ Connect your inbox for suggested actions
+ </button>
+ </Match>
+ </Switch>
+ </section>
+ );
+}
diff --git a/apps/web/src/features/home/home-chat-input.test.tsx b/apps/web/src/features/home/home-chat-input.test.tsx
new file mode 100644
index 0000000000..68106599f4
--- /dev/null
+++ b/apps/web/src/features/home/home-chat-input.test.tsx
@@ -0,0 +1,180 @@
+import type { ChatSendInput } from '@core/component/AI/component/input/buildRequest';
+import { Model } from '@core/component/AI/constant';
+import { cleanup, render } from '@solidjs/testing-library';
+import { err, ok } from 'neverthrow';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { HomeChatInput } from './home-chat-input';
+
+const mocks = vi.hoisted(() => ({
+ onSend: undefined as ((request: ChatSendInput) => Promise<void>) | undefined,
+ draft: '',
+ attached: [] as ChatSendInput['attachments'],
+ setMarkdown: vi.fn(),
+ setAttached: vi.fn(),
+ createChat: vi.fn(),
+ sendStreamChatMessage: vi.fn(),
+ showPaywall: vi.fn(),
+ rename: vi.fn(),
+ replace: vi.fn(),
+ pendingSend: vi.fn(),
+ invalidateSoup: vi.fn(),
+}));
+
+vi.mock('@components/app/split-layout/layoutUtils', () => ({
+ useSplitPanelOrThrow: () => ({ handle: { replace: mocks.replace } }),
+}));
+vi.mock('@core/component/AI/component/input/buildChatEditor', () => ({
+ buildChatEditor: () => ({
+ withMentions: () => ({ controls: { setMarkdown: mocks.setMarkdown } }),
+ }),
+}));
+vi.mock('@core/component/AI/component/input/ChatInput', () => ({
+ ChatInput: (props: { onSend: typeof mocks.onSend }) => {
+ mocks.onSend = props.onSend;
+ return null;
+ },
+}));
+vi.mock('@core/component/AI/context', () => ({
+ useChatInputContext: () => ({
+ attachments: { setAttached: mocks.setAttached },
+ pendingDraft: () => null,
+ }),
+}));
+vi.mock('@core/component/AI/signal/attachment', () => ({
+ useGetChatAttachmentInfo: () => ({}),
+}));
+vi.mock('@core/component/AI/signal/mention-attachment-callbacks', () => ({
+ createMentionAttachmentCallbacks: () => ({}),
+}));
+vi.mock('@core/component/AI/signal/pendingSend', () => ({
+ setPendingSendData: mocks.pendingSend,
+}));
+vi.mock('@core/constant/PaywallState', () => ({
+ PaywallKey: { CHAT_LIMIT: 'chat_limit' },
+ usePaywallState: () => ({ showPaywall: mocks.showPaywall }),
+}));
+vi.mock('@core/hotkey/hotkeys', () => ({ registerHotkey: vi.fn() }));
+vi.mock('@entity', () => ({
+ createRenameDssEntityMutation: () => ({ mutate: mocks.rename }),
+}));
+vi.mock('@queries/soup/normalized-cache', () => ({
+ invalidateAllSoup: mocks.invalidateSoup,
+}));
+vi.mock('@service-cognition/client', () => ({
+ cognitionApiServiceClient: {
+ createChat: mocks.createChat,
+ sendStreamChatMessage: mocks.sendStreamChatMessage,
+ },
+}));
+
+const request: ChatSendInput = {
+ content: 'Summarize **these documents**\nInclude the key decisions.',
+ model: Model.sonnet5,
+ attachments: [
+ { entity_id: 'document-1', entity_type: 'document' },
+ { entity_id: 'project-1', entity_type: 'project' },
+ ],
+ toolset: { type: 'none' },
+};
+
+beforeEach(() => {
+ vi.resetAllMocks();
+ // ChatInput clears the editor and attachments before invoking onSend.
+ mocks.draft = '';
+ mocks.attached = [];
+ mocks.setMarkdown.mockImplementation((text: string) => {
+ mocks.draft = text;
+ });
+ mocks.setAttached.mockImplementation(
+ (value: ChatSendInput['attachments']) => {
+ mocks.attached = value;
+ }
+ );
+ render(() => <HomeChatInput />);
+});
+
+afterEach(cleanup);
+
+describe('Home chat creation', () => {
+ it.each([
+ { code: 'NETWORK_ERROR', message: 'Request failed', paywall: false },
+ { code: 'HTTP_ERROR', message: '402 payment_required', paywall: true },
+ { code: 'FORBIDDEN', message: 'Chat limit reached', paywall: true },
+ ])(
+ 'restores the submitted draft on $code before any paywall',
+ async (failure) => {
+ mocks.createChat.mockResolvedValue(err([failure]));
+ mocks.showPaywall.mockImplementation(() => {
+ expect(mocks.draft).toBe(request.content);
+ expect(mocks.attached).toEqual(request.attachments);
+ });
+
+ await mocks.onSend?.(request);
+
+ expect(mocks.createChat).toHaveBeenCalledOnce();
+ expect(mocks.draft).toBe(request.content);
+ expect(mocks.attached).toEqual(request.attachments);
+ if (failure.paywall) {
+ expect(mocks.showPaywall).toHaveBeenCalledWith('chat_limit');
+ } else {
+ expect(mocks.showPaywall).not.toHaveBeenCalled();
+ }
+ expect(mocks.rename).not.toHaveBeenCalled();
+ expect(mocks.replace).not.toHaveBeenCalled();
+ expect(mocks.pendingSend).not.toHaveBeenCalled();
+ expect(mocks.sendStreamChatMessage).not.toHaveBeenCalled();
+ }
+ );
+
+ it('restores an attachment-only submission', async () => {
+ mocks.createChat.mockResolvedValue(
+ err([{ code: 'NETWORK_ERROR', message: 'Failed' }])
+ );
+
+ await mocks.onSend?.({ ...request, content: '' });
+
+ expect(mocks.draft).toBe('');
+ expect(mocks.attached).toEqual(request.attachments);
+ });
+
+ it.each([false, true])(
+ 'keeps successful-send behavior (background=%s)',
+ async (metaKey) => {
+ mocks.createChat.mockResolvedValue(ok({ id: 'new-chat' }));
+
+ await mocks.onSend?.({ ...request, metaKey });
+
+ expect(mocks.setMarkdown).not.toHaveBeenCalled();
+ expect(mocks.setAttached).not.toHaveBeenCalled();
+ expect(mocks.rename).toHaveBeenCalledWith(
+ expect.objectContaining({
+ entity: expect.objectContaining({ type: 'chat', id: 'new-chat' }),
+ })
+ );
+ if (metaKey) {
+ expect(mocks.sendStreamChatMessage).toHaveBeenCalledWith(
+ expect.objectContaining({
+ chat_id: 'new-chat',
+ content: request.content,
+ attachments: request.attachments,
+ model: request.model,
+ toolset: request.toolset,
+ })
+ );
+ expect(mocks.invalidateSoup).toHaveBeenCalledOnce();
+ expect(mocks.replace).not.toHaveBeenCalled();
+ expect(mocks.pendingSend).not.toHaveBeenCalled();
+ } else {
+ expect(mocks.pendingSend).toHaveBeenCalledWith({
+ content: request.content,
+ attachments: request.attachments,
+ model: request.model,
+ });
+ expect(mocks.replace).toHaveBeenCalledWith({
+ next: { type: 'chat', id: 'new-chat' },
+ });
+ expect(mocks.sendStreamChatMessage).not.toHaveBeenCalled();
+ }
+ }
+ );
+});
diff --git a/apps/web/src/features/home/home-chat-input.tsx b/apps/web/src/features/home/home-chat-input.tsx
new file mode 100644
index 0000000000..af289abdf2
--- /dev/null
+++ b/apps/web/src/features/home/home-chat-input.tsx
@@ -0,0 +1,142 @@
+import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
+import { buildChatEditor } from '@core/component/AI/component/input/buildChatEditor';
+import type { ChatSendInput } from '@core/component/AI/component/input/buildRequest';
+import { ChatInput } from '@core/component/AI/component/input/ChatInput';
+import { useChatInputContext } from '@core/component/AI/context';
+import { useGetChatAttachmentInfo } from '@core/component/AI/signal/attachment';
+import { createMentionAttachmentCallbacks } from '@core/component/AI/signal/mention-attachment-callbacks';
+import { setPendingSendData } from '@core/component/AI/signal/pendingSend';
+import { deriveChatName } from '@core/component/AI/util/deriveName';
+import { PaywallKey, usePaywallState } from '@core/constant/PaywallState';
+import { registerHotkey } from '@core/hotkey/hotkeys';
+import { TOKENS } from '@core/hotkey/tokens';
+import { isPaymentError } from '@core/util/handlePaymentError';
+import { createRenameDssEntityMutation } from '@entity';
+import { invalidateAllSoup } from '@queries/soup/normalized-cache';
+import { cognitionApiServiceClient } from '@service-cognition/client';
+import { $getRoot } from 'lexical';
+import { createEffect } from 'solid-js';
+import { replaceHomeComposerDraft } from './home-composer-selection';
+
+export const HomeChatInput = (props: {
+ variant?: 'default' | 'tall';
+ class?: string;
+ placeholder?: string;
+ autoFocusOnMount?: boolean;
+}) => {
+ const splitPanelContext = useSplitPanelOrThrow();
+ const input = useChatInputContext();
+
+ const { getAttachmentFromMention } = useGetChatAttachmentInfo();
+ const attachmentMentionCallbacks = createMentionAttachmentCallbacks(
+ input.attachments,
+ getAttachmentFromMention
+ );
+ const editor = buildChatEditor().withMentions({
+ ...attachmentMentionCallbacks,
+ block: 'chat',
+ showOpenTabs: true,
+ });
+
+ const applyDraft = (text: string) => {
+ replaceHomeComposerDraft(editor.controls, text);
+ requestAnimationFrame(() => {
+ editor.controls.focus();
+ // Focus lands at the start of the document; drafts are prompt prefixes,
+ // so the caret belongs at the end, ready to complete the sentence.
+ editor.controls.getLexical().update(() => {
+ $getRoot().selectEnd();
+ });
+ });
+ };
+
+ // Drafts requested from elsewhere on the home (e.g. a suggested action row).
+ createEffect(() => {
+ const draft = input.pendingDraft();
+ if (draft != null) {
+ applyDraft(draft);
+ input.setPendingDraft(null);
+ }
+ });
+
+ registerHotkey({
+ hotkey: 'enter',
+ scopeId: splitPanelContext.splitHotkeyScope,
+ description: 'Focus Chat Input',
+ keyDownHandler: () => {
+ editor.controls.focus();
+ return true;
+ },
+ hotkeyToken: TOKENS.block.focus,
+ hide: true,
+ });
+
+ const renameMutation = createRenameDssEntityMutation();
+
+ const handleSend = async (request: ChatSendInput) => {
+ const backgroundSend = request.metaKey;
+
+ // Create a new persistent chat
+ const response = await cognitionApiServiceClient.createChat({});
+ if (response.isErr()) {
+ input.attachments.setAttached(request.attachments);
+ replaceHomeComposerDraft(editor.controls, request.content);
+ if (isPaymentError(response)) {
+ const { showPaywall } = usePaywallState();
+ showPaywall(PaywallKey.CHAT_LIMIT);
+ }
+ return;
+ }
+ const { id: chatId } = response.value;
+
+ // Rename via mutation for optimistic cache updates (history, preview, soup)
+ const name = deriveChatName(request.content);
+ if (name) {
+ renameMutation.mutate({
+ entity: { type: 'chat', id: chatId, name: '', ownerId: '' },
+ newName: name,
+ });
+ }
+
+ if (backgroundSend) {
+ // Send the message in the background without navigating
+ cognitionApiServiceClient.sendStreamChatMessage({
+ content: request.content,
+ model: request.model,
+ chat_id: chatId,
+ attachments:
+ request.attachments.length > 0 ? request.attachments : undefined,
+ toolset: request.toolset,
+ });
+ invalidateAllSoup();
+ } else {
+ // Store the pending send data for the chat to pick up
+ setPendingSendData({
+ content: request.content,
+ attachments: request.attachments,
+ model: request.model,
+ });
+
+ // Replace the soup split with the chat split
+ splitPanelContext.handle.replace({
+ next: { type: 'chat', id: chatId },
+ });
+ }
+ };
+
+ return (
+ <ChatInput
+ variant={props.variant ?? 'default'}
+ class={props.class}
+ placeholder={props.placeholder}
+ editor={editor}
+ onSend={handleSend}
+ onEscape={() => {
+ splitPanelContext.panelRef()?.focus();
+ return true;
+ }}
+ isPersistent={true}
+ autoFocusOnMount={props.autoFocusOnMount ?? true}
+ />
+ );
+};
diff --git a/apps/web/src/features/home/home-hub.tsx b/apps/web/src/features/home/home-hub.tsx
index 04bd774194..c20081cf4b 100644
--- a/apps/web/src/features/home/home-hub.tsx
+++ b/apps/web/src/features/home/home-hub.tsx
@@ -26,6 +26,7 @@ import {
import { useEmailLinksQuery } from '@queries/email/link';
import { useMcpServersQuery } from '@queries/mcp-servers';
import { usePipedreamConnectionsQuery } from '@queries/pipedream-connectors';
+import { stringToItemType } from '@service-storage/itemType';
import { useNavigate } from '@solidjs/router';
import { For, Match, Show, Switch } from 'solid-js';
import { match } from 'ts-pattern';
@@ -291,14 +292,15 @@ function RecommendedRow(props: {
onOpen: () => void;
}) {
const status = () => STATUS[props.item.action];
+ const iconType = () => {
+ const type = stringToItemType(props.item.entityType);
+ return type ? getEntityIconType({ type }) : 'default';
+ };
return (
<div class="group flex w-full items-stretch overflow-hidden rounded-xl border border-edge-muted bg-active transition-colors hover:border-edge">
<div class="flex min-w-0 flex-1 items-center gap-3.5 px-4 py-3">
<div class="flex size-7 shrink-0 items-center justify-center rounded-lg bg-surface text-ink-muted">
- <EntityIcon
- targetType={recommendedIconType(props.item.entityType)}
- size="xs"
- />
+ <EntityIcon targetType={iconType()} size="xs" />
</div>
<div class="min-w-0 flex-1">
<div class="truncate text-sm font-medium text-ink">
@@ -333,20 +335,3 @@ function RecommendedRow(props: {
</div>
);
}
-
-function recommendedIconType(entityType: RecommendedItem['entityType']) {
- switch (entityType) {
- case 'email_thread':
- return getEntityIconType({ type: 'email' });
- case 'channel':
- return getEntityIconType({ type: 'channel' });
- case 'chat':
- return getEntityIconType({ type: 'chat' });
- case 'document':
- return getEntityIconType({ type: 'document' });
- case 'project':
- return getEntityIconType({ type: 'project' });
- default:
- return 'default' as const;
- }
-}
diff --git a/apps/web/src/features/home/inbox-start.tsx b/apps/web/src/features/home/inbox-start.tsx
new file mode 100644
index 0000000000..263cbd726a
--- /dev/null
+++ b/apps/web/src/features/home/inbox-start.tsx
@@ -0,0 +1,25 @@
+import { DragDropWrapper } from '@core/component/AI/component/DragDrop';
+import { ChatInputProvider } from '@core/component/AI/context';
+import { HomeRecommendedActions } from './components/home-recommended-actions';
+import { HomeStartLayout } from './components/home-start-layout';
+import { HomeChatInput } from './home-chat-input';
+
+/** Desktop inbox landing pane, sharing the original Home composer and recommendations. */
+export function InboxStart() {
+ return (
+ <ChatInputProvider>
+ <DragDropWrapper class="relative size-full">
+ <HomeStartLayout
+ composer={
+ <HomeChatInput
+ variant="default"
+ autoFocusOnMount={false}
+ placeholder="Work on anything"
+ />
+ }
+ suggestions={<HomeRecommendedActions />}
+ />
+ </DragDropWrapper>
+ </ChatInputProvider>
+ );
+}
diff --git a/apps/web/src/features/home/use-home-recommendations.ts b/apps/web/src/features/home/use-home-recommendations.ts
new file mode 100644
index 0000000000..16dde9b233
--- /dev/null
+++ b/apps/web/src/features/home/use-home-recommendations.ts
@@ -0,0 +1,124 @@
+import { LIST_VIEW_PATHS } from '@app/constants/list-views';
+import { globalSplitManager } from '@app/signal/splitLayout';
+import { useGlobalNotificationSource } from '@components/app/GlobalAppState';
+import { useChatInputContext } from '@core/component/AI/context';
+import { fileTypeToBlockName } from '@core/constant/allBlocks';
+import { useSettingsState } from '@core/constant/SettingsState';
+import type { Entity } from '@core/types';
+import {
+ compositeEntity,
+ fetchNotificationsForEntities,
+ openNotification,
+} from '@notifications';
+import { createHomeRecommendations } from '@queries/ai/createHomeRecommendations';
+import {
+ deriveRecommendedView,
+ type RecommendedItem,
+} from '@queries/ai/homeRecommendations';
+import { useEmailLinksQuery } from '@queries/email/link';
+import { fetchDocumentMetadata } from '@queries/storage/document-metadata';
+import { useNavigate } from '@solidjs/router';
+import { match } from 'ts-pattern';
+import { replaceHomeComposerSelection } from './home-composer-selection';
+
+const ATTACHABLE_ENTITY_TYPES = new Set<RecommendedItem['entityType']>([
+ 'channel',
+ 'document',
+ 'email_thread',
+ 'project',
+]);
+
+/** Shared Home recommendation data and open/draft actions. */
+export function useHomeRecommendations() {
+ const input = useChatInputContext();
+ const notificationSource = useGlobalNotificationSource();
+ const { openSettings } = useSettingsState();
+ const navigate = useNavigate();
+
+ const emailLinks = useEmailLinksQuery();
+ const recommendations = createHomeRecommendations();
+
+ const view = () =>
+ deriveRecommendedView({
+ loading: emailLinks.isLoading || recommendations.isLoading(),
+ failed:
+ (emailLinks.isError && emailLinks.data === undefined) ||
+ recommendations.hasError(),
+ items: recommendations.items(),
+ emailLinked:
+ emailLinks.isSuccess && (emailLinks.data?.links.length ?? 0) > 0,
+ });
+ const items = () => {
+ const current = view();
+ return current.kind === 'items' ? current.items : [];
+ };
+
+ const selectRecommendation = (item: RecommendedItem) => {
+ replaceHomeComposerSelection(
+ input,
+ item.prompt,
+ ATTACHABLE_ENTITY_TYPES.has(item.entityType)
+ ? [{ entity_id: item.entityId, entity_type: item.entityType }]
+ : undefined
+ );
+ };
+
+ const openRecommendation = async (item: RecommendedItem) => {
+ const splitManager = globalSplitManager();
+ if (!splitManager) return;
+
+ const entity = { id: item.entityId, type: item.entityType } as Entity;
+ let notification =
+ notificationSource.notificationsByEntity()[compositeEntity(entity)]?.[0];
+ if (!notification) {
+ notification = (await fetchNotificationsForEntities([entity]))[0];
+ }
+
+ if (notification) {
+ const result = await openNotification(notification, splitManager, true);
+ if (result.isOk()) {
+ await notificationSource.markAsRead(notification);
+ return;
+ }
+ }
+
+ return match(item.entityType)
+ .with('email_thread', () =>
+ splitManager.openWithSplit(
+ { type: 'email', id: item.entityId },
+ { activate: true, preferNewSplit: true }
+ )
+ )
+ .with('channel', 'chat', 'call', 'project', (entityType) =>
+ splitManager.openWithSplit(
+ { type: entityType, id: item.entityId },
+ { activate: true, preferNewSplit: true }
+ )
+ )
+ .with('document', async () => {
+ const metadata = await fetchDocumentMetadata(item.entityId);
+ return splitManager.openWithSplit(
+ {
+ type: fileTypeToBlockName(metadata.subType ?? metadata.fileType),
+ id: item.entityId,
+ },
+ { activate: true, preferNewSplit: true }
+ );
+ })
+ .otherwise(() => navigate(LIST_VIEW_PATHS.inbox));
+ };
+
+ const retry = () => {
+ void Promise.allSettled([emailLinks.refetch(), recommendations.retry()]);
+ };
+
+ return {
+ view,
+ items,
+ selectRecommendation,
+ openRecommendation,
+ retry,
+ openSettings,
+ navigate,
+ };
+}
diff --git a/apps/web/src/features/inbox-view/components/HomeChatStart.tsx b/apps/web/src/features/inbox-view/components/HomeChatStart.tsx
new file mode 100644
index 0000000000..024b465545
--- /dev/null
+++ b/apps/web/src/features/inbox-view/components/HomeChatStart.tsx
@@ -0,0 +1,27 @@
+import { DragDropWrapper } from '@core/component/AI/component/DragDrop';
+import { ChatInputProvider } from '@core/component/AI/context';
+import { HomeRecommendedActions } from '../../home/components/home-recommended-actions';
+import { HomeChatInput } from '../../home/home-chat-input';
+
+/** Desktop Home's idle pane uses the single-line chat composer and send flow. */
+export function HomeChatStart() {
+ return (
+ <ChatInputProvider>
+ <DragDropWrapper class="relative size-full min-h-0 min-w-0 overflow-y-auto px-6">
+ <div class="mx-auto grid h-full min-h-64 min-w-0 w-full max-w-180 grid-cols-1 grid-rows-[1fr_auto_1fr] pb-16">
+ <h1 class="mb-6 min-h-0 min-w-0 self-end text-center text-2xl font-normal leading-[42px] text-ink">
+ What should we get done in Macro?
+ </h1>
+ <HomeChatInput
+ variant="default"
+ placeholder="Type @ to reference / for skills"
+ autoFocusOnMount={false}
+ />
+ <div class="min-h-0 min-w-0 pb-8">
+ <HomeRecommendedActions />
+ </div>
+ </div>
+ </DragDropWrapper>
+ </ChatInputProvider>
+ );
+}
diff --git a/apps/web/src/features/inbox-view/components/HomeEntityIcon.tsx b/apps/web/src/features/inbox-view/components/HomeEntityIcon.tsx
new file mode 100644
index 0000000000..abe8f1cf58
--- /dev/null
+++ b/apps/web/src/features/inbox-view/components/HomeEntityIcon.tsx
@@ -0,0 +1,28 @@
+import { EntityIcon } from '@entity/extractors/entity-icon';
+import { type EntityData, isGithubPrEntity } from '@entity/types/entity';
+
+/** Shared entity icons sized for compact Home rows. */
+export function HomeEntityIcon(props: { entity: EntityData }) {
+ return (
+ <span
+ class="flex size-5 shrink-0 items-center justify-center"
+ aria-hidden="true"
+ >
+ <span
+ class={
+ props.entity.type === 'channel' &&
+ props.entity.channelType === 'direct_message'
+ ? 'size-5 overflow-hidden rounded-full'
+ : 'size-4'
+ }
+ >
+ <EntityIcon
+ entity={props.entity}
+ class={isGithubPrEntity(props.entity) ? undefined : 'text-current'}
+ suppressClick
+ showTooltip={false}
+ />
+ </span>
+ </span>
+ );
+}
diff --git a/apps/web/src/features/inbox-view/components/HomeListEntity.tsx b/apps/web/src/features/inbox-view/components/HomeListEntity.tsx
new file mode 100644
index 0000000000..73066a04f6
--- /dev/null
+++ b/apps/web/src/features/inbox-view/components/HomeListEntity.tsx
@@ -0,0 +1,137 @@
+import { useUserId } from '@core/context/user';
+import { getDisplayName, tryMacroId } from '@core/user';
+import { Entity, MaybeEntityRow } from '@entity';
+import type { BaseListEntityProps } from '@entity/composed/list-entity/shared';
+import { unreadFilterFn } from '@entity/utils/filter';
+import ArrowBendUpLeftIcon from '@phosphor-icons/core/regular/arrow-bend-up-left.svg?component-solid';
+import { getBotDisplayName } from '@queries/channel/message-sender';
+import { cn, pressHandlers } from '@ui';
+import { Show } from 'solid-js';
+import { HomeEntityIcon } from './HomeEntityIcon';
+
+type HomeListEntityProps = BaseListEntityProps & {
+ occurrenceKey: string;
+ channelName?: string;
+};
+
+/** One compact, single-line Home item; the list owns focus and activation. */
+export function HomeListEntity(props: HomeListEntityProps) {
+ const threadEntity = () =>
+ props.entity.type === 'channel_thread' ? props.entity : undefined;
+ const unread = () => unreadFilterFn(props.entity);
+
+ return (
+ <div class="soup-list-entity relative mx-1.5 my-0.5">
+ <MaybeEntityRow
+ entityId={props.occurrenceKey}
+ config={props.entityRowConfig}
+ >
+ <div
+ class={cn(
+ 'group/home-item relative flex h-8 min-w-0 items-center gap-2 rounded-xl px-2.5 text-left text-sm outline-none touch:h-11',
+ props.checked || props.highlighted
+ ? 'bg-active text-ink'
+ : 'text-ink-muted hover:bg-hover hover:text-ink'
+ )}
+ {...pressHandlers((event) => {
+ event.preventDefault();
+ props.onClick?.(event);
+ })}
+ data-home-item
+ >
+ <Show
+ when={threadEntity()}
+ fallback={<HomeEntityIcon entity={props.entity} />}
+ >
+ <span class="flex size-5 shrink-0 items-center justify-center">
+ <ArrowBendUpLeftIcon class="size-4" />
+ </span>
+ </Show>
+ <span
+ class={cn(
+ 'block min-w-0 flex-1 truncate font-normal',
+ unread() && 'text-ink'
+ )}
+ >
+ <Show
+ when={threadEntity()}
+ fallback={
+ <Show
+ when={props.channelName}
+ fallback={<Entity.Title entity={props.entity} />}
+ >
+ {props.channelName}
+ </Show>
+ }
+ >
+ {(thread) => (
+ <HomeThreadTitle
+ entity={thread()}
+ channelName={props.channelName}
+ />
+ )}
+ </Show>
+ </span>
+ <span
+ data-home-timestamp
+ class="hidden shrink-0 text-xs font-normal text-ink-extra-muted group-hover/home-item:block"
+ >
+ <Entity.Timestamp
+ entity={props.entity}
+ overrideTimeStamp={props.timestamp ?? undefined}
+ />
+ </span>
+ <Show when={unread()}>
+ <span
+ aria-label="Unread"
+ class="size-1.5 shrink-0 rounded-full bg-accent"
+ />
+ </Show>
+ </div>
+ </MaybeEntityRow>
+ </div>
+ );
+}
+
+function HomeThreadTitle(
+ props: Pick<HomeListEntityProps, 'entity' | 'channelName'>
+) {
+ const currentUserId = useUserId();
+ const sender = () => {
+ const entity = props.entity;
+ if (entity.type !== 'channel_thread') return undefined;
+ const notification = entity.notifications?.()?.[0];
+ if (
+ notification?.notification_metadata?.tag === 'channel_message_reply' &&
+ notification.sender_id
+ ) {
+ return { id: notification.sender_id };
+ }
+ return { id: entity.senderId, details: entity.sender };
+ };
+ const senderLabel = () => {
+ const value = sender();
+ if (!value) return 'Someone';
+ if (value.id === currentUserId()) return 'You';
+ return (
+ getBotDisplayName(value.id, value.details) ||
+ getDisplayName(tryMacroId(value.id), { emailFallback: 'local-part' }) ||
+ value.details?.name ||
+ 'Someone'
+ );
+ };
+ const location = () => {
+ const name = props.channelName || props.entity.name;
+ return props.entity.type === 'channel_thread' &&
+ props.entity.channelType === 'direct_message'
+ ? name
+ : `#${name.replace(/^#/, '')}`;
+ };
+ return (
+ <span class="flex min-w-0 items-center">
+ <span class="max-w-1/2 truncate">{senderLabel()}</span>
+ <span class="shrink-0 whitespace-pre"> in </span>
+ <span class="min-w-0 truncate">{location()}</span>
+ </span>
+ );
+}
diff --git a/apps/web/src/features/inbox-view/components/InboxDateGroupHeader.tsx b/apps/web/src/features/inbox-view/components/InboxDateGroupHeader.tsx
index 576b8819af..1742ac9047 100644
--- a/apps/web/src/features/inbox-view/components/InboxDateGroupHeader.tsx
+++ b/apps/web/src/features/inbox-view/components/InboxDateGroupHeader.tsx
@@ -15,7 +15,7 @@ export function InboxDateGroupHeader(props: {
'group/header relative flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-xs font-semibold tracking-tight',
'border-none my-0 text-ink-extra-muted/80',
'mx-0 w-full',
- 'pl-(--soup-row-padding-l)',
+ 'px-4',
!props.isFirst && 'pt-5'
)}
>
diff --git a/apps/web/src/features/inbox-view/components/InboxEmptyState.tsx b/apps/web/src/features/inbox-view/components/InboxEmptyState.tsx
index d420311d21..61eaa7d24d 100644
--- a/apps/web/src/features/inbox-view/components/InboxEmptyState.tsx
+++ b/apps/web/src/features/inbox-view/components/InboxEmptyState.tsx
@@ -46,8 +46,8 @@ export function InboxEmptyState() {
<Match when={!emailActive()}>
<EmptyStatePanel
graphic={EmptyStateInboxTrayGraphic}
- title="No notifications yet"
- description="Bring your inbox into Macro to triage signal from noise, reply faster, and let agents work alongside your mail."
+ title="Welcome home"
+ description="Your recent work and notifications will appear here. Connect email to include your inbox, too."
primaryAction={{
label: 'Connect email',
onClick: () => void startAddInbox(),
@@ -75,8 +75,8 @@ export function InboxEmptyState() {
<Match when={true}>
<EmptyStatePanel
graphic={EmptyStateInboxTrayGraphic}
- title="You're all caught up"
- description="Important items will appear here as they arrive."
+ title="No activity yet"
+ description="Your recent documents, sent emails, AI chats, and notifications will appear here."
documentationUrl={`${DOCS_BASE}/product/inbox`}
/>
</Match>
diff --git a/apps/web/src/features/inbox-view/components/InboxFilters.tsx b/apps/web/src/features/inbox-view/components/InboxFilters.tsx
index e07296f719..858cd9ee7c 100644
--- a/apps/web/src/features/inbox-view/components/InboxFilters.tsx
+++ b/apps/web/src/features/inbox-view/components/InboxFilters.tsx
@@ -99,7 +99,7 @@ export function InboxFilterDropdown() {
isSelected={filters.isSelected}
onSelectionChange={filters.setSelected}
onClear={filters.clear}
- label="Filter Inbox"
+ label="Filter Home"
/>
<FilterCountBadge count={filters.activeCount()} />
diff --git a/apps/web/src/features/inbox-view/components/InboxHeader.tsx b/apps/web/src/features/inbox-view/components/InboxHeader.tsx
index 6a501db905..ddf5b3b3ce 100644
--- a/apps/web/src/features/inbox-view/components/InboxHeader.tsx
+++ b/apps/web/src/features/inbox-view/components/InboxHeader.tsx
@@ -1,25 +1,11 @@
+import { SidebarCreateHeader } from '@app/components/view-shell/SidebarCreateButton';
import { MobileTopEdgeFade } from '@components/app/mobile/MobileEdgeFade';
-import { SplitPanel } from '@components/app/split-panel';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { type JSX, type ParentProps, Show } from 'solid-js';
-function InboxHeader(props: ParentProps) {
+function MobileInboxHeader(props: ParentProps) {
return (
<header class="flex shrink-0 flex-col gap-3 px-4 pt-2 touch:px-(--mobile-chrome-gutter) touch:pt-[calc(var(--safe-top,0px)+0.5rem)] touch:absolute touch:inset-x-0 touch:top-0 touch:z-split-panel-chrome touch:pointer-events-none">
- <Show when={!isTouchDevice()}>
- <div class="flex items-center">
- <SplitPanel.ControlGroup>
- <SplitPanel.CloseButton />
- </SplitPanel.ControlGroup>
- </div>
- </Show>
- <Show when={!isTouchDevice()}>
- <div class="flex h-8 min-w-0 items-center">
- <h1 class="m-0 min-w-0 flex-1 truncate text-base font-semibold tracking-[-0.035em] text-ink">
- Notifications
- </h1>
- </div>
- </Show>
<div class="flex h-8 min-w-0 items-center touch:h-10 touch:pointer-events-auto">
{props.children}
</div>
@@ -28,7 +14,9 @@ function InboxHeader(props: ParentProps) {
}
/** Keep mobile chrome above a full-height list so rows fade beneath it. */
-export function InboxListLayout(props: ParentProps<{ tabs: JSX.Element }>) {
+export function InboxListLayout(
+ props: ParentProps<{ tabs: JSX.Element; onNewChat: () => void }>
+) {
return (
<div
class="relative flex size-full min-h-0 min-w-0 flex-col"
@@ -36,7 +24,18 @@ export function InboxListLayout(props: ParentProps<{ tabs: JSX.Element }>) {
'--mobile-content-inset-top': 'calc(var(--safe-top, 0px) + 3.75rem)',
}}
>
- <InboxHeader>{props.tabs}</InboxHeader>
+ <Show
+ when={isTouchDevice()}
+ fallback={
+ <SidebarCreateHeader
+ title="Home"
+ label="New chat"
+ onCreate={props.onNewChat}
+ />
+ }
+ >
+ <MobileInboxHeader>{props.tabs}</MobileInboxHeader>
+ </Show>
{props.children}
<Show when={isTouchDevice()}>
<MobileTopEdgeFade />
diff --git a/apps/web/src/features/inbox-view/components/InboxList.tsx b/apps/web/src/features/inbox-view/components/InboxList.tsx
index e7a44939b5..a2305b36a4 100644
--- a/apps/web/src/features/inbox-view/components/InboxList.tsx
+++ b/apps/web/src/features/inbox-view/components/InboxList.tsx
@@ -11,7 +11,6 @@ import {
toEntityActionListState,
useEntityActionHotkeys,
} from '@app/features/next-soup/actions';
-import { InboxListEntity } from '@app/features/next-soup/soup-view/views/inbox/InboxListEntity';
import {
createSoupEntityActions,
MaybeSoupEntityActionDrawerManager,
@@ -28,6 +27,7 @@ import {
useSplitPanelOrThrow,
withSplitPanelOwner,
} from '@components/app/split-layout/layoutUtils';
+import { useChannelsContext } from '@core/context/channels';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import {
type EntityData,
@@ -35,12 +35,12 @@ import {
isNonMemberChannelEntity,
type WithNotification,
} from '@entity';
-import CaretDownIcon from '@phosphor/caret-down.svg';
+import { getChannelThreadName } from '@entity/utils/channel-thread-name';
import CheckIcon from '@phosphor/check.svg';
import SpinnerIcon from '@phosphor/spinner.svg';
import { createElementSize } from '@solid-primitives/resize-observer';
import { debounce } from '@solid-primitives/scheduled';
-import { Button, cn } from '@ui';
+import { Button } from '@ui';
import {
createEffect,
createMemo,
@@ -71,6 +71,7 @@ import {
type InboxDataSourceItem,
useInboxDataSource,
} from '../queries/use-inbox-query';
+import { HomeListEntity } from './HomeListEntity';
import { InboxDateGroupHeader } from './InboxDateGroupHeader';
import { InboxEmptyState } from './InboxEmptyState';
@@ -91,6 +92,11 @@ type InboxListProps = {
/** Compact notification list used by the Notifications workspace. */
export function InboxList(props: InboxListProps) {
+ const channels = useChannelsContext();
+ const channelName = (entity: WithNotification<EntityData>) =>
+ entity.type === 'channel_thread'
+ ? getChannelThreadName(entity, channels.channelsById())
+ : undefined;
const { state } = useInboxView();
const panel = useSplitPanelOrThrow();
const notificationSource = useGlobalNotificationSource();
@@ -106,7 +112,7 @@ export function InboxList(props: InboxListProps) {
selection: {
getKey: (row) => (row.kind === 'entity' ? row.entity.id : row.id),
},
- isNavigable: (row) => row.kind === 'entity' || row.kind === 'load-more',
+ isNavigable: (row) => row.kind === 'entity',
isSelectable: (row) => row.kind === 'entity',
onActivate,
})
@@ -139,12 +145,6 @@ export function InboxList(props: InboxListProps) {
item,
metadata,
}: ListActivation<InboxDataSourceItem, InboxListActivationMetadata>) {
- if (item.kind === 'load-more') {
- if (!item.isLoading) void source.loadMore();
-
- return;
- }
-
if (item.kind !== 'entity') return;
const sourceRow = source.items().find((row) => row.id === item.id);
@@ -431,29 +431,64 @@ export function InboxList(props: InboxListProps) {
});
function checkNearEnd() {
- const handle = virtualizer();
- if (!handle) return;
+ if (
+ forceEmptyState() ||
+ source.isLoading() ||
+ source.isFetching() ||
+ source.error() ||
+ !source.hasMore()
+ )
+ return;
- if (!source.hasMore()) return;
+ const container = pullScrollContainer();
+ if (!container || container.clientHeight === 0) return;
const distance =
- handle.scrollSize - handle.scrollOffset - handle.viewportSize;
- if (distance < 300 && !source.isLoadingMore()) {
+ container.scrollHeight - container.scrollTop - container.clientHeight;
+ if (distance < 300) {
void source.loadMore();
}
}
+ const scrollContainerSize = createElementSize(pullScrollContainer);
+ createEffect(() => {
+ rows();
+ source.isFetching();
+ scrollContainerSize.height;
+
+ // Fill short or filtered pages without waiting for a scroll event.
+ const frame = requestAnimationFrame(checkNearEnd);
+ onCleanup(() => cancelAnimationFrame(frame));
+ });
+
return (
<MaybeSoupEntityActionDrawerManager>
<div
ref={listRoot}
role="grid"
- aria-label="Notifications"
+ aria-label="Home"
aria-multiselectable="true"
aria-activedescendant={list.focus.key()}
tabIndex={0}
class="soup-list relative mt-3 flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden outline-none touch:mt-0"
>
+ <Show when={source.warning()}>
+ {(warning) => (
+ <div
+ role="status"
+ class="flex items-center gap-2 px-4 pb-2 text-xs text-ink-muted"
+ >
+ <span>{warning()}</span>
+ <button
+ type="button"
+ class="underline"
+ onClick={() => void source.refresh()}
+ >
+ Retry
+ </button>
+ </div>
+ )}
+ </Show>
<PullToRefresh
scrollContainer={pullScrollContainer}
onRefresh={pullRefresh}
@@ -485,7 +520,7 @@ export function InboxList(props: InboxListProps) {
>
<div class="grid min-h-0 flex-1 place-items-center text-ink-muted touch:pt-(--mobile-content-inset-top)">
<SpinnerIcon
- aria-label="Loading notifications"
+ aria-label="Loading Home"
class="size-5 animate-spin"
/>
</div>
@@ -496,7 +531,7 @@ export function InboxList(props: InboxListProps) {
ref={setEmptyViewport}
class="flex min-h-0 flex-1 flex-col items-center justify-center gap-3 overflow-y-auto pb-[max(1rem,var(--mobile-content-inset-bottom,0px))] touch:pt-(--mobile-content-inset-top) text-sm text-ink-muted"
>
- <span>Notifications couldn’t be loaded.</span>
+ <span>Home couldn’t be loaded.</span>
<Button
variant="outline"
size="sm"
@@ -523,6 +558,7 @@ export function InboxList(props: InboxListProps) {
soupNavigationTouchHighlight(element);
}}
class="scrollbar-hidden min-h-0 flex-1 overflow-y-auto overscroll-none pb-[max(0.5rem,var(--mobile-content-inset-bottom,0px))]"
+ onScroll={checkNearEnd}
>
{/* The spacer scrolls away; the viewport stays behind the filters. */}
<div
@@ -538,11 +574,10 @@ export function InboxList(props: InboxListProps) {
isTouchDevice() ? (topSpacerSize.height ?? 0) : 0
}
bufferSize={500}
- itemSize={88}
+ itemSize={36}
keepMounted={
list.focus.index() >= 0 ? [list.focus.index()] : undefined
}
- onScroll={checkNearEnd}
>
{(row) => (
<Switch>
@@ -577,9 +612,14 @@ export function InboxList(props: InboxListProps) {
data-soup-entity
>
<div role="gridcell">
- <InboxListEntity
- class="mx-0 w-full border-b-[1px] border-thread-rail touch:border-b-0"
- cardClass="rounded-none px-4 py-3 mobile:pl-(--soup-row-padding-l)"
+ <HomeListEntity
+ channelName={channelName(entityRow().entity)}
+ timestamp={
+ state.tab === 'signal'
+ ? entityRow().entity.sortTs
+ : (entityRow().entity.notifiedAt ??
+ entityRow().entity.sortTs)
+ }
entity={entityRow().entity}
occurrenceKey={entityRow().id}
checked={list.selection.isSelected(
@@ -590,7 +630,6 @@ export function InboxList(props: InboxListProps) {
!isTouchDevice() &&
list.focus.key() === entityRow().id
}
- focusable={false}
entityRowConfig={{
swipeLeftColor: 'bg-success',
swipeLeftRevealedComponent: (
@@ -621,47 +660,6 @@ export function InboxList(props: InboxListProps) {
</SoupEntityContextMenu>
)}
</Match>
- <Match when={row.kind === 'load-more' ? row : undefined}>
- {(loadMore) => (
- <div id={loadMore().id} role="row">
- <div
- role="gridcell"
- aria-busy={loadMore().isLoading}
- class={cn(
- 'flex min-h-12 items-center justify-center',
- !isTouchDevice() &&
- list.focus.key() === loadMore().id &&
- 'bg-active/60'
- )}
- onClick={() =>
- list.activate.key(loadMore().id, {
- reason: 'pointer',
- })
- }
- >
- <Button
- variant="outline"
- size="sm"
- depth={2}
- disabled={loadMore().isLoading}
- class="bg-surface"
- >
- <Show
- when={!loadMore().isLoading}
- fallback={
- <SpinnerIcon class="size-3 animate-spin" />
- }
- >
- <CaretDownIcon class="size-2.5" />
- </Show>
- {loadMore().isLoading
- ? 'Loading...'
- : 'Load More'}
- </Button>
- </div>
- </div>
- )}
- </Match>
</Switch>
)}
</Virtualizer>
diff --git a/apps/web/src/features/inbox-view/components/InboxTabs.tsx b/apps/web/src/features/inbox-view/components/InboxTabs.tsx
index 7e0bbf793a..190f14bbbe 100644
--- a/apps/web/src/features/inbox-view/components/InboxTabs.tsx
+++ b/apps/web/src/features/inbox-view/components/InboxTabs.tsx
@@ -40,7 +40,7 @@ export function InboxTabs() {
fallback={
<div class="flex h-8 min-w-0 flex-1 items-center gap-3">
<Tabs
- aria-label="Notification views"
+ aria-label="Home views"
list={INBOX_TABS}
value={state.tab}
onChange={handleTabChange}
diff --git a/apps/web/src/features/inbox-view/components/home-press.test.tsx b/apps/web/src/features/inbox-view/components/home-press.test.tsx
new file mode 100644
index 0000000000..a4598f2a52
--- /dev/null
+++ b/apps/web/src/features/inbox-view/components/home-press.test.tsx
@@ -0,0 +1,83 @@
+import { SidebarCreateHeader } from '@app/components/view-shell/SidebarCreateButton';
+import { cleanup, fireEvent, render } from '@solidjs/testing-library';
+import type { JSX } from 'solid-js';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { HomeListEntity } from './HomeListEntity';
+
+vi.mock('@core/context/user', () => ({ useUserId: () => () => 'test-user' }));
+vi.mock('@core/user', () => ({
+ getDisplayName: () => 'Peter',
+ tryMacroId: (id: string) => id,
+}));
+vi.mock('@components/app/split-panel', () => ({
+ SplitPanel: { CloseButton: () => null },
+}));
+
+vi.mock('@entity', () => ({
+ Entity: { Title: () => 'Recent chat', Timestamp: () => 'now' },
+ MaybeEntityRow: (props: { children: JSX.Element }) => props.children,
+}));
+vi.mock('@entity/utils/filter', () => ({ unreadFilterFn: () => false }));
+vi.mock('./HomeEntityIcon', () => ({ HomeEntityIcon: () => null }));
+vi.mock('@ui', async () => ({
+ ...(await import('@app/components/ui/utils/press')),
+ cn: (...parts: unknown[]) => parts.filter(Boolean).join(' '),
+}));
+
+afterEach(cleanup);
+
+describe.each(['recent', 'new chat'] as const)('Home %s press', (kind) => {
+ function setup() {
+ const activate = vi.fn();
+ const view = render(() =>
+ kind === 'new chat' ? (
+ <SidebarCreateHeader
+ title="Home"
+ label="New chat"
+ onCreate={activate}
+ />
+ ) : (
+ <HomeListEntity
+ entity={{
+ type: 'chat',
+ id: 'recent-chat',
+ name: 'Recent chat',
+ ownerId: 'test-user',
+ }}
+ occurrenceKey="recent-chat"
+ onClick={activate}
+ />
+ )
+ );
+ const item = view.container.querySelector<HTMLElement>(
+ kind === 'new chat' ? 'button' : '[data-home-item]'
+ )!;
+ return { activate, item };
+ }
+
+ it('activates on primary press exactly once and preserves modifiers', () => {
+ const { activate, item } = setup();
+ fireEvent.mouseDown(item, { button: 0, detail: 1, ctrlKey: true });
+ expect(activate).toHaveBeenCalledTimes(1);
+ if (kind === 'recent') {
+ expect(activate.mock.calls[0][0].ctrlKey).toBe(true);
+ }
+ fireEvent.mouseUp(item, { button: 0, detail: 1 });
+ fireEvent.click(item, { button: 0, detail: 1 });
+ expect(activate).toHaveBeenCalledTimes(1);
+ });
+
+ it('supports keyboard and click-only activation', () => {
+ const { activate, item } = setup();
+ fireEvent.click(item, { button: 0, detail: 0 });
+ fireEvent.click(item, { button: 0, detail: 1 });
+ expect(activate).toHaveBeenCalledTimes(2);
+ });
+
+ it('ignores secondary presses', () => {
+ const { activate, item } = setup();
+ fireEvent.mouseDown(item, { button: 2 });
+ fireEvent.click(item, { button: 2 });
+ expect(activate).not.toHaveBeenCalled();
+ });
+});
diff --git a/apps/web/src/features/inbox-view/inbox-facets.ts b/apps/web/src/features/inbox-view/inbox-facets.ts
index b2a315f7c7..3a03e5ae18 100644
--- a/apps/web/src/features/inbox-view/inbox-facets.ts
+++ b/apps/web/src/features/inbox-view/inbox-facets.ts
@@ -4,7 +4,7 @@ import {
type FacetClause,
type FacetOption,
NIL_UUID,
-} from '@app/features/soup';
+} from '@app/features/soup/filters';
import {
type EntityData,
isGithubPrEntity,
diff --git a/apps/web/src/features/inbox-view/inbox-view-context.test.tsx b/apps/web/src/features/inbox-view/inbox-view-context.test.tsx
new file mode 100644
index 0000000000..546080a755
--- /dev/null
+++ b/apps/web/src/features/inbox-view/inbox-view-context.test.tsx
@@ -0,0 +1,135 @@
+import { cleanup, render } from '@solidjs/testing-library';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import {
+ type InboxViewContext,
+ InboxViewProvider,
+ useInboxView,
+} from './inbox-view-context';
+import { INBOX_ENTRY_STATE_KEY } from './persistence';
+import type { InboxViewStateOptions } from './types';
+
+const entry = vi.hoisted(() => ({
+ state: {} as Record<string, unknown>,
+ captors: new Map<string, () => unknown>(),
+}));
+
+vi.mock('@components/app/split-layout/layoutUtils', () => ({
+ useSplitPanelOrThrow: () => ({
+ handle: {
+ currentEntryState: () => entry.state,
+ registerEntryStateCaptor: (key: string, capture: () => unknown) => {
+ entry.captors.set(key, capture);
+ return () => entry.captors.delete(key);
+ },
+ },
+ }),
+}));
+
+function mountProvider(initialState?: InboxViewStateOptions) {
+ let context!: InboxViewContext;
+ function ReadContext() {
+ context = useInboxView();
+ return null;
+ }
+ const view = render(() => (
+ <InboxViewProvider initialState={initialState}>
+ <ReadContext />
+ </InboxViewProvider>
+ ));
+ return { ...view, context };
+}
+
+beforeEach(() => {
+ entry.state = {};
+ entry.captors.clear();
+});
+afterEach(cleanup);
+
+describe('InboxViewProvider initialization', () => {
+ it('honors all explicit fields instead of restoring the split entry', () => {
+ entry.state = { [INBOX_ENTRY_STATE_KEY]: { version: 1, tab: 'signal' } };
+ const initial: InboxViewStateOptions = {
+ tab: 'noise',
+ search: 'release notes',
+ groupBy: 'type',
+ facets: { type: ['email'], read: ['unread'] },
+ };
+
+ expect(mountProvider(initial).context.state).toEqual(initial);
+ });
+
+ it.each([
+ { tab: 'signal', groupBy: 'date' },
+ { tab: 'noise', groupBy: 'date' },
+ { tab: 'reminders', groupBy: 'none' },
+ ] as const)('defaults omitted fields for $tab', ({ tab, groupBy }) => {
+ expect(mountProvider({ tab }).context.state).toEqual({
+ tab,
+ groupBy,
+ search: '',
+ facets: {},
+ });
+ });
+
+ it('normalizes facet selections without mutating the caller', () => {
+ const facets = { type: ['email', 'channel', 'email'], read: [] };
+ const { context } = mountProvider({ facets });
+
+ expect(context.state.facets).toEqual({ type: ['channel', 'email'] });
+ expect(facets).toEqual({
+ type: ['email', 'channel', 'email'],
+ read: [],
+ });
+ });
+
+ it('preserves explicit empty values and grouping', () => {
+ entry.state = {
+ [INBOX_ENTRY_STATE_KEY]: {
+ version: 1,
+ tab: 'noise',
+ search: 'old search',
+ groupBy: 'type',
+ facets: { type: ['email'] },
+ },
+ };
+ expect(
+ mountProvider({ search: '', groupBy: 'none', facets: {} }).context.state
+ ).toEqual({ tab: 'signal', search: '', groupBy: 'none', facets: {} });
+ });
+
+ it('still resets restored entries to the unfiltered Signal defaults', () => {
+ entry.state = {
+ [INBOX_ENTRY_STATE_KEY]: {
+ version: 1,
+ tab: 'noise',
+ search: 'old search',
+ groupBy: 'type',
+ facets: { read: ['unread'] },
+ },
+ };
+
+ expect(mountProvider().context.state).toEqual({
+ tab: 'signal',
+ search: '',
+ groupBy: 'date',
+ facets: {},
+ });
+ });
+
+ it('keeps the persistence reset when returning from an explicitly initialized view', () => {
+ const view = mountProvider({ tab: 'noise', search: 'explicit search' });
+ view.context.setState('groupBy', 'type');
+ view.context.setFacets({ type: ['email'] });
+ const stored = entry.captors.get(INBOX_ENTRY_STATE_KEY)?.();
+ expect(stored).toEqual({ version: 1, tab: 'signal' });
+
+ view.unmount();
+ entry.state = { [INBOX_ENTRY_STATE_KEY]: stored };
+ expect(mountProvider().context.state).toEqual({
+ tab: 'signal',
+ search: '',
+ groupBy: 'date',
+ facets: {},
+ });
+ });
+});
diff --git a/apps/web/src/features/inbox-view/inbox-view.tsx b/apps/web/src/features/inbox-view/inbox-view.tsx
index 9f90c05653..032b6fbc87 100644
--- a/apps/web/src/features/inbox-view/inbox-view.tsx
+++ b/apps/web/src/features/inbox-view/inbox-view.tsx
@@ -5,11 +5,10 @@ import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
import { SplitPanel } from '@components/app/split-panel';
import { StaticMarkdownContext } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
-import EmptyStatePreviewIcon from '@design/empty-state-doc.svg';
import { type EntityData, ListEntityMetadataQueryProvider } from '@entity';
import SpinnerIcon from '@phosphor/spinner.svg';
-import { EmptyStatePanel } from '@ui';
import { createEffect, createSignal, onMount, Show, Suspense } from 'solid-js';
+import { HomeChatStart } from './components/HomeChatStart';
import { InboxListLayout } from './components/InboxHeader';
import { InboxList } from './components/InboxList';
import { InboxTabs } from './components/InboxTabs';
@@ -24,20 +23,18 @@ export type InboxViewProps = {
function InboxFallback() {
return (
<div class="grid min-h-0 min-w-0 flex-1 place-items-center text-ink-muted">
- <SpinnerIcon
- aria-label="Loading notifications"
- class="size-5 animate-spin"
- />
+ <SpinnerIcon aria-label="Loading Home" class="size-5 animate-spin" />
</div>
);
}
-function NotificationsListPane(props: {
+function HomeListPane(props: {
previewEntity: EntityData | undefined;
onPreviewEntityChange: (entity: EntityData | undefined) => void;
+ onNewChat: () => void;
}) {
return (
- <InboxListLayout tabs={<InboxTabs />}>
+ <InboxListLayout tabs={<InboxTabs />} onNewChat={props.onNewChat}>
<Suspense fallback={<InboxFallback />}>
<InboxList
previewEntity={props.previewEntity}
@@ -58,18 +55,16 @@ function InboxViewRoot() {
createEffect(() => {
const nextTab = state.tab;
if (nextTab === activeTab) return;
-
activeTab = nextTab;
setPreviewEntity(undefined);
});
createEffect(() => {
- if (state.tab !== 'reminders') return;
-
- setTab('signal');
+ if (state.tab === 'reminders') setTab('signal');
});
+ const newChat = () => setPreviewEntity(undefined);
- onMount(() => panel.handle.setDisplayName('Notifications'));
+ onMount(() => panel.handle.setDisplayName('Home'));
return (
<ListEntityMetadataQueryProvider>
@@ -82,8 +77,8 @@ function InboxViewRoot() {
<div class="size-full min-h-0 bg-panel">
<ViewShell.Root
aside={{
- width: 360,
- min: 300,
+ width: 256,
+ min: 224,
max: 420,
preserveDuringResize: false,
}}
@@ -93,21 +88,19 @@ function InboxViewRoot() {
resizable
>
<ViewShell.Aside class="flex flex-col bg-panel">
- <NotificationsListPane
+ <HomeListPane
previewEntity={previewEntity()}
onPreviewEntityChange={setPreviewEntity}
+ onNewChat={newChat}
/>
</ViewShell.Aside>
<ViewShell.Main class="overflow-hidden">
<Show
when={previewEntity()}
fallback={
- <EmptyStatePanel
- graphic={EmptyStatePreviewIcon}
- title="No content selected"
- description="Select an item from the connected list to preview it here"
- centered
- />
+ <Suspense fallback={<InboxFallback />}>
+ <HomeChatStart />
+ </Suspense>
}
>
{(entity) => (
@@ -127,9 +120,10 @@ function InboxViewRoot() {
>
<ViewShell.Root aside={false} main={{ min: 224 }}>
<ViewShell.Main>
- <NotificationsListPane
+ <HomeListPane
previewEntity={previewEntity()}
onPreviewEntityChange={setPreviewEntity}
+ onNewChat={newChat}
/>
</ViewShell.Main>
</ViewShell.Root>
diff --git a/apps/web/src/features/inbox-view/persistence.ts b/apps/web/src/features/inbox-view/persistence.ts
index 644761712e..6241957951 100644
--- a/apps/web/src/features/inbox-view/persistence.ts
+++ b/apps/web/src/features/inbox-view/persistence.ts
@@ -19,11 +19,6 @@ const inboxEntryStateSchemaWithDefaults = z.object({
type InboxEntryState = z.infer<typeof inboxEntryStateSchemaWithDefaults>;
-const DEFAULT_INBOX_ENTRY_STATE = {
- version: 1,
- tab: 'signal',
-} satisfies InboxEntryState;
-
const inboxListEntryStateSchemaWithDefaults = z.object({
version: z.literal(1).default(1),
focusKey: z.string().optional(),
@@ -50,10 +45,10 @@ export const DEFAULT_INBOX_LIST_STATE: InboxListStateSnapshot = {
scrollOffset: 0,
};
-function selectEntryState(state: InboxViewState): InboxEntryState {
+function selectEntryState(_state: InboxViewState): InboxEntryState {
return {
version: 1,
- tab: state.tab === 'reminders' ? 'signal' : state.tab,
+ tab: 'signal',
};
}
@@ -64,15 +59,12 @@ function createInboxEntryStorage(options: {
return createEntryPersistenceStorage({
handle: options.handle,
key: INBOX_ENTRY_STATE_KEY,
- restore: (current, stored) => {
+ restore: (current, _stored) => {
if (!options.restore) return undefined;
- const result = inboxEntryStateSchemaWithDefaults.safeParse(stored);
- const restored = result.success ? result.data : DEFAULT_INBOX_ENTRY_STATE;
-
return {
...current,
- tab: restored.tab,
+ tab: 'signal',
};
},
select: selectEntryState,
diff --git a/apps/web/src/features/inbox-view/queries/home-date-buckets.test.ts b/apps/web/src/features/inbox-view/queries/home-date-buckets.test.ts
new file mode 100644
index 0000000000..e75eb95dbd
--- /dev/null
+++ b/apps/web/src/features/inbox-view/queries/home-date-buckets.test.ts
@@ -0,0 +1,49 @@
+import { describe, expect, it } from 'vitest';
+import { homeDateBucket } from './home-date-buckets';
+
+const evening = new Date(2026, 8, 14, 20, 0);
+const todayAt = (hour: number, minute = 0) =>
+ new Date(2026, 8, 14, hour, minute);
+
+describe('Home time sections', () => {
+ it('excludes future timestamps from the recent-time sections', () => {
+ expect(homeDateBucket(new Date(evening.getTime() + 1), evening).key).toBe(
+ 'this-evening'
+ );
+ expect(homeDateBucket(todayAt(21), evening).key).toBe('this-evening');
+ });
+ it('includes the current time in Last few minutes', () => {
+ expect(homeDateBucket(evening, evening).key).toBe('last-few-minutes');
+ });
+ it('uses non-overlapping fine-grained sections throughout the day', () => {
+ expect(homeDateBucket(todayAt(19, 58), evening).label).toBe(
+ 'Last few minutes'
+ );
+ expect(homeDateBucket(todayAt(19, 55), evening).label).toBe('Last hour');
+ expect(homeDateBucket(todayAt(19), evening).label).toBe('This evening');
+ expect(homeDateBucket(todayAt(15), evening).label).toBe('This afternoon');
+ expect(homeDateBucket(todayAt(9), evening).label).toBe('This morning');
+ expect(homeDateBucket(todayAt(3), evening).label).toBe('Earlier today');
+ });
+ it('moves an unchanged item between groups as the clock advances', () => {
+ const item = todayAt(9);
+ expect(homeDateBucket(item, todayAt(9, 3)).key).toBe('last-few-minutes');
+ expect(homeDateBucket(item, todayAt(9, 15)).key).toBe('last-hour');
+ expect(homeDateBucket(item, todayAt(10)).key).toBe('this-morning');
+ });
+ it('uses Yesterday across midnight, even if fewer than five minutes elapsed', () => {
+ expect(
+ homeDateBucket(todayAt(23, 59), new Date(2026, 8, 15, 0, 1)).key
+ ).toBe('yesterday');
+ });
+ it('preserves older sections and handles absent or invalid timestamps', () => {
+ expect(homeDateBucket(new Date(2026, 8, 13, 10), evening).key).toBe(
+ 'yesterday'
+ );
+ expect(homeDateBucket(new Date(2026, 8, 11, 10), evening).key).toBe(
+ 'last-7-days'
+ );
+ expect(homeDateBucket(undefined, evening).key).toBe('older');
+ expect(homeDateBucket('bad date', evening).key).toBe('older');
+ });
+});
diff --git a/apps/web/src/features/inbox-view/queries/home-date-buckets.ts b/apps/web/src/features/inbox-view/queries/home-date-buckets.ts
new file mode 100644
index 0000000000..590cf64714
--- /dev/null
+++ b/apps/web/src/features/inbox-view/queries/home-date-buckets.ts
@@ -0,0 +1,22 @@
+import {
+ type DateBucket,
+ dateBucket,
+} from '@app/features/soup/collection/date-buckets';
+
+/** Fine-grained local-time sections for the live Home feed. */
+export function homeDateBucket(value: unknown, now = new Date()): DateBucket {
+ const day = dateBucket(value, now);
+ if (day.key !== 'today') return day;
+ const date =
+ value instanceof Date ? value : new Date(value as string | number);
+ const minutesAgo = (now.getTime() - date.getTime()) / 60_000;
+ if (minutesAgo >= 0 && minutesAgo < 5)
+ return { key: 'last-few-minutes', label: 'Last few minutes' };
+ if (minutesAgo >= 0 && minutesAgo < 60)
+ return { key: 'last-hour', label: 'Last hour' };
+ const hour = date.getHours();
+ if (hour >= 18) return { key: 'this-evening', label: 'This evening' };
+ if (hour >= 12) return { key: 'this-afternoon', label: 'This afternoon' };
+ if (hour >= 6) return { key: 'this-morning', label: 'This morning' };
+ return { key: 'earlier-today', label: 'Earlier today' };
+}
diff --git a/apps/web/src/features/inbox-view/queries/home-pagination.ts b/apps/web/src/features/inbox-view/queries/home-pagination.ts
new file mode 100644
index 0000000000..edcd0a15ea
--- /dev/null
+++ b/apps/web/src/features/inbox-view/queries/home-pagination.ts
@@ -0,0 +1,35 @@
+type HomePageSource = {
+ oldestFetchedTimestamp?: number;
+ hasMore: boolean;
+ isLoading: boolean;
+};
+
+function loadedThrough(source: HomePageSource): number {
+ if (source.isLoading) return Infinity;
+ if (!source.hasMore) return -Infinity;
+
+ return source.oldestFetchedTimestamp ?? Infinity;
+}
+
+/** Only expose the interval both descending feeds have loaded. Fetch the
+ * shallower feed next; the other feed's older rows stay buffered. */
+export function getHomePagination(
+ notifications: HomePageSource,
+ activity: HomePageSource
+) {
+ const notificationBoundary = loadedThrough(notifications);
+ const activityBoundary = loadedThrough(activity);
+
+ return {
+ // Keep boundary ties buffered too: unseen rows may share this timestamp.
+ cutoff: Math.max(notificationBoundary, activityBoundary),
+ loadNotifications:
+ notifications.hasMore &&
+ !notifications.isLoading &&
+ notificationBoundary >= activityBoundary,
+ loadActivity:
+ activity.hasMore &&
+ !activity.isLoading &&
+ activityBoundary >= notificationBoundary,
+ };
+}
diff --git a/apps/web/src/features/inbox-view/queries/inbox-query.ts b/apps/web/src/features/inbox-view/queries/inbox-query.ts
index 27a4bdaf8b..edb6620406 100644
--- a/apps/web/src/features/inbox-view/queries/inbox-query.ts
+++ b/apps/web/src/features/inbox-view/queries/inbox-query.ts
@@ -8,7 +8,7 @@ import {
mergeAst,
NIL_UUID,
type TargetExpr,
-} from '@app/features/soup';
+} from '@app/features/soup/filters';
import type { SoupAstBody, SoupAstItemsQueryArgs } from '@queries/soup/items';
import { startOfDay, subWeeks } from 'date-fns';
import { match } from 'ts-pattern';
diff --git a/apps/web/src/features/inbox-view/queries/inbox-results.test.ts b/apps/web/src/features/inbox-view/queries/inbox-results.test.ts
index 4b8719a28b..e2305976fa 100644
--- a/apps/web/src/features/inbox-view/queries/inbox-results.test.ts
+++ b/apps/web/src/features/inbox-view/queries/inbox-results.test.ts
@@ -1,7 +1,13 @@
import type { EntityData, WithNotification } from '@entity';
+import { soupPageTimestamp } from '@queries/soup/page-timestamp';
import { describe, expect, it, vi } from 'vitest';
+import { getHomePagination } from './home-pagination';
import { buildInboxQuery } from './inbox-query';
-import { groupInboxEntitiesByDate, inboxGroupTimestamp } from './inbox-results';
+import {
+ groupInboxEntitiesByDate,
+ inboxGroupTimestamp,
+ mergeHomeEntities,
+} from './inbox-results';
// The soup barrel these pull in transitively imports the websocket client
// modules, which open real sockets at module scope and reject under jsdom.
@@ -135,3 +141,312 @@ describe('inbox date buckets', () => {
]);
});
});
+
+describe('Home activity and notifications', () => {
+ const signal = { tab: 'signal' as const, capabilities };
+ const recent = (id: string, touchedAt: string) => ({
+ ...staleTaskFreshComment,
+ id,
+ notifiedAt: undefined,
+ // Someone else's later edit must not determine my recency.
+ updatedAt: '2026-09-03T12:00:00Z',
+ touchedAt,
+ });
+
+ it('includes own activity without notifications and sorts by own action time', () => {
+ const rows = mergeHomeEntities(
+ [staleTaskFreshComment],
+ [
+ recent('older', '2026-09-01T12:00:00Z'),
+ recent('newer', '2026-09-02T18:00:00Z'),
+ ],
+ signal
+ );
+ expect(rows.map((row) => row.id)).toEqual(['newer', 'task', 'older']);
+ expect(rows[2].sortTs).toBe('2026-09-01T12:00:00Z');
+ expect(
+ groupInboxEntitiesByDate(
+ rows,
+ signal,
+ now,
+ (entity) => entity.sortTs
+ ).map((group) => group.label)
+ ).toEqual(['Today', 'Yesterday']);
+ });
+
+ it('deduplicates an entity, retaining notifications and the latest relevant timestamp', () => {
+ const notifications = () => [];
+ const notified = { ...staleTaskFreshComment, notifications };
+ const rows = mergeHomeEntities(
+ [notified],
+ [recent('task', '2026-09-02T18:00:00Z')],
+ signal
+ );
+ expect(rows).toHaveLength(1);
+ expect(rows[0].notifications).toBe(notifications);
+ expect(rows[0].sortTs).toBe('2026-09-02T18:00:00Z');
+ expect(rows[0].notifiedAt).toBe(notified.notifiedAt);
+ expect(notified.sortTs).toBeUndefined();
+ expect(
+ mergeHomeEntities(
+ [notified],
+ [recent('task', '2026-09-01T12:00:00Z')],
+ signal
+ )[0].sortTs
+ ).toBe(notified.notifiedAt);
+ });
+
+ it('keeps sent mail and AI chats without requiring an unread notification', () => {
+ const sent = {
+ ...freshEmail,
+ done: true,
+ isRead: true,
+ touchedAt: '2026-09-02T18:00:00Z',
+ };
+ const chat = {
+ ...recent('chat', '2026-09-02T17:00:00Z'),
+ type: 'chat' as const,
+ };
+ expect(
+ mergeHomeEntities([], [sent, chat], signal).map((row) => row.type)
+ ).toEqual(['email', 'chat']);
+ });
+
+ it('keeps multiple reply threads separate from their parent channel and own activity', () => {
+ const channel: WithNotification<EntityData> = {
+ type: 'channel',
+ id: 'channel',
+ name: 'Support',
+ ownerId: 'alice',
+ channelType: 'public',
+ touchedAt: '2026-09-02T16:00:00Z',
+ };
+ const thread: WithNotification<EntityData> = {
+ type: 'channel_thread',
+ id: 'root-1',
+ name: 'Channel thread',
+ ownerId: 'alice',
+ channelId: channel.id,
+ messageId: 'root-1',
+ threadId: 'root-1',
+ senderId: 'alice',
+ sender: { id: 'alice', type: 'user' },
+ content: 'First discussion',
+ attachments: [],
+ reactions: [],
+ thread: { replyCount: 2, preview: [] },
+ notifiedAt: '2026-09-02T18:00:00Z',
+ notifications: () => [],
+ };
+ const secondThread = {
+ ...thread,
+ id: 'root-2',
+ messageId: 'root-2',
+ threadId: 'root-2',
+ notifiedAt: '2026-09-02T17:00:00Z',
+ };
+ const rows = mergeHomeEntities(
+ [thread, secondThread],
+ [channel, { ...thread, touchedAt: '2026-09-02T15:00:00Z' }],
+ signal
+ );
+ expect(rows.map(({ type, id }) => [type, id])).toEqual([
+ ['channel_thread', 'root-1'],
+ ['channel_thread', 'root-2'],
+ ['channel', 'channel'],
+ ]);
+ expect(rows[0].notifications).toBe(thread.notifications);
+ expect(rows[0].sortTs).toBe(thread.notifiedAt);
+ });
+
+ it('rejects cache inserts without a recorded own touch', () => {
+ expect(mergeHomeEntities([], [freshEmail], signal)).toEqual([]);
+ });
+
+ it('uses fresher content without losing notification metadata or own activity', () => {
+ const notifications = () => [];
+ const notified = { ...staleTaskFreshComment, notifications };
+ const edited = {
+ ...recent('task', '2026-09-01T12:00:00Z'),
+ name: 'Renamed',
+ };
+ const [row] = mergeHomeEntities([notified], [edited], signal);
+ expect(row.name).toBe('Renamed');
+ expect(row.updatedAt).toBe(edited.updatedAt);
+ expect(row.sortTs).toBe(notified.notifiedAt);
+ expect(row.notifications).toBe(notifications);
+ expect(row.touchedAt).toBe(edited.touchedAt);
+ expect(notified.name).toBe(staleTaskFreshComment.name);
+ expect(edited.sortTs).toBeUndefined();
+ });
+
+ it('keeps the freshest content and timestamps across overlapping pages', () => {
+ const newest = {
+ ...recent('task', '2026-09-02T18:00:00Z'),
+ name: 'Latest',
+ };
+ const older = {
+ ...recent('task', '2026-09-01T12:00:00Z'),
+ updatedAt: '2026-08-01T12:00:00Z',
+ };
+ for (const recents of [
+ [newest, older],
+ [older, newest],
+ ]) {
+ const [row] = mergeHomeEntities([staleTaskFreshComment], recents, signal);
+ expect(row.name).toBe('Latest');
+ expect(row.touchedAt).toBe(newest.touchedAt);
+ expect(row.notifiedAt).toBe(staleTaskFreshComment.notifiedAt);
+ expect(row.sortTs).toBe(newest.touchedAt);
+ }
+ });
+
+ it('keeps the latest notification across duplicate notification pages', () => {
+ const older = {
+ ...staleTaskFreshComment,
+ notifiedAt: '2026-08-01T12:00:00Z',
+ };
+ expect(
+ mergeHomeEntities([staleTaskFreshComment, older], [], signal)[0]
+ .notifiedAt
+ ).toBe(staleTaskFreshComment.notifiedAt);
+ });
+
+ it('orders timestamp ties by entity identity, independently of source order', () => {
+ const a = recent('a', '2026-09-02T18:00:00Z');
+ const b = recent('b', '2026-09-02T18:00:00Z');
+ expect(mergeHomeEntities([], [b, a], signal).map((row) => row.id)).toEqual([
+ 'a',
+ 'b',
+ ]);
+ expect(mergeHomeEntities([], [a, b], signal).map((row) => row.id)).toEqual([
+ 'a',
+ 'b',
+ ]);
+ });
+});
+
+describe('Home pagination', () => {
+ const signal = { tab: 'signal' as const, capabilities };
+ const entity = (id: string, day: number): EntityData => ({
+ type: 'chat',
+ id,
+ name: id,
+ ownerId: 'alice',
+ updatedAt: new Date(2026, 8, day),
+ notifiedAt: new Date(2026, 8, day),
+ touchedAt: new Date(2026, 8, day),
+ });
+ const page = (entities: EntityData[], hasMore = true, isLoading = false) => ({
+ entities,
+ hasMore,
+ isLoading,
+ get oldestFetchedTimestamp() {
+ return soupPageTimestamp(this.entities, 'touched_by_me');
+ },
+ });
+ const visible = (
+ notifications: ReturnType<typeof page>,
+ activity: ReturnType<typeof page>
+ ) => {
+ const { cutoff } = getHomePagination(notifications, activity);
+ return mergeHomeEntities(notifications.entities, activity.entities, signal)
+ .filter((row) => new Date(row.sortTs ?? 0).getTime() > cutoff)
+ .map((row) => row.id);
+ };
+
+ it('buffers older rows and advances only the shallower feed', () => {
+ const notifications = page([entity('n9', 9), entity('n1', 1)]);
+ const activity = page([entity('a10', 10), entity('a8', 8)]);
+ expect(visible(notifications, activity)).toEqual(['a10', 'n9']);
+ expect(getHomePagination(notifications, activity)).toMatchObject({
+ loadNotifications: false,
+ loadActivity: true,
+ });
+
+ activity.entities.push(entity('a7', 7), entity('a6', 6));
+ expect(visible(notifications, activity)).toEqual(['a10', 'n9', 'a8', 'a7']);
+ activity.hasMore = false;
+ expect(visible(notifications, activity)).toEqual([
+ 'a10',
+ 'n9',
+ 'a8',
+ 'a7',
+ 'a6',
+ ]);
+ expect(getHomePagination(notifications, activity)).toMatchObject({
+ loadNotifications: true,
+ loadActivity: false,
+ });
+ notifications.hasMore = false;
+ expect(visible(notifications, activity)).toEqual([
+ 'a10',
+ 'n9',
+ 'a8',
+ 'a7',
+ 'a6',
+ 'n1',
+ ]);
+ });
+
+ it('holds boundary ties until all rows at that timestamp are loaded', () => {
+ const notifications = page([entity('z', 9)]);
+ const activity = page([entity('b', 9)]);
+ expect(visible(notifications, activity)).toEqual([]);
+ expect(getHomePagination(notifications, activity)).toMatchObject({
+ loadNotifications: true,
+ loadActivity: true,
+ });
+ notifications.entities.push(entity('a', 9), entity('n8', 8));
+ activity.entities.push(entity('a8', 8));
+ expect(visible(notifications, activity)).toEqual(['a', 'b', 'z']);
+ });
+
+ it('waits for both initial pages before exposing rows', () => {
+ const notifications = page([entity('old', 1)], false);
+ const activity = page([], false, true);
+ expect(visible(notifications, activity)).toEqual([]);
+ activity.isLoading = false;
+ activity.entities = [entity('new', 10)];
+ expect(visible(notifications, activity)).toEqual(['new', 'old']);
+ });
+
+ it('advances empty pages and ignores unstamped optimistic inserts', () => {
+ const notifications = page([entity('n9', 9)]);
+ const activity = page([
+ { ...entity('unstamped', 1), touchedAt: undefined },
+ ]);
+ expect(visible(notifications, activity)).toEqual([]);
+ expect(getHomePagination(notifications, activity)).toMatchObject({
+ cutoff: Infinity,
+ loadActivity: true,
+ });
+ activity.entities = [];
+ expect(getHomePagination(notifications, activity).loadActivity).toBe(true);
+ });
+
+ it('releases the available source when the other source is exhausted or failed', () => {
+ expect(visible(page([], false), page([entity('a9', 9)], false))).toEqual([
+ 'a9',
+ ]);
+ });
+
+ it('uses content ordering when notification sorting is disabled', () => {
+ const notifications = page([
+ { ...entity('n', 9), updatedAt: new Date(2026, 8, 1) },
+ ]);
+ const activity = page([entity('a', 8)]);
+ expect(
+ getHomePagination(
+ {
+ ...notifications,
+ oldestFetchedTimestamp: soupPageTimestamp(
+ notifications.entities,
+ 'updated_at'
+ ),
+ },
+ activity
+ )
+ ).toMatchObject({ loadActivity: true, loadNotifications: false });
+ });
+});
diff --git a/apps/web/src/features/inbox-view/queries/inbox-results.ts b/apps/web/src/features/inbox-view/queries/inbox-results.ts
index 70f901035a..8df1465524 100644
--- a/apps/web/src/features/inbox-view/queries/inbox-results.ts
+++ b/apps/web/src/features/inbox-view/queries/inbox-results.ts
@@ -1,9 +1,13 @@
+import { dateBucket } from '@app/features/soup/collection/date-buckets';
import {
- dateBucket,
+ deduplicateItems,
groupSoupEntities,
- type SoupGroup,
-} from '@app/features/soup/collection';
-import type { EntityData, WithNotification } from '@entity';
+} from '@app/features/soup/collection/transforms';
+import type { SoupGroup } from '@app/features/soup/collection/types';
+import type { EntityWithRawNotifications } from '@app/features/soup/entity-notifications';
+import { compareDateDesc, type DateValue } from '@core/util/date';
+import type { EntityData } from '@entity';
+import { homeDateBucket } from './home-date-buckets';
import {
type InboxViewContext,
inboxTabOrdersByNotification,
@@ -27,15 +31,78 @@ export const inboxGroupTimestamp = (
(inboxTabOrdersByNotification(context) ? entity.notifiedAt : undefined) ??
inboxSortTimestamp(entity);
-export function groupInboxEntitiesByDate(
- entities: WithNotification<EntityData>[],
+export function groupInboxEntitiesByDate<T extends EntityData>(
+ entities: T[],
context: InboxOrderContext,
- now = new Date()
-): SoupGroup<WithNotification<EntityData>>[] {
+ now = new Date(),
+ getTimestamp: (entity: EntityData) => DateValue | null | undefined = (
+ entity
+ ) => inboxGroupTimestamp(entity, context)
+): SoupGroup<T>[] {
return groupSoupEntities(entities, {
- getGroupId: (entity) =>
- dateBucket(inboxGroupTimestamp(entity, context), now).key,
+ getGroupId: (entity) => dateBucket(getTimestamp(entity), now).key,
getGroupLabel: (_groupId, firstEntity) =>
- dateBucket(inboxGroupTimestamp(firstEntity, context), now).label,
+ dateBucket(getTimestamp(firstEntity), now).label,
+ });
+}
+
+const latestTimestamp = (
+ first: DateValue | null | undefined,
+ second: DateValue | null | undefined
+) => (compareDateDesc(first, second) <= 0 ? first : second);
+
+/** Content freshness and Home ordering are independent: keep the newest
+ * payload, both source stamps, and the notification source's metadata. */
+export function mergeHomeEntities(
+ notifications: EntityWithRawNotifications<EntityData>[],
+ recents: EntityWithRawNotifications<EntityData>[],
+ context: InboxOrderContext
+): EntityWithRawNotifications<EntityData>[] {
+ return deduplicateItems<EntityWithRawNotifications<EntityData>>(
+ [
+ ...notifications.map((entity) => ({
+ ...entity,
+ sortTs: inboxGroupTimestamp(entity, context),
+ })),
+ // Cache inserts from other users are not the viewer's own activity.
+ ...recents
+ .filter((entity) => entity.touchedAt)
+ .map((entity) => ({
+ ...entity,
+ sortTs: entity.touchedAt,
+ })),
+ ],
+ {
+ getKey: (entity) => `${entity.type}:${entity.id}`,
+ resolveConflict: (existing, incoming) => ({
+ ...(compareDateDesc(
+ incoming.updatedAt ?? incoming.createdAt,
+ existing.updatedAt ?? existing.createdAt
+ ) < 0
+ ? incoming
+ : existing),
+ notifications: existing.notifications ?? incoming.notifications,
+ notifiedAt: latestTimestamp(existing.notifiedAt, incoming.notifiedAt),
+ touchedAt: latestTimestamp(existing.touchedAt, incoming.touchedAt),
+ sortTs: latestTimestamp(existing.sortTs, incoming.sortTs),
+ }),
+ }
+ ).sort(
+ (a, b) =>
+ compareDateDesc(a.sortTs, b.sortTs) ||
+ a.type.localeCompare(b.type) ||
+ a.id.localeCompare(b.id)
+ );
+}
+
+/** Home uses its merged timestamp and finer intraday sections. */
+export function groupHomeEntitiesByDate<T extends EntityData>(
+ entities: T[],
+ now: Date
+): SoupGroup<T>[] {
+ return groupSoupEntities(entities, {
+ getGroupId: (entity) => homeDateBucket(entity.sortTs, now).key,
+ getGroupLabel: (_groupId, firstEntity) =>
+ homeDateBucket(firstEntity.sortTs, now).label,
});
}
diff --git a/apps/web/src/features/inbox-view/queries/use-inbox-query.test.ts b/apps/web/src/features/inbox-view/queries/use-inbox-query.test.ts
new file mode 100644
index 0000000000..bf80e0979e
--- /dev/null
+++ b/apps/web/src/features/inbox-view/queries/use-inbox-query.test.ts
@@ -0,0 +1,271 @@
+import type { EmailEntity, EntityData } from '@entity/types/entity';
+import type { SoupAstItemsQuery } from '@queries/soup/items';
+import { useSoupAstItemsQuery } from '@queries/soup/items';
+import { soupPageTimestamp } from '@queries/soup/page-timestamp';
+import { createRoot, createSignal } from 'solid-js';
+import { createStore } from 'solid-js/store';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import type { InboxViewState } from '../types';
+import { type InboxDataSource, useInboxDataSource } from './use-inbox-query';
+
+vi.mock('@app/features/soup', async () => ({
+ ...(await import('@app/features/soup/filters')),
+ ...(await import('@app/features/soup/collection/rows')),
+ useSearchContext: () => ({ entityPool: () => [] }),
+ createSearchState: () => ({
+ isSearching: () => false,
+ usesServiceSearch: () => false,
+ isSettling: () => false,
+ }),
+}));
+vi.mock('@app/lib/analytics/posthog', () => ({
+ useFeatureFlag: () => () => ({ enabled: true }),
+}));
+vi.mock('@components/app/GlobalAppState', () => ({
+ useGlobalNotificationSource: () => ({ notificationsByEntity: () => ({}) }),
+}));
+vi.mock('@core/context/user', () => ({ useUserId: () => () => 'alice' }));
+vi.mock('@queries/soup/items', () => ({ useSoupAstItemsQuery: vi.fn() }));
+vi.mock('@service-storage/websocket', () => ({
+ storageWS: { reconnectIfDisconnected: vi.fn() },
+ createWebSocketJob: vi.fn(),
+}));
+vi.mock('@service-connection/websocket', () => ({
+ ws: { addEventListener: vi.fn(), send: vi.fn() },
+ state: () => 'closed',
+ createConnectionBlockWebsocketEffect: vi.fn(),
+ createConnectionWebsocketEffect: vi.fn(),
+}));
+
+function email(id: string, day: number): EmailEntity {
+ const timestamp = new Date(2026, 8, day);
+ return {
+ type: 'email',
+ id,
+ name: id,
+ ownerId: 'alice',
+ isRead: false,
+ isDraft: false,
+ isImportant: true,
+ done: false,
+ updatedAt: timestamp,
+ notifiedAt: timestamp,
+ touchedAt: timestamp,
+ };
+}
+
+function makeQuery(initial: EntityData[], hasMore = true) {
+ const [entities, setEntities] = createSignal(initial);
+ const [more, setMore] = createSignal(hasMore);
+ const [oldestFetchedTimestamp, setOldestFetchedTimestamp] =
+ createSignal<number>();
+ const [loading, setLoading] = createSignal(false);
+ const [error, setError] = createSignal<Error | null>(null);
+ const fetchNextPage = vi.fn(async () => {});
+ const query: SoupAstItemsQuery = {
+ get data() {
+ if (loading()) throw new Error('Read pending query data');
+ return {
+ entities: entities(),
+ groups: undefined,
+ oldestFetchedTimestamp:
+ oldestFetchedTimestamp() ??
+ soupPageTimestamp(entities(), 'touched_by_me'),
+ };
+ },
+ get isLoading() {
+ return loading();
+ },
+ get hasNextPage() {
+ return more();
+ },
+ get error() {
+ return error();
+ },
+ isFetching: false,
+ isFetchingNextPage: false,
+ isPlaceholderData: false,
+ isEnabled: true,
+ transport: 'rest',
+ fetchNextPage,
+ refetch: vi.fn(async () => {}),
+ refresh: vi.fn(async () => {}),
+ resetToInitialPage: vi.fn(),
+ };
+ return {
+ query,
+ setEntities,
+ setMore,
+ setLoading,
+ setError,
+ fetchNextPage,
+ setOldestFetchedTimestamp,
+ };
+}
+
+let dispose: (() => void) | undefined;
+function mount(
+ notifications: ReturnType<typeof makeQuery>,
+ activity: ReturnType<typeof makeQuery>
+) {
+ vi.mocked(useSoupAstItemsQuery)
+ .mockReturnValueOnce(notifications.query)
+ .mockReturnValueOnce(activity.query);
+ return createRoot((cleanup) => {
+ dispose = cleanup;
+ const [state, setState] = createStore<InboxViewState>({
+ tab: 'signal',
+ search: '',
+ groupBy: 'none',
+ facets: {},
+ });
+ const source = useInboxDataSource(state);
+ return { source, setState };
+ });
+}
+const rows = (source: InboxDataSource) =>
+ source.items().flatMap((row) => (row.kind === 'entity' ? [row.entity] : []));
+const ids = (source: InboxDataSource) => rows(source).map((row) => row.id);
+
+describe('Home data source', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ vi.setSystemTime(new Date(2026, 8, 10, 12));
+ });
+ afterEach(() => {
+ dispose?.();
+ vi.useRealTimers();
+ });
+
+ it('does not treat older cache-only rows as fetched page coverage', async () => {
+ const notifications = makeQuery([email('n9', 9), email('n1', 1)]);
+ const activity = makeQuery([
+ email('a10', 10),
+ email('a8', 8),
+ email('cached', 2),
+ ]);
+ activity.setOldestFetchedTimestamp(new Date(2026, 8, 8).getTime());
+ const { source } = mount(notifications, activity);
+ expect(ids(source)).toEqual(['a10', 'n9']);
+ await source.loadMore();
+ expect(activity.fetchNextPage).toHaveBeenCalledOnce();
+ expect(notifications.fetchNextPage).not.toHaveBeenCalled();
+ });
+
+ it('pages the shallower source and appends history without moving existing rows', async () => {
+ const notifications = makeQuery([email('n9', 9), email('n1', 1)]);
+ const activity = makeQuery([email('a10', 10), email('a8', 8)]);
+ const { source } = mount(notifications, activity);
+ expect(ids(source)).toEqual(['a10', 'n9']);
+ await source.loadMore();
+ expect(activity.fetchNextPage).toHaveBeenCalledOnce();
+ expect(notifications.fetchNextPage).not.toHaveBeenCalled();
+
+ activity.setEntities((previous) => [
+ ...previous,
+ email('a7', 7),
+ email('a6', 6),
+ ]);
+ expect(ids(source)).toEqual(['a10', 'n9', 'a8', 'a7']);
+ activity.setMore(false);
+ expect(ids(source)).toEqual(['a10', 'n9', 'a8', 'a7', 'a6']);
+ await source.loadMore();
+ expect(notifications.fetchNextPage).toHaveBeenCalledOnce();
+ notifications.setMore(false);
+ expect(ids(source)).toEqual(['a10', 'n9', 'a8', 'a7', 'a6', 'n1']);
+ expect(source.hasMore()).toBe(false);
+ });
+
+ it('uses unfiltered page boundaries when a type facet hides a whole page', async () => {
+ const notifications = makeQuery([email('old', 1)], false);
+ const activity = makeQuery([
+ {
+ type: 'chat',
+ id: 'chat',
+ name: 'chat',
+ ownerId: 'alice',
+ touchedAt: new Date(2026, 8, 9),
+ },
+ ]);
+ const { source, setState } = mount(notifications, activity);
+ setState('facets', { type: ['email'] });
+ expect(ids(source)).toEqual([]);
+ expect(source.hasMore()).toBe(true);
+ await source.loadMore();
+ expect(activity.fetchNextPage).toHaveBeenCalledOnce();
+ activity.setEntities((previous) => [...previous, email('sent', 8)]);
+ activity.setMore(false);
+ expect(ids(source)).toEqual(['sent', 'old']);
+ });
+
+ it('waits for an initial page without reading its suspending data', () => {
+ const notifications = makeQuery([email('old', 1)], false);
+ const activity = makeQuery([], false);
+ activity.setLoading(true);
+ const { source } = mount(notifications, activity);
+ expect(ids(source)).toEqual([]);
+ expect(source.isLoading()).toBe(true);
+ activity.setEntities([email('new', 10)]);
+ activity.setLoading(false);
+ expect(ids(source)).toEqual(['new', 'old']);
+ });
+
+ it('retains usable rows and a retry warning when one source fails', async () => {
+ const notifications = makeQuery([email('old', 1)], false);
+ const activity = makeQuery([]);
+ activity.setError(new Error('Offline'));
+ const { source } = mount(notifications, activity);
+ expect(ids(source)).toEqual(['old']);
+ expect(source.error()).toBeUndefined();
+ expect(source.warning()).toBe('Recent activity could not be refreshed.');
+ await source.refresh();
+ expect(notifications.query.refresh).toHaveBeenCalledOnce();
+ expect(activity.query.refresh).toHaveBeenCalledOnce();
+ });
+
+ it('can continue a healthy source while its first rows are buffered and the other source failed', async () => {
+ const notifications = makeQuery([]);
+ notifications.setError(new Error('Offline'));
+ const activity = makeQuery([email('boundary', 9)]);
+ const { source } = mount(notifications, activity);
+ expect(ids(source)).toEqual([]);
+ expect(source.error()).toBeUndefined();
+ expect(source.warning()).toBe('Notifications could not be refreshed.');
+ expect(source.hasMore()).toBe(true);
+ await source.loadMore();
+ expect(activity.fetchNextPage).toHaveBeenCalledOnce();
+ expect(notifications.fetchNextPage).not.toHaveBeenCalled();
+ activity.setMore(false);
+ expect(ids(source)).toEqual(['boundary']);
+ });
+
+ it('keeps newer entity content, attaches a reactive notification accessor, and retains read rows', () => {
+ const notifications = makeQuery([email('same', 9)], false);
+ const activity = makeQuery(
+ [{ ...email('same', 10), name: 'Renamed', isRead: true }],
+ false
+ );
+ const { source, setState } = mount(notifications, activity);
+ expect(rows(source)[0].name).toBe('Renamed');
+ expect(rows(source)[0].notifications?.()).toEqual([]);
+ setState('facets', { read: ['unread'] });
+ expect(ids(source)).toEqual([]);
+ activity.setEntities([{ ...email('same', 10), name: 'Renamed' }]);
+ expect(ids(source)).toEqual(['same']);
+ activity.setEntities([
+ { ...email('same', 10), name: 'Renamed', isRead: true },
+ ]);
+ expect(ids(source)).toEqual(['same']);
+ });
+
+ it('does not buffer the Noise tab behind Home activity', async () => {
+ const notifications = makeQuery([email('n9', 9)]);
+ const activity = makeQuery([email('a10', 10)]);
+ const { source, setState } = mount(notifications, activity);
+ setState('tab', 'noise');
+ expect(ids(source)).toEqual(['n9']);
+ await source.loadMore();
+ expect(notifications.fetchNextPage).toHaveBeenCalledOnce();
+ expect(activity.fetchNextPage).not.toHaveBeenCalled();
+ });
+});
diff --git a/apps/web/src/features/inbox-view/queries/use-inbox-query.ts b/apps/web/src/features/inbox-view/queries/use-inbox-query.ts
index c63a22eed4..dd64e621b9 100644
--- a/apps/web/src/features/inbox-view/queries/use-inbox-query.ts
+++ b/apps/web/src/features/inbox-view/queries/use-inbox-query.ts
@@ -7,7 +7,10 @@ import {
testFacets,
useSearchContext,
} from '@app/features/soup';
-import { withEntityNotifications } from '@app/features/soup/entity-notifications';
+import {
+ getEntityNotifications,
+ withEntityNotifications,
+} from '@app/features/soup/entity-notifications';
import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { useGlobalNotificationSource } from '@components/app/GlobalAppState';
import {
@@ -27,30 +30,35 @@ import {
import type { NotificationSource } from '@notifications';
import { useSoupAstItemsQuery } from '@queries/soup/items';
import { startOfDay, subWeeks } from 'date-fns';
-import { createMemo } from 'solid-js';
+import { createMemo, createSignal, onCleanup, onMount } from 'solid-js';
import { match } from 'ts-pattern';
import {
noiseFilter,
signalFilter,
} from '../../next-soup/filters/inbox-filters';
-import {
- notDoneFilter,
- scheduledRemindersFilter,
-} from '../../next-soup/filters/predicates';
+import { scheduledRemindersFilter } from '../../next-soup/filters/predicates';
import { INBOX_FACETS, type InboxFacetContext } from '../inbox-facets';
import type { InboxTab, InboxViewState } from '../types';
+import { getHomePagination } from './home-pagination';
import { soupItemMatchesInboxTab } from './inbox-item-filter';
import {
buildInboxQuery,
type InboxQueryCapabilities,
type InboxViewContext,
} from './inbox-query';
-import { groupInboxEntitiesByDate, inboxSortTimestamp } from './inbox-results';
+import {
+ groupHomeEntitiesByDate,
+ groupInboxEntitiesByDate,
+ inboxSortTimestamp,
+ mergeHomeEntities,
+} from './inbox-results';
import { buildInboxSearchRequest } from './inbox-search';
export type InboxDataSourceItem = SoupRow<WithNotification<EntityData>>;
-export type InboxDataSource = ListDataSource<InboxDataSourceItem>;
+export type InboxDataSource = ListDataSource<InboxDataSourceItem> & {
+ warning: () => string | undefined;
+};
export type InboxDataSourceInput = Pick<
InboxViewState,
@@ -74,9 +82,15 @@ function matchesTab(
tab: InboxTab,
source: NotificationSource
): boolean {
+ const notDone = () =>
+ entity.type === 'email'
+ ? !entity.done
+ : getEntityNotifications(entity, source, {
+ scopeChannelThreads: true,
+ }).some((notification) => notification.state !== 'done');
return match(tab)
.with('signal', () => {
- if (!signalFilter(entity) || !notDoneFilter(source)(entity)) return false;
+ if (!signalFilter(entity) || !notDone()) return false;
if (
entity.type !== 'document' &&
@@ -92,7 +106,7 @@ function matchesTab(
subWeeks(startOfDay(new Date()), 2).getTime()
);
})
- .with('noise', () => noiseFilter(entity) && notDoneFilter(source)(entity))
+ .with('noise', () => noiseFilter(entity) && notDone())
.with('reminders', () => scheduledRemindersFilter(entity))
.exhaustive();
}
@@ -143,33 +157,83 @@ export function useInboxEntitiesQuery(
};
});
- const transformEntities = (entities: EntityData[]) => {
+ const filterEntities = (entities: EntityData[]) => {
const context = viewContext();
return entities
.filter((entity) => matchesCapabilities(entity, context.capabilities))
- .map((entity) =>
- withEntityNotifications(entity, notificationSource, {
- scopeChannelThreads: true,
- })
- )
.filter((entity) => matchesTab(entity, context.tab, notificationSource));
};
- return { query, viewContext, transformEntities };
+ const attachNotifications = (entity: EntityData) =>
+ withEntityNotifications(entity, notificationSource, {
+ scopeChannelThreads: true,
+ });
+ const transformEntities = (entities: EntityData[]) =>
+ filterEntities(entities).map(attachNotifications);
+
+ return {
+ query,
+ viewContext,
+ filterEntities,
+ attachNotifications,
+ transformEntities,
+ notificationSource,
+ };
}
export function useInboxDataSource(
state: InboxDataSourceInput
): InboxDataSource {
- const { query, viewContext, transformEntities } =
- useInboxEntitiesQuery(state);
+ const {
+ query,
+ viewContext,
+ filterEntities,
+ attachNotifications,
+ transformEntities,
+ } = useInboxEntitiesQuery(state);
+
+ const [now, setNow] = createSignal(new Date());
+ onMount(() => {
+ const timer = setInterval(() => setNow(new Date()), 30_000);
+ onCleanup(() => clearInterval(timer));
+ });
+
+ // Activity's hydrated own-touch projection includes sent mail and chats even
+ // when they have no outstanding notifications. Its endpoint rejects email
+ // and channel filter trees, so Home applies its facets after merging.
+ const recentQuery = useSoupAstItemsQuery(
+ () => ({
+ params: {
+ expand: true,
+ limit: 100,
+ sort_method: 'touched_by_me',
+ sort_direction: 'desc',
+ },
+ body: {},
+ }),
+ () => ({ enabled: state.tab === 'signal' })
+ );
+ const recentEntities = () =>
+ state.tab === 'signal' && !recentQuery.isLoading
+ ? (recentQuery.data?.entities ?? [])
+ : [];
+ const transformHomeEntities = (entities: EntityData[], recents = entities) =>
+ state.tab === 'signal'
+ ? mergeHomeEntities(
+ filterEntities(entities),
+ recents.filter((entity) =>
+ matchesCapabilities(entity, viewContext().capabilities)
+ ),
+ viewContext()
+ ).map(attachNotifications)
+ : transformEntities(entities);
const { entityPool } = useSearchContext();
const localPool = createMemo(() => {
if (!state.search.trim()) return [];
const pool = entityPool();
const matchingIds = new Set(
- transformEntities(pool.map((item) => item.data)).map(
+ transformHomeEntities(pool.map((item) => item.data)).map(
(entity) => entity.id
)
);
@@ -184,9 +248,8 @@ export function useInboxDataSource(
const rawEntities = createMemo<EntityData[]>((previous) => {
if (!search.isSearching()) {
- if (query.isLoading) return previous;
-
- return query.data?.entities ?? [];
+ const notifications = query.isLoading ? [] : (query.data?.entities ?? []);
+ return notifications;
}
const results = search.data();
@@ -200,6 +263,26 @@ export function useInboxDataSource(
return results;
}, []);
+ const homePagination = createMemo(() => {
+ if (state.tab !== 'signal' || search.isSearching()) return undefined;
+ return getHomePagination(
+ {
+ oldestFetchedTimestamp: query.isLoading
+ ? undefined
+ : query.data?.oldestFetchedTimestamp,
+ hasMore: query.hasNextPage && !query.error,
+ isLoading: query.isLoading,
+ },
+ {
+ oldestFetchedTimestamp: recentQuery.isLoading
+ ? undefined
+ : recentQuery.data?.oldestFetchedTimestamp,
+ hasMore: recentQuery.hasNextPage && !recentQuery.error,
+ isLoading: recentQuery.isLoading,
+ }
+ );
+ });
+
// Keep rows admitted after they transition from unread to read. Changing the
// tab or read filter starts a new admission scope.
const entities = createMemo<{
@@ -209,7 +292,14 @@ export function useInboxDataSource(
}>(
(previous) => {
const context = viewContext();
- const transformed = transformEntities(rawEntities());
+ const transformed = transformHomeEntities(
+ rawEntities(),
+ search.isSearching() ? rawEntities() : recentEntities()
+ ).filter(
+ (entity) =>
+ new Date(entity.sortTs ?? 0).getTime() >
+ (homePagination()?.cutoff ?? -Infinity)
+ );
const activeReadFacets = context.facets.read ?? [];
const readScope = `${context.tab}:${activeReadFacets.join(',')}`;
const admittedIds =
@@ -253,19 +343,27 @@ export function useInboxDataSource(
const hasMore = () => {
if (usesServiceSearch()) return search.hasNextPage();
- return query.hasNextPage;
+ return (
+ (query.hasNextPage && !query.error) ||
+ (state.tab === 'signal' && recentQuery.hasNextPage && !recentQuery.error)
+ );
};
const isLoadingMore = () => {
if (usesServiceSearch()) return search.isFetchingNextPage();
- return query.isFetchingNextPage;
+ return (
+ query.isFetchingNextPage ||
+ (state.tab === 'signal' && recentQuery.isFetchingNextPage)
+ );
};
const items = createMemo<InboxDataSourceItem[]>(() => {
let result: InboxDataSourceItem[];
if (state.groupBy === 'date' && !search.isSearching()) {
result = buildGroupedSoupRows(
- groupInboxEntitiesByDate(entities().items, viewContext())
+ state.tab === 'signal'
+ ? groupHomeEntitiesByDate(entities().items, now())
+ : groupInboxEntitiesByDate(entities().items, viewContext())
);
} else {
result = buildFlatSoupRows(entities().items);
@@ -276,7 +374,11 @@ export function useInboxDataSource(
const isLoading = () => {
if (!search.isSearching()) {
- return query.isLoading && rawEntities().length === 0;
+ return (
+ (query.isLoading ||
+ (state.tab === 'signal' && recentQuery.isLoading)) &&
+ entities().items.length === 0
+ );
}
if (entities().items.length > 0) return false;
if (usesServiceSearch()) return search.isLoading();
@@ -288,12 +390,28 @@ export function useInboxDataSource(
isLoading,
isFetching: () => {
if (search.isSettling()) return true;
- return usesServiceSearch() ? search.isFetching() : query.isFetching;
+ return usesServiceSearch()
+ ? search.isFetching()
+ : query.isFetching ||
+ (state.tab === 'signal' && recentQuery.isFetching);
},
error: () => {
- if (!usesServiceSearch()) return query.error ?? undefined;
+ if (!usesServiceSearch())
+ return entities().items.length === 0 && !hasMore()
+ ? (query.error ??
+ (state.tab === 'signal' ? recentQuery.error : undefined) ??
+ undefined)
+ : undefined;
return search.error();
},
+ warning: () => {
+ if (usesServiceSearch() || (entities().items.length === 0 && !hasMore()))
+ return undefined;
+ if (query.error) return 'Notifications could not be refreshed.';
+ if (state.tab === 'signal' && recentQuery.error)
+ return 'Recent activity could not be refreshed.';
+ return undefined;
+ },
hasMore,
isLoadingMore,
loadMore: async () => {
@@ -301,14 +419,30 @@ export function useInboxDataSource(
await search.fetchNextPage();
return;
}
- await query.fetchNextPage();
+ const pagination = homePagination();
+ await Promise.all([
+ query.hasNextPage &&
+ !query.error &&
+ (pagination?.loadNotifications ?? true)
+ ? query.fetchNextPage()
+ : undefined,
+ state.tab === 'signal' &&
+ recentQuery.hasNextPage &&
+ !recentQuery.error &&
+ (pagination?.loadActivity ?? true)
+ ? recentQuery.fetchNextPage()
+ : undefined,
+ ]);
},
refresh: async () => {
if (usesServiceSearch()) {
await search.refetch();
return;
}
- await query.refresh();
+ await Promise.all([
+ query.refresh(),
+ state.tab === 'signal' ? recentQuery.refresh() : undefined,
+ ]);
},
} satisfies InboxDataSource;
}
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 f6d32a0e33..f7c59a50dd 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
@@ -7,6 +7,7 @@ import {
type BaseListEntityProps,
InboxDivider,
} from '@entity/composed/list-entity/shared';
+import { getChannelThreadName } from '@entity/utils/channel-thread-name';
import { cn } from '@ui';
import { createMemo, Show } from 'solid-js';
import { InboxCardLayout, toInboxCardDisplayItem } from './inbox-card-layouts';
@@ -31,13 +32,13 @@ type InboxListEntityProps = BaseListEntityProps & {
export function InboxListEntity(props: InboxListEntityProps) {
const channels = useChannelsContext();
- // A channel_thread soup entity comes back with a generic name ("Channel
- // thread"), so resolve the real channel name for the row's location label.
const entity = createMemo(() => {
const scoped = scopeThreadNotifications(props.entity);
if (scoped.type !== 'channel_thread') return scoped;
- const name = channels.channelsById()[scoped.channelId]?.name;
- return name ? { ...scoped, name } : scoped;
+ return {
+ ...scoped,
+ name: getChannelThreadName(scoped, channels.channelsById()),
+ };
});
const item = createMemo(() => toInboxCardDisplayItem(entity()));
diff --git a/apps/web/src/features/property/tags/SidebarTagsSection.tsx b/apps/web/src/features/property/tags/SidebarTagsSection.tsx
index 679ff52c61..2bef1feeb0 100644
--- a/apps/web/src/features/property/tags/SidebarTagsSection.tsx
+++ b/apps/web/src/features/property/tags/SidebarTagsSection.tsx
@@ -85,12 +85,9 @@ export function SidebarTagsSection(props: SidebarTagsSectionProps) {
props.onNavigate?.();
}}
>
- <span
- aria-hidden="true"
- class="flex size-4 shrink-0 items-center justify-center"
- >
+ <ViewSidebar.Icon>
<TagDot color={tag.color} />
- </span>
+ </ViewSidebar.Icon>
<span class="truncate">{tag.label}</span>
</ViewSidebar.Item>
)}
diff --git a/apps/web/src/features/sharing/ios-share-sheet/IosShareSheet.tsx b/apps/web/src/features/sharing/ios-share-sheet/IosShareSheet.tsx
index e59d363549..e0a7adcf76 100644
--- a/apps/web/src/features/sharing/ios-share-sheet/IosShareSheet.tsx
+++ b/apps/web/src/features/sharing/ios-share-sheet/IosShareSheet.tsx
@@ -434,47 +434,45 @@ function IosShareSheetComposer(props: {
onDragEnd={() => inputState.setIsDraggedOver(false)}
>
<Input.Layout>
- <Input.DropOverlay />
- <Input.FormatRibbon>
- <FormatButtons
- selectionState={() => markdownEditor.selection}
- onInlineFormat={(format) =>
- applyInlineFormat(markdownEditor.lexical, format)
- }
- onNodeFormat={(format) =>
- applyNodeFormat(markdownEditor.lexical, format)
- }
- />
- </Input.FormatRibbon>
- <Input.EditorShell
- ref={setScrollContainer}
- onClick={(event) => {
- if (!isMobile()) {
- event.stopPropagation();
- markdownEditor.controls.focus();
- }
- }}
- >
- <Input.Editor>
- <MarkdownShell
- config={markdownEditor}
- placeholder={inputState.view().placeholder}
- initialValue={inputState.view().value}
- autofocus={false}
- class="text-sm"
+ <Input.Layout.Body>
+ <Input.DropOverlay />
+ <Input.FormatRibbon>
+ <FormatButtons
+ selectionState={() => markdownEditor.selection}
+ onInlineFormat={(format) =>
+ applyInlineFormat(markdownEditor.lexical, format)
+ }
+ onNodeFormat={(format) =>
+ applyNodeFormat(markdownEditor.lexical, format)
+ }
/>
- </Input.Editor>
- </Input.EditorShell>
- <Input.Attachments kind="media" />
- <Input.Attachments kind="document" />
- <Input.Footer>
- <Input.Actions>
- <Input.Actions.Left>
- <Input.AttachNativeMediaAction />
- <Input.ToggleFormatAction />
- </Input.Actions.Left>
- </Input.Actions>
- </Input.Footer>
+ </Input.FormatRibbon>
+ <Input.Layout.Editor
+ ref={setScrollContainer}
+ onClick={(event) => {
+ if (!isMobile()) {
+ event.stopPropagation();
+ markdownEditor.controls.focus();
+ }
+ }}
+ >
+ <Input.Editor>
+ <MarkdownShell
+ config={markdownEditor}
+ placeholder={inputState.view().placeholder}
+ initialValue={inputState.view().value}
+ autofocus={false}
+ class="text-sm"
+ />
+ </Input.Editor>
+ </Input.Layout.Editor>
+ <Input.Attachments kind="media" />
+ <Input.Attachments kind="document" />
+ </Input.Layout.Body>
+ <Input.Layout.ActionsLeft>
+ <Input.AttachNativeMediaAction />
+ <Input.ToggleFormatAction />
+ </Input.Layout.ActionsLeft>
</Input.Layout>
</Input.DropZone>
</ChannelInputContainer>
diff --git a/apps/web/src/features/soup/entity-notifications.ts b/apps/web/src/features/soup/entity-notifications.ts
index 35b9865426..d29c244aaa 100644
--- a/apps/web/src/features/soup/entity-notifications.ts
+++ b/apps/web/src/features/soup/entity-notifications.ts
@@ -83,19 +83,19 @@ export function scopeChannelNotificationsForEntity(
return notifications;
}
-type EntityWithRawNotifications<T extends EntityData> = T & {
+export type EntityWithRawNotifications<T extends EntityData> = T & {
notifications?: UnifiedNotification[] | Accessor<UnifiedNotification[]>;
};
/**
- * Normalizes GraphQL notification arrays and the global notification source
- * into the accessor shape expected by reusable list-entity components.
+ * Reads attached GraphQL notifications or the global source with the same
+ * channel-thread scoping for membership checks and rendered rows.
*/
-export function withEntityNotifications<T extends EntityData>(
+export function getEntityNotifications<T extends EntityData>(
entity: EntityWithRawNotifications<T>,
source: NotificationSource,
options: { scopeChannelThreads?: boolean } = {}
-): WithNotification<T> {
+): UnifiedNotification[] {
const attached = entity.notifications;
const read = (): UnifiedNotification[] => {
if (typeof attached === 'function') return attached();
@@ -106,16 +106,23 @@ export function withEntityNotifications<T extends EntityData>(
] ?? []
);
};
+ const notifications = read();
+ return options.scopeChannelThreads &&
+ (entity.type === 'channel' ||
+ entity.type === 'channel_message' ||
+ entity.type === 'channel_thread')
+ ? scopeChannelNotificationsForEntity(entity, notifications)
+ : notifications;
+}
+
+/** Attach the reactive accessor expected by reusable list-entity components. */
+export function withEntityNotifications<T extends EntityData>(
+ entity: EntityWithRawNotifications<T>,
+ source: NotificationSource,
+ options: { scopeChannelThreads?: boolean } = {}
+): WithNotification<T> {
return {
...entity,
- notifications: () => {
- const notifications = read();
- return options.scopeChannelThreads &&
- (entity.type === 'channel' ||
- entity.type === 'channel_message' ||
- entity.type === 'channel_thread')
- ? scopeChannelNotificationsForEntity(entity, notifications)
- : notifications;
- },
+ notifications: () => getEntityNotifications(entity, source, options),
};
}
diff --git a/apps/web/src/features/tasks-view/components/TasksSidebar.tsx b/apps/web/src/features/tasks-view/components/TasksSidebar.tsx
index 616f98b186..9b4ca103de 100644
--- a/apps/web/src/features/tasks-view/components/TasksSidebar.tsx
+++ b/apps/web/src/features/tasks-view/components/TasksSidebar.tsx
@@ -3,6 +3,7 @@ import {
useViewTabHotkeys,
ViewSidebar,
} from '@app/components/view-shell';
+import { SidebarCreateHeader } from '@app/components/view-shell/SidebarCreateButton';
import { FavoriteContextMenu } from '@app/features/favorites/FavoriteContextMenu';
import { FavoriteIcon } from '@app/features/favorites/FavoriteIcon';
import {
@@ -11,15 +12,12 @@ import {
} from '@app/util/favorites';
import { useSplitLayout } from '@components/app/split-layout/layout';
import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
-import { SplitPanel } from '@components/app/split-panel';
import CheckSquareIcon from '@phosphor/check-square.svg';
import ListChecksIcon from '@phosphor/list-checks.svg';
import NoteIcon from '@phosphor/note-pencil.svg';
-import PlusIcon from '@phosphor/plus.svg';
import { SidebarTagsSection } from '@property/tags/SidebarTagsSection';
import { useFavoritesData } from '@queries/favorites/favorites';
import type { Favorite } from '@service-storage/generated/schemas/favorite';
-import { Button } from '@ui';
import { createMemo, For, Show } from 'solid-js';
import { Dynamic } from 'solid-js/web';
import { useTasksView } from '../tasks-view-context';
@@ -40,17 +38,14 @@ export function TasksNavigation(props: { onNavigate?: () => void }) {
{(item) => (
<ViewSidebar.Item
active={state.tab === item.id}
- class="font-normal"
onClick={() => {
setTab(item.id);
props.onNavigate?.();
}}
>
- <Dynamic
- component={item.icon}
- aria-hidden="true"
- class="size-4 shrink-0"
- />
+ <ViewSidebar.Icon>
+ <Dynamic component={item.icon} class="size-4" />
+ </ViewSidebar.Icon>
<span class="truncate">{item.label}</span>
</ViewSidebar.Item>
)}
@@ -68,13 +63,12 @@ function FavoriteRow(props: {
return (
<FavoriteContextMenu favorite={props.favorite} triggerClass="block">
<ViewSidebar.Item
- class="font-normal"
title={name()}
onClick={(event) => props.onOpen(props.favorite, name(), event)}
>
- <span class="flex size-4 shrink-0 items-center justify-center">
+ <ViewSidebar.Icon>
<FavoriteIcon favorite={props.favorite} class="size-4" />
- </span>
+ </ViewSidebar.Icon>
<span class="truncate">{name()}</span>
</ViewSidebar.Item>
</FavoriteContextMenu>
@@ -165,30 +159,16 @@ export function TasksSidebar() {
return (
<ViewSidebar.Root aria-label="Tasks navigation" class="gap-4 bg-panel">
- <ViewSidebar.Header>
- <div class="flex min-w-0 items-center gap-1">
- <SplitPanel.CloseButton />
- <ViewSidebar.Title>Tasks</ViewSidebar.Title>
- </div>
- </ViewSidebar.Header>
+ <SidebarCreateHeader
+ title="Tasks"
+ label="New task"
+ onCreate={() =>
+ layout.popoverSplit({ type: 'component', id: 'task-compose' })
+ }
+ />
<ViewSidebar.Content class="flex flex-col gap-6">
- <div class="flex shrink-0 flex-col gap-6">
- <Button
- type="button"
- variant="ghost"
- depth={2}
- class="h-10 shrink-0 justify-start gap-3 rounded-xl bg-surface px-3"
- onClick={() =>
- layout.popoverSplit({ type: 'component', id: 'task-compose' })
- }
- >
- <PlusIcon class="size-4 shrink-0" />
- New task
- </Button>
-
- <TasksNavigation />
- </div>
+ <TasksNavigation />
<TaskFavorites
open={isSidebarSectionOpen('favorites')}
diff --git a/apps/web/src/index.css b/apps/web/src/index.css
index 378c61431d..9d8ba2f9f6 100644
--- a/apps/web/src/index.css
+++ b/apps/web/src/index.css
@@ -241,6 +241,12 @@ body.tauri-ios {
}
@theme {
+ /* Reading sizes at a 16px root; rem units preserve accessibility scaling. */
+ --text-base: 0.9375rem;
+ --text-base--line-height: calc(1.5 / 0.9375);
+ --text-sm: 0.875rem;
+ --text-sm--line-height: calc(1.25 / 0.875);
+
/* Disable default tailwind color palette */
--color-*: initial;
@@ -293,16 +299,19 @@ body.tauri-ios {
--color-panel: var(--theme-panel, var(--color-surface-1));
--color-dialog: var(--color-surface-2);
--color-menu: var(--color-surface-2);
- /* Menu surface for glassed floating chrome (menus, popovers, cmd+k, the
- channel input): the menu color with a hint of see-through, mirroring the
- site hero bar's `--b1 86%`. Pair `bg-menu-glass` with a `glass-*` utility
- so a backdrop blur sits behind the translucency. */
+ /* Touch surfaces keep their translucent fill; desktop overrides it below
+ while retaining the shared glass rim and shadow. */
--color-menu-glass: color-mix(in oklch, var(--color-menu) 88%, transparent);
--color-tooltip: var(--color-surface-2);
--color-toast: var(--color-surface-2);
--color-input: transparent;
--color-input-focus: var(--color-surface-1);
--color-message: var(--color-surface-1);
+ --color-composer: var(--color-surface-2);
+ --color-composer-ink: var(--color-ink);
+ --color-composer-placeholder: var(--color-ink-placeholder);
+ --color-composer-action: var(--color-ink);
+ --color-composer-action-ink: var(--color-panel);
--color-code-buffer: color-mix(in srgb, var(--color-surface-0) 60%, var(--color-surface-1));
--color-hover: color-mix(in oklch, var(--color-content-0) 3%, transparent);
--color-active: color-mix(in oklch, var(--color-content-0) 6%, transparent);
@@ -531,6 +540,10 @@ html[data-touch-device='true'] {
-webkit-tap-highlight-color: initial;
}
+html:not([data-touch-device="true"]) {
+ --color-menu-glass: var(--color-menu);
+}
+
@custom-variant mobile {
&:where(html[data-touch-device="true"] *) {
@media (max-width: 639px) {
@@ -566,6 +579,7 @@ html[data-theme-light='false'] {
[data-theme-light='true'] {
--color-avatar-edge: oklch(1 0 0 / 0.4);
+ --color-composer: var(--color-surface-4);
}
/* Floating "island" chrome shared by the mobile dock buttons, header islands,
@@ -627,6 +641,9 @@ html[data-theme-light='false'] {
which Chrome ignores: the glass loses its blur in production builds while
still looking right in dev. */
--glass-backdrop: blur(var(--glass-blur)) saturate(var(--glass-saturate));
+ &:where(html:not([data-touch-device="true"]) *) {
+ --glass-backdrop: none;
+ }
--glass-shadow:
inset 0 1px 0 color-mix(in oklch, var(--glass-tint) calc(var(--glass-highlight-base) * var(--glass-scale)), transparent),
inset 0 -1px 0 color-mix(in oklch, var(--glass-shade-color) calc(var(--glass-shade-base) * var(--glass-scale)), transparent),
@@ -908,7 +925,7 @@ html[data-touch-device='true'] :is(
}
body {
- @apply overflow-clip overscroll-none relative m-0 p-0 font-sans optical-auto;
+ @apply overflow-clip overscroll-none relative m-0 p-0 font-sans text-base optical-auto;
font-feature-settings: "dlig" 1, "calt" 1;
background-color: var(--color-surface);
-webkit-font-smoothing: antialiased;
@@ -1235,7 +1252,7 @@ a {
/* Shared text-field styling so inputs look the same across every settings tab.
Apply to an <input>; pair with a width utility (e.g. `w-full`) as needed. */
@utility settings-input {
- @apply h-9 px-3 rounded-lg border border-edge-muted bg-transparent text-sm text-ink outline-none transition-colors;
+ @apply h-9 px-3 rounded-lg border border-edge-muted bg-transparent text-base text-ink outline-none transition-colors;
/* Matches the composer/chat placeholder token so hint text reads the same
faintness everywhere, rather than settings sitting more prominent. */
&::placeholder {
@@ -1377,17 +1394,6 @@ a {
/** isolate the app-root stacking context from the kobalte dialog and modal stacking context */
#root { isolation: isolate; }
-/* On mobile (width and touch) bump tailwind's font-sizes up 1px. */
-/* Purposefully only changing the "reading" sizes, not the heading sizes. */
-@media (max-width: 639px) {
- :root:where(html[data-touch-device="true"]) {
- --text-base: 1.0625rem;
- --text-xxs: 0.6875rem;
- --text-xs: 0.8125rem;
- --text-sm: 0.9375rem;
- }
-}
-
@media (min-width: 640px) {
:root {
--thread-shift: 40px;
diff --git a/apps/web/src/lib/core/comments/Inputs.tsx b/apps/web/src/lib/core/comments/Inputs.tsx
index 41dd99f2eb..7ad61d8c7c 100644
--- a/apps/web/src/lib/core/comments/Inputs.tsx
+++ b/apps/web/src/lib/core/comments/Inputs.tsx
@@ -1,10 +1,8 @@
import { MarkdownTextarea } from '@core/component/LexicalMarkdown/component/core/MarkdownTextarea';
import type { ItemMention } from '@core/component/LexicalMarkdown/plugins/mentions/mentionsPlugin';
-import { isTouchDevice } from '@core/mobile/isTouchDevice';
import XIcon from '@phosphor/x.svg';
-import { Button, ComposerSurface, SendButton } from '@ui';
+import { Button, SendButton } from '@ui';
import { batch, createEffect, createSignal, Show, useContext } from 'solid-js';
-import { Dynamic } from 'solid-js/web';
import { CommentsContext, ThreadContext } from './Thread';
function EditBottomRow(props: {
@@ -102,8 +100,7 @@ export function EditInput(props: {
};
return (
- <Dynamic
- component={isTouchDevice() ? 'div' : ComposerSurface}
+ <div
class="relative h-auto px-4 pt-2 pb-11 touch:px-3 touch:pb-12"
on:click={(e) => {
e.stopPropagation();
@@ -112,7 +109,7 @@ export function EditInput(props: {
>
<MarkdownTextarea
autoLinkMatchMode="common-tlds"
- class="text-sm wrap-break-word text-ink"
+ class="text-base wrap-break-word text-ink"
editable={() => true}
onChange={(value) => {
setEditState(value);
@@ -140,7 +137,7 @@ export function EditInput(props: {
hasContent={editState().trim().length > 0}
isSending={isSending()}
/>
- </Dynamic>
+ </div>
);
}
@@ -160,7 +157,7 @@ export function NewReplyInput(props: {
when={props.isEditing}
fallback={
<div
- class="cursor-default p-2 text-sm text-ink-placeholder"
+ class="cursor-default p-2 text-base text-ink-placeholder"
on:click={(e) => {
e.stopPropagation();
props.setEditing(true);
diff --git a/apps/web/src/lib/core/comments/MessageTopRow.tsx b/apps/web/src/lib/core/comments/MessageTopRow.tsx
index ec00898607..9a64f263f2 100644
--- a/apps/web/src/lib/core/comments/MessageTopRow.tsx
+++ b/apps/web/src/lib/core/comments/MessageTopRow.tsx
@@ -69,12 +69,8 @@ function MessageRowUI(
'mb-3': !props.hideBottomMargin,
}}
>
- <div
- class={cn(
- 'flex items-center w-full flex-row gap-2 group-hover:truncate',
- props.isActive && 'truncate'
- )}
- >
+ {/* Hover must not change the height used to position margin threads. */}
+ <div class="flex min-w-0 flex-1 items-center gap-2">
{!props.hideBubble && (
<div
class={cn(
@@ -91,11 +87,11 @@ function MessageRowUI(
/>
</div>
)}
- <div class="text-xs touch:text-sm text-ink truncate grow">
+ <div class="min-w-0 flex-1 text-xs touch:text-sm text-ink truncate">
{displayName()}
</div>
<Show when={props.date}>
- <div class="text-xs touch:text-sm text-ink-placeholder">
+ <div class="shrink-0 whitespace-nowrap text-xs touch:text-sm text-ink-placeholder">
{formatDate(props.date)}
</div>
</Show>
@@ -103,7 +99,7 @@ function MessageRowUI(
<Show when={props.children}>
<div
class={cn(
- 'items-center flex self-center group-hover:opacity-100',
+ 'items-center flex shrink-0 self-center group-hover:opacity-100',
props.actionsVisible || (isMobileWidth() && props.isActive)
? 'opacity-100'
: 'opacity-0'
diff --git a/apps/web/src/lib/core/comments/Thread.tsx b/apps/web/src/lib/core/comments/Thread.tsx
index 6d774f5eaf..ea38557d6b 100644
--- a/apps/web/src/lib/core/comments/Thread.tsx
+++ b/apps/web/src/lib/core/comments/Thread.tsx
@@ -39,7 +39,7 @@ type SetText = {
};
export const baseCommentTheme = createTheme({
- root: 'text-sm',
+ root: 'text-base',
text: {
base: 'select-text',
},
diff --git a/apps/web/src/lib/core/comments/discussion/DiscussionInput.test.tsx b/apps/web/src/lib/core/comments/discussion/DiscussionInput.test.tsx
index 88321daf34..04adc902c1 100644
--- a/apps/web/src/lib/core/comments/discussion/DiscussionInput.test.tsx
+++ b/apps/web/src/lib/core/comments/discussion/DiscussionInput.test.tsx
@@ -23,6 +23,9 @@ vi.mock('@core/mobile/nativePhotoLibrary', () => ({
vi.mock('@core/util/platform', () => ({
isPlatform: (platform: string) => platform === 'ios' && editor.isIOS,
}));
+vi.mock('@core/component/LexicalMarkdown/utils/create-has-line-breaks', () => ({
+ createHasLineBreaks: () => () => false,
+}));
vi.mock('@channel/Input/ActionButton', () => ({}));
vi.mock('@channel/Input/context', () => ({}));
vi.mock('@channel/Input/FormatButtons', () => ({ FormatButtons: () => null }));
@@ -44,10 +47,13 @@ vi.mock('@channel/Input/Input', () => {
return {
Input: {
Root: Slot,
- Layout: Slot,
- EditorShell: Slot,
+ Layout: Object.assign(Slot, {
+ Body: Slot,
+ Editor: Slot,
+ ActionsLeft: Slot,
+ ActionsRight: Slot,
+ }),
Editor: Slot,
- Footer: Slot,
FormatRibbon: () => null,
},
};
diff --git a/apps/web/src/lib/core/comments/discussion/DiscussionInput.tsx b/apps/web/src/lib/core/comments/discussion/DiscussionInput.tsx
index 7cbe95256e..fbc9fb22cb 100644
--- a/apps/web/src/lib/core/comments/discussion/DiscussionInput.tsx
+++ b/apps/web/src/lib/core/comments/discussion/DiscussionInput.tsx
@@ -14,14 +14,16 @@ import {
applyInlineFormat,
applyNodeFormat,
} from '@channel/Input/utils/formatting';
-import { MarkdownShell } from '@core/component/LexicalMarkdown/builder/MarkdownShell';
+import { ComposerEditor } from '@core/component/LexicalMarkdown/component/ComposerEditor';
import { StaticMarkdown } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';
import type { ItemMention } from '@core/component/LexicalMarkdown/plugins';
import { addMediaFromFile } from '@core/component/LexicalMarkdown/plugins/media';
import { singleLineMarkdownTheme } from '@core/component/LexicalMarkdown/theme';
+import { createHasLineBreaks } from '@core/component/LexicalMarkdown/utils/create-has-line-breaks';
import { isMobile } from '@core/mobile/isMobile';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
import type { IUser } from '@core/user/types';
-import PaperclipIcon from '@phosphor-icons/core/regular/paperclip.svg?component-solid';
+import PaperclipIcon from '@phosphor/paperclip.svg';
import { isIOS } from '@solid-primitives/platform';
import { CollapsedInput, ComposerSurface } from '@ui';
import {
@@ -85,18 +87,20 @@ function AttachImagesAction() {
function DefaultActions(props: { input: InputData; isSending: boolean }) {
return (
- <Input.Actions>
- <Input.Actions.Left>
+ <>
+ <Input.Layout.ActionsLeft>
<AttachImagesAction />
- <Input.ToggleFormatAction />
+ <Show when={isTouchDevice()}>
+ <Input.ToggleFormatAction />
+ </Show>
<Show when={isReplyInput(props.input)}>
<Input.CloseReplyAction />
</Show>
- </Input.Actions.Left>
- <Input.Actions.Right>
+ </Input.Layout.ActionsLeft>
+ <Input.Layout.ActionsRight>
<Input.SendAction tooltip="Send comment" disabled={props.isSending} />
- </Input.Actions.Right>
- </Input.Actions>
+ </Input.Layout.ActionsRight>
+ </>
);
}
@@ -152,6 +156,7 @@ export function DiscussionInput(props: DiscussionInputProps) {
// Build the editor handle immediately to ensure lexical is available for commands
markdownEditor.buildHandle();
+ const hasLineBreaks = createHasLineBreaks(markdownEditor.lexical);
const commands = {
send: async () => {
@@ -280,45 +285,49 @@ export function DiscussionInput(props: DiscussionInputProps) {
collapsedInput.collapse();
}}
>
- <Input.Layout>
- <Input.FormatRibbon>
- <FormatButtons
- selectionState={() => markdownEditor.selection}
- onInlineFormat={(format) =>
- applyInlineFormat(markdownEditor.lexical, format)
- }
- onNodeFormat={(format) =>
- applyNodeFormat(markdownEditor.lexical, format)
- }
- />
- </Input.FormatRibbon>
- <Input.EditorShell
- ref={setScrollContainer}
- onClick={(event) => {
- if (!isMobile()) {
- event.stopPropagation();
- markdownEditor.controls.focus();
- }
- }}
- >
- <Input.Editor>
- <MarkdownShell
- config={markdownEditor}
- placeholder={inputView().placeholder}
- initialValue={inputView().value}
- autofocus={!isMobile() && (props.autofocus ?? true)}
- class="text-sm"
+ <Input.Layout
+ oneLineInput={
+ !isTouchDevice() && !showFormatRibbon() && !hasLineBreaks()
+ }
+ >
+ <Input.Layout.Body>
+ <Input.FormatRibbon>
+ <FormatButtons
+ selectionState={() => markdownEditor.selection}
+ onInlineFormat={(format) =>
+ applyInlineFormat(markdownEditor.lexical, format)
+ }
+ onNodeFormat={(format) =>
+ applyNodeFormat(markdownEditor.lexical, format)
+ }
/>
- </Input.Editor>
- </Input.EditorShell>
- <Input.Footer>
- <Switch>
- <Match when={props.children}>{props.children}</Match>
- <Match when>
- <DefaultActions input={inputView()} isSending={isSending()} />
- </Match>
- </Switch>
- </Input.Footer>
+ </Input.FormatRibbon>
+ <Input.Layout.Editor
+ ref={setScrollContainer}
+ onClick={(event) => {
+ if (!isMobile()) {
+ event.stopPropagation();
+ markdownEditor.controls.focus();
+ }
+ }}
+ >
+ <Input.Editor>
+ <ComposerEditor
+ config={markdownEditor}
+ placeholder={inputView().placeholder}
+ initialValue={inputView().value}
+ autofocus={!isMobile() && (props.autofocus ?? true)}
+ class="text-base"
+ />
+ </Input.Editor>
+ </Input.Layout.Editor>
+ </Input.Layout.Body>
+ <Switch>
+ <Match when={props.children}>{props.children}</Match>
+ <Match when>
+ <DefaultActions input={inputView()} isSending={isSending()} />
+ </Match>
+ </Switch>
</Input.Layout>
</ComposerSurface>
</Input.Root>
diff --git a/apps/web/src/lib/core/component/AI/component/ProviderIcon.tsx b/apps/web/src/lib/core/component/AI/component/ProviderIcon.tsx
index 000789cf34..1764bc78a7 100644
--- a/apps/web/src/lib/core/component/AI/component/ProviderIcon.tsx
+++ b/apps/web/src/lib/core/component/AI/component/ProviderIcon.tsx
@@ -49,9 +49,7 @@ export function ProviderIcon(props: {
data-ai-provider={provider()}
>
<Show when={provider()}>
- {(name) => (
- <Dynamic component={icons[name()]} class="size-full text-ink" />
- )}
+ {(name) => <Dynamic component={icons[name()]} class="size-full" />}
</Show>
</span>
);
diff --git a/apps/web/src/lib/core/component/AI/component/input/ChatInput.model.test.tsx b/apps/web/src/lib/core/component/AI/component/input/ChatInput.model.test.tsx
index f5e4e9a8e6..b1e9dbe701 100644
--- a/apps/web/src/lib/core/component/AI/component/input/ChatInput.model.test.tsx
+++ b/apps/web/src/lib/core/component/AI/component/input/ChatInput.model.test.tsx
@@ -108,6 +108,9 @@ vi.mock('@service-cognition/client', () => ({
vi.mock('@app/lib/analytics/analytics-context', () => ({
useAnalytics: () => ({ track: vi.fn() }),
}));
+vi.mock('@core/component/LexicalMarkdown/utils/create-has-line-breaks', () => ({
+ createHasLineBreaks: () => () => false,
+}));
vi.mock('@core/auth/license', () => ({ useHasPaidAccess: () => () => true }));
vi.mock('@core/component/AI/signal/attachment', () => ({
useAttachments: () => ({ attached: () => [], setAttached: vi.fn() }),
@@ -175,6 +178,7 @@ vi.mock('@ui', async () => {
it('preserves a real soup composer selection when creating and opening its first chat', async () => {
mocks.mobile = true;
const editor = {
+ buildHandle: () => ({ lexical: {} }),
withFilePaste: () => editor,
onEnter: () => editor,
onEscape: () => editor,
@@ -280,6 +284,7 @@ it.each([true, false])(
mocks.mobile = mobile;
const onSend = vi.fn();
const editor = {
+ buildHandle: () => ({ lexical: {} }),
withFilePaste: () => editor,
onEnter: () => editor,
onEscape: () => editor,
diff --git a/apps/web/src/lib/core/component/AI/component/input/ChatInput.test.tsx b/apps/web/src/lib/core/component/AI/component/input/ChatInput.test.tsx
index 0af0a8e691..5d61528f72 100644
--- a/apps/web/src/lib/core/component/AI/component/input/ChatInput.test.tsx
+++ b/apps/web/src/lib/core/component/AI/component/input/ChatInput.test.tsx
@@ -8,6 +8,7 @@ const mocks = vi.hoisted(() => ({
touch: true,
emitChange: undefined as ((value: string) => void) | undefined,
root: undefined as HTMLDivElement | undefined,
+ upload: vi.fn(),
mount: vi.fn(),
unmount: vi.fn(),
}));
@@ -15,8 +16,12 @@ const mocks = vi.hoisted(() => ({
vi.mock('@app/lib/analytics/analytics-context', () => ({
useAnalytics: () => ({ track: vi.fn() }),
}));
+vi.mock('@core/component/LexicalMarkdown/utils/create-has-line-breaks', () => ({
+ createHasLineBreaks: () => () => true,
+}));
vi.mock('@core/auth/license', () => ({ useHasPaidAccess: () => () => false }));
vi.mock('@core/component/AI/constant', () => ({
+ SUPPORTED_ATTACHMENT_EXTENSIONS: ['pdf', 'png'],
Model: { test: 'test' },
modelsForPlan: () => ['test'],
defaultModelForPlan: () => 'test',
@@ -26,7 +31,11 @@ vi.mock('@core/component/AI/context', () => ({
model: () => 'test',
setModel: vi.fn(),
isGenerating: () => false,
- uploadQueue: { popComplete: () => [], uploading: () => [] },
+ uploadQueue: {
+ popComplete: () => [],
+ uploading: () => [],
+ upload: mocks.upload,
+ },
attachments: { attached: () => [], setAttached: vi.fn() },
}),
}));
@@ -110,6 +119,7 @@ function setup(collapseOnBlur = true) {
const draft = 'First line\nSecond line of the unsent prompt';
const onSend = vi.fn();
const editor = {
+ buildHandle: () => ({ lexical: {} }),
withFilePaste: () => editor,
onEnter: () => editor,
onEscape: () => editor,
@@ -197,3 +207,20 @@ describe('compact mobile chat drafts', () => {
expect(wrapper.classList.contains('max-h-5')).toBe(false);
});
});
+
+it('opens the desktop file picker directly and uploads the selected files', () => {
+ mocks.touch = false;
+ setup();
+ const click = vi.spyOn(HTMLInputElement.prototype, 'click');
+ fireEvent.click(screen.getByRole('button', { name: 'Attach files' }));
+ expect(click).toHaveBeenCalledOnce();
+ click.mockRestore();
+ expect(
+ screen.queryByRole('textbox', { name: 'Search attachments' })
+ ).toBeNull();
+ const picker =
+ document.querySelector<HTMLInputElement>('input[type="file"]')!;
+ const file = new File(['pdf'], 'report.pdf', { type: 'application/pdf' });
+ fireEvent.change(picker, { target: { files: [file] } });
+ expect(mocks.upload).toHaveBeenCalledExactlyOnceWith([file]);
+});
diff --git a/apps/web/src/lib/core/component/AI/component/input/ChatInput.tsx b/apps/web/src/lib/core/component/AI/component/input/ChatInput.tsx
index 3d5b9c8f68..aae6d3658c 100644
--- a/apps/web/src/lib/core/component/AI/component/input/ChatInput.tsx
+++ b/apps/web/src/lib/core/component/AI/component/input/ChatInput.tsx
@@ -6,13 +6,15 @@ import {
defaultModelForPlan,
Model,
modelsForPlan,
+ SUPPORTED_ATTACHMENT_EXTENSIONS,
} from '@core/component/AI/constant';
import { useChatInputContext } from '@core/component/AI/context';
import type { ToolSet } from '@core/component/AI/types';
import { isImageAttachment } from '@core/component/AI/util/attachment';
import { insertChatAttachmentMention } from '@core/component/AI/util/chatAttachmentMention';
import type { EditorConfigBuilder } from '@core/component/LexicalMarkdown/builder/MarkdownConfigBuilder';
-import { MarkdownShell } from '@core/component/LexicalMarkdown/builder/MarkdownShell';
+import { ComposerEditor } from '@core/component/LexicalMarkdown/component/ComposerEditor';
+import { createHasLineBreaks } from '@core/component/LexicalMarkdown/utils/create-has-line-breaks';
import { toast } from '@core/component/Toast/Toast';
import { fileTypeToBlockName } from '@core/constant/allBlocks';
import { PaywallKey, usePaywallState } from '@core/constant/PaywallState';
@@ -51,6 +53,8 @@ type ChatInputProps = {
type ChatInputComponentProps = {
variant?: 'default' | 'tall';
+ class?: string;
+ placeholder?: string;
/** Keep an unfocused mobile accessory to one line without unmounting its editor. */
collapseOnBlur?: boolean;
editor: EditorConfigBuilder;
@@ -93,6 +97,7 @@ export function ChatInput(props: ChatInputComponentProps) {
});
let containerRef!: HTMLDivElement;
+ let fileInputRef: HTMLInputElement | undefined;
useTouchOutsideToDismissKeyboard(() => containerRef);
// The model selector lives inside the input, directly left of the send
@@ -122,7 +127,10 @@ export function ChatInput(props: ChatInputComponentProps) {
// the right-hand controls (whose width changes with the selector's state).
const [rightControlsEl, setRightControlsEl] = createSignal<HTMLElement>();
const rightControlsSize = createElementSize(rightControlsEl);
- const rightControlsInset = () => (rightControlsSize.width ?? 44) + 10;
+ const rightControlsInset = () =>
+ isTouchDevice()
+ ? (rightControlsSize.width ?? 44) + 10
+ : (rightControlsSize.width ?? 41.25) + 9.375;
const toolsetSignal = createSignal<ToolSet>({ type: 'all' });
const { hasConsent, requestConsent, ConsentDialog } = useAiDataConsentGate();
@@ -168,6 +176,7 @@ export function ChatInput(props: ChatInputComponentProps) {
if (isCollapsed()) return false;
// Access markdownText to create reactive dependency
const text = markdownText();
+ if (hasLineBreaks()) return true;
if (text.trim().length === 0) return false;
if (!mdRef) return false;
return mdRef.scrollHeight > LINE_HEIGHT_THRESHOLD;
@@ -219,6 +228,8 @@ export function ChatInput(props: ChatInputComponentProps) {
props.onChange?.(md);
});
+ const hasLineBreaks = createHasLineBreaks(props.editor.buildHandle().lexical);
+
const hasAttachments = () =>
attachments.attached().some(isImageAttachment) ||
uploadQueue.uploading().length > 0;
@@ -227,11 +238,14 @@ export function ChatInput(props: ChatInputComponentProps) {
<Button
ref={setAttachMenuAnchorRef}
variant="ghost"
- size="icon-sm"
- class="text-ink rounded-full size-7 touch:size-6"
+ size="icon-composer"
+ class="rounded-full text-ink not-touch:text-composer-ink touch:size-6"
label="Attach files"
aria-label="Attach files"
- onClick={() => setShowAttachMenu((prev) => !prev)}
+ onClick={() => {
+ if (isTouchDevice()) setShowAttachMenu((prev) => !prev);
+ else fileInputRef?.click();
+ }}
>
<Show when={isTouchDevice()} fallback={<PaperclipIcon />}>
<PlusIcon />
@@ -242,23 +256,24 @@ export function ChatInput(props: ChatInputComponentProps) {
const StopButton = () => (
<Button
variant={isTouchDevice() ? 'ghost' : 'strong'}
- size="icon-sm"
+ size="icon-composer"
label="Stop generating"
hotkey={TOKENS.chat.stop}
onClick={() => props.onStop?.()}
class={cn(
- 'rounded-full size-7 touch:size-7.5 [&_svg]:stroke-[4px]',
+ 'rounded-full touch:size-7.5 [&_svg]:stroke-[4px]',
isTouchDevice() &&
'text-ink-extra-muted not-disabled:bg-ink/5 not-disabled:hover:bg-ink/10',
'data-disabled:opacity-100 data-disabled:text-ink-extra-muted data-disabled:bg-ink-muted/5'
)}
>
- <div class="size-3.5 rounded-sm bg-current" />
+ <div class="size-3.5 not-touch:size-[13.125px] rounded-sm bg-current" />
</Button>
);
const SendButton = () => (
<UiSendButton
+ appearance="composer"
tooltip={'Ask AI'}
shortcut="enter"
tooltipPlacement="top"
@@ -269,7 +284,10 @@ export function ChatInput(props: ChatInputComponentProps) {
);
const RightControls = () => (
- <div ref={setRightControlsEl} class="flex shrink-0 items-center gap-1">
+ <div
+ ref={setRightControlsEl}
+ class="flex shrink-0 items-center gap-1 not-touch:gap-[3.75px]"
+ >
<ModelSelector
selectedModel={model()}
models={modelOptions()}
@@ -315,13 +333,35 @@ export function ChatInput(props: ChatInputComponentProps) {
return (
<div class="relative">
+ <Show when={!isTouchDevice()}>
+ <input
+ ref={fileInputRef}
+ type="file"
+ class="hidden"
+ multiple
+ accept={SUPPORTED_ATTACHMENT_EXTENSIONS.map((ext) => `.${ext}`).join(
+ ','
+ )}
+ onChange={(event) => {
+ const files = Array.from(event.currentTarget.files ?? []).filter(
+ (file) =>
+ SUPPORTED_ATTACHMENT_EXTENSIONS.includes(
+ file.name.split('.').pop()?.toLowerCase() ?? ''
+ )
+ );
+ event.currentTarget.value = '';
+ if (files.length > 0) uploadQueue.upload(files);
+ }}
+ />
+ </Show>
<ComposerSurface
class={cn(
'h-auto',
!isMultiline() &&
!hasAttachments() &&
!isTallVariant() &&
- 'touch:rounded-full'
+ 'touch:rounded-full',
+ props.class
)}
>
<div
@@ -362,12 +402,18 @@ export function ChatInput(props: ChatInputComponentProps) {
</Show>
<div
+ data-chat-input-layout=""
ref={setLineEl}
- class={cn('relative px-2 py-1.5 touch:min-h-12.5 touch:py-[9px]', {
- 'flex flex-col px-2 py-2 touch:p-0': isTallVariant(),
- 'touch:h-(--mobile-chrome-button-size) touch:min-h-0 touch:py-0 touch:flex touch:items-center':
- isCompactMobile(),
- })}
+ class={cn(
+ 'relative px-[7.5px] touch:px-2 touch:min-h-12.5 touch:py-[9px]',
+ {
+ 'flex flex-col pt-[11.25px] pb-[7.5px] touch:p-0':
+ isTallVariant(),
+ 'not-touch:min-h-[48.75px] py-[12.1875px]': !isTallVariant(),
+ 'touch:h-(--mobile-chrome-button-size) touch:min-h-0 touch:py-0 touch:flex touch:items-center':
+ isCompactMobile(),
+ }
+ )}
>
{/* Invisible reference of the fully-expanded control row laid out
inline (paperclip + min editor room + full selector + send). Its
@@ -378,9 +424,9 @@ export function ChatInput(props: ChatInputComponentProps) {
ref={setProbeEl}
aria-hidden="true"
inert
- class="pointer-events-none invisible absolute flex w-max items-center gap-1"
+ class="pointer-events-none invisible absolute flex w-max items-center gap-1 not-touch:gap-[3.75px]"
>
- <div class="size-7 shrink-0" />
+ <div class="size-7 not-touch:size-[33.75px] shrink-0" />
<div
class="shrink-0"
style={{ width: `${MIN_EDITOR_WIDTH}px` }}
@@ -390,19 +436,19 @@ export function ChatInput(props: ChatInputComponentProps) {
models={modelOptions()}
onSelect={() => {}}
/>
- <div class="size-7 shrink-0" />
+ <div class="size-7 not-touch:size-[33.75px] shrink-0" />
</div>
</Show>
<div
id={CHAT_INPUT_TEXT_AREA_ID}
class={cn(
- 'text-sm text-ink touch:px-3 touch:py-2',
+ 'text-base text-ink touch:px-3 touch:py-2 not-touch:leading-[24.375px] not-touch:text-composer-ink',
isCompactMobile() && 'w-full touch:py-0',
- !isTouchDevice() && (isMultiline() || isTallVariant()) && 'pl-2'
+ (isMultiline() || isTallVariant()) && 'not-touch:px-[9.375px]'
)}
classList={{
- 'pl-8 touch:pl-10': !isMultiline() && !isTallVariant(),
- 'pb-8 touch:pb-10': isMultiline() && !isTallVariant(),
+ 'pl-[41.25px] touch:pl-10': !isMultiline() && !isTallVariant(),
+ 'pb-[37.5px] touch:pb-10': isMultiline() && !isTallVariant(),
'max-h-[calc(32*var(--dvh,1dvh))] overflow-y-auto':
isMobile() && isMultiline(),
// While empty, the only thing rendered is the placeholder.
@@ -422,11 +468,12 @@ export function ChatInput(props: ChatInputComponentProps) {
}
ref={mdRef}
>
- <MarkdownShell
+ <ComposerEditor
class={isCompactMobile() ? 'min-h-5' : undefined}
config={props.editor}
placeholder={
- isTouchDevice() ? 'Ask AI…' : 'Ask AI, @mention anything'
+ props.placeholder ??
+ (isTouchDevice() ? 'Ask AI…' : 'Ask AI, @mention anything')
}
initialValue={props.initialValue}
autofocus={
@@ -436,7 +483,7 @@ export function ChatInput(props: ChatInputComponentProps) {
}
/>
<Show when={isTallVariant()}>
- <div class="h-4 touch:hidden" />
+ <div class="h-[15px] touch:hidden" />
</Show>
<Show when={isTallVariant()}>
<Attachments />
@@ -452,7 +499,7 @@ export function ChatInput(props: ChatInputComponentProps) {
<div
class={cn(
!isTallVariant() &&
- 'absolute left-2 bottom-2 touch:bottom-[7px]',
+ 'absolute left-[7.5px] bottom-[7.5px] touch:left-2 touch:bottom-[7px]',
isCompactMobile() &&
'touch:top-1/2 touch:bottom-auto touch:-translate-y-1/2'
)}
@@ -463,7 +510,7 @@ export function ChatInput(props: ChatInputComponentProps) {
<div
class={cn(
!isTallVariant() &&
- 'absolute right-2 bottom-2 touch:right-2 touch:bottom-[7px]',
+ 'absolute right-[7.5px] bottom-[7.5px] touch:right-2 touch:bottom-[7px]',
isCompactMobile() &&
'touch:right-[5px] touch:top-1/2 touch:bottom-auto touch:-translate-y-1/2'
)}
diff --git a/apps/web/src/lib/core/component/AI/component/input/ModelSelector.tsx b/apps/web/src/lib/core/component/AI/component/input/ModelSelector.tsx
index 6f28051754..f680b95a6d 100644
--- a/apps/web/src/lib/core/component/AI/component/input/ModelSelector.tsx
+++ b/apps/web/src/lib/core/component/AI/component/input/ModelSelector.tsx
@@ -66,7 +66,9 @@ export function ModelSelector(props: ModelSelectorProps) {
size={props.compact ? 'icon-sm' : 'sm'}
class={cn(
'rounded-lg text-sm text-ink-subtle',
- !props.compact && 'gap-1.5'
+ !props.compact && 'gap-1.5',
+ 'not-touch:h-[33.75px] not-touch:rounded-full not-touch:text-base not-touch:gap-[5.625px] not-touch:px-[7.5px] not-touch:[&_svg]:size-[15px] not-touch:light-mode:text-composer-placeholder not-touch:light-mode:font-normal',
+ props.compact && 'not-touch:p-[3.75px]'
)}
label={props.compact ? MODEL_PRETTYNAME[model()] : undefined}
>
diff --git a/apps/web/src/lib/core/component/AI/component/message/ChatMessages.tsx b/apps/web/src/lib/core/component/AI/component/message/ChatMessages.tsx
index 695df20e36..b9c40f181b 100644
--- a/apps/web/src/lib/core/component/AI/component/message/ChatMessages.tsx
+++ b/apps/web/src/lib/core/component/AI/component/message/ChatMessages.tsx
@@ -219,7 +219,7 @@ export function ChatMessages(props: ChatMessagesProps) {
return (
<StaticMarkdownContext theme={aiChatTheme}>
<div
- class="relative flex flex-col w-full px-2 pt-2 gap-y-6 text-sm"
+ class="relative flex flex-col w-full px-2 pt-2 gap-y-6 text-base"
ref={messagesRef}
>
<Show
diff --git a/apps/web/src/lib/core/component/AI/component/tool/email/DraftComposer.tsx b/apps/web/src/lib/core/component/AI/component/tool/email/DraftComposer.tsx
index e73041a92a..472601e973 100644
--- a/apps/web/src/lib/core/component/AI/component/tool/email/DraftComposer.tsx
+++ b/apps/web/src/lib/core/component/AI/component/tool/email/DraftComposer.tsx
@@ -29,13 +29,21 @@ import {
enableEmailSignatures,
} from '@core/constant/featureFlags';
import { isMobile } from '@core/mobile/isMobile';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { interceptMailtoLinks } from '@core/util/interceptMailtoLinks';
import { useEmailLinksQuery, useEmailSignature } from '@queries/email/link';
import type { SendEmail } from '@service-cognition/generated/tools/types';
import { debounce } from '@solid-primitives/scheduled';
-import { cn } from '@ui';
+import { ComposerSurface, cn } from '@ui';
import type { LexicalEditor } from 'lexical';
-import { createMemo, createSignal, type JSX, onCleanup, Show } from 'solid-js';
+import {
+ type ComponentProps,
+ createMemo,
+ createSignal,
+ type JSX,
+ onCleanup,
+ Show,
+} from 'solid-js';
import type { UserToolReviewSink } from '../user-tool-review';
export type EmailDraftComposerProps = {
@@ -72,6 +80,10 @@ function fromEmailRecipients(
});
}
+function DraftComposerSurface(props: ComponentProps<typeof ComposerSurface>) {
+ return <ComposerSurface {...props} as="div" />;
+}
+
export function EmailDraftComposer(props: EmailDraftComposerProps) {
const uiDisabled = () => !props.sink.canAct() || props.readOnly === true;
const emailLinksQuery = useEmailLinksQuery();
@@ -277,9 +289,11 @@ export function EmailDraftComposer(props: EmailDraftComposerProps) {
<ComposeProvider value={ctx}>
<div class="relative">
<ComposeLayout
+ as={DraftComposerSurface}
bodyDebugName={`chat-compose:${props.debugName}`}
class={cn(
- 'flex flex-col w-full text-xs rounded-lg p-4 bg-surface',
+ 'relative flex flex-col w-full text-xs p-4',
+ isTouchDevice() && 'rounded-lg bg-surface',
uiDisabled() &&
'[&_button:disabled]:opacity-50 [&_button:disabled]:text-ink-disabled [&_input:disabled]:text-ink-muted'
)}
diff --git a/apps/web/src/lib/core/component/EntityIcon.test.tsx b/apps/web/src/lib/core/component/EntityIcon.test.tsx
new file mode 100644
index 0000000000..e025744e80
--- /dev/null
+++ b/apps/web/src/lib/core/component/EntityIcon.test.tsx
@@ -0,0 +1,150 @@
+import { itemToBlockName } from '@core/constant/allBlocks';
+import SkillIcon from '@icon/skill.svg';
+import WideBook from '@icon/wide-book.svg';
+import WideSnippet from '@icon/wide-snippet.svg';
+import WideUnknown from '@icon/wide-unknown.svg';
+import AlarmIcon from '@phosphor/alarm.svg';
+import ArticleIcon from '@phosphor/article.svg';
+import BuildingsIcon from '@phosphor/buildings.svg';
+import CalendarIcon from '@phosphor/calendar-blank.svg';
+import ChatsIcon from '@phosphor/chats-circle.svg';
+import EnvelopeIcon from '@phosphor/envelope.svg';
+import EnvelopeOpenIcon from '@phosphor/envelope-open.svg';
+import FileArchive from '@phosphor/file-archive.svg';
+import FilePdf from '@phosphor/file-pdf.svg';
+import FolderIcon from '@phosphor/folder-simple.svg';
+import GitPullRequestIcon from '@phosphor/git-pull-request.svg';
+import HashIcon from '@phosphor/hash.svg';
+import LightningIcon from '@phosphor/lightning.svg';
+import ListChecksIcon from '@phosphor/list-checks.svg';
+import PhoneIcon from '@phosphor/phone.svg';
+import SparkleIcon from '@phosphor/sparkle.svg';
+import UsersIcon from '@phosphor/users.svg';
+import { cleanup, render } from '@solidjs/testing-library';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { EntityIcon, getEntityIconType, getIconConfig } from './EntityIcon';
+
+const flags = vi.hoisted(() => ({ wideIcons: false }));
+vi.mock('@core/constant/featureFlags', () => ({
+ get USE_WIDE_ICONS() {
+ return flags.wideIcons;
+ },
+}));
+vi.mock('@core/constant/allBlocks', () => ({
+ blockAcceptedFileExtensionSet: new Set(),
+ fileTypeToBlockName: vi.fn(),
+ isBlockAlias: () => false,
+ itemToBlockName: vi.fn(),
+}));
+vi.mock('@ui', async () => ({
+ cn: (await import('@ui/utils/classname')).cn,
+}));
+
+type IconInput = Parameters<typeof getEntityIconType>[0];
+
+const entityGlyphs: [
+ string,
+ IconInput,
+ typeof ArticleIcon,
+ ReturnType<typeof itemToBlockName>?,
+][] = [
+ ['document', { type: 'document', fileType: 'md' }, ArticleIcon, 'md'],
+ ['unresolved document', { type: 'document' }, ArticleIcon, 'unknown'],
+ [
+ 'snippet document',
+ { type: 'document', fileType: 'md', subType: { type: 'snippet' } },
+ WideSnippet,
+ 'snippet',
+ ],
+ [
+ 'skill document',
+ { type: 'document', subType: { type: 'skill' } },
+ SkillIcon,
+ 'skill',
+ ],
+ ['task', { type: 'document', subType: { type: 'task' } }, ListChecksIcon],
+ ['channel', { type: 'channel', channelType: 'public' }, HashIcon],
+ ['message', { type: 'channel_message', channelType: 'private' }, HashIcon],
+ ['thread', { type: 'channel_thread', channelType: 'team' }, HashIcon],
+ [
+ 'direct message',
+ { type: 'channel', channelType: 'direct_message' },
+ ChatsIcon,
+ ],
+ [
+ 'direct thread',
+ { type: 'channel_thread', channelType: 'direct_message' },
+ ChatsIcon,
+ ],
+ ['email', { type: 'email', isRead: false }, EnvelopeIcon],
+ ['read email', { type: 'email', isRead: true }, EnvelopeOpenIcon],
+ ['chat', { type: 'chat' }, SparkleIcon],
+ ['agent', { type: 'agent_session' }, SparkleIcon],
+ ['project', { type: 'project' }, FolderIcon],
+ ['calendar', { type: 'calendar_event' }, CalendarIcon],
+ ['reminder', { type: 'reminder' }, AlarmIcon],
+ ['call', { type: 'call' }, PhoneIcon],
+ ['automation', { type: 'automation' }, LightningIcon],
+ [
+ 'GitHub pull request',
+ { type: 'foreign', foreignSource: 'github_pull_request' },
+ GitPullRequestIcon,
+ ],
+ ['company', { type: 'crm_company' }, BuildingsIcon],
+ ['contact', { type: 'crm_contact' }, UsersIcon],
+];
+
+afterEach(cleanup);
+
+describe.each([false, true])(
+ 'entity glyphs with wide icons %s',
+ (wideIcons) => {
+ beforeEach(() => {
+ flags.wideIcons = wideIcons;
+ vi.mocked(itemToBlockName).mockReset();
+ });
+
+ it.each(entityGlyphs)(
+ 'renders the shared %s glyph',
+ (_, entity, Glyph, blockName) => {
+ vi.mocked(itemToBlockName).mockReturnValue(blockName ?? 'unknown');
+ const targetType = getEntityIconType(entity);
+ expect(getIconConfig(targetType).icon).toBe(Glyph);
+
+ const actual = render(() => <EntityIcon targetType={targetType} />);
+ const expected = render(() => <Glyph />);
+ const actualSvg = actual.container.querySelector('svg');
+ const expectedSvg = expected.container.querySelector('svg');
+ expect(actualSvg).not.toBeNull();
+ expect(actualSvg?.innerHTML).toBe(expectedSvg?.innerHTML);
+ }
+ );
+
+ it('keeps archive documents distinct from unresolved documents', () => {
+ vi.mocked(itemToBlockName).mockReturnValue('unknown');
+ const targetType = getEntityIconType({
+ type: 'document',
+ fileType: 'zip',
+ });
+ expect(targetType).toBe('archive');
+ expect(getIconConfig(targetType).icon).toBe(
+ wideIcons ? WideUnknown : FileArchive
+ );
+ });
+
+ it('uses the selected file-format variant for PDF documents', () => {
+ const entity = { type: 'document', fileType: 'pdf' } as const;
+ vi.mocked(itemToBlockName).mockReturnValue('pdf');
+ const targetType = getEntityIconType(entity);
+ expect(targetType).toBe('pdf');
+ expect(itemToBlockName).toHaveBeenCalledWith(entity, true);
+ const Glyph = wideIcons ? WideBook : FilePdf;
+ expect(getIconConfig(targetType).icon).toBe(Glyph);
+ const actual = render(() => <EntityIcon targetType={targetType} />);
+ const expected = render(() => <Glyph />);
+ expect(actual.container.querySelector('svg')?.innerHTML).toBe(
+ expected.container.querySelector('svg')?.innerHTML
+ );
+ });
+ }
+);
diff --git a/apps/web/src/lib/core/component/EntityIcon.tsx b/apps/web/src/lib/core/component/EntityIcon.tsx
index 8053b761c6..418d904786 100644
--- a/apps/web/src/lib/core/component/EntityIcon.tsx
+++ b/apps/web/src/lib/core/component/EntityIcon.tsx
@@ -11,54 +11,45 @@ import type {
DocumentEntity,
EmailEntity,
EntityData,
+ ForeignEntity,
NamedSubType,
ReminderEntity,
} from '@entity';
-import GithubIcon from '@icon/mcp-github.svg';
import SkillIcon from '@icon/skill.svg';
-import WideAutomation from '@icon/wide-automation.svg';
import WideBook from '@icon/wide-book.svg';
-import WideCalendar from '@icon/wide-calendar.svg';
-import PhoneCall from '@icon/wide-call.svg';
-import WideChannel from '@icon/wide-channel.svg';
-import WideChat from '@icon/wide-chat.svg';
-import { AnimatedCompanyIcon } from '@icon/wide-company';
-import { AnimatedContactIcon } from '@icon/wide-contact';
import WideCsv from '@icon/wide-csv.svg';
import WideDiagram from '@icon/wide-diagram.svg';
-import WideDocx from '@icon/wide-docx.svg';
-import WideEmail from '@icon/wide-email.svg';
import WideFileCode from '@icon/wide-file-code.svg';
import WideFileImage from '@icon/wide-file-image.svg';
-import WideFileMd from '@icon/wide-file-md.svg';
import WideFiles from '@icon/wide-files.svg';
-import WideFolder from '@icon/wide-folder.svg';
-import WideGlobe from '@icon/wide-globe.svg';
import WideSnippet from '@icon/wide-snippet.svg';
-import WideStar from '@icon/wide-star.svg';
-import WideTask from '@icon/wide-task.svg';
import WideUnknown from '@icon/wide-unknown.svg';
import WideVideo from '@icon/wide-video.svg';
-import BellSimple from '@phosphor/bell-simple.svg';
+import AlarmIcon from '@phosphor/alarm.svg';
+import ArticleIcon from '@phosphor/article.svg';
import Building from '@phosphor/building.svg';
-import Chat from '@phosphor/chat.svg';
-import Check from '@phosphor/check-fat.svg';
+import BuildingsIcon from '@phosphor/buildings.svg';
+import CalendarIcon from '@phosphor/calendar-blank.svg';
+import ChatsIcon from '@phosphor/chats-circle.svg';
import FileCode from '@phosphor/code.svg';
import Email from '@phosphor/envelope.svg';
import EmailRead from '@phosphor/envelope-open.svg';
import File from '@phosphor/file.svg';
import FileArchive from '@phosphor/file-archive.svg';
-import FileDoc from '@phosphor/file-doc.svg';
import FileHtml from '@phosphor/file-html.svg';
-import FileMd from '@phosphor/file-md.svg';
import FilePdf from '@phosphor/file-pdf.svg';
import FileVideo from '@phosphor/file-video.svg';
import Files from '@phosphor/files.svg';
import Folder from '@phosphor/folder-simple.svg';
-import FolderUser from '@phosphor/folder-user.svg';
-import GlobeIcon from '@phosphor/globe.svg';
+import GitMergeIcon from '@phosphor/git-merge.svg';
+import GitPullRequestIcon from '@phosphor/git-pull-request.svg';
+import HashIcon from '@phosphor/hash.svg';
import FileImage from '@phosphor/image.svg';
+import LightningIcon from '@phosphor/lightning.svg';
+import ListChecksIcon from '@phosphor/list-checks.svg';
import Canvas from '@phosphor/pencil-circle.svg';
+import PhoneIcon from '@phosphor/phone.svg';
+import SparkleIcon from '@phosphor/sparkle.svg';
import Users from '@phosphor/users.svg';
import type { PreviewItem } from '@queries/preview';
import type { ChannelType } from '@service-cognition/generated/schemas/channelType';
@@ -82,10 +73,14 @@ export type EntityWithValidIcon =
| ChannelType
| 'organization'
| 'default'
+ | 'document'
| 'sharedProject'
| 'emailRead'
| 'emailInvite'
| 'githubPullRequest'
+ | 'githubPullRequestOpen'
+ | 'githubPullRequestMerged'
+ | 'githubPullRequestClosed'
| 'archive'
| 'files'
| 'crm_company'
@@ -99,14 +94,20 @@ const ARCHIVE_EXTENSIONS = new Set(
);
export const ENTITY_ICON_CONFIGS: Record<EntityWithValidIcon, IconConfig> = {
+ document: {
+ icon: ArticleIcon,
+ foreground: 'text-default',
+ background: 'bg-default/20',
+ prettyName: 'Document',
+ },
call: {
- icon: PhoneCall,
+ icon: PhoneIcon,
foreground: 'text-default',
background: 'bg-default/20',
prettyName: 'Call',
},
calendar: {
- icon: WideCalendar,
+ icon: CalendarIcon,
foreground: 'text-default',
background: 'bg-default/20',
prettyName: 'Calendar',
@@ -124,13 +125,13 @@ export const ENTITY_ICON_CONFIGS: Record<EntityWithValidIcon, IconConfig> = {
prettyName: 'Webpage',
},
channel: {
- icon: WideChannel,
+ icon: HashIcon,
foreground: 'text-default',
background: 'bg-default/20',
prettyName: 'Channel',
},
public: {
- icon: GlobeIcon,
+ icon: HashIcon,
foreground: 'text-default',
background: 'bg-default/20',
prettyName: 'Public Channel',
@@ -142,19 +143,19 @@ export const ENTITY_ICON_CONFIGS: Record<EntityWithValidIcon, IconConfig> = {
prettyName: 'Organization',
},
private: {
- icon: WideChannel,
+ icon: HashIcon,
foreground: 'text-default',
background: 'bg-default/20',
prettyName: 'Private Channel',
},
direct_message: {
- icon: Users,
+ icon: ChatsIcon,
foreground: 'text-default',
background: 'bg-default/20',
prettyName: 'Direct Message',
},
team: {
- icon: Users,
+ icon: HashIcon,
foreground: 'text-default',
background: 'bg-default/20',
prettyName: 'Team Channel',
@@ -184,7 +185,7 @@ export const ENTITY_ICON_CONFIGS: Record<EntityWithValidIcon, IconConfig> = {
prettyName: 'PDF',
},
md: {
- icon: FileMd,
+ icon: ArticleIcon,
foreground: 'text-note',
background: 'bg-note/20',
prettyName: 'Note',
@@ -196,13 +197,13 @@ export const ENTITY_ICON_CONFIGS: Record<EntityWithValidIcon, IconConfig> = {
prettyName: 'Image',
},
write: {
- icon: FileDoc,
+ icon: ArticleIcon,
foreground: 'text-write',
background: 'bg-write/20',
prettyName: 'Document',
},
chat: {
- icon: Chat,
+ icon: SparkleIcon,
foreground: 'text-chat',
background: 'bg-chat/20',
prettyName: 'Chat',
@@ -214,7 +215,7 @@ export const ENTITY_ICON_CONFIGS: Record<EntityWithValidIcon, IconConfig> = {
prettyName: 'Folder',
},
sharedProject: {
- icon: FolderUser,
+ icon: Folder,
foreground: 'text-folder',
background: 'bg-folder/20',
prettyName: 'Shared Folder',
@@ -244,7 +245,7 @@ export const ENTITY_ICON_CONFIGS: Record<EntityWithValidIcon, IconConfig> = {
prettyName: 'Video',
},
contact: {
- icon: AnimatedContactIcon,
+ icon: Users,
foreground: 'text-default',
background: 'bg-default/20',
prettyName: 'Contact',
@@ -262,31 +263,49 @@ export const ENTITY_ICON_CONFIGS: Record<EntityWithValidIcon, IconConfig> = {
prettyName: 'Read Email',
},
emailInvite: {
- icon: WideCalendar,
+ icon: CalendarIcon,
foreground: 'text-calendar',
background: 'bg-calendar/20',
prettyName: 'Calendar Invite',
},
githubPullRequest: {
- icon: GithubIcon,
+ icon: GitPullRequestIcon,
foreground: 'text-default',
background: 'bg-default/20',
prettyName: 'GitHub Pull Request',
},
+ githubPullRequestOpen: {
+ icon: GitPullRequestIcon,
+ foreground: 'text-success',
+ background: 'bg-success/20',
+ prettyName: 'Open Pull Request',
+ },
+ githubPullRequestMerged: {
+ icon: GitMergeIcon,
+ foreground: 'text-note',
+ background: 'bg-note/20',
+ prettyName: 'Merged Pull Request',
+ },
+ githubPullRequestClosed: {
+ icon: GitPullRequestIcon,
+ foreground: 'text-failure',
+ background: 'bg-failure/20',
+ prettyName: 'Closed Pull Request',
+ },
pr: {
- icon: GithubIcon,
+ icon: GitPullRequestIcon,
foreground: 'text-default',
background: 'bg-default/20',
prettyName: 'Pull Request',
},
agent: {
- icon: WideStar,
+ icon: SparkleIcon,
foreground: 'text-chat',
background: 'bg-chat/20',
prettyName: 'Agent',
},
task: {
- icon: Check,
+ icon: ListChecksIcon,
foreground: 'text-task',
background: 'bg-task/20',
prettyName: 'Task',
@@ -304,25 +323,25 @@ export const ENTITY_ICON_CONFIGS: Record<EntityWithValidIcon, IconConfig> = {
prettyName: 'Skill',
},
automation: {
- icon: WideAutomation,
+ icon: LightningIcon,
foreground: 'text-chat',
background: 'bg-chat/20',
prettyName: 'Automation',
},
crm_company: {
- icon: AnimatedCompanyIcon,
+ icon: BuildingsIcon,
foreground: 'text-default',
background: 'bg-default/20',
prettyName: 'Company',
},
company: {
- icon: AnimatedCompanyIcon,
+ icon: BuildingsIcon,
foreground: 'text-default',
background: 'bg-default/20',
prettyName: 'Company',
},
reminder: {
- icon: BellSimple,
+ icon: AlarmIcon,
foreground: 'text-default',
background: 'bg-default/20',
prettyName: 'Reminder',
@@ -354,50 +373,21 @@ function validateEntity(entity: string): EntityWithValidIcon {
}
}
-const WIDE_ICONS: Record<
- EntityWithValidIcon,
- Component<JSX.SvgSVGAttributes<SVGSVGElement>>
+// File-format icons retain their wide variants; entity glyphs live in the
+// shared registry above so the feature flag cannot replace their mapping.
+const WIDE_ICONS: Partial<
+ Record<EntityWithValidIcon, Component<JSX.SvgSVGAttributes<SVGSVGElement>>>
> = {
- call: PhoneCall,
- calendar: WideCalendar,
canvas: WideDiagram,
html: WideFileCode,
- channel: WideChannel,
- public: WideGlobe,
- organization: Building,
- private: WideChannel,
- direct_message: WideChat,
- team: WideChannel,
- email: WideEmail,
code: WideFileCode,
- csv: WideCsv,
pdf: WideBook,
- md: WideFileMd,
image: WideFileImage,
- write: WideDocx,
- chat: WideStar,
- project: WideFolder,
- sharedProject: WideFolder,
unknown: WideUnknown,
files: WideFiles,
archive: WideUnknown,
video: WideVideo,
- contact: AnimatedContactIcon,
default: WideUnknown,
- emailRead: WideEmail,
- emailInvite: WideCalendar,
- githubPullRequest: GithubIcon,
- pr: GithubIcon,
- agent: WideStar,
- task: WideTask,
- snippet: WideSnippet,
- skill: SkillIcon,
- automation: WideAutomation,
- crm_company: AnimatedCompanyIcon,
- company: AnimatedCompanyIcon,
- // No wide bell asset exists; the phosphor one carries over, as it does for
- // `organization` and the github icons.
- reminder: BellSimple,
};
const ICON_SIZES = {
@@ -460,14 +450,7 @@ export function EntityIcon(props: EntityIconProps) {
return validateEntity(props.targetType || 'default');
};
- const config = () => ENTITY_ICON_CONFIGS[getName()];
- const icon = () => {
- if (USE_WIDE_ICONS) {
- return WIDE_ICONS[getName()];
- } else {
- return config().icon;
- }
- };
+ const config = () => getIconConfig(getName());
const sizeClass = () => ICON_SIZE_CLASSES[props.size ?? 'xs'];
const isMonochrome = () => props.theme === 'monochrome';
@@ -482,7 +465,7 @@ export function EntityIcon(props: EntityIconProps) {
)}
>
{/* size-full: Safari needs a CSS size, not the SVG's % attributes. */}
- <Dynamic component={icon()} class="size-full" />
+ <Dynamic component={config().icon} class="size-full" />
</div>
);
}
@@ -519,7 +502,7 @@ export function getIconConfig(
const key = validateEntity(targetType);
const config = { ...ENTITY_ICON_CONFIGS[key] };
if (USE_WIDE_ICONS) {
- config.icon = WIDE_ICONS[key];
+ config.icon = WIDE_ICONS[key] ?? config.icon;
}
return config;
}
@@ -529,26 +512,49 @@ type EntityIconData = Pick<EntityData, 'type'> & {
fileType?: DocumentEntity['fileType'] | null;
subType?: DocumentEntity['subType'];
isRead?: EmailEntity['isRead'];
- /** Reminders icon as the entity they reference. */
+ hasIcsAttachment?: EmailEntity['hasIcsAttachment'];
+ foreignSource?: ForeignEntity['foreignSource'];
+ metadata?: ForeignEntity['metadata'];
+ /** Reference metadata carried by reminder entities. */
referencedEntity?: ReminderEntity['referencedEntity'];
};
+/** The shared entity-to-icon mapping used by lists, previews, and drag images. */
export function getEntityIconType(entity: EntityIconData): EntityWithValidIcon {
- const typeString = match(entity)
- .with({ type: 'channel' }, (e) => e.channelType || 'channel')
- .with({ type: 'channel_message' }, (e) => e.channelType || 'channel')
- .with({ type: 'document' }, (e) => itemToBlockName(e, true) ?? 'default')
- .with({ type: 'email', isRead: true }, () => 'emailRead')
- .with({ type: 'email' }, () => 'email')
- // Always the bell, never the referenced entity's icon: a reminder is a
- // reminder first, and what it points at is iconed beside its name instead
- // — see `reminderReferenceIconType`.
- .with({ type: 'reminder' }, () => 'reminder')
+ return match<EntityIconData, EntityWithValidIcon>(entity)
+ .with({ type: 'document' }, (e) => {
+ if (e.subType?.type === 'task') return 'task';
+ if (e.fileType && isArchiveType(e.fileType)) return 'archive';
+ const blockName = itemToBlockName(e, true);
+ return blockName === 'unknown' ? 'document' : blockName;
+ })
+ .with(
+ { type: 'channel' },
+ { type: 'channel_message' },
+ { type: 'channel_thread' },
+ (e) => (e.channelType === 'direct_message' ? 'direct_message' : 'channel')
+ )
+ .with({ type: 'email' }, (e) =>
+ e.hasIcsAttachment ? 'emailInvite' : e.isRead ? 'emailRead' : 'email'
+ )
+ .with({ type: 'chat' }, () => 'chat')
.with({ type: 'agent_session' }, () => 'agent')
+ .with({ type: 'project' }, () => 'project')
.with({ type: 'calendar_event' }, () => 'calendar')
- .otherwise((e) => e.type);
-
- return validateEntity(typeString);
+ .with({ type: 'reminder' }, () => 'reminder')
+ .with({ type: 'call' }, () => 'call')
+ .with({ type: 'automation' }, () => 'automation')
+ .with({ type: 'foreign' }, (e) => {
+ if (e.foreignSource !== 'github_pull_request') return 'default';
+ return match<unknown, EntityWithValidIcon>(e.metadata?.status)
+ .with('open', () => 'githubPullRequestOpen')
+ .with('merged', () => 'githubPullRequestMerged')
+ .with('closed', () => 'githubPullRequestClosed')
+ .otherwise(() => 'githubPullRequest');
+ })
+ .with({ type: 'crm_company' }, () => 'crm_company')
+ .with({ type: 'crm_contact' }, () => 'contact')
+ .exhaustive();
}
/** What the block resolvers return when they cannot place something. */
@@ -560,7 +566,7 @@ const UNRESOLVED_ICONS: ReadonlySet<string> = new Set(['default', 'unknown']);
* Synchronous by design: the referenced entity's `fileType`/`subType` are
* resolved server-side precisely so this costs no fetch per row.
*
- * A reference that resolves to nothing gets the bell, not the unknown-file
+ * A reference that resolves to nothing gets the reminder icon, not the unknown-file
* glyph, which on a reminder row reads as breakage rather than as a reminder.
* That needs both sentinels and neither is falsy: `fileTypeToBlockName`
* returns the literal `unknown`, and `validateEntity` returns `default`.
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/builder/MarkdownShell.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/builder/MarkdownShell.tsx
index 7a34178a85..849137fe2d 100644
--- a/apps/web/src/lib/core/component/LexicalMarkdown/builder/MarkdownShell.tsx
+++ b/apps/web/src/lib/core/component/LexicalMarkdown/builder/MarkdownShell.tsx
@@ -44,11 +44,14 @@ import {
createFilesReadyHandler,
getDragDropPosition,
} from '../utils/fileUploadUtils';
+import { MarkdownShellContent } from './MarkdownShellContent';
import type { EditorBuilder, EditorComponentProps } from './types';
-export const MarkdownShell: Component<
- { config: EditorBuilder } & EditorComponentProps
-> = (props) => {
+export type MarkdownShellProps = EditorComponentProps & {
+ config: EditorBuilder;
+};
+
+export const MarkdownShell: Component<MarkdownShellProps> = (props) => {
const handle = props.config.buildHandle();
const state = handle._internal;
const {
@@ -196,7 +199,7 @@ export const MarkdownShell: Component<
<LexicalWrapperContext.Provider value={lexicalWrapper}>
<div
class={cn(
- 'relative h-full overflow-y-auto min-h-8 scrollbar-hidden',
+ 'relative h-full overflow-y-auto min-h-8 scrollbar-hidden text-base',
props.class
)}
on:keydown={(e) => e.stopPropagation()}
@@ -221,16 +224,17 @@ export const MarkdownShell: Component<
: undefined
}
>
- {/* Content Editable */}
- <div
- ref={(el) => {
- onElementConnect(el, () => {
- editor.setRootElement(el);
+ <MarkdownShellContent
+ connectRoot={(element) => {
+ onElementConnect(element, () => {
+ editor.setRootElement(element);
onConnect();
});
- props.refFn?.(el);
+ props.refFn?.(element);
}}
- contentEditable={!props.disabled}
+ disabled={!!props.disabled}
+ showPlaceholder={showPlaceholder()}
+ placeholder={props.placeholder ?? '...'}
/>
<DecoratorRenderer editor={editor} />
@@ -240,14 +244,6 @@ export const MarkdownShell: Component<
{(store) => <NodeAccessoryRenderer editor={editor} store={store()} />}
</Show>
- <Show when={showPlaceholder()}>
- <div class="pointer-events-none text-ink-placeholder absolute top-0">
- <p class="my-1.5 pointer-events-none">
- {props.placeholder ?? '...'}
- </p>
- </div>
- </Show>
-
<Show when={state.dragInsertStore}>
{(store) => (
<DragInsertIndicator state={store()} active={!props.disabled} />
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/builder/MarkdownShellContent.test.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/builder/MarkdownShellContent.test.tsx
new file mode 100644
index 0000000000..1ddfeba469
--- /dev/null
+++ b/apps/web/src/lib/core/component/LexicalMarkdown/builder/MarkdownShellContent.test.tsx
@@ -0,0 +1,62 @@
+import { cleanup, render, screen } from '@solidjs/testing-library';
+import { createSignal } from 'solid-js';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { MarkdownShellContent } from './MarkdownShellContent';
+
+afterEach(cleanup);
+
+describe('MarkdownShell content', () => {
+ it('connects one editable element and retains its contents as presentation and disabled state change', () => {
+ const connectRoot = vi.fn();
+ const [disabled, setDisabled] = createSignal(false);
+ const [showPlaceholder, setShowPlaceholder] = createSignal(false);
+ const { container } = render(() => (
+ <MarkdownShellContent
+ connectRoot={connectRoot}
+ disabled={disabled()}
+ showPlaceholder={showPlaceholder()}
+ placeholder="Message"
+ />
+ ));
+
+ const editable =
+ container.querySelector<HTMLDivElement>('[contenteditable]')!;
+ expect(container.querySelectorAll('[contenteditable]')).toHaveLength(1);
+ editable.textContent = 'Unsent draft';
+ setShowPlaceholder(true);
+ setDisabled(true);
+
+ expect(container.querySelector('[contenteditable]')).toBe(editable);
+ expect(editable.textContent).toBe('Unsent draft');
+ expect(editable.getAttribute('contenteditable')).toBe('false');
+ expect(connectRoot.mock.calls[0][0]).toBe(editable);
+
+ setDisabled(false);
+ expect(editable.getAttribute('contenteditable')).toBe('true');
+ expect(connectRoot).toHaveBeenCalledOnce();
+ });
+
+ it('updates placeholder text and visibility without replacing the editable', () => {
+ const [showPlaceholder, setShowPlaceholder] = createSignal(true);
+ const [placeholder, setPlaceholder] = createSignal('Write a message');
+ const { container } = render(() => (
+ <MarkdownShellContent
+ connectRoot={vi.fn()}
+ disabled={false}
+ showPlaceholder={showPlaceholder()}
+ placeholder={placeholder()}
+ />
+ ));
+
+ const editable = container.querySelector('[contenteditable]');
+ expect(screen.getByText('Write a message')).toBeTruthy();
+ setPlaceholder('Reply to thread');
+ expect(screen.queryByText('Write a message')).toBeNull();
+ expect(screen.getByText('Reply to thread')).toBeTruthy();
+ setShowPlaceholder(false);
+ expect(screen.queryByText('Reply to thread')).toBeNull();
+ setShowPlaceholder(true);
+ expect(screen.getByText('Reply to thread')).toBeTruthy();
+ expect(container.querySelector('[contenteditable]')).toBe(editable);
+ });
+});
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/builder/MarkdownShellContent.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/builder/MarkdownShellContent.tsx
new file mode 100644
index 0000000000..95c2a4d511
--- /dev/null
+++ b/apps/web/src/lib/core/component/LexicalMarkdown/builder/MarkdownShellContent.tsx
@@ -0,0 +1,27 @@
+import { Show } from 'solid-js';
+
+/** Fixed editor markup; Lexical owns the editable element's contents. */
+export function MarkdownShellContent(props: {
+ connectRoot: (element: HTMLDivElement) => void;
+ disabled: boolean;
+ showPlaceholder: boolean;
+ placeholder: string;
+}) {
+ return (
+ <>
+ <div
+ data-markdown-editable
+ ref={props.connectRoot}
+ contentEditable={!props.disabled}
+ />
+ <Show when={props.showPlaceholder}>
+ <div
+ data-markdown-placeholder
+ class="pointer-events-none text-ink-placeholder absolute top-0"
+ >
+ <p class="my-1.5 pointer-events-none">{props.placeholder}</p>
+ </div>
+ </Show>
+ </>
+ );
+}
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/ComposerEditor.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/ComposerEditor.tsx
new file mode 100644
index 0000000000..6f5906b70b
--- /dev/null
+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/ComposerEditor.tsx
@@ -0,0 +1,20 @@
+import { cn } from '@ui/utils/classname';
+import {
+ MarkdownShell,
+ type MarkdownShellProps,
+} from '../builder/MarkdownShell';
+
+/** Shared message editor sizing and colors. */
+export function ComposerEditor(props: MarkdownShellProps) {
+ return (
+ <MarkdownShell
+ {...props}
+ class={cn(
+ 'not-touch:min-h-[24.375px] text-base not-touch:leading-[24.375px] not-touch:text-composer-ink',
+ 'not-touch:[&>[data-markdown-editable]]:min-h-[24.375px] not-touch:[&>[data-markdown-editable]]:max-h-[195px] not-touch:[&>[data-markdown-editable]]:overflow-y-auto not-touch:[&>[data-markdown-editable]>p]:my-0 not-touch:[&>[data-markdown-editable]>p:first-child]:mt-0 not-touch:[&>[data-markdown-editable]>p:last-child]:mb-0',
+ 'not-touch:[&>[data-markdown-placeholder]]:text-composer-placeholder not-touch:[&>[data-markdown-placeholder]>p]:my-0',
+ props.class
+ )}
+ />
+ );
+}
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/core/MarkdownTextarea.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/core/MarkdownTextarea.tsx
index 69dc6e8d2b..7710b7ed6c 100644
--- a/apps/web/src/lib/core/component/LexicalMarkdown/component/core/MarkdownTextarea.tsx
+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/core/MarkdownTextarea.tsx
@@ -346,7 +346,10 @@ export function MarkdownTextarea(props: MarkdownTextareaProps) {
<LexicalWrapperContext.Provider value={lexicalWrapper}>
<div
ref={scrollContainerRef}
- class={cn('relative size-full overflow-auto min-h-8', props.class)}
+ class={cn(
+ 'relative size-full overflow-auto min-h-8 text-base',
+ props.class
+ )}
on:keydown={(e) => {
e.stopPropagation();
}}
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/utils/create-has-line-breaks.test.ts b/apps/web/src/lib/core/component/LexicalMarkdown/utils/create-has-line-breaks.test.ts
new file mode 100644
index 0000000000..07529c301f
--- /dev/null
+++ b/apps/web/src/lib/core/component/LexicalMarkdown/utils/create-has-line-breaks.test.ts
@@ -0,0 +1,51 @@
+import {
+ $createLineBreakNode,
+ $createParagraphNode,
+ $createTextNode,
+ $getRoot,
+ createEditor,
+} from 'lexical';
+import { createRoot } from 'solid-js';
+import { describe, expect, it } from 'vitest';
+import { createHasLineBreaks } from './create-has-line-breaks';
+
+describe('composer line breaks', () => {
+ it('expands for blank paragraphs and collapses when they are removed', () => {
+ createRoot((dispose) => {
+ const editor = createEditor();
+ const hasLineBreaks = createHasLineBreaks(editor);
+ editor.update(() => $getRoot().append($createParagraphNode()), {
+ discrete: true,
+ });
+ expect(hasLineBreaks()).toBe(false);
+ editor.update(() => $getRoot().append($createParagraphNode()), {
+ discrete: true,
+ });
+ expect(hasLineBreaks()).toBe(true);
+ editor.update(() => $getRoot().clear().append($createParagraphNode()), {
+ discrete: true,
+ });
+ expect(hasLineBreaks()).toBe(false);
+ dispose();
+ });
+ });
+
+ it('detects a trailing soft break before another character is typed', () => {
+ createRoot((dispose) => {
+ const editor = createEditor();
+ const hasLineBreaks = createHasLineBreaks(editor);
+ editor.update(
+ () =>
+ $getRoot().append(
+ $createParagraphNode().append(
+ $createTextNode('Hello'),
+ $createLineBreakNode()
+ )
+ ),
+ { discrete: true }
+ );
+ expect(hasLineBreaks()).toBe(true);
+ dispose();
+ });
+ });
+});
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/utils/create-has-line-breaks.ts b/apps/web/src/lib/core/component/LexicalMarkdown/utils/create-has-line-breaks.ts
new file mode 100644
index 0000000000..a4599d0f96
--- /dev/null
+++ b/apps/web/src/lib/core/component/LexicalMarkdown/utils/create-has-line-breaks.ts
@@ -0,0 +1,21 @@
+import { $getRoot, type LexicalEditor } from 'lexical';
+import { createSignal, onCleanup } from 'solid-js';
+
+/** Track explicit line breaks, including blank paragraphs, for composer layout. */
+export function createHasLineBreaks(editor: LexicalEditor) {
+ const read = () => {
+ const root = $getRoot();
+ return root.getChildrenSize() > 1 || root.getTextContent().includes('\n');
+ };
+
+ const [hasLineBreaks, setHasLineBreaks] = createSignal(
+ editor.getEditorState().read(read)
+ );
+
+ const unsubscribe = editor.registerUpdateListener(({ editorState }) => {
+ setHasLineBreaks(editorState.read(read));
+ });
+
+ onCleanup(unsubscribe);
+ return hasLineBreaks;
+}
diff --git a/apps/web/src/lib/core/component/RecipientSelector.tsx b/apps/web/src/lib/core/component/RecipientSelector.tsx
index f3ad2a18b8..c5f8212418 100644
--- a/apps/web/src/lib/core/component/RecipientSelector.tsx
+++ b/apps/web/src/lib/core/component/RecipientSelector.tsx
@@ -628,7 +628,7 @@ export function RecipientSelector<K extends CombinedRecipientKind>(
: undefined
}
class={cn(
- 'ph-no-capture w-full text-sm offset-2 bg-surface rounded-2xl',
+ 'ph-no-capture w-full text-base offset-2 bg-surface rounded-2xl',
!props.hideBorder && 'border border-edge',
!props.noPadding && 'p-2',
props.class
diff --git a/apps/web/src/lib/core/component/Resize/Resize.tsx b/apps/web/src/lib/core/component/Resize/Resize.tsx
index 8018c8f3f7..66a2848f94 100644
--- a/apps/web/src/lib/core/component/Resize/Resize.tsx
+++ b/apps/web/src/lib/core/component/Resize/Resize.tsx
@@ -565,7 +565,7 @@ function Gutter(props: GutterProps) {
their own spacing and do not draw it. */}
<div
class={cn(
- 'absolute border-thread-rail touch:hidden',
+ 'absolute border-edge-muted touch:hidden',
horizontal() ? 'border-l-[1px]' : 'border-t-[1px]'
)}
style={barStyle('1px')}
diff --git a/apps/web/src/lib/queries/ai/createHomeRecommendations.ts b/apps/web/src/lib/queries/ai/createHomeRecommendations.ts
index b80ea9e903..c6a6acb575 100644
--- a/apps/web/src/lib/queries/ai/createHomeRecommendations.ts
+++ b/apps/web/src/lib/queries/ai/createHomeRecommendations.ts
@@ -1,6 +1,13 @@
import { PERMISSION_IDS } from '@core/constant/permissions';
import { useHasPermission } from '@core/context/user';
-import type { Accessor } from 'solid-js';
+import {
+ type Accessor,
+ createEffect,
+ createMemo,
+ createSignal,
+ on,
+ onCleanup,
+} from 'solid-js';
import {
buildRecommendationPrompt,
pickRecommendations,
@@ -56,8 +63,29 @@ export function createHomeRecommendations(
const items = () => pickRecommendations(smart.data(), fast.data());
+ const [timedOut, setTimedOut] = createSignal(false);
+ const [attempt, setAttempt] = createSignal(0);
+ const waiting = createMemo(
+ () =>
+ enabled() &&
+ items() === undefined &&
+ (fast.isGenerating() || smart.isGenerating())
+ );
+
+ // Bound the visible loading state even if the server never leaves "loading".
+ // Keep accepting a late result; cached items always take precedence.
+ createEffect(
+ on([waiting, attempt], ([pending]) => {
+ setTimedOut(false);
+ if (!pending) return;
+ const timer = setTimeout(() => setTimedOut(true), 45_000);
+ onCleanup(() => clearTimeout(timer));
+ })
+ );
+
const retry = async () => {
if (!enabled()) return;
+ setAttempt((value) => value + 1);
const requests = [fast.refresh()];
if (smartEnabled()) requests.push(smart.refresh());
await Promise.allSettled(requests);
@@ -69,15 +97,13 @@ export function createHomeRecommendations(
/** Smart pass still running — the visible items may improve shortly. */
isThinking: () => smartEnabled() && smart.isGenerating(),
/** Nothing to render yet. */
- isLoading: () =>
- enabled() &&
- items() === undefined &&
- (fast.isGenerating() || smart.isGenerating()),
- /** Every enabled projection failed and there is nothing to show. */
+ isLoading: () => waiting() && !timedOut(),
+ /** Generation failed or timed out, with no cached result to show. */
hasError: () =>
items() === undefined &&
- fast.error() !== undefined &&
- (!smartEnabled() || smart.error() !== undefined),
+ (timedOut() ||
+ (fast.error() !== undefined &&
+ (!smartEnabled() || smart.error() !== undefined))),
retry,
};
}
diff --git a/apps/web/src/lib/queries/ai/projection.ts b/apps/web/src/lib/queries/ai/projection.ts
index 4d40a93f53..42a9a428ec 100644
--- a/apps/web/src/lib/queries/ai/projection.ts
+++ b/apps/web/src/lib/queries/ai/projection.ts
@@ -186,6 +186,10 @@ export function createAIProjection<Schema extends z.ZodType>(
return state;
};
+ // Do not suspend callers while the request is pending: they own the loading
+ // and timeout UI. Retain cached data during refreshes and refetch errors.
+ const state = () => (query.isPending ? undefined : query.data);
+
/** The projection result: schema-parsed object when a schema is set,
* otherwise the raw text. Undefined until a result exists (stale results
* remain visible while refreshing). */
@@ -194,7 +198,7 @@ export function createAIProjection<Schema extends z.ZodType>(
data: z.infer<Schema> | string | undefined;
error?: string;
} => {
- const raw = query.data?.data;
+ const raw = state()?.data;
if (raw === null || raw === undefined) return { data: undefined };
const schema = options().schema;
@@ -226,7 +230,7 @@ export function createAIProjection<Schema extends z.ZodType>(
}
);
- const status = () => query.data?.status;
+ const status = () => state()?.status;
return {
/** Parsed result (see above). */
@@ -241,7 +245,7 @@ export function createAIProjection<Schema extends z.ZodType>(
},
/** Materialization error (from the projection) or request error message. */
error: () =>
- query.data?.error ??
+ state()?.error ??
query.error?.message ??
parsedResult().error ??
undefined,
diff --git a/apps/web/src/lib/queries/ai/tests/createHomeRecommendations.test.ts b/apps/web/src/lib/queries/ai/tests/createHomeRecommendations.test.ts
new file mode 100644
index 0000000000..43a3d58261
--- /dev/null
+++ b/apps/web/src/lib/queries/ai/tests/createHomeRecommendations.test.ts
@@ -0,0 +1,105 @@
+import { createRoot, createSignal } from 'solid-js';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { createHomeRecommendations } from '../createHomeRecommendations';
+import type { HomeRecommendations } from '../homeRecommendations';
+import { createAIProjection } from '../projection';
+
+vi.mock('@core/context/user', () => ({ useHasPermission: () => () => true }));
+vi.mock('../projection', () => ({ createAIProjection: vi.fn() }));
+
+afterEach(() => {
+ vi.useRealTimers();
+ vi.clearAllMocks();
+});
+
+describe('Home recommendation loading', () => {
+ it('keeps the original timeout when projection updates leave it waiting', async () => {
+ vi.useFakeTimers();
+ const [status, setStatus] = createSignal<'cold' | 'loading' | 'refreshing'>(
+ 'cold'
+ );
+ vi.mocked(createAIProjection).mockReturnValue({
+ data: () => undefined,
+ isGenerating: () => ['cold', 'loading', 'refreshing'].includes(status()),
+ error: () => undefined,
+ refresh: vi.fn().mockResolvedValue(undefined),
+ } as unknown as ReturnType<typeof createAIProjection>);
+
+ let dispose!: () => void;
+ const recommendations = createRoot((cleanup) => {
+ dispose = cleanup;
+ return createHomeRecommendations();
+ });
+ try {
+ await vi.advanceTimersByTimeAsync(15_000);
+ setStatus('loading');
+ await vi.advanceTimersByTimeAsync(15_000);
+ setStatus('refreshing');
+ await vi.advanceTimersByTimeAsync(14_999);
+ expect(recommendations.isLoading()).toBe(true);
+ expect(recommendations.hasError()).toBe(false);
+
+ await vi.advanceTimersByTimeAsync(1);
+ expect(recommendations.isLoading()).toBe(false);
+ expect(recommendations.hasError()).toBe(true);
+
+ setStatus('loading');
+ expect(recommendations.isLoading()).toBe(false);
+ expect(recommendations.hasError()).toBe(true);
+ } finally {
+ dispose();
+ }
+ expect(vi.getTimerCount()).toBe(0);
+ });
+
+ it('stops a stalled shimmer, allows retry, and accepts a late result', async () => {
+ vi.useFakeTimers();
+ const [data, setData] = createSignal<HomeRecommendations>();
+ const refresh = vi.fn().mockResolvedValue(undefined);
+ vi.mocked(createAIProjection).mockReturnValue({
+ data,
+ isGenerating: () => true,
+ error: () => undefined,
+ refresh,
+ } as unknown as ReturnType<typeof createAIProjection>);
+
+ let dispose!: () => void;
+ const recommendations = createRoot((cleanup) => {
+ dispose = cleanup;
+ return createHomeRecommendations();
+ });
+ try {
+ expect(recommendations.isLoading()).toBe(true);
+ await vi.advanceTimersByTimeAsync(45_000);
+ expect(recommendations.isLoading()).toBe(false);
+ expect(recommendations.hasError()).toBe(true);
+
+ await recommendations.retry();
+ expect(refresh).toHaveBeenCalledTimes(2);
+ expect(recommendations.isLoading()).toBe(true);
+ expect(recommendations.hasError()).toBe(false);
+ await vi.advanceTimersByTimeAsync(45_000);
+ expect(recommendations.hasError()).toBe(true);
+
+ setData({
+ items: [
+ {
+ entityType: 'email_thread',
+ entityId: 'thread-1',
+ title: 'Review',
+ source: 'Email',
+ action: 'review',
+ reason: 'Needs review',
+ prompt: 'Review this email',
+ },
+ ],
+ });
+ expect(recommendations.items()).toHaveLength(1);
+ expect(recommendations.isLoading()).toBe(false);
+ expect(recommendations.hasError()).toBe(false);
+ } finally {
+ dispose();
+ }
+ expect(vi.getTimerCount()).toBe(0);
+ });
+});
diff --git a/apps/web/src/lib/queries/ai/tests/homeRecommendations.test.ts b/apps/web/src/lib/queries/ai/tests/homeRecommendations.test.ts
index b56ddfcc8e..adede208f9 100644
--- a/apps/web/src/lib/queries/ai/tests/homeRecommendations.test.ts
+++ b/apps/web/src/lib/queries/ai/tests/homeRecommendations.test.ts
@@ -143,6 +143,12 @@ describe('pickRecommendations', () => {
});
describe('recommendationSchema', () => {
+ it('accepts three recommendations', () => {
+ expect(
+ recommendationSchema.safeParse(recommendations('a', 'b', 'c')).success
+ ).toBe(true);
+ });
+
it(`rejects more than ${MAX_RECOMMENDATIONS} recommendations`, () => {
expect(
recommendationSchema.safeParse(recommendations('a', 'b', 'c', 'd'))
diff --git a/apps/web/src/lib/queries/soup/graphql/items.test.ts b/apps/web/src/lib/queries/soup/graphql/items.test.ts
index 4c446b62d9..63f2d34a11 100644
--- a/apps/web/src/lib/queries/soup/graphql/items.test.ts
+++ b/apps/web/src/lib/queries/soup/graphql/items.test.ts
@@ -63,6 +63,7 @@ vi.mock('./ast', () => ({
}));
vi.mock('../transform-utils', () => ({
+ mapApiSoupItemToEntity: vi.fn((item) => item),
mapSoupPageToEntityList: mapSoupPageToEntityListMock,
}));
@@ -146,12 +147,168 @@ function makeFakeClient(): {
describe('createGraphqlSoupAstItemsQuery', () => {
beforeEach(() => {
vi.clearAllMocks();
+ mapSoupPageToEntityListMock.mockImplementation((page) => page.items);
getGraphqlSoupCacheHostMock.mockReturnValue(undefined);
makeGraphqlSoupInputMock.mockReturnValue({
initial: { limit: 50, sortMethod: 'UPDATED_AT' },
});
});
+ it.each([
+ { sort: 'touched_by_me', field: 'touchedAt' },
+ { sort: 'notified_at', field: 'notifiedAt' },
+ { sort: 'updated_at', field: 'updatedAt' },
+ ] as const)(
+ 'preserves fetched coverage through display filtering ($sort)',
+ async ({ sort, field }) => {
+ const fake = makeFakeClient();
+ getGraphqlSoupClientMock.mockReturnValue(fake.client);
+ mapSoupPageToEntityListMock.mockImplementation((page) =>
+ page.items.filter((item: { id: string }) => item.id === 'visible')
+ );
+ const { query, dispose } = createRoot((dispose) => ({
+ dispose,
+ query: createGraphqlSoupAstItemsQuery(
+ () => ({ params: { sort_method: sort }, body: {} }),
+ () => ({ enabled: true })
+ ),
+ }));
+ try {
+ fake.executions[0].next(
+ graphqlSoupPage({
+ items: [
+ { id: 'visible', [field]: '2026-09-10T00:00:00Z' },
+ { id: 'hidden', [field]: '2026-09-08T00:00:00Z' },
+ ],
+ next_cursor: 'next-page',
+ })
+ );
+ expect(query.data()?.entities.map((entity) => entity.id)).toEqual([
+ 'visible',
+ ]);
+ expect(query.data()?.oldestFetchedTimestamp).toBe(
+ Date.parse('2026-09-08T00:00:00Z')
+ );
+
+ const nextPage = query.fetchNextPage();
+ await vi.waitFor(() => expect(fake.executions).toHaveLength(2));
+ fake.executions[1].next(
+ graphqlSoupPage({
+ items: [{ id: 'older-hidden', [field]: '2026-09-01T00:00:00Z' }],
+ next_cursor: null,
+ })
+ );
+ await nextPage;
+ expect(query.data()?.entities.map((entity) => entity.id)).toEqual([
+ 'visible',
+ ]);
+ expect(query.data()?.oldestFetchedTimestamp).toBe(
+ Date.parse('2026-09-01T00:00:00Z')
+ );
+ } finally {
+ dispose();
+ }
+ }
+ );
+
+ it('retains fetched coverage when display filtering hides every row', () => {
+ const fake = makeFakeClient();
+ getGraphqlSoupClientMock.mockReturnValue(fake.client);
+ mapSoupPageToEntityListMock.mockReturnValue([]);
+ const { query, dispose } = createRoot((dispose) => ({
+ dispose,
+ query: createGraphqlSoupAstItemsQuery(
+ () => ({ params: { sort_method: 'notified_at' }, body: {} }),
+ () => ({ enabled: true })
+ ),
+ }));
+ try {
+ fake.executions[0].next(
+ graphqlSoupPage({
+ items: [{ id: 'hidden', notifiedAt: '2026-09-08T00:00:00Z' }],
+ next_cursor: 'next-page',
+ })
+ );
+ expect(query.data()?.entities).toEqual([]);
+ expect(query.data()?.oldestFetchedTimestamp).toBe(
+ Date.parse('2026-09-08T00:00:00Z')
+ );
+ expect(query.hasNextPage()).toBe(true);
+ } finally {
+ dispose();
+ }
+ });
+
+ it('keeps fetched timestamp coverage separate from older local cache candidates', async () => {
+ const fake = makeFakeClient();
+ getGraphqlSoupClientMock.mockReturnValue(fake.client);
+ getGraphqlSoupCacheHostMock.mockReturnValue({
+ currentRevision: async () => REVISION_0,
+ entityFilter: entityFilterMock,
+ onCacheChanged: () => () => {},
+ onCacheGenerationChanged: () => () => {},
+ });
+ entityFilterMock.mockResolvedValue({
+ kind: 'reconciled',
+ revision: REVISION_0,
+ keys: ['GraphqlSoupDocument:cached'],
+ retainedKeys: [],
+ optimistic: false,
+ });
+ readRecordsByKeysMock.mockResolvedValue({
+ revision: REVISION_0,
+ records: [
+ {
+ recordKey: 'GraphqlSoupDocument:cached',
+ record: {
+ __typename: 'GraphqlSoupDocument',
+ id: 'cached',
+ type: 'document',
+ name: 'Cached',
+ touchedAt: '2025-01-01T00:00:00Z',
+ },
+ },
+ ],
+ });
+ const { query, dispose } = createRoot((dispose) => ({
+ dispose,
+ query: createGraphqlSoupAstItemsQuery(
+ () => ({ params: { sort_method: 'touched_by_me' }, body: {} }),
+ () => ({ enabled: true })
+ ),
+ }));
+ try {
+ await vi.waitFor(() =>
+ expect(query.data()?.entities[0]?.id).toBe('cached')
+ );
+ expect(query.data()?.oldestFetchedTimestamp).toBeUndefined();
+ fake.executions[0].next(
+ graphqlSoupPage({
+ items: [
+ {
+ id: 'fetched',
+ type: 'document',
+ name: 'Fetched',
+ touchedAt: '2026-09-08T00:00:00Z',
+ },
+ ],
+ next_cursor: 'next-page',
+ }),
+ { source: 'normalized-cache-hit', revision: REVISION_0 }
+ );
+ await vi.waitFor(() => {
+ expect(
+ query.data()?.entities.some((entity) => entity.id === 'cached')
+ ).toBe(true);
+ expect(query.data()?.oldestFetchedTimestamp).toBe(
+ Date.parse('2026-09-08T00:00:00Z')
+ );
+ });
+ } finally {
+ dispose();
+ }
+ });
+
it('paginates never-visited Mail filters offline without a server cursor or stale preview timestamps', async () => {
const online = vi.spyOn(navigator, 'onLine', 'get').mockReturnValue(false);
const fake = makeFakeClient();
diff --git a/apps/web/src/lib/queries/soup/graphql/items.ts b/apps/web/src/lib/queries/soup/graphql/items.ts
index d4758b15f8..98fd5d4cc9 100644
--- a/apps/web/src/lib/queries/soup/graphql/items.ts
+++ b/apps/web/src/lib/queries/soup/graphql/items.ts
@@ -46,7 +46,11 @@ import {
untrack,
} from 'solid-js';
import type { SoupAstBody, SoupAstItemsData, SoupAstParams } from '../items';
-import { mapSoupPageToEntityList } from '../transform-utils';
+import { soupPageTimestamp } from '../page-timestamp';
+import {
+ mapApiSoupItemToEntity,
+ mapSoupPageToEntityList,
+} from '../transform-utils';
import { makeGraphqlSoupInput } from './ast';
import { isCachedMailView, materializeMailView } from './mail-view';
import {
@@ -442,6 +446,7 @@ export function createGraphqlSoupAstItemsQuery(
ServerProjection
>(() => {
const firstInput = firstPageInput();
+ const sortMethod = args().params.sort_method;
const queryOptions = options();
const showSupportedForeignEntities =
queryOptions.showSupportedForeignEntities;
@@ -476,18 +481,27 @@ export function createGraphqlSoupAstItemsQuery(
recordAuthority('network');
finishStaleFallback('network');
},
- select: ({ pages }) => ({
- records: pages.flatMap((page) => page.user.soup.items),
- data: {
- entities: pages.flatMap((page) =>
- mapSoupPageToEntityList(mapGraphqlSoupPage(page), {
- instructionsIdQuery,
- showSupportedForeignEntities,
- })
- ),
- groups: undefined,
- },
- }),
+ select: ({ pages }) => {
+ const mappedPages = pages.map(mapGraphqlSoupPage);
+ const oldestFetchedTimestamp = soupPageTimestamp(
+ mappedPages.flatMap((page) => page.items.map(mapApiSoupItemToEntity)),
+ sortMethod
+ );
+ const entities = mappedPages.flatMap((page) =>
+ mapSoupPageToEntityList(page, {
+ instructionsIdQuery,
+ showSupportedForeignEntities,
+ })
+ );
+ return {
+ records: pages.flatMap((page) => page.user.soup.items),
+ data: {
+ entities,
+ groups: undefined,
+ oldestFetchedTimestamp,
+ },
+ };
+ },
};
});
@@ -586,7 +600,15 @@ export function createGraphqlSoupAstItemsQuery(
);
return {
- data: displayData,
+ data: createMemo(() => {
+ const data = displayData();
+ return (
+ data && {
+ ...data,
+ oldestFetchedTimestamp: query.data?.data.oldestFetchedTimestamp,
+ }
+ );
+ }),
error,
isSupported,
isEnabled: () => query.isEnabled,
diff --git a/apps/web/src/lib/queries/soup/items.transport-refetch.test.ts b/apps/web/src/lib/queries/soup/items.transport-refetch.test.ts
index a6fd4778b6..8eef1eac13 100644
--- a/apps/web/src/lib/queries/soup/items.transport-refetch.test.ts
+++ b/apps/web/src/lib/queries/soup/items.transport-refetch.test.ts
@@ -1,8 +1,10 @@
+import { useInfiniteQuery } from '@tanstack/solid-query';
import { createRoot } from 'solid-js';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
const testState = vi.hoisted(() => ({ graphqlEnabled: false }));
const restRefetch = vi.hoisted(() => vi.fn(async () => undefined));
+const fetchSoup = vi.hoisted(() => vi.fn());
const flatQuery = vi.hoisted(() => makeGraphqlQuery(false));
const groupedQuery = vi.hoisted(() => makeGraphqlQuery(true));
@@ -32,7 +34,9 @@ vi.mock('@app/lib/analytics/posthog', () => ({
vi.mock('@core/constant/featureFlags', () => ({
enableGraphqlSoup: { key: 'enable-graphql-soup' },
}));
-vi.mock('@core/util/result', () => ({ throwOnErr: vi.fn() }));
+vi.mock('@core/util/result', () => ({
+ throwOnErr: vi.fn(async (run: () => Promise<unknown>) => await run()),
+}));
vi.mock('@queries/soup/grouped/api', () => ({
groupedSortMethod: vi.fn(),
makeGroupComparator: vi.fn(),
@@ -47,14 +51,19 @@ vi.mock('@queries/soup/keys', () => ({
vi.mock('@queries/soup/transform-utils', () => ({
isDisplayableSoupItem: vi.fn(() => true),
isInstructionsMdDoc: vi.fn(() => false),
- mapApiSoupItemToEntity: vi.fn(),
- mapSoupPageToEntityList: vi.fn(),
+ mapApiSoupItemToEntity: vi.fn((item) => ({
+ ...item.data,
+ touchedAt: item.touched_at,
+ })),
+ mapSoupPageToEntityList: vi.fn((page) =>
+ page.items.map((item: { data: unknown }) => item.data)
+ ),
}));
vi.mock('@queries/storage/instructions-md', () => ({
useInstructionsMdIdQuery: vi.fn(() => ({})),
}));
vi.mock('@service-storage/client', () => ({
- storageServiceClient: { getSoupItems: vi.fn() },
+ storageServiceClient: { getSoupItems: vi.fn(), getSoupAstItems: fetchSoup },
}));
vi.mock('@tanstack/solid-query', () => ({
useInfiniteQuery: vi.fn(() => ({
@@ -81,7 +90,12 @@ vi.mock('./graphql/grouped-items', () => ({
}));
import { refreshActiveGraphqlSoupQueries } from './graphql/active-queries';
-import { type SoupAstItemsQuery, useSoupAstItemsQuery } from './items';
+import {
+ type SoupAstItemsData,
+ type SoupAstItemsPage,
+ type SoupAstItemsQuery,
+ useSoupAstItemsQuery,
+} from './items';
let disposeRoot: (() => void) | undefined;
@@ -113,6 +127,61 @@ describe('Soup refetch transport selection', () => {
disposeRoot = undefined;
});
+ it('preserves fetched page coverage when optimistic inserts change cached membership', async () => {
+ const item = {
+ tag: 'chat',
+ frecency_score: 0,
+ is_favorited: false,
+ touched_at: '2026-09-08T00:00:00Z',
+ data: {
+ id: 'fetched',
+ name: 'Fetched',
+ ownerId: 'alice',
+ isPersistent: true,
+ properties: [],
+ createdAt: '2026-09-08T00:00:00Z',
+ updatedAt: '2026-09-08T00:00:00Z',
+ },
+ } as const;
+ fetchSoup.mockResolvedValue({ items: [item], next_cursor: 'next' });
+ createRoot((dispose) => {
+ disposeRoot = dispose;
+ useSoupAstItemsQuery(() => ({
+ params: { sort_method: 'touched_by_me' },
+ body: {},
+ transport: 'rest',
+ }));
+ });
+ const createOptions = vi.mocked(useInfiniteQuery).mock.calls.at(-1)?.[0];
+ if (!createOptions) throw new Error('REST query was not created');
+ const options = createOptions() as unknown as {
+ queryFn: (context: {
+ signal: AbortSignal;
+ pageParam: null;
+ }) => Promise<SoupAstItemsPage>;
+ select: (data: { pages: SoupAstItemsPage[] }) => SoupAstItemsData;
+ };
+ const page = await options.queryFn({
+ signal: new AbortController().signal,
+ pageParam: null,
+ });
+ if (page.kind !== 'flat') throw new Error('Expected a flat page');
+ page.items.push({
+ ...item,
+ touched_at: '2025-01-01T00:00:00Z',
+ data: {
+ ...item.data,
+ properties: [],
+ id: 'cached',
+ },
+ });
+ const selected = options.select({ pages: [page] });
+ expect(selected.entities).toHaveLength(2);
+ expect(selected.oldestFetchedTimestamp).toBe(
+ Date.parse('2026-09-08T00:00:00Z')
+ );
+ });
+
it('uses REST refetch and skips mutation-driven GraphQL refresh when the flag is off', async () => {
const query = mountAutoTransportQuery();
diff --git a/apps/web/src/lib/queries/soup/items.ts b/apps/web/src/lib/queries/soup/items.ts
index cf88847dee..cf8763ada8 100644
--- a/apps/web/src/lib/queries/soup/items.ts
+++ b/apps/web/src/lib/queries/soup/items.ts
@@ -35,6 +35,7 @@ import { queryClient } from '../client';
import { registerActiveGraphqlSoupQuery } from './graphql/active-queries';
import { createGraphqlGroupedSoupAstItemsQuery } from './graphql/grouped-items';
import { createGraphqlSoupAstItemsQuery } from './graphql/items';
+import { soupPageTimestamp } from './page-timestamp';
import {
createSoupRequestSignal,
SOUP_NETWORK_QUERY_OPTIONS,
@@ -98,12 +99,15 @@ export type SoupAstItemsFlatPage = {
kind: 'flat';
items: SoupApiItem[];
nextCursor: string | null;
+ oldestFetchedTimestamp?: number;
};
export type SoupAstItemsData = {
/** Local Mail results cover synchronized metadata, not the entire mailbox. */
cachedMail?: boolean;
entities: EntityData[];
+ /** Descending page coverage, independent of optimistic/local row membership. */
+ oldestFetchedTimestamp?: number;
groups: GroupMeta[] | undefined;
/** Raw API item pool. Only present when query is grouped. */
itemsById?: SoupAstItemsGroupedPage['items'];
@@ -227,6 +231,10 @@ const useRestSoupAstItemsQuery = (
kind: 'flat',
items: response.items,
nextCursor: response.next_cursor ?? null,
+ oldestFetchedTimestamp: soupPageTimestamp(
+ response.items.map(mapApiSoupItemToEntity),
+ params.sort_method
+ ),
};
},
initialPageParam: null as string | null,
@@ -282,7 +290,17 @@ const useRestSoupAstItemsQuery = (
);
});
- return { entities, groups: undefined };
+ const pageTimestamps = data.pages.flatMap((page) =>
+ page.kind === 'flat' && page.oldestFetchedTimestamp !== undefined
+ ? [page.oldestFetchedTimestamp]
+ : []
+ );
+ return {
+ entities,
+ groups: undefined,
+ oldestFetchedTimestamp:
+ pageTimestamps.length > 0 ? Math.min(...pageTimestamps) : undefined,
+ };
},
enabled: options?.().enabled,
// Do not spin through background retries while the explicit load-error
diff --git a/apps/web/src/lib/queries/soup/page-timestamp.test.ts b/apps/web/src/lib/queries/soup/page-timestamp.test.ts
new file mode 100644
index 0000000000..c77207f1df
--- /dev/null
+++ b/apps/web/src/lib/queries/soup/page-timestamp.test.ts
@@ -0,0 +1,48 @@
+import type { EntityData } from '@entity/types/entity';
+import { describe, expect, it } from 'vitest';
+import { soupPageTimestamp } from './page-timestamp';
+
+const entity: EntityData = {
+ type: 'chat',
+ id: 'chat',
+ name: 'Chat',
+ ownerId: 'alice',
+ updatedAt: '2026-09-10T12:00:00Z',
+ touchedAt: '2026-09-08T12:00:00Z',
+ notifiedAt: '2026-09-09T12:00:00Z',
+};
+
+describe('fetched Soup page coverage', () => {
+ it('uses the requested source timestamp rather than content freshness', () => {
+ expect(soupPageTimestamp([entity], 'touched_by_me')).toBe(
+ Date.parse(entity.touchedAt as string)
+ );
+ expect(soupPageTimestamp([entity], 'notified_at')).toBe(
+ Date.parse(entity.notifiedAt as string)
+ );
+ expect(soupPageTimestamp([entity], 'updated_at')).toBe(
+ Date.parse(entity.updatedAt as string)
+ );
+ });
+
+ it('uses the oldest source stamp and skips unstamped cache inserts', () => {
+ expect(
+ soupPageTimestamp(
+ [
+ entity,
+ { ...entity, id: 'older', touchedAt: '2026-09-01T00:00:00Z' },
+ { ...entity, id: 'unstamped', touchedAt: undefined },
+ ],
+ 'touched_by_me'
+ )
+ ).toBe(Date.parse('2026-09-01T00:00:00Z'));
+ });
+
+ it('keeps unknown and nonchronological coverage undefined', () => {
+ expect(soupPageTimestamp([], 'notified_at')).toBeUndefined();
+ expect(
+ soupPageTimestamp([{ ...entity, notifiedAt: undefined }], 'notified_at')
+ ).toBeUndefined();
+ expect(soupPageTimestamp([entity], 'frecency')).toBeUndefined();
+ });
+});
diff --git a/apps/web/src/lib/queries/soup/page-timestamp.ts b/apps/web/src/lib/queries/soup/page-timestamp.ts
new file mode 100644
index 0000000000..36f1a9cfa9
--- /dev/null
+++ b/apps/web/src/lib/queries/soup/page-timestamp.ts
@@ -0,0 +1,25 @@
+import type { EntityData } from '@entity/types/entity';
+import type { Params } from '@service-storage/generated/schemas/params';
+import { match } from 'ts-pattern';
+
+/** Timestamp coverage of a fetched descending page, before local cache inserts
+ * or view filters change its membership. Unsupported sorts have no time bound. */
+export function soupPageTimestamp(
+ entities: EntityData[],
+ sort: Params['sort_method']
+): number | undefined {
+ let oldest = Infinity;
+ for (const entity of entities) {
+ const timestamp = match(sort)
+ .with('notified_at', () => entity.notifiedAt)
+ .with('touched_by_me', () => entity.touchedAt)
+ .with(
+ 'updated_at',
+ () => entity.sortTs ?? entity.updatedAt ?? entity.createdAt
+ )
+ .otherwise(() => undefined);
+ if (timestamp == null) continue;
+ oldest = Math.min(oldest, new Date(timestamp).getTime());
+ }
+ return Number.isFinite(oldest) ? oldest : undefined;
+}
diff --git a/apps/web/src/lib/queries/storage/document-metadata.ts b/apps/web/src/lib/queries/storage/document-metadata.ts
index eba522b9d1..79c4115e12 100644
--- a/apps/web/src/lib/queries/storage/document-metadata.ts
+++ b/apps/web/src/lib/queries/storage/document-metadata.ts
@@ -8,7 +8,7 @@ import { entityKeys } from './keys';
const STALE_TIME = 60 * 1000;
const GC_TIME = 10 * 60 * 1000;
-async function fetchDocumentMetadata(
+export async function fetchDocumentMetadata(
documentId: string
): Promise<DocumentMetadata> {
const result = await storageServiceClient.getDocumentMetadata({ documentId });
diff --git a/docs/AGENT_GUIDE/ai-chat.md b/docs/AGENT_GUIDE/ai-chat.md
index 8e5709e1bf..94b67ff0fd 100644
--- a/docs/AGENT_GUIDE/ai-chat.md
+++ b/docs/AGENT_GUIDE/ai-chat.md
@@ -38,6 +38,8 @@ Ask AI itself, the composer stays above the software keyboard; the list reserves
space for it so its last row remains reachable. This also follows focus when a
hardware keyboard is attached.
The area behind the composer is transparent, without a bottom gradient overlay.
+The composer has one editable field. Its placeholder appears only while empty;
+placeholder updates and disabled-state changes preserve the editor and draft.
Almost every list surface (Home, Agents, Files, Tasks, Customers, Email) has a bottom
composer with placeholder **`Ask AI, @mention anything`**. Click it, `type_text` the message,
@@ -154,7 +156,8 @@ documents:
Open a doc → side panel `Actions` → `Ask Macro`. Opens a chat pane with the document already
attached as context (it appears as a link chip in the composer). New-chat pane shows tips:
`@mention anything` to attach entities, `Ctrl+Enter` to send in the background (you get
-notified when the AI responds).
+notified when the AI responds). Background sends from Home preserve the submitted
+tool selection.
## Composer anatomy (a11y)
@@ -175,17 +178,23 @@ an additional 2px of space below them; mobile dock spacing is unchanged.
On mobile the production AI, new agent, and channel composers share rounded
glass chrome, text padding, and a footer toolbar with a circular Send button.
The production AI composer has an `Attach files` paperclip, `Ask AI…` placeholder,
-and compact model picker. Both AI systems keep model selection in the toolbar
+and compact model picker. On desktop, `Attach files` opens the file picker directly; use `@` to reference existing workspace items. Both AI systems keep model selection in the toolbar
and expand with longer drafts. The new agent editor supports context via `@`
mentions; its existing attachment capabilities are unchanged. Stop and queued
message controls remain available.
-User messages in both AI systems appear in right-aligned, filled gray bubbles
-with rounded corners, including on mobile. Long prompts wrap within the bubble;
+User messages in both AI systems appear in right-aligned bubbles with rounded
+corners, including on mobile. In dark mode, their fill and text follow the active
+theme; Macro Dark uses a dark gray fill and white text. Long prompts wrap within the bubble;
production chat retains its Show more/Show less and editing controls.
## Waiting for a response
+On desktop, email drafts embedded in chat use the same rounded, elevated surface
+as email blocks: an opaque background, subtle border and shadow, and a raised
+rim in dark mode. The recipients, subject, body, and send controls stay inside
+that card. Touch-device styling is unchanged.
+
The reliable completion signal is the disappearance of the `Stop generating` button — poll
with `evaluate_script`. Do not wait on response text: the page displays
`Time to first token: N s` and doc content that easily false-matches `wait_for` patterns.
diff --git a/docs/AGENT_GUIDE/channels.md b/docs/AGENT_GUIDE/channels.md
index 97778aa7fc..9e67f34e26 100644
--- a/docs/AGENT_GUIDE/channels.md
+++ b/docs/AGENT_GUIDE/channels.md
@@ -26,12 +26,25 @@ session-specific.
## Message composer
-Desktop composer and conversation body text use 15px type. Mobile keeps its
-existing text sizing.
+Composer and conversation body text use `text-base` (15px at the default root
+size) on desktop and mobile. The shared scale uses 14px for `text-sm` and 12px
+for `text-xs`, with accessibility text scaling preserved.
Desktop message text uses a 16px horizontal inset and a compact gap above the
toolbar, consistent at narrow and wide composer widths.
+The new-message compose screen and channel message/reply inputs use the same
+attachment and send controls on mobile and desktop, with no format toggle.
+iOS uses the native media attachment picker.
+Short drafts place attachment, message text, and send on one row on both mobile
+and desktop. Multiline drafts and attachments expand the composer with its
+actions below the editor.
+When checking this transition, add and remove a line break or attachment and
+confirm the draft and caret position survive. The attachment and send controls
+should remain usable in both layouts, including when editing an existing message.
+The iOS share sheet keeps its editor above the attachment and formatting controls.
+Check this arrangement at both phone and tablet widths.
+
The shared `@` menu also offers `Recent agent sessions` after Channels and
before Companies (the latest 500 accessible sessions, searchable by title or
persona). These inline chips show the shared
@@ -46,7 +59,7 @@ to update titles and access.
Placeholder `Type @ to share with #<name>`. Click it, `type_text`, press Enter to send.
The message renders immediately with avatar, email, timestamp. Composer extras: `Attach
-files`, `Format`, a `Task` switch (turns the message into a task), `Send message` button.
+files` and the `Send message` button. Replies also include a close-reply control.
Hover a message for its action menu. `Reply` on a top-level message opens that thread. On
an existing thread reply, it inserts a one-line reply-target reference into the composer;
diff --git a/docs/AGENT_GUIDE/documents.md b/docs/AGENT_GUIDE/documents.md
index cbbc6539c0..0b4ee3e718 100644
--- a/docs/AGENT_GUIDE/documents.md
+++ b/docs/AGENT_GUIDE/documents.md
@@ -116,8 +116,11 @@ access to the title and property controls.
## Comments (Discussion)
-On desktop, below the editor: `Discussion` section with a `Leave a comment...` contenteditable, buttons
-`Attach images`, `Format`, and `Send comment` (disabled until text exists). Click the
+Below the editor: `Discussion` section with a `Leave a comment...` contenteditable.
+Desktop uses the same compact 15px composer as channels and AI chat, with an
+an `Attach images` paperclip that opens the image picker directly. Shift+Enter
+expands the editor above the controls. Touch keeps separate `Attach images` and
+`Format` buttons. `Send comment` is disabled until text exists. Click the
composer, `type_text`, then click `Send comment` (Enter also submits). The comment renders
above the composer with author + timestamp. `@`-mentions in comments notify the mentioned
user. On mobile, the new-comment composer is docked above the navigation bar,
@@ -139,8 +142,12 @@ becomes empty again, the section disappears. Desktop keeps the empty section
and inline input.
Comments anchored to selected text open in a floating margin card on desktop and
-a `Comments` drawer on touch devices. New comments, replies, and edits use the
-composer surface on desktop; touch inputs use the drawer's background directly.
+a `Comments` drawer on touch devices. Hovering a desktop card reveals its actions
+without changing the card size or header text wrapping. New comments, replies,
+and edits use plain inputs on the card or drawer's background. The pinned reply
+keeps at least 16px of
+bottom clearance above the drawer's curve, including while the keyboard is open,
+and accounts for the home-indicator safe area when the keyboard is closed.
## Side panel
diff --git a/docs/AGENT_GUIDE/navigation.md b/docs/AGENT_GUIDE/navigation.md
index a4681b59bc..507f538635 100644
--- a/docs/AGENT_GUIDE/navigation.md
+++ b/docs/AGENT_GUIDE/navigation.md
@@ -6,7 +6,7 @@
| --- | --- |
| `/app` | Redirects to inbox |
| `/app/welcome` | Login page (when unauthenticated) |
-| `/app/component/inbox` | Unified inbox |
+| `/app/component/inbox` | Home (notifications + recent activity) |
| `/app/component/mail` | Email client |
| `/app/component/channels` | Channels list |
| `/app/component/documents` | Files (documents list) |
@@ -15,7 +15,7 @@
| `/app/component/calls` | Calls list |
| `/app/component/companies` | Customers (CRM; needs a team) |
| `/app/component/activity` | Activity heatmap + feed |
-| `/app/component/home` | Home (AI-first landing) |
+| `/app/component/home` | Assistant (AI-first landing) |
| `/app/calendar/view` | Calendar |
| `/app/md/<uuid>` | A document |
| `/app/chat/<uuid>` | A standalone AI chat |
@@ -42,21 +42,37 @@ second block instance.
new split, including when Search is already active. This left-click menu shares
its surface and item styling with the sidebar right-click menus, in both the
compact rail and expanded sidebar.
-- Nav: `Go to Home`, `Go to Getting Started`, `Go to Notifications`, `Go to Recent`, `Go to Activity`.
+- Nav: `Go to Assistant`, `Go to Getting Started`, `Go to Home`, `Go to Recent`, `Go to Activity`.
- Workspace: `Go to Email`, `Go to Channels`, `Go to Calls`, `Go to Files`, `Go to Tasks`,
`Go to Calendar`, `Go to Agents`, `Go to Customers`.
- Then `Favorites` (pinned items) and `Latest` (recent channels/DMs with an `Unread` switch).
- Bottom: button named after the user's email — menu with `Command menu (Ctrl K)`,
`Settings (Ctrl ;)`, `Log out`.
-With the new app views enabled, the outer sidebar is an icon rail. Notifications,
+With the new app views enabled, the outer sidebar is an icon rail. Its tooltips
+use the standard 400 ms hover delay and 300 ms grace period between items. Home,
Email, and Chat show a small accent dot when the loaded data contains an unread
-item. Notifications uses Signal; Email uses Important across all linked inboxes.
+item. Home uses Signal; Email uses Important across all linked inboxes.
Noise does not light either dot. These are presence indicators, not counts; they
do not fetch additional pages to find every unread item. Opening a view alone does
not clear its dot — reading or completing the represented items does. The button's
accessible description is `Unread items` while its dot is active.
+Home's inner rail starts with a full-width **New chat** plus button that returns
+to Home's starting pane without creating a chat. Email and Tasks use the same
+pill styling and top placement for **New email** and **New task**, replacing
+the sidebar title bars. When multiple desktop splits are open, a **Close** (X)
+button appears beside each sidebar's New button and closes that split. The last
+logical split has no close button; mobile chrome is unchanged.
+These buttons and Home items activate on primary-button
+press; keyboard activation remains supported. Home, Chat, Email,
+Tasks, and other views using the shared inner
+sidebar layout default to 256px; manually resized Chat widths remain saved.
+
+Email, Tasks, and Agents use the same sidebar rows, including favorites, tags,
+inboxes, and recent agent chats: 32px high on desktop and 44px on touch devices,
+with regular-weight labels and consistent icon spacing.
+
## Favorites
Use an entity's command/context menu to add or remove it from Favorites; drag rows
@@ -73,7 +89,7 @@ changes roll back rather than becoming committed local favorites.
## Create menu
-On mobile, the bottom dock fits fixed-width buttons in this order: Notifications,
+On mobile, the bottom dock fits fixed-width buttons in this order: Home,
Calendar, Email, Channels, Files, Agents, Tasks, Calls, and CRM (when enabled). Calendar appears in the
dock and search scope pills only when the calendar UI flag is enabled.
Resizing the screen moves views between the dock
@@ -175,7 +191,9 @@ category, Esc closes. The category strip and footer have transparent backgrounds
- `Ctrl/Cmd+K` — jump to anything by name.
- `c` then `d`/`t`/`e`/`m`/`a` — create doc / task / email / channel / AI chat.
Single-letter shortcuts only work when no editor has focus; press `Escape` first.
-- `/` — search everything. `j`/`k` — move in lists. `e` — mark done. `g` then `i` — inbox.
+- `/` — search everything. `j`/`k` — move in lists. `e` — mark done.
+- `g` then `h` — Home (inbox); `g` then `i` remains an alias. Assistant is
+ available through its sidebar link or the `Go to Assistant` command.
- In Email and Tasks search, `Escape` returns focus to the list and keeps the query.
Use the search field's clear button to clear it.
- Splits: `` ` `` split, `Shift+H`/`Shift+L` move focus, `Shift+Esc` maximize.
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index 6287f55806..cf7f72c60e 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -52,17 +52,90 @@ that entity's last operation in the batch. Emitted `SoupUpdated` items are non-n
If viewer-scoped hydration finds no item, the backend logs and omits that update;
it does not imply deletion. Only explicit `GraphqlCacheDeletion` events remove records.
-## Notifications — `/app/component/inbox`
-
-Unified triage list (emails, channel messages, task assignments, doc mentions, agent
-results). Tabs are `Signal` (default, AI-filtered "needs attention") and `Noise`, with a
-Filter menu. On desktop, selecting a row renders its block in the inline preview beside
-the notification sidebar. With the `enable-inbox-notified-sort` flag on, both tabs order
-rows and date headers by when you were last notified about the item, so a fresh comment
-on an old task sits under "Today"; with it off they order by content recency. Keyboard:
-`j`/`k` move between rows and update the preview; alternate activation and Shift-click
-open a new split.
-On mobile, the filters float above the full-height scrolling list. On iOS, rows
+## Home — `/app/component/inbox`
+
+With the new app views enabled, Home defaults to an unfiltered Signal feed merging
+notifications with Activity's `touched_by_me` recents, including sent emails and
+AI chats. Each entity appears once, ordered by its latest notification or own
+action. On desktop, there are no Signal/Noise tabs or filter menu. A **Home** heading
+labels the top left of the block, matching the **Email**, **Tasks**, **Chat**, and
+**Agents** sidebar headings. The full-width **New chat** plus pill below the heading clears the preview and returns to the Home
+starting pane; it does not create a chat. Email and Tasks have matching top pills
+for **New email** and **New task**.
+
+The Inbox provider honors an explicit initial tab, search, grouping, and facet
+selection. Returning through split history still resets the view to the unfiltered
+Signal defaults.
+
+Channel thread replies remain separate Home entries from their parent channel,
+using single-line rows and a reply arrow icon on desktop and touch devices, labeled
+with the sender and channel (for example, **Peter in #battlefield**). Channel names
+prefer the current channel cache, then a matching thread notification's name,
+then **Unknown channel** if neither source has a name. Selecting a
+thread opens that thread in the channel preview; Shift-click opens it in a split.
+
+Items in the 256px desktop rail use single-line pills with 16px icons: profile photos for
+DMs and model logos for AI chats (Claude sunburst or ChatGPT knot). Other items
+use the same glyphs as entity rows elsewhere: document file-type and
+task/snippet/skill variants, hashes for channels, read/unread envelopes or
+calendar invites for email, sparkles for agents, folders for projects, and alarms
+for reminders. Pull requests retain open, merged, and closed status glyphs and
+colors; unknown foreign sources use the generic file icon.
+There are no title tooltips, and timestamps are
+visible only while hovering the row. An unread
+dot remains visible. Click a row to preview it; `j`/`k` navigate and update the
+preview; alternate activation and Shift-click open a split.
+
+On desktop, before selecting a row, the main pane shows a centered single-line chat
+composer under “What should we get done in Macro?”. Attachment, text, model, and
+send controls share one row; longer prompts expand the input as needed.
+Home uses the shared app font and composer theme tokens; suggestion text and
+hover states use the same semantic colors as other app surfaces.
+Type in “Type @ to reference / for skills”, use the attachment button for
+attachments and the model menu to choose a model, then press Enter or Send to
+create and open an AI chat. If chat creation fails, the submitted text and attachments
+are restored, including before a chat-limit paywall opens. The input stays 32px above the vertical center as suggestions load. Up to three cached AI
+suggestions appear below the
+composer, using the existing fast/smart recommendation projections. Compact rows
+use one line: reason — Phosphor icon and item name, followed by Open, all at the same font size. Clicking a
+suggestion fills the input and replaces its context attachments without sending;
+the Open action opens its source item in a new split, preserving the editor type
+for tasks, skills, snippets, and other documents. Suggestion loading/errors
+are isolated from the input. If generation stalls for 45 seconds, the shimmer
+is replaced with a retry action; a late result still appears automatically.
+Generation status updates do not extend that deadline. Retry starts a fresh
+45-second wait. Shift+Enter adds a line. Selecting a Home row replaces
+the composer with its preview. Mobile continues to show the activity list alone.
+
+AI chat, agent, and channel message bodies use 15px text, including thread replies.
+Desktop AI chats, agents, and channel composers share Home's rounded composer
+surface: a muted dark fill or a white light-mode surface with a soft shadow,
+15px input text, and circular controls. Composer geometry is scaled to 15/16
+of the original design (48.75px single-line height); the Home composer is at most
+720px wide. In narrower desktop splits, the Home heading wraps and the composer
+shrinks to the available pane width; suggestion text truncates while Open stays
+visible. Plain channel messages use a compact row;
+multiline messages, formatting, and attachments retain a full-width editor and
+footer. Switching between compact and expanded layouts keeps the same editor and
+draft. Mobile composer styling and send behavior are unchanged.
+
+Sections are Last few minutes (under five minutes), Last hour, This evening
+(6pm onward), This afternoon (noon–6pm), This morning (6am–noon), Earlier today,
+Yesterday, and the existing older-date groups. These use local time and refresh
+every 30 seconds without a new action. Scrolling near the bottom automatically
+loads older items. Home buffers older rows until both notification and own-activity
+pages have loaded through their timestamp, then advances the shallower feed first.
+Fetched rows still advance this boundary when display filters hide them;
+older cache-only rows do not.
+Rows tied at a page boundary appear together, so loading another page does not
+insert older history above already displayed rows. Live actions and refreshes
+can still reorder rows. Short or fully filtered pages continue loading until the list
+fills or there are no more results. A failed
+source shows a retry notice while the other source stays usable. Document typing
+alone is not yet attributed by Activity; Home reflects the actions the existing
+Activity system records.
+
+On mobile, Signal/Noise tabs and filters float above the full-height scrolling list. On iOS, rows
fade underneath the filters and status bar using the shared top edge gradient.
Notifications have three lifecycle states: `unseen`, `seen`, and `done`. Active means
@@ -97,6 +170,10 @@ header exposes Share and the task Details/Properties panel. Shift-click opens
the task in a new split instead. Keyboard navigation moves list focus without
opening a task until activation.
+The desktop `Create` → `Task` modal uses the standard dialog panel, circular
+icon controls, and a pill-shaped `Create Task` button with 16px outer padding.
+The mobile task drawer retains its existing layout.
+
## Email — `/app/component/mail`
Full email client. Tabs: `Signal` / `Noise` / `Sent` / `Calendar` / `Drafts` / `Shared` /
@@ -169,8 +246,16 @@ conversation. A link with `?email_message_id=<message-id>` reveals that message.
Collapsed thread cards use a compact text snippet; expanding mounts the message
body and its attachments. On phones, messages form flat rows with horizontal
separators and 16px side gutters; collapsed previews show one line. Desktop
-keeps the framed cards.
+keeps rounded cards matching the chat composer: soft shadows in light mode,
+the same subtle 3D rim in dark mode, and a faint hover tint. Desktop selection
+does not add an accent-colored ring; keyboard focus has a neutral outline.
Replies appear inline on desktop and in a composer drawer on touch devices.
+Desktop draft bodies and app-controlled message text use 15px, matching channels.
+HTML messages with preserved sender typography retain their explicit sizes.
+Desktop reply actions sit together at the bottom right: discard, attach, schedule,
+then Send, with circular hover backgrounds inside the card's 16px padding.
+Standalone compose uses one right-aligned row inside its 16px content padding:
+delete, attach, format, schedule, and send. Touch compose uses its header toolbar.
`R` and `Alt+R` (`Option+R` on macOS) open reply-all for the selected message,
or the latest message when none is selected. `F` opens a forward and focuses To.
While an editable field is focused, Escape is handled by that field before the
@@ -341,6 +426,10 @@ Board/List views, `Company` create button. Requires a team ("Join a team to enab
## Activity — `/app/component/activity`
+Requires authentication and the `enable-activity-feed` flag. Direct navigation and
+restored splits wait for flags to load; when disabled, they redirect to Home
+(`/app/component/inbox`) without loading the activity feed.
+
GitHub-style actions heatmap (one a11y node per day — makes snapshots huge; prefer saving the
snapshot to a file), then a `Most active` section header (styled like the feed's day headers)
over a wrapping row of pill chips (entity icon, name, action count; click opens the entity,
@@ -455,9 +544,11 @@ Those rows are available on the next fetch/refetch. Signal delivery and the exis
staff/customer eligibility rules are unchanged; no browser eligibility request is needed.
Discussion composers on companies, contacts, documents, tasks, and PRs use the
-shared channel/AI glass surface, 22px desktop corners, 15px desktop text, and
-a circular neutral Send button. Document comment replies/edits and Edit with AI
-use the same composer treatment. Attachment and formatting actions stay available.
+shared channel/AI composer surface, 26.25px desktop corners, 15px desktop text, and
+a circular neutral Send button. Edit with AI uses the same composer treatment.
+Inline comments, replies, and their edits use a plain
+input without a surface background, rounded frame, or shadow. Attachment and
+formatting actions stay available.
On mobile, open documents and tasks put their new-comment composer in the
accessory dock above navigation, using the channel input's compact pill and
expanded surface. Ask AI and New are hidden in these open views only when the
@@ -487,3 +578,9 @@ spinner while sending.
The mobile new-email composer nests the channel-style Send button inside its
top-right glass toolbar, with an even 5px inset on the top, bottom, and right.
The toolbar is 46px tall; attachment and schedule controls align with Send.
+
+Channel, email, Markdown, and composer body text use `text-base`: 15px at the
+default root size. Supporting `text-sm` text is 14px and `text-xs` is 12px.
+Desktop and mobile share this scale, with accessibility text scaling preserved.
+
+Desktop channel and AI composers use an `Attach files` paperclip that opens the file picker directly, without a plus menu. Comment composers open the image picker directly. Channels and DMs always open in message mode; create tasks through the task creation dialog. Shift+Enter, including an empty new line, expands channel and AI inputs so text starts above the toolbar at the left inset. Sent AI message bubbles use the ink fill with a contrasting foreground in each theme.