Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(channels): add unread-only filter toggle to rail (#8907)
Jacob Beckermancb4b7de4a659
diff --git a/.agents/rules/web/design-system.md b/.agents/rules/web/design-system.mdindex 798f855e2a..0582dc8276 100644--- a/.agents/rules/web/design-system.md+++ b/.agents/rules/web/design-system.md@@ -15,7 +15,7 @@ construction. Browse them at `/app/component/ui` (Foundations → Controls).| Role | Use | Never || --- | --- | --- |-| Switch a view, section, or one of a few values (`wrap` for separate preset chips in forms) | `Tabs` (desktop pill within a pill) | Buttons, a ButtonGroup, or an island acting as tabs |+| Switch a view, section, or one of a few values (`wrap` for separate preset chips in forms) | `Tabs` (desktop pill within a pill; `toggle` adds an on/off view filter, such as Unread, to the same frame) | Buttons, a ButtonGroup, or an island acting as tabs || Tabs that own panels or a dynamic collection (tables, form pages, rename, add) | `TabSelector` (`Root`, `List`, `Tab`, `Panel`, `AddMenu`) | `@kobalte/core/tabs` in a feature || Related header actions (filters, view options, sharing, navigation) | `HeaderActionGroup` | A hand-built bordered row || One on/off toggle, or an icon-only layout choice | `Button` with `aria-pressed` | A custom active tint |diff --git a/.agents/rules/web/ui-primitives.md b/.agents/rules/web/ui-primitives.mdindex 0faa784ea4..cf84278c81 100644--- a/.agents/rules/web/ui-primitives.md+++ b/.agents/rules/web/ui-primitives.md@@ -79,8 +79,9 @@ Applies to `apps/web/src/components/ui`, including ports from shadcn-solid.accent Button's `button-accent-ink` token.- Set checkbox/radio size on the root: `sm` is 14px, `md` (default) is 16px,and `lg` is 20px. `ToggleSwitch` tracks use `xs` 28×14px, `sm` (default)- 32×16px, and `md` 40×20px. Do not resize internal SVGs or override selection- colors from callers or enclosing pages; checked controls use the theme accent.+ 32×16px, and `md` 40×20px; `trackIcon` adds a glyph in the track's free+ half. Do not resize internal SVGs or override selection colors from callers+ or enclosing pages; checked controls use the theme accent.- Switch thumbs stay fixed white in both states and every theme, with a secondary border.Only the track changes to the theme accent when checked; do not apply accent-contrast to the thumb.Use the shared `ToggleSwitch` for code-preview controls instead of separately styled Kobalte parts.diff --git a/apps/web/src/components/ui/components/Tabs.docs.tsx b/apps/web/src/components/ui/components/Tabs.docs.tsxindex 216cb1aba5..92f831c0ef 100644--- a/apps/web/src/components/ui/components/Tabs.docs.tsx+++ b/apps/web/src/components/ui/components/Tabs.docs.tsx@@ -1,6 +1,9 @@import { defineDoc } from '@app/features/ui-gallery/types';+import ArrowBendUpLeftIcon from '@icon/system/regular/arrow-bend-up-left.svg';import ChatIcon from '@icon/system/regular/chat-text.svg';+import ClockIcon from '@icon/system/regular/clock.svg';import CodeIcon from '@icon/system/regular/code.svg';+import EyeSlashIcon from '@icon/system/regular/eye-slash.svg';import PaperclipIcon from '@icon/system/regular/paperclip.svg';import UsersIcon from '@icon/system/regular/users.svg';import { createSignal, For } from 'solid-js';@@ -26,6 +29,32 @@ function ViewDemo() {}// #endregion+// #region demo:toggle+function ToggleDemo() {+ const [value, setValue] = createSignal<'all' | 'recent' | 'threads'>('all');+ const [unreadOnly, setUnreadOnly] = createSignal(false);+ return (+ <Tabs+ aria-label="Conversation views"+ size="md"+ options={[+ { value: 'all', label: 'All', icon: ChatIcon },+ { value: 'recent', label: 'Recent', icon: ClockIcon },+ { value: 'threads', label: 'Threads', icon: ArrowBendUpLeftIcon },+ ]}+ value={value()}+ onChange={setValue}+ toggle={{+ label: 'Unread',+ icon: EyeSlashIcon,+ checked: unreadOnly(),+ onChange: setUnreadOnly,+ }}+ />+ );+}+// #endregion+// #region demo:countsfunction CountsDemo() {const [value, setValue] = createSignal<'upcoming' | 'past' | 'canceled'>(@@ -156,7 +185,7 @@ export default defineDoc({status: 'stable',exports: ['Tabs'],import: "import { Tabs } from '@ui';",- propTypes: ['TabsProps', 'TabOption'],+ propTypes: ['TabsProps', 'TabOption', 'TabsToggle'],demos: [{id: 'view',@@ -165,6 +194,13 @@ export default defineDoc({'Header view tabs sit after the title, left of the controls. The choices share a flat rounded track with an inset selected pill, sized to match neighbouring controls.',render: ViewDemo,},+ {+ id: 'toggle',+ title: 'View filter toggle',+ description:+ '`toggle` adds an on/off filter that applies to every view, such as Unread, past a divider in the same frame. The frame turns soft: a borderless filled track, a borderless selected option, and a neutral switch whose segment fills while on. When the frame is too narrow for every label, the switch drops its text into a tooltip first, then options with icons show only their icons. `toggle.icon` sits in the switch track so the switch reads without its text.',+ render: ToggleDemo,+ },{id: 'counts',title: 'Counts',diff --git a/apps/web/src/components/ui/components/Tabs.tsx b/apps/web/src/components/ui/components/Tabs.tsxindex 56c15395b2..412140a2a4 100644--- a/apps/web/src/components/ui/components/Tabs.tsx+++ b/apps/web/src/components/ui/components/Tabs.tsx@@ -1,6 +1,17 @@import { isTouchDevice } from '@core/mobile/isTouchDevice';import { SegmentedControl as KSegmentedControl } from '@kobalte/core/segmented-control';-import { type Component, For, Match, Show, Switch } from 'solid-js';+import { createElementSize } from '@solid-primitives/resize-observer';+import {+ type Component,+ createEffect,+ createSignal,+ For,+ Match,+ on,+ type ParentProps,+ Show,+ Switch,+} from 'solid-js';import { Dynamic } from 'solid-js/web';import { cn } from '../utils/classname';import {@@ -10,6 +21,7 @@ import {labeledControlFrames,} from '../utils/control-sizes';import { Layer } from './Layer';+import { ToggleSwitch } from './ToggleSwitch';import { Tooltip } from './Tooltip';export type TabOption<T extends string> = {@@ -55,6 +67,14 @@ function tabContentClasses(size: TabsSize) {*/export type TabsTouchStyle = 'pill' | 'inset' | 'segmented' | 'pills';+export type TabsToggle = {+ label: string;+ /** Shown in the switch track so the switch reads without its label. */+ icon?: Component<{ class?: string }>;+ checked: boolean;+ onChange: (checked: boolean) => void;+};+export type TabsProps<T extends string> = {'aria-label': string;options: readonly TabOption<T>[];@@ -65,6 +85,12 @@ export type TabsProps<T extends string> = {/** Show only icons, with each label as a tooltip; options without an icon keep their label. */iconOnly?: boolean;disabled?: boolean;+ /**+ * An on/off view filter after the options, such as "Unread". The desktop+ * frame holds it past a divider as one more segment, raised like a selected+ * option while on; elsewhere it follows the options.+ */+ toggle?: TabsToggle;/** Placement only (margins, width, alignment); never restyle the options. */class?: string;ref?: (element: HTMLElement) => void;@@ -113,19 +139,38 @@ export function Tabs<T extends string>(props: TabsProps<T>) {// Wrapping presets retain separate pills; desktop view tabs share a frame.const touchStyle = (): TabsTouchStyle =>isTouchDevice() && !props.wrap ? (props.touch ?? 'pill') : 'pills';+ const joined = () =>+ props.variant !== 'track' &&+ !isTouchDevice() &&+ !props.wrap &&+ props.variant !== 'pills';+ // A narrow toggle frame first drops the toggle's text, then shows options+ // as their icons when every option has one (see ToggleFrame).+ const [collapseStage, setCollapseStage] = createSignal(0);+ const iconOnly = () => (props.iconOnly ?? false) || collapseStage() >= 2;+ const maxCollapseStage = () =>+ props.options.every((option) => option.icon !== undefined) ? 2 : 1;+ // With a toggle the frame is soft: a borderless filled track whose selected+ // option and pressed toggle are borderless fills too.+ const frameClass = () =>+ cn(+ 'inline-flex min-w-0 items-stretch overflow-hidden rounded-full',+ props.toggle+ ? 'bg-active gap-0.5 p-1'+ : 'border border-edge-button bg-control gap-0.5 p-0.5',+ labeledControlFrames[props.size ?? 'md'],+ props.fullWidth && 'w-full'+ );- return (+ // The toggle sits beside the segmented control, not inside its radio group.+ const control = (rootClass: string | undefined) => (<KSegmentedControlref={props.ref}aria-label={props['aria-label']}value={props.value ?? ''}onChange={select}disabled={props.disabled}- class={cn(- 'relative inline-flex min-w-0 items-center',- props.fullWidth && 'flex w-full',- props.class- )}+ class={cn('relative inline-flex min-w-0 items-center', rootClass)}><Switchfallback={@@ -153,23 +198,24 @@ export function Tabs<T extends string>(props: TabsProps<T>) {<Match when={props.variant === 'track'}><Track {...props} /></Match>- <Match- when={!isTouchDevice() && !props.wrap && props.variant !== 'pills'}- >+ <Match when={joined()}><div- class={cn(- 'inline-flex min-w-0 items-stretch overflow-hidden rounded-full border border-edge-button bg-control gap-0.5 p-0.5',- labeledControlFrames[props.size ?? 'md'],- props.fullWidth && 'w-full'- )}+ class={+ props.toggle+ ? 'flex min-w-0 flex-1 items-stretch gap-0.5'+ : frameClass()+ }><For each={props.options}>{(option) => (<PillOptionoption={option}size={props.size ?? 'md'}- iconOnly={props.iconOnly ?? false}- fullWidth={props.fullWidth ?? false}+ iconOnly={iconOnly()}+ // Beside a toggle, options keep their label widths and share+ // what is left, so no label truncates before it must.+ fullWidth={(props.fullWidth ?? false) && !props.toggle}+ soft={props.toggle !== undefined}joined/>)}@@ -188,21 +234,154 @@ export function Tabs<T extends string>(props: TabsProps<T>) {</Switch></KSegmentedControl>);++ return (+ <Show+ when={props.toggle}+ fallback={control(cn(props.fullWidth && 'flex w-full', props.class))}+ >+ {(toggle) => (+ <ToggleFrame+ class={cn(+ joined() ? frameClass() : 'inline-flex min-w-0 items-center gap-2',+ props.fullWidth && 'flex w-full',+ props.class+ )}+ toggle={toggle()}+ size={props.size ?? 'md'}+ joined={joined()}+ optionCount={props.options.length}+ stage={collapseStage()}+ maxStage={maxCollapseStage()}+ onStageChange={setCollapseStage}+ >+ {control(+ cn(+ joined() && 'flex-1 items-stretch',+ !joined() && props.fullWidth && 'flex-1'+ )+ )}+ </ToggleFrame>+ )}+ </Show>+ );+}++/**+ * Holds the options and the toggle. When an option label would truncate, a+ * narrow frame first drops the toggle's text (shown as a tooltip), then shows+ * the options as icons (labels become tooltips). Each step undoes only once+ * the frame has grown by what the labels were short when it was taken, so+ * undoing it cannot truncate them again and flip back.+ */+function ToggleFrame(+ props: ParentProps<{+ class: string;+ toggle: TabsToggle;+ size: TabsSize;+ joined: boolean;+ optionCount: number;+ stage: number;+ maxStage: number;+ onStageChange: (stage: number) => void;+ }>+) {+ const [frame, setFrame] = createSignal<HTMLElement>();+ const frameSize = createElementSize(frame);+ const expandAtWidth: number[] = [];+ createEffect(+ on(+ () => [frameSize.width, props.optionCount, props.stage] as const,+ ([width, , stage]) => {+ const element = frame();+ if (!element || width === null) return;+ if (stage > 0 && width >= (expandAtWidth[stage] ?? 0)) {+ props.onStageChange(stage - 1);+ return;+ }+ if (stage >= props.maxStage) return;+ let shortfall = 0;+ for (const label of element.querySelectorAll('[data-tab-label]')) {+ shortfall += label.scrollWidth - label.clientWidth;+ }+ if (shortfall <= 0) return;+ expandAtWidth[stage + 1] = width + shortfall;+ props.onStageChange(stage + 1);+ }+ )+ );++ return (+ <div ref={setFrame} class={props.class}>+ {props.children}+ <Show when={props.joined}>+ <span aria-hidden="true" class="my-1 w-px shrink-0 bg-edge-button" />+ </Show>+ <ToggleSegment+ toggle={props.toggle}+ size={props.size}+ joined={props.joined}+ collapsed={props.stage >= 1}+ />+ </div>+ );+}++function ToggleSegment(props: {+ toggle: TabsToggle;+ size: TabsSize;+ joined: boolean;+ collapsed: boolean;+}) {+ return (+ <Tooltip+ label={props.toggle.label}+ disabled={!props.collapsed}+ class={cn('shrink-0', props.joined && 'self-stretch')}+ >+ <ToggleSwitch+ size={+ props.size === 'xs'+ ? 'xs'+ : props.size === 'lg' || props.size === 'xl'+ ? 'md'+ : 'sm'+ }+ label={props.toggle.label}+ labelClass={props.collapsed ? 'sr-only' : undefined}+ trackIcon={props.toggle.icon}+ checked={props.toggle.checked}+ onChange={props.toggle.onChange}+ // A view filter, not a setting: a neutral borderless track.+ controlClass="border-transparent bg-ink/15 data-checked:border-transparent data-checked:bg-ink/60"+ class={cn(+ 'shrink-0 rounded-full border border-transparent font-medium whitespace-nowrap text-ink-muted transition-colors duration-120 select-none motion-reduce:transition-none',+ 'not-touch:not-data-checked:hover:overlay-hover not-touch:not-data-checked:hover:text-ink',+ 'data-checked:overlay-active data-checked:text-ink',+ labeledControlContents[props.size],+ props.collapsed && 'px-1',+ props.joined && 'self-stretch py-0'+ )}+ />+ </Tooltip>+ );}function OptionContent<T extends string>(props: {option: TabOption<T>;iconOnly: boolean;+ hideIcon?: boolean;iconClass: string;}) {return (<>- <Show when={props.option.icon}>+ <Show when={!props.hideIcon && props.option.icon}>{(icon) => (<Dynamic component={icon()} class={cn('shrink-0', props.iconClass)} />)}</Show><span+ data-tab-label=""class={cn('truncate',props.iconOnly && props.option.icon !== undefined && 'sr-only'@@ -224,6 +403,8 @@ function PillOption<T extends string>(props: {size: TabsSize;iconOnly: boolean;fullWidth: boolean;+ /** Size to the label and drop the selected border, beside a toggle. */+ soft?: boolean;joined?: boolean;}) {const square = () => props.iconOnly && props.option.icon !== undefined;@@ -234,7 +415,10 @@ function PillOption<T extends string>(props: {class={cn('relative inline-flex min-w-0 shrink-0 rounded-full border text-ink-muted transition-colors duration-120 motion-reduce:transition-none',props.joined- ? 'self-stretch border-transparent data-checked:border-edge-button'+ ? cn(+ 'self-stretch border-transparent',+ !props.soft && 'data-checked:border-edge-button'+ ): 'bg-control border-edge-button','shadow-none not-touch:not-data-checked:hover:overlay-hover not-touch:not-data-checked:hover:text-ink','data-checked:overlay-active data-checked:text-ink',@@ -247,7 +431,8 @@ function PillOption<T extends string>(props: {props.joined && square() && joinedIconSizes[props.size],'touch:min-h-8',square() && 'touch:min-w-8',- props.fullWidth && !square() && 'flex-1'+ props.fullWidth && !square() && 'flex-1',+ props.soft && !square() && 'flex-auto')}><KSegmentedControl.ItemInput class="pointer-events-none absolute inset-0" />@@ -255,12 +440,15 @@ function PillOption<T extends string>(props: {class={cn('flex min-w-0 flex-1 self-stretch items-center justify-center gap-2 font-medium whitespace-nowrap select-none',!square() && tabContentClasses(props.size),+ props.soft && 'px-1.5',props.joined && 'py-0')}><OptionContentoption={props.option}iconOnly={props.iconOnly}+ // Soft options show their icon only once collapsed to icons.+ hideIcon={props.soft === true && !props.iconOnly}// Glyphs match a Button of the same size: smaller beside a label.iconClass={tabIconSizes[props.size][square() ? 'square' : 'labeled']}/>@@ -270,7 +458,11 @@ function PillOption<T extends string>(props: {return (<Show when={square()} fallback={item()}>- <Tooltip label={props.option.label} class="shrink-0">+ <Tooltip+ label={props.option.label}+ // Soft icon options share the frame's width, each icon centered.+ class={cn('shrink-0', props.soft && 'flex-1 justify-center')}+ >{item()}</Tooltip></Show>diff --git a/apps/web/src/components/ui/components/ToggleSwitch.docs.tsx b/apps/web/src/components/ui/components/ToggleSwitch.docs.tsxindex 34a7f04869..6ce046a7ed 100644--- a/apps/web/src/components/ui/components/ToggleSwitch.docs.tsx+++ b/apps/web/src/components/ui/components/ToggleSwitch.docs.tsx@@ -1,4 +1,5 @@import { defineDoc } from '@app/features/ui-gallery/types';+import EyeSlashIcon from '@icon/system/regular/eye-slash.svg';import { createSignal, For } from 'solid-js';import { ToggleSwitch } from './ToggleSwitch';@@ -44,6 +45,22 @@ function SizesDemo() {}// #endregion+// #region demo:track-icon+function TrackIconDemo() {+ const [unreadOnly, setUnreadOnly] = createSignal(false);++ return (+ <ToggleSwitch+ trackIcon={EyeSlashIcon}+ checked={unreadOnly()}+ onChange={setUnreadOnly}+ label="Unread only"+ labelClass="text-sm text-ink"+ />+ );+}+// #endregion+// #region demo:disabledfunction DisabledDemo() {return (@@ -139,6 +156,13 @@ export default defineDoc({'`sm` is the default toolbar size (32×16px); `md` is for settings rows (40×20px); `xs` is for dense inline chrome (28×14px).',render: SizesDemo,},+ {+ id: 'track-icon',+ title: 'Track icon',+ description:+ '`trackIcon` shows a glyph in the half of the track the thumb leaves free, so a compact switch says what it does even when its label is hidden.',+ render: TrackIconDemo,+ },{id: 'disabled',title: 'Disabled',diff --git a/apps/web/src/components/ui/components/ToggleSwitch.tsx b/apps/web/src/components/ui/components/ToggleSwitch.tsxindex 2e044596fa..6f9cdda50b 100644--- a/apps/web/src/components/ui/components/ToggleSwitch.tsx+++ b/apps/web/src/components/ui/components/ToggleSwitch.tsx@@ -3,8 +3,9 @@ import {Switch as KobalteSwitch,type SwitchRootProps,} from '@kobalte/core/switch';-import type { JSX } from 'solid-js';+import type { Component, JSX } from 'solid-js';import { Show, splitProps } from 'solid-js';+import { Dynamic } from 'solid-js/web';import { cn } from '../utils/classname';export type ToggleSwitchSize = 'xs' | 'sm' | 'md';@@ -17,24 +18,32 @@ export type ToggleSwitchProps = Omit</** Compact toolbar sizes are xs/sm; use md in settings rows. */size?: ToggleSwitchSize;controlClass?: string;+ /** A glyph in the track beside the thumb that says what the switch does. */+ trackIcon?: Component<{ class?: string }>;};const SWITCH_SIZES = {xs: {control: 'h-3.5 w-7',thumb: '-left-0.5 -top-px size-3.5 data-checked:translate-x-4',+ trackIcon:+ 'right-0.5 size-2 group-data-checked/switch:right-auto group-data-checked/switch:left-0.5',pressed:'group-active/switch:w-4 data-checked:group-active/switch:translate-x-3.5',},sm: {control: 'h-4 w-8',thumb: '-left-0.5 -top-px size-4 data-checked:translate-x-4.5',+ trackIcon:+ 'right-1 size-2.5 group-data-checked/switch:right-auto group-data-checked/switch:left-1',pressed:'group-active/switch:w-5 data-checked:group-active/switch:translate-x-3.5',},md: {control: 'h-5 w-10',thumb: '-left-0.5 -top-px size-5 data-checked:translate-x-5.5',+ trackIcon:+ 'right-1.5 size-3 group-data-checked/switch:right-auto group-data-checked/switch:left-1.5',pressed:'group-active/switch:w-6 data-checked:group-active/switch:translate-x-4.5',},@@ -63,6 +72,7 @@ export const ToggleSwitch = (props: ToggleSwitchProps): JSX.Element => {'controlClass','label','size',+ 'trackIcon',]);const sizing = () => SWITCH_SIZES[local.size ?? 'sm'];@@ -95,6 +105,18 @@ export const ToggleSwitch = (props: ToggleSwitchProps): JSX.Element => {local.controlClass)}>+ <Show when={local.trackIcon}>+ {(icon) => (+ <Dynamic+ component={icon()}+ aria-hidden="true"+ class={cn(+ 'pointer-events-none absolute top-1/2 -translate-y-1/2 text-ink-muted group-data-checked/switch:text-surface',+ sizing().trackIcon+ )}+ />+ )}+ </Show><KobalteSwitch.Thumbclass={cn('absolute rounded-full border border-border-secondary bg-[white] transition-[width,translate] duration-150 ease-out motion-reduce:transition-none',diff --git a/apps/web/src/components/ui/index.ts b/apps/web/src/components/ui/index.tsindex 7c2d969a26..ff59cd40f9 100644--- a/apps/web/src/components/ui/index.ts+++ b/apps/web/src/components/ui/index.ts@@ -182,6 +182,7 @@ export type {TabOption,TabsProps,TabsSize,+ TabsToggle,TabsTouchStyle,} from './components/Tabs';export { Tabs } from './components/Tabs';diff --git a/apps/web/src/features/channels-view/channels-view-context.tsx b/apps/web/src/features/channels-view/channels-view-context.tsxindex f18cbf4d18..476e109a76 100644--- a/apps/web/src/features/channels-view/channels-view-context.tsx+++ b/apps/web/src/features/channels-view/channels-view-context.tsx@@ -58,6 +58,7 @@ export type ChannelsViewContext = {/** Threads tab filter: the conversation whose threads are shown, or all. */threadsChannelId: Accessor<string | undefined>;setThreadsChannelId: (channelId: string | undefined) => void;+ setUnreadOnly: (unreadOnly: boolean) => void;setTab: (tab: ChannelsTab) => void;setSelectedChannel: (channel: ChannelPreviewSelection | undefined) => boolean;setGroupOpen: (group: ChannelsRailSection, open: boolean) => void;@@ -80,6 +81,7 @@ function createInitialState(},collapsedLabels: initial.collapsedLabels ?? [],threadsChannelId: initial.threadsChannelId,+ unreadOnly: initial.unreadOnly ?? false,sortBy: {team_channels:initial.sortBy?.team_channels ?? CHANNELS_DEFAULT_SORT_BY.team_channels,@@ -225,6 +227,7 @@ export const [ChannelsViewProvider, useChannelsView] =if (state.threadsChannelId === channelId) return;setState('threadsChannelId', channelId);},+ setUnreadOnly: (unreadOnly) => setState('unreadOnly', unreadOnly),setTab: (tab) => {if (state.tab === tab) return;setState('tab', tab);diff --git a/apps/web/src/features/channels-view/components/rail/ChannelUnreadFilter.tsx b/apps/web/src/features/channels-view/components/rail/ChannelUnreadFilter.tsxnew file mode 100644index 0000000000..034d607253--- /dev/null+++ b/apps/web/src/features/channels-view/components/rail/ChannelUnreadFilter.tsx@@ -0,0 +1,25 @@+import EmptyStateChannelsGraphic from '@design/empty-state-channels.svg';+import { EmptyStatePanel } from '@ui';+import { useChannelsRail } from './ChannelsRailContext';++/** Shown in place of a list the Unread filter has emptied. */+export function ChannelUnreadEmptyState() {+ const rail = useChannelsRail();++ return (+ <EmptyStatePanel+ centered+ graphic={EmptyStateChannelsGraphic}+ graphicClass="aspect-square h-auto w-[clamp(12rem,70%,18rem)] self-center"+ title="No unread conversations"+ description="You're all caught up."+ descriptionClass="mt-1 text-balance"+ actionsClass="mt-5 flex-row @max-sm:flex-row"+ primaryAction={{+ label: 'Show all',+ onClick: () => rail.setUnreadOnly(false),+ }}+ class="px-4 pt-4 @4xl:px-4 [&>div:first-child]:basis-0"+ />+ );+}diff --git a/apps/web/src/features/channels-view/components/rail/ChannelsRail.test.tsx b/apps/web/src/features/channels-view/components/rail/ChannelsRail.test.tsxindex 72c1815c72..05e127fe38 100644--- a/apps/web/src/features/channels-view/components/rail/ChannelsRail.test.tsx+++ b/apps/web/src/features/channels-view/components/rail/ChannelsRail.test.tsx@@ -165,6 +165,7 @@ vi.mock('../../channels-view-context', () => ({tab: 'browse',expandedGroups: { channels: true, direct_messages: true },collapsedLabels: [],+ unreadOnly: false,},tab: () => mocks.tab,threadsEnabled: () => false,diff --git a/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx b/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsxindex 6d9ee83d7d..7742f7c58e 100644--- a/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx+++ b/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx@@ -105,6 +105,7 @@ export { buildChannelRailRows } from './build-channel-rail-rows';import { fireAndForget } from '@core/util/fireAndForget';import { useChannelCalls } from './hooks/useChannelCalls';import { useChannelRailActivity } from './hooks/useChannelRailActivity';+import { useChannelRailUnreadFilter } from './hooks/useChannelRailUnreadFilter';const CHANNEL_RAIL_SECTIONS: ChannelsRailSection[] = ['favorites',@@ -153,6 +154,7 @@ export function ChannelsRail(props: ChannelsRailProps) {threadsEnabled,threadsChannelId,setThreadsChannelId,+ setUnreadOnly,} = useChannelsView();const panel = useSplitPanelOrThrow();@@ -361,9 +363,9 @@ export function ChannelsRail(props: ChannelsRailProps) {return 'Channel labels are unavailable right now.';};- const favorites = createMemo(() => favoritesData()?.favorites ?? []);+ const allFavorites = createMemo(() => favoritesData()?.favorites ?? []);const favoriteChannelIds = createMemo(() =>- favorites()+ allFavorites().filter((favorite) => favorite.entityType === 'channel').map((favorite) => favorite.entityId));@@ -412,6 +414,21 @@ export function ChannelsRail(props: ChannelsRailProps) {const channelActivity = useChannelRailActivity(allChannels, channelCalls);+ const unreadOnly = () => state.unreadOnly;+ const unreadFilter = useChannelRailUnreadFilter({+ sources: props.sources,+ favorites: allFavorites,+ unreadOnly,+ unreadChannelIds: channelActivity.unreadChannelIds,+ isSelected: (channelId) =>+ tab() === 'threads'+ ? threadsChannelId() === channelId+ : selectedChannel()?.id === channelId,+ });+ // The rail lists these; unread state and label lookups use the full lists.+ const sources = unreadFilter.sources;+ const favorites = unreadFilter.favorites;+const isLabelOpen = (labelId: string) =>!state.collapsedLabels.includes(labelId);@@ -424,6 +441,9 @@ export function ChannelsRail(props: ChannelsRailProps) {]),channelsById: channelsById(),isLabelOpen,+ isChannelVisible: unreadOnly()+ ? unreadFilter.isChannelVisible+ : undefined,}));@@ -452,11 +472,11 @@ export function ChannelsRail(props: ChannelsRailProps) {state.expandedGroups,{favorites: favorites(),- team_channels: props.sources.team_channels.items(),- channels: props.sources.channels.items(),- direct_messages: props.sources.direct_messages.items(),- recents: props.sources.recents.items(),- threads: props.sources.threads.items(),+ team_channels: sources.team_channels.items(),+ channels: sources.channels.items(),+ direct_messages: sources.direct_messages.items(),+ recents: sources.recents.items(),+ threads: sources.threads.items(),},channelSectionRows());@@ -583,7 +603,7 @@ export function ChannelsRail(props: ChannelsRailProps) {? channelSectionRows().map((row) =>row.kind === 'conversation' ? row.channel.id : undefined)- : props.sources[scope].items().map((channel) => channel.id);+ : sources[scope].items().map((channel) => channel.id);const selectedIndex = rendered.indexOf(selectedChannel()?.id ?? '');@@ -603,7 +623,7 @@ export function ChannelsRail(props: ChannelsRailProps) {};const scrollThreadsToSelectedOrStart = () => {- const items = props.sources.threads.items();+ const items = sources.threads.items();const selectedIndex = items.findIndex((channel) => channel.id === threadsChannelId());@@ -662,12 +682,10 @@ export function ChannelsRail(props: ChannelsRailProps) {const sourcesReady = searchOpen? !props.sources.search.isLoading(): tab() === 'recents'- ? !props.sources.recents.isLoading()+ ? !sources.recents.isLoading(): tab() === 'threads'- ? !props.sources.threads.isLoading()- : BROWSE_QUERY_SCOPES.every(- (scope) => !props.sources[scope].isLoading()- );+ ? !sources.threads.isLoading()+ : BROWSE_QUERY_SCOPES.every((scope) => !sources[scope].isLoading());if (!sourcesReady) return;const frame = requestAnimationFrame(() => {@@ -728,7 +746,7 @@ export function ChannelsRail(props: ChannelsRailProps) {const row = current?.item;if (direction !== 1 || row?.kind !== 'conversation') return true;- const source = props.sources[row.scope];+ const source = sources[row.scope];const renderedCount =row.scope === 'team_channels'? channelSectionRows().length@@ -1213,8 +1231,10 @@ export function ChannelsRail(props: ChannelsRailProps) {list,tab,selectTab,- sources: props.sources,+ sources,favorites,+ unreadOnly,+ setUnreadOnly,channelById,selectedChannel,threadsEnabled,diff --git a/apps/web/src/features/channels-view/components/rail/ChannelsRailContext.ts b/apps/web/src/features/channels-view/components/rail/ChannelsRailContext.tsindex c54ab8bae4..0a85bc3228 100644--- a/apps/web/src/features/channels-view/components/rail/ChannelsRailContext.ts+++ b/apps/web/src/features/channels-view/components/rail/ChannelsRailContext.ts@@ -123,8 +123,12 @@ export type ChannelsRailContext = {list: ListController<ChannelRailRow, ChannelRailActivationMetadata>;tab: Accessor<ChannelsTab>;selectTab: (tab: ChannelsTab) => void;+ /** The listed conversations, narrowed while the Unread filter is on. */sources: ChannelsSources;favorites: Accessor<readonly Favorite[]>;+ /** Whether the rail lists only conversations with unread activity. */+ unreadOnly: Accessor<boolean>;+ setUnreadOnly: (unreadOnly: boolean) => void;/*** A channel the rail has loaded, from its sections or fetched by id for a* label or favorite row. Undefined until the fetch settles.diff --git a/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx b/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsxindex 727a9c56d0..35d4db7af2 100644--- a/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx+++ b/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx@@ -9,9 +9,13 @@ import { isTouchDevice } from '@core/mobile/isTouchDevice';import { createScrollTopFade } from '@core/util/createScrollTopFade';import EmptyStateNoSearchMatchGraphic from '@design/empty-state-no-search-match.svg';import { type ChannelEntity, Entity } from '@entity';+import ArrowBendUpLeftIcon from '@icon/system/regular/arrow-bend-up-left.svg';import CaretDownIcon from '@icon/system/regular/caret-down.svg';+import ChatCircleTextIcon from '@icon/system/regular/chat-circle-text.svg';import ChatsCircleIcon from '@icon/system/regular/chats-circle.svg';import CheckIcon from '@icon/system/regular/check.svg';+import ClockIcon from '@icon/system/regular/clock.svg';+import EyeSlashIcon from '@icon/system/regular/eye-slash.svg';import MagnifyingGlassIcon from '@icon/system/regular/magnifying-glass.svg';import SortIcon from '@icon/system/regular/sort-ascending.svg';import XIcon from '@icon/system/regular/x.svg';@@ -85,6 +89,7 @@ import {RailListLoading,RailListLoadingMore,} from './ChannelsRailSection';+import { ChannelUnreadEmptyState } from './ChannelUnreadFilter';import {CHANNEL_LIST_GROUPS,useChannelRailItemState,@@ -93,13 +98,14 @@ import {useChannelRailVirtualizer,} from './hooks/useChannelRailState';+// Icons stand in for the labels when the rail is too narrow for them.const CHANNEL_TABS: TabOption<ChannelsTab>[] = [- { value: 'browse', label: 'All' },- { value: 'recents', label: 'Recent' },+ { value: 'browse', label: 'All', icon: ChatCircleTextIcon },+ { value: 'recents', label: 'Recent', icon: ClockIcon },];const CHANNEL_TABS_WITH_THREADS: TabOption<ChannelsTab>[] = [...CHANNEL_TABS,- { value: 'threads', label: 'Threads' },+ { value: 'threads', label: 'Threads', icon: ArrowBendUpLeftIcon },];type ChannelRailSearch = {@@ -119,6 +125,7 @@ type GroupConfig = {group: ChannelsGroup;label: string;emptyLabel: string;+ unreadEmptyLabel: string;createLabel: string;onCreate: () => void;};@@ -128,6 +135,7 @@ const GROUPS: GroupConfig[] = [group: 'team_channels',label: 'Team channels',emptyLabel: 'No team channels',+ unreadEmptyLabel: 'No unread team channels',createLabel: 'Create channel',onCreate: openNewChannelModal,},@@ -135,6 +143,7 @@ const GROUPS: GroupConfig[] = [group: 'channels',label: 'Channels',emptyLabel: 'No channels',+ unreadEmptyLabel: 'No unread channels',createLabel: 'Create channel',onCreate: openNewChannelModal,},@@ -142,6 +151,7 @@ const GROUPS: GroupConfig[] = [group: 'direct_messages',label: 'DMs',emptyLabel: 'No direct messages',+ unreadEmptyLabel: 'No unread direct messages',createLabel: 'Start direct message',onCreate: () => runCreateAction('channel'),},@@ -434,12 +444,19 @@ function ExpandedHeader(props: { search: ChannelRailSearch }) {<ViewSidebar.Toolbar class={!isTouchDevice() ? 'px-0' : undefined}><Tabsaria-label="Chat sidebar views"+ size="md"fullWidth={!isTouchDevice()}options={rail.threadsEnabled() ? CHANNEL_TABS_WITH_THREADS : CHANNEL_TABS}value={rail.tab()}onChange={selectTab}+ toggle={{+ label: 'Unread',+ icon: EyeSlashIcon,+ checked: rail.unreadOnly(),+ onChange: rail.setUnreadOnly,+ }}/><Show when={isTouchDevice()}><ViewSidebar.Control@@ -706,6 +723,8 @@ function ExpandedGroupSection(props: {() => props.config.group);const pagination = useChannelRailVirtualizer(() => props.config.group);+ const emptyLabel = () =>+ rail.unreadOnly() ? props.config.unreadEmptyLabel : props.config.emptyLabel;const registerScrollRef = (element: HTMLDivElement) => {setScrollRoot(element);rail.registerScrollRef(props.config.group, element);@@ -822,7 +841,7 @@ function ExpandedGroupSection(props: {scrollRoot={scrollRoot()}keepMounted={section().keepMounted}onScroll={pagination.loadMoreNearEnd}- emptyLabel={props.config.emptyLabel}+ emptyLabel={emptyLabel()}><Show when={section().source.isLoadingMore()}><RailListLoadingMore variant="channel" />@@ -867,7 +886,7 @@ function ExpandedGroupSection(props: {</Match><Match when={true}><div class="px-2 py-2 text-xs text-ink-extra-muted">- {props.config.emptyLabel}+ {emptyLabel()}</div></Match></Switch>@@ -881,8 +900,10 @@ function ExpandedBrowse() {const forceEmptyState = useDebugSetting(DEBUG_SETTING_KEYS.FORCE_EMPTY_STATES);+ // Label headings and channels; the Unread filter leaves out labels without+ // unread channels.const hasItems = () =>- rail.labels().length > 0 ||+ rail.channelSectionRows().length > 0 ||rail.favorites().length > 0 ||CHANNEL_LIST_GROUPS.some((group) => rail.sources[group].items().length > 0);const sourcesSettled = () =>@@ -901,6 +922,16 @@ function ExpandedBrowse() {return (<Switch>+ <Match+ when={+ !forceEmptyState() &&+ rail.unreadOnly() &&+ sourcesSettled() &&+ !hasItems()+ }+ >+ <ChannelUnreadEmptyState />+ </Match><Match when={forceEmptyState() || (sourcesSettled() && !hasItems())}><ChannelsEmptyState scope="channels" topAligned /></Match>@@ -964,6 +995,7 @@ function RecentConversationCard(props: { channel: ChannelEntity }) {}function ExpandedRecents() {+ const rail = useChannelsRail();const [scrollRoot, setScrollRoot] = createSignal<HTMLDivElement>();createScrollTopFade(scrollRoot);const scope = useChannelRailScopeState(() => 'recents');@@ -992,6 +1024,13 @@ function ExpandedRecents() {><RailListError retry={scope().source.refresh} /></Match>+ <Match+ when={+ !forceEmptyState() && rail.unreadOnly() && scope().items.length === 0+ }+ >+ <ChannelUnreadEmptyState />+ </Match><Match when={forceEmptyState() || scope().items.length === 0}><ChannelsEmptyState scope="recents" topAligned /></Match>@@ -1116,7 +1155,9 @@ function ExpandedThreads() {</Match><Match when={true}><div class="px-2 py-2 text-xs text-ink-extra-muted">- No conversations+ {rail.unreadOnly()+ ? 'No unread conversations'+ : 'No conversations'}</div></Match></Switch>diff --git a/apps/web/src/features/channels-view/components/rail/build-channel-rail-rows.test.ts b/apps/web/src/features/channels-view/components/rail/build-channel-rail-rows.test.tsindex e2440dc4a0..57bc483e5c 100644--- a/apps/web/src/features/channels-view/components/rail/build-channel-rail-rows.test.ts+++ b/apps/web/src/features/channels-view/components/rail/build-channel-rail-rows.test.ts@@ -167,6 +167,27 @@ describe('buildChannelSectionRows', () => {);});+ it('lists only visible channels and leaves out labels with none of them', () => {+ const rows = buildChannelSectionRows({+ labels: [+ label('l1', 'Enterprise', ['zeta', 'acme'], 0),+ label('l2', 'Onboarding', ['deals'], 1),+ ],+ channels: [globex, deals, zeta, acme],+ channelsById: byId,+ isLabelOpen: (labelId) => labelId !== 'l1',+ isChannelVisible: (channelId) =>+ channelId === 'zeta' || channelId === 'globex',+ });++ expect(+ rows.map((row) =>+ row.kind === 'label'+ ? `label:${row.label.name}`+ : `${row.labelId ?? '-'}:${row.channel.id}`+ )+ ).toEqual(['label:Enterprise', '-:globex']);+ });});describe('buildChannelRailRows', () => {diff --git a/apps/web/src/features/channels-view/components/rail/build-channel-rail-rows.ts b/apps/web/src/features/channels-view/components/rail/build-channel-rail-rows.tsindex cbc0549570..fca225ac9c 100644--- a/apps/web/src/features/channels-view/components/rail/build-channel-rail-rows.ts+++ b/apps/web/src/features/channels-view/components/rail/build-channel-rail-rows.ts@@ -31,6 +31,8 @@ const compareChannelName = (left: ChannelEntity, right: ChannelEntity) =>* Lay out the Team channels section: each label in saved order with the* channels the user can see in it (A→Z, the same for everyone), then the* channels in no label in the section's own sort. Empty labels stay visible as drop targets; a collapsed label hides its channels.+ * With `isChannelVisible`, only matching channels are listed and labels with+ * none of them are left out.** Labelled channels come from `channelsById` because the paginated source* may not have reached them yet; anything unlabelled comes from `channels`@@ -41,7 +43,9 @@ export function buildChannelSectionRows(options: {channels: readonly ChannelEntity[];channelsById: ReadonlyMap<string, ChannelEntity>;isLabelOpen: (labelId: string) => boolean;+ isChannelVisible?: (channelId: string) => boolean;}): ChannelSectionRow[] {+ const isVisible = options.isChannelVisible ?? (() => true);const rows: ChannelSectionRow[] = [];const labelled = new Set<string>();@@ -55,15 +59,17 @@ export function buildChannelSectionRows(options: {.sort(compareChannelName);for (const channel of visible) labelled.add(channel.id);+ const listed = visible.filter((channel) => isVisible(channel.id));+ if (options.isChannelVisible && listed.length === 0) continue;rows.push({ kind: 'label', label });if (!options.isLabelOpen(label.id)) continue;- for (const channel of visible) {+ for (const channel of listed) {rows.push({ kind: 'conversation', channel, labelId: label.id });}}for (const channel of options.channels) {- if (labelled.has(channel.id)) continue;+ if (labelled.has(channel.id) || !isVisible(channel.id)) continue;rows.push({ kind: 'conversation', channel });}diff --git a/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailUnreadFilter.test.ts b/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailUnreadFilter.test.tsnew file mode 100644index 0000000000..760864df0b--- /dev/null+++ b/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailUnreadFilter.test.ts@@ -0,0 +1,110 @@+import type { ChannelEntity } from '@entity/types/entity';+import type { Favorite } from '@service-storage/generated/schemas/favorite';+import type { FavoriteEntityType } from '@service-storage/generated/schemas/favoriteEntityType';+import { createRoot, createSignal } from 'solid-js';+import { afterEach, describe, expect, it, vi } from 'vitest';+import type { ChannelsDataSource, ChannelsSources } from '../../../queries';+import { useChannelRailUnreadFilter } from './useChannelRailUnreadFilter';++const row = (id: string): ChannelEntity => ({+ id,+ type: 'channel',+ name: id,+ ownerId: 'owner',+ channelType: 'private',+});+const source = (items: ChannelEntity[]): ChannelsDataSource => ({+ items: () => items,+ isLoading: () => false,+ isFetching: () => false,+ error: () => undefined,+ hasMore: () => false,+ isLoadingMore: () => false,+ loadMore: async () => {},+ refresh: async () => {},+});+const favorite = (+ entityType: FavoriteEntityType,+ entityId: string+): Favorite => ({+ entityType,+ entityId,+ createdAt: '2026-01-01',+ sortOrder: 0,+});+const sources: ChannelsSources = {+ team_channels: source([row('team-read'), row('team-unread')]),+ channels: source([row('read'), row('unread'), row('open')]),+ direct_messages: source([row('dm-read'), row('dm-unread')]),+ recents: source([row('unread'), row('read')]),+ threads: source([row('read')]),+ search: source([row('read'), row('unread')]),+};+const ids = (channels: readonly ChannelEntity[]) =>+ channels.map((channel) => channel.id);++let dispose: (() => void) | undefined;+afterEach(() => dispose?.());++describe('channel rail unread filter', () => {+ it('lists only unread conversations and the open one, leaving search whole', () => {+ const [unreadOnly, setUnreadOnly] = createSignal(false);+ const filter = createRoot((disposeRoot) => {+ dispose = disposeRoot;+ return useChannelRailUnreadFilter({+ sources,+ favorites: () => [+ favorite('channel', 'unread'),+ favorite('channel', 'read'),+ favorite('document', 'doc'),+ ],+ unreadOnly,+ unreadChannelIds: () => new Set(['unread', 'dm-unread', 'team-unread']),+ isSelected: (channelId) => channelId === 'open',+ });+ });++ expect(ids(filter.sources.channels.items())).toEqual([+ 'read',+ 'unread',+ 'open',+ ]);+ expect(filter.favorites()).toHaveLength(3);++ setUnreadOnly(true);++ expect(ids(filter.sources.channels.items())).toEqual(['unread', 'open']);+ expect(ids(filter.sources.team_channels.items())).toEqual(['team-unread']);+ expect(ids(filter.sources.direct_messages.items())).toEqual(['dm-unread']);+ expect(ids(filter.sources.recents.items())).toEqual(['unread']);+ expect(filter.sources.threads.items()).toEqual([]);+ expect(ids(filter.sources.search.items())).toEqual(['read', 'unread']);+ expect(filter.favorites().map((item) => item.entityId)).toEqual(['unread']);+ });++ it('pages a filtered list until it fills while the filter is on', () => {+ const [unreadOnly, setUnreadOnly] = createSignal(false);+ const loadMore = vi.fn(async () => {});+ const paged = {+ ...source([row('read'), row('unread')]),+ hasMore: () => true,+ loadMore,+ };+ createRoot((disposeRoot) => {+ dispose = disposeRoot;+ return useChannelRailUnreadFilter({+ sources: { ...sources, channels: paged },+ favorites: () => [],+ unreadOnly,+ unreadChannelIds: () => new Set(['unread']),+ isSelected: () => false,+ });+ });++ expect(loadMore).not.toHaveBeenCalled();++ setUnreadOnly(true);++ expect(loadMore).toHaveBeenCalledOnce();+ });+});diff --git a/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailUnreadFilter.ts b/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailUnreadFilter.tsnew file mode 100644index 0000000000..c9db2b1f73--- /dev/null+++ b/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailUnreadFilter.ts@@ -0,0 +1,72 @@+import { fireAndForget } from '@core/util/fireAndForget';+import type { Favorite } from '@service-storage/generated/schemas/favorite';+import { type Accessor, createEffect, createMemo } from 'solid-js';+import type { ChannelsDataSource, ChannelsSources } from '../../../queries';++/** Rows a filtered list should hold before paging waits for a scroll. */+const UNREAD_PAGE_FILL = 20;++/**+ * Narrow the rail's lists to conversations with unread activity while the+ * Unread filter is on. The open conversation stays listed, so reading it does+ * not pull it out from under the pointer. Search results are never filtered.+ *+ * Unread state comes from the rows the rail has loaded, the same evidence as+ * the unread dots and section counts, so a filtered list keeps paging until it+ * fills or its source runs out.+ */+export function useChannelRailUnreadFilter(options: {+ sources: ChannelsSources;+ favorites: Accessor<readonly Favorite[]>;+ unreadOnly: Accessor<boolean>;+ unreadChannelIds: Accessor<ReadonlySet<string>>;+ isSelected: (channelId: string) => boolean;+}) {+ const isChannelVisible = (channelId: string) =>+ !options.unreadOnly() ||+ options.unreadChannelIds().has(channelId) ||+ options.isSelected(channelId);++ const filterSource = (source: ChannelsDataSource): ChannelsDataSource => {+ const items = createMemo(() =>+ options.unreadOnly()+ ? source.items().filter((channel) => isChannelVisible(channel.id))+ : source.items()+ );+ // A short filtered list never scrolls far enough to ask for more.+ createEffect(() => {+ if (+ options.unreadOnly() &&+ items().length < UNREAD_PAGE_FILL &&+ source.hasMore() &&+ !source.isLoadingMore() &&+ !source.error()+ )+ fireAndForget(source.loadMore(), 'channels-view');+ });+ return { ...source, items };+ };++ const favorites = createMemo(() =>+ options.unreadOnly()+ ? options+ .favorites()+ .filter(+ (favorite) =>+ favorite.entityType === 'channel' &&+ isChannelVisible(favorite.entityId)+ )+ : options.favorites()+ );++ const sources: ChannelsSources = {+ team_channels: filterSource(options.sources.team_channels),+ channels: filterSource(options.sources.channels),+ direct_messages: filterSource(options.sources.direct_messages),+ recents: filterSource(options.sources.recents),+ threads: filterSource(options.sources.threads),+ search: options.sources.search,+ };++ return { sources, favorites, isChannelVisible };+}diff --git a/apps/web/src/features/channels-view/persistence.ts b/apps/web/src/features/channels-view/persistence.tsindex 881cb1f633..a69598af4e 100644--- a/apps/web/src/features/channels-view/persistence.ts+++ b/apps/web/src/features/channels-view/persistence.ts@@ -55,6 +55,7 @@ const channelsEntryStateSchemaWithDefaults = z.object({}),collapsedLabels: z.array(z.string()).default([]),threadsChannelId: z.string().optional(),+ unreadOnly: z.boolean().default(false),});type ChannelsEntryState = z.infer<typeof channelsEntryStateSchemaWithDefaults>;@@ -70,6 +71,7 @@ const DEFAULT_CHANNELS_ENTRY_STATE = {},collapsedLabels: [],threadsChannelId: undefined,+ unreadOnly: false,} satisfies ChannelsEntryState;const channelsPreferencesSchema = z.object({@@ -112,6 +114,7 @@ function selectEntryState(state: ChannelsViewState): ChannelsEntryState {expandedGroups: state.expandedGroups,collapsedLabels: state.collapsedLabels,threadsChannelId: state.threadsChannelId,+ unreadOnly: state.unreadOnly,};}@@ -128,6 +131,7 @@ function restoreChannelsEntryState(expandedGroups: restored.expandedGroups,collapsedLabels: restored.collapsedLabels,threadsChannelId: restored.threadsChannelId,+ unreadOnly: restored.unreadOnly,};}diff --git a/apps/web/src/features/channels-view/types.ts b/apps/web/src/features/channels-view/types.tsindex ea73dddcf5..f954c3a799 100644--- a/apps/web/src/features/channels-view/types.ts+++ b/apps/web/src/features/channels-view/types.ts@@ -27,6 +27,8 @@ export type ChannelsViewState = {* split's history entry, which is too costly for a per-click filter.*/threadsChannelId: string | undefined;+ /** Show only conversations with unread activity in the rail. */+ unreadOnly: boolean;sortBy: Record<ChannelsSortGroup, ChannelListSort>;asideWidth: number;};diff --git a/docs/agent-guide/channels.md b/docs/agent-guide/channels.mdindex acdb40ff24..0c39fac409 100644--- a/docs/agent-guide/channels.md+++ b/docs/agent-guide/channels.md@@ -862,6 +862,19 @@ Deferred navigation waits until the destination is applied; an unavailable splitmust leave unread state unchanged. Join-only channels remainblocked after hydration, including on mobile.+The **Unread** switch, after a divider in the tabs' frame, lists only+conversations with an unread dot in every tab: Favorites, Channels (labels+without unread channels are hidden), DMs, Recent, and the Threads tab's+Conversations. Search results are not filtered. The open conversation stays+listed after it is read and drops out once another is opened. Unread state comes+from the loaded pages, like the section counts. An emptied tab shows **No unread+conversations** with a `Show all` action. Its track shows a crossed-out eye.+When the rail is too narrow for every tab label, the switch drops its text into+a tooltip, and if that is still not enough the tabs show icons (All, a speech+bubble; Recent, a clock; Threads, a reply arrow) with their names as tooltips.+The toggle persists with the rail's other view state across reloads. The mobile+Recent feed has no toggle.+With GraphQL caching enabled, a current-query cached Team channels, Channels, or DMs page(including an empty page) remains quiet on a response-free refresh failure.Hold or fail the refresh before local filtering finishes: cached rows must not