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(new-layout): update new app views (#6224)
dev-rb2dfb5e760797
diff --git a/apps/web/src/components/app/PreviewPanel.tsx b/apps/web/src/components/app/PreviewPanel.tsxindex ece59a9b65..608ebde1a5 100644--- a/apps/web/src/components/app/PreviewPanel.tsx+++ b/apps/web/src/components/app/PreviewPanel.tsx@@ -27,6 +27,7 @@ import {createMemo,createRenderEffect,createSignal,+ type JSX,on,Show,Suspense,@@ -57,6 +58,7 @@ export type PreviewPanelProps = {splitPanelContext: SplitPanelContextType;onFocusOut?: VoidFunction;ref?: (el: HTMLElement) => void;+ headerLeading?: JSX.Element;};type PreviewBlockTarget = {@@ -211,6 +213,9 @@ function PreviewPanelContent(ref={headerCollapseController.setRow}class="relative flex min-h-10 w-full shrink-0 items-center justify-between bg-surface px-2">+ <Show when={props.headerLeading}>+ <div class="flex shrink-0 items-center">{props.headerLeading}</div>+ </Show><PriorityCollapseOverflowSensorcontroller={headerCollapseController}truncateAsLastResortdiff --git a/apps/web/src/components/app/split-layout/componentRegistry.tsx b/apps/web/src/components/app/split-layout/componentRegistry.tsxindex a7f3b6e7b5..2154711596 100644--- a/apps/web/src/components/app/split-layout/componentRegistry.tsx+++ b/apps/web/src/components/app/split-layout/componentRegistry.tsx@@ -51,10 +51,8 @@ import {createRenderEffect,type JSXElement,lazy,- Match,onMount,Show,- Switch,} from 'solid-js';import type { SplitContent } from './layoutManager';import { useSplitPanelOrThrow } from './layoutUtils';@@ -68,7 +66,9 @@ function usePageViewTracking(pageTitle: string) {});}-function useNewAppViews() {+function useNewAppViews(options?: {+ enabledLayout?: () => 'legacy' | 'composable';+}) {const panel = useSplitPanelOrThrow();const posthog = usePosthog();const flag = useFeatureFlag(enableNewAppViews);@@ -79,7 +79,9 @@ function useNewAppViews() {createRenderEffect(() => {if (!ready()) return;panel.handle.updateMeta?.({- splitPanelLayout: enabled() ? 'composable' : 'legacy',+ splitPanelLayout: enabled()+ ? (options?.enabledLayout?.() ?? 'composable')+ : 'legacy',});});@@ -471,7 +473,9 @@ function LegacyChannelsView() {}function FeatureGatedChannelsView() {- const newAppViews = useNewAppViews();+ const newAppViews = useNewAppViews({+ enabledLayout: () => (isTouchDevice() ? 'legacy' : 'composable'),+ });return (<Show when={newAppViews.ready()} fallback={<LoadingBlock />}>@@ -485,16 +489,7 @@ function FeatureGatedChannelsView() {function RegisteredChannelsView() {usePageViewTracking('channels');- return (- <Switch>- <Match when={isTouchDevice()}>- <LegacyChannelsView />- </Match>- <Match when={!isTouchDevice()}>- <FeatureGatedChannelsView />- </Match>- </Switch>- );+ return <FeatureGatedChannelsView />;}registerComponent('channels', withAuth(RegisteredChannelsView));diff --git a/apps/web/src/components/list/README.md b/apps/web/src/components/list/README.mdnew file mode 100644index 0000000000..2ad8dab386--- /dev/null+++ b/apps/web/src/components/list/README.md@@ -0,0 +1,83 @@+# Query-backed list views++Status: design note for future iteration; this architecture is not yet fully+implemented.++## Goal++List views need one collection definition to drive both their mounted UI and+navigation after the list has opened an entity in the same split. The query and+pagination lifetime must follow the split panel, while rendering and expensive+reactive memoization should follow the mounted view.++## Layers++### Data source++A data source owns querying and fetching operations. Its values are exposed as+plain functions rather than source-owned memos so the caller decides where a+read is tracked.++The base contract should only contain data, request status, errors, and refresh.+Features extend that contract with their own operations. Pagination is not+required by every data source, so a paginated feature source adds `hasMore`,+`isLoadingMore`, and `loadMore` itself.++Tasks additionally exposes its per-group continuation sources. Each group+source returns raw group query data and its own pagination operations. The+source does not filter entities, sort them, or build list rows.++### List model++A feature-owned list model defines the semantic collection presented by the+view. It applies every rule that can change which entity navigation should open+next:++- tab and facet predicates+- sorting and grouping+- collapsed-group visibility+- parent and continuation-page merging+- deduplication+- selection of the pagination source for a row++The model exposes plain functions, including `items()` and a feature-specific+pagination resolver. The same model is used by rendering, the list controller,+and cross-block keyboard navigation.++### Controller and rendering++The data source, list model, controller, and cross-block navigation hotkeys are+owned by the split panel. They remain available after the list opens a block,+so j/k navigation can read the latest projected collection and fetch another+page when it reaches the end.++The mounted view creates local memos around the model functions for efficient+rendering and virtualization. Those memos belong beneath the view's Suspense+boundary. Presentation-only derivations remain local to row components.++The list controller must pull the model's current items during operations+instead of eagerly memoizing them in its panel-owned root. This lets mounted+rendering choose its reactive owner while off-screen navigation reads current+query and group pages on demand.++## Applying the pattern++Inbox's model owns Signal/Noise/All admission, notification enrichment, read+facets, date grouping, and ordering.++Tasks' model composes the parent query, search results, and per-group+continuations before applying task predicates, sorting, grouping, and collapsed+group visibility.++Channels' model composes channel, direct-message, and recents sources, then+owns section partitioning, recents ordering, disclosure visibility, and+section-specific pagination. Full and slim rails render the same model.++## Open questions++- Define the smallest pull-based controller change without regressing focus and+ selection reconciliation.+- Decide how the custom GraphQL query adapter should participate in Solid+ Suspense consistently with TanStack Query.+- Confirm whether grouped cross-block navigation should prefetch only the+ focused group or advance into the next visible group first.diff --git a/apps/web/src/components/ui/components/EmptyStatePanel.tsx b/apps/web/src/components/ui/components/EmptyStatePanel.tsxindex 9558ef09cf..f4a3962a40 100644--- a/apps/web/src/components/ui/components/EmptyStatePanel.tsx+++ b/apps/web/src/components/ui/components/EmptyStatePanel.tsx@@ -16,13 +16,16 @@ export interface EmptyStatePanelProps {graphicClass?: string;title?: string;description?: JSXElement;+ descriptionClass?: string;primaryAction?: EmptyStateAction;+ actionsClass?: string;/*** When set, renders a secondary "Documentation" button that opens the given* URL in a new tab. Omit when no relevant documentation page exists.*/documentationUrl?: string;documentationLabel?: string;+ documentationIcon?: Component<{ class?: string }>;/*** Centered, vertically-balanced variant for very simple states (e.g. "no* results") that are just a graphic and a line of text. Defaults to the@@ -86,13 +89,18 @@ export function EmptyStatePanel(props: EmptyStatePanelProps) {<h2 class="text-base font-semibold text-ink">{props.title}</h2></Show><Show when={props.description}>- <div class="mt-3 text-sm/6 text-ink-muted">{props.description}</div>+ <p+ class={cn('mt-3 text-sm/6 text-ink-muted', props.descriptionClass)}+ >+ {props.description}+ </p></Show><Show when={props.primaryAction || props.documentationUrl}><divclass={cn('mt-3 flex flex-wrap gap-2 @max-sm:w-full @max-sm:flex-col',- props.centered ? 'justify-center' : 'justify-start'+ props.centered ? 'justify-center' : 'justify-start',+ props.actionsClass)}><Show when={props.primaryAction}>@@ -110,6 +118,7 @@ export function EmptyStatePanel(props: EmptyStatePanelProps) {{(url) => (<PillButtontone="subtle"+ icon={props.documentationIcon}onClick={() => openExternalUrl(url())}>{props.documentationLabel ?? 'Documentation'}diff --git a/apps/web/src/components/ui/components/Tabs.tsx b/apps/web/src/components/ui/components/Tabs.tsxindex b391dcce5d..651c202fc0 100644--- a/apps/web/src/components/ui/components/Tabs.tsx+++ b/apps/web/src/components/ui/components/Tabs.tsx@@ -7,7 +7,7 @@ import { cn } from '../utils/classname';export type TabItem = {value: string;- label: string | JSX.Element;+ label: string | (() => JSX.Element);};export type TabsProps = {@@ -69,7 +69,7 @@ export const Tabs = (props: TabsProps) => {local.labelClass)}>- {item.label}+ {typeof item.label === 'function' ? item.label() : item.label}</KSegmentedControl.ItemLabel></KSegmentedControl.Item>)}diff --git a/apps/web/src/components/view-shell/ListDropdowns.tsx b/apps/web/src/components/view-shell/ListDropdowns.tsxindex 38ab0a25d7..448f86cb0f 100644--- a/apps/web/src/components/view-shell/ListDropdowns.tsx+++ b/apps/web/src/components/view-shell/ListDropdowns.tsx@@ -13,22 +13,33 @@ export type ListControlOption<TId extends string> = {disabled?: boolean;};+type ListDropdownOpenProps = {+ open?: boolean;+ onOpenChange?: (open: boolean) => void;+};+type SingleSelectDropdownProps<TId extends string> = {label: string;icon: JSX.Element;value: TId;options: ListControlOption<TId>[];onChange: (value: TId) => void;+ triggerRef?: (element: HTMLButtonElement) => void;class?: string;contentClass?: string;-};+} & ListDropdownOpenProps;function SingleSelectDropdown<TId extends string>(props: SingleSelectDropdownProps<TId>) {return (- <Dropdown placement="bottom-end">+ <Dropdown+ open={props.open}+ onOpenChange={props.onOpenChange}+ placement="bottom-end"+ ><Dropdown.Trigger+ ref={props.triggerRef}variant="outline"size="md"square@@ -135,19 +146,25 @@ export type ListFilterDropdownProps<selected: boolean) => void;onClear?: () => void;+ triggerRef?: (element: HTMLButtonElement) => void;label?: string;clearLabel?: string;class?: string;contentClass?: string;-};+} & ListDropdownOpenProps;export function ListFilterDropdown<TGroupId extends string,TOptionId extends string,>(props: ListFilterDropdownProps<TGroupId, TOptionId>) {return (- <Dropdown placement="bottom-end">+ <Dropdown+ open={props.open}+ onOpenChange={props.onOpenChange}+ placement="bottom-end"+ ><Dropdown.Trigger+ ref={props.triggerRef}variant="outline"size="md"squarediff --git a/apps/web/src/components/view-shell/ViewShell.tsx b/apps/web/src/components/view-shell/ViewShell.tsxindex 02b580ddce..4e2d3b9d34 100644--- a/apps/web/src/components/view-shell/ViewShell.tsx+++ b/apps/web/src/components/view-shell/ViewShell.tsx@@ -268,8 +268,17 @@ function Root(props: ViewShellRootProps) {* Sizing region for navigation. Renders a div, not aside.* ViewSidebar.Root inside keeps the landmark.*/-function Aside(props: JSX.HTMLAttributes<HTMLDivElement>) {- const [local, rest] = splitProps(props, ['children', 'class']);+type ViewShellAsideProps = JSX.HTMLAttributes<HTMLDivElement> & {+ /** Called with the solved aside width after a drag or keyboard resize. */+ onWidthChangeEnd?: (width: number) => void;+};++function Aside(props: ViewShellAsideProps) {+ const [local, rest] = splitProps(props, [+ 'children',+ 'class',+ 'onWidthChangeEnd',+ ]);const ws = useViewShellInternal();const redistributionPreferredSize = () => {const layout = ws.aside.layout();@@ -302,6 +311,7 @@ function Aside(props: JSX.HTMLAttributes<HTMLDivElement>) {redistributionPreferredSize={redistributionPreferredSize()}target={{ kind: 'px', px: ws.aside.layout().width }}collapsed={() => ws.aside.isCollapsed()}+ onSizeChangeEnd={local.onWidthChangeEnd}><div{...rest}@@ -351,7 +361,7 @@ function Header(props: JSX.HTMLAttributes<HTMLElement>) {<header{...rest}class={cn(- 'shrink-0 px-4 pb-5 pt-4 @max-[760px]/view-shell:px-3 @max-[480px]/view-shell:px-2',+ 'shrink-0 px-4 pb-3 pt-2 touch:px-(--mobile-chrome-gutter) touch:pt-[calc(var(--safe-top,0px)+0.5rem)]',local.class)}data-view-shell-header=""@@ -370,7 +380,7 @@ function Content(props: JSX.HTMLAttributes<HTMLDivElement>) {<div{...rest}class={cn(- 'min-h-0 min-w-0 flex-1 px-4 pb-4 @max-[760px]/view-shell:px-3 @max-[480px]/view-shell:px-2',+ 'min-h-0 min-w-0 flex-1 px-4 pb-4 @max-[760px]/view-shell:px-3 @max-[720px]/view-shell:pb-2 @max-[480px]/view-shell:px-2',local.class)}data-view-shell-content=""diff --git a/apps/web/src/features/channels-view/channels-view-context.tsx b/apps/web/src/features/channels-view/channels-view-context.tsxindex 3b8c986fce..fbbb1373c6 100644--- a/apps/web/src/features/channels-view/channels-view-context.tsx+++ b/apps/web/src/features/channels-view/channels-view-context.tsx@@ -4,9 +4,15 @@ import { createAssertedContextProvider } from '@core/context/createContext';import { useUserId } from '@core/context/user';import type { ContextProviderProps } from '@solid-primitives/context';import { createStore, type Store } from 'solid-js/store';+import {+ CHANNELS_DEFAULT_RAIL_WIDTH,+ clampChannelsRailWidth,+} from './constants';import { createChannelsViewPersistence } from './persistence';import type {ChannelsGroup,+ ChannelsQueryScope,+ ChannelsRailMode,ChannelsTab,ChannelsViewState,ChannelsViewStateOptions,@@ -19,8 +25,11 @@ type ChannelsViewProviderProps = ContextProviderProps & {export type ChannelsViewContext = {state: Store<ChannelsViewState>;setTab: (tab: ChannelsTab) => void;+ setMobileTab: (tab: ChannelsQueryScope) => void;setSelectedChannelId: (channelId: string | undefined) => void;setGroupOpen: (group: ChannelsGroup, open: boolean) => void;+ setAsideWidth: (width: number) => void;+ setRailMode: (mode: Exclude<ChannelsRailMode, 'auto'>) => void;};export const [ChannelsViewProvider, useChannelsView] =@@ -33,26 +42,39 @@ export const [ChannelsViewProvider, useChannelsView] =const [state, setState] = makePersistedState(createStore<ChannelsViewState>({tab: initial.tab ?? 'browse',+ mobileTab:+ initial.mobileTab ??+ (initial.tab === 'recents' ? 'recents' : 'channels'),selectedChannelId: initial.selectedChannelId,expandedGroups: {channels: initial.expandedGroups?.channels ?? true,direct_messages: initial.expandedGroups?.direct_messages ?? true,},+ asideWidth: clampChannelsRailWidth(+ initial.asideWidth ?? CHANNELS_DEFAULT_RAIL_WIDTH+ ),+ railMode: initial.railMode ?? 'auto',}),createChannelsViewPersistence({handle: panel.handle,userId,restoreEntryState: props.initialState === undefined,restoreLocalState: props.initialState === undefined,+ restorePreferences:+ initial.asideWidth === undefined && initial.railMode === undefined,}));return {state,setTab: (tab) => setState('tab', tab),+ setMobileTab: (tab) => setState('mobileTab', tab),setSelectedChannelId: (channelId) =>setState('selectedChannelId', channelId),setGroupOpen: (group, open) => setState('expandedGroups', group, open),+ setAsideWidth: (width) =>+ setState('asideWidth', clampChannelsRailWidth(width)),+ setRailMode: (mode) => setState('railMode', mode),};});diff --git a/apps/web/src/features/channels-view/channels-view.tsx b/apps/web/src/features/channels-view/channels-view.tsxindex 2939abd491..bd5304b07f 100644--- a/apps/web/src/features/channels-view/channels-view.tsx+++ b/apps/web/src/features/channels-view/channels-view.tsx@@ -1,29 +1,26 @@import { ViewShell } from '@app/components/view-shell';-import {- compileToAst,- defineQueryFilters,- queryStateFrom,-} from '@app/features/next-soup/filters/filter-store';import { createSizeBreakpoints } from '@app/util/create-size-breakpoints';import { useGlobalBlockOrchestrator } from '@components/app/GlobalAppState';import { PreviewPanel } from '@components/app/PreviewPanel';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 { isChannelEntity, ListEntityMetadataQueryProvider } from '@entity';-import { useSoupAstItemsQuery } from '@queries/soup/items';+import SpinnerIcon from '@phosphor/spinner.svg';import { createElementSize } from '@solid-primitives/resize-observer';import { createMemo, createSignal, onMount, Show, Suspense } from 'solid-js';import { ChannelsViewProvider, useChannelsView } from './channels-view-context';-import { ChannelsRail } from './components/ChannelsRail';+import { ChannelsMobileView } from './components/ChannelsMobileView';+import { ChannelsRail } from './components/rail/ChannelsRail';+import {+ CHANNELS_MAX_RAIL_WIDTH,+ CHANNELS_MIN_RAIL_WIDTH,+ CHANNELS_NARROW_RAIL_WIDTH,+} from './constants';+import { useChannelsQuery } from './queries';import type { ChannelsViewStateOptions } from './types';-const SIDEBAR_CHANNEL_LIMIT = 100;-const NARROW_RAIL_WIDTH = 64;-const DEFAULT_RAIL_WIDTH = 360;-const MIN_RAIL_WIDTH = 224;-const MAX_RAIL_WIDTH = 420;-export type ChannelsViewProps = {/** Explicit navigation state. When present, it wins over entry restoration. */initialState?: ChannelsViewStateOptions;@@ -32,45 +29,34 @@ export type ChannelsViewProps = {function ChannelsViewRoot() {const panel = useSplitPanelOrThrow();const orchestrator = useGlobalBlockOrchestrator();- const { state } = useChannelsView();+ const { state, setAsideWidth, setMobileTab, setRailMode } = useChannelsView();const [workspace, setWorkspace] = createSignal<HTMLDivElement>();const workspaceSize = createElementSize(workspace);const breakpoints = createSizeBreakpoints(() => workspaceSize.width ?? undefined,{ narrow: 720 });- const railMode = () => (breakpoints.narrow() ? 'slim' : 'full');+ const railMode = () =>+ state.railMode === 'auto'+ ? breakpoints.narrow()+ ? 'slim'+ : 'full'+ : state.railMode;const railLayout = () =>railMode() === 'slim'? {- width: NARROW_RAIL_WIDTH,- min: NARROW_RAIL_WIDTH,- max: NARROW_RAIL_WIDTH,+ width: CHANNELS_NARROW_RAIL_WIDTH,+ min: CHANNELS_NARROW_RAIL_WIDTH,+ max: CHANNELS_NARROW_RAIL_WIDTH,}: {- width: DEFAULT_RAIL_WIDTH,- min: MIN_RAIL_WIDTH,- max: MAX_RAIL_WIDTH,+ width: state.asideWidth,+ min: CHANNELS_MIN_RAIL_WIDTH,+ max: CHANNELS_MAX_RAIL_WIDTH,};- const channelsQuery = useSoupAstItemsQuery(- () => ({- params: {- limit: SIDEBAR_CHANNEL_LIMIT,- sort_method: 'updated_at',- },- body: compileToAst(- queryStateFrom(- defineQueryFilters({- include: {- channelImportance: true,- channelIsParticipant: [true],- },- })- )- ),- }),- () => ({ staleTime: 30_000 })+ const channelsQuery = useChannelsQuery(() =>+ isTouchDevice() ? state.mobileTab : 'recents');const channels = createMemo(() =>(channelsQuery.data?.entities ?? []).filter(isChannelEntity)@@ -86,47 +72,86 @@ function ChannelsViewRoot() {<StaticMarkdownContext><SplitPanel.Root><SplitPanel.Body>- <div ref={setWorkspace} class="size-full min-h-0 bg-panel">- <ViewShell.Root- aside={railLayout()}- breakpoints={{ collapsed: 0 }}- layoutBreakpoint="collapsed"- main={{ min: 224 }}- resizable={railMode() === 'full'}- >- <ViewShell.Aside>- <ChannelsRail channels={channels()} mode={railMode()} />- </ViewShell.Aside>- <ViewShell.Main class="overflow-hidden">- <Show- when={selectedChannel()}- fallback={- <div class="flex size-full items-center justify-center px-6 text-center">- <div class="flex max-w-sm flex-col gap-2">- <h2 class="text-base font-semibold text-ink">- Select a conversation- </h2>- <p class="text-sm leading-5 text-ink-muted">- Choose a channel or person from the sidebar to open- the conversation here.- </p>- </div>- </div>- }+ <Show+ when={isTouchDevice()}+ fallback={+ <div ref={setWorkspace} class="size-full min-h-0 bg-panel">+ <ViewShell.Root+ aside={railLayout()}+ breakpoints={{ collapsed: 0 }}+ layoutBreakpoint="collapsed"+ main={{ min: 224 }}+ resizable={railMode() === 'full'}>- {(channel) => (- <Suspense>- <PreviewPanel- selectedEntity={channel()}- orchestrator={orchestrator}- splitPanelContext={panel}- />- </Suspense>- )}- </Show>- </ViewShell.Main>- </ViewShell.Root>- </div>+ <ViewShell.Aside+ onWidthChangeEnd={(width) => {+ if (railMode() === 'full') setAsideWidth(width);+ }}+ >+ <ChannelsRail+ channels={channels()}+ mode={railMode()}+ onModeChange={setRailMode}+ />+ </ViewShell.Aside>+ <ViewShell.Main class="overflow-hidden">+ <Show+ when={selectedChannel()}+ fallback={+ <div class="flex size-full items-center justify-center px-6 text-center">+ <div class="flex max-w-sm flex-col gap-2">+ <h2 class="text-base font-semibold text-ink">+ Select a conversation+ </h2>+ <p class="text-sm leading-5 text-ink-muted">+ Choose a channel or person from the sidebar to+ open the conversation here.+ </p>+ </div>+ </div>+ }+ >+ {(channel) => (+ <Suspense>+ <PreviewPanel+ selectedEntity={channel()}+ orchestrator={orchestrator}+ splitPanelContext={panel}+ headerLeading={+ <Show when={railMode() === 'slim'}>+ <SplitPanel.ControlGroup class="mr-1">+ <SplitPanel.BackButton />+ <SplitPanel.ForwardButton />+ </SplitPanel.ControlGroup>+ </Show>+ }+ />+ </Suspense>+ )}+ </Show>+ </ViewShell.Main>+ </ViewShell.Root>+ </div>+ }+ >+ <Suspense+ fallback={+ <div class="grid size-full place-items-center text-ink-muted">+ <SpinnerIcon+ aria-label="Loading channels"+ class="size-5 animate-spin"+ />+ </div>+ }+ >+ <ChannelsMobileView+ channels={channels()}+ source={channelsQuery}+ tab={state.mobileTab}+ onTabChange={setMobileTab}+ />+ </Suspense>+ </Show></SplitPanel.Body></SplitPanel.Root></StaticMarkdownContext>diff --git a/apps/web/src/features/channels-view/components/ChannelRailItems.tsx b/apps/web/src/features/channels-view/components/ChannelRailItems.tsxdeleted file mode 100644index d77c9a06a9..0000000000--- a/apps/web/src/features/channels-view/components/ChannelRailItems.tsx+++ /dev/null@@ -1,305 +0,0 @@-import { StaticMarkdown } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';-import { useUserId } from '@core/context/user';-import { getDisplayName, tryMacroId } from '@core/user';-import type { MacroId } from '@core/user/macroId';-import { type ChannelEntity, Entity } from '@entity';-import ReplyIcon from '@phosphor/arrow-bend-up-left.svg';-import AtIcon from '@phosphor/at.svg';-import { cn, Tooltip } from '@ui';-import { Show } from 'solid-js';-import { channelInitials, formatDetailedTimestamp } from '../utils';--function ChannelAvatar(props: { channel: ChannelEntity; size?: 'sm' | 'md' }) {- const sizeClass = () =>- props.size === 'md' ? 'size-9 [&_svg]:size-4.5' : 'size-6 [&_svg]:size-3.5';-- return (- <Show- when={props.channel.channelType === 'direct_message'}- fallback={- <span- class={cn(- 'flex shrink-0 items-center justify-center text-ink-muted [&_svg]:shrink-0',- sizeClass()- )}- >- <Entity.Icon- entity={props.channel}- suppressClick- showTooltip={false}- />- </span>- }- >- <span- class={cn(- 'relative flex shrink-0 items-center justify-center overflow-hidden rounded-full border border-edge bg-surface-2 [&_img]:size-full [&_svg]:shrink-0',- sizeClass()- )}- >- <Entity.Icon entity={props.channel} suppressClick showTooltip={false} />- </span>- </Show>- );-}--function SlimChannelAvatar(props: { channel: ChannelEntity }) {- return (- <Show- when={props.channel.channelType === 'direct_message'}- fallback={- <span class="flex size-6 shrink-0 items-center justify-center rounded-full border border-edge bg-surface-2 text-xxs font-semibold tracking-wide text-ink">- {channelInitials(props.channel.name)}- </span>- }- >- <span class="relative flex size-6 shrink-0 items-center justify-center overflow-hidden rounded-full border border-edge bg-surface-2 [&_img]:size-full [&_svg]:size-3.5 [&_svg]:shrink-0">- <Entity.Icon entity={props.channel} suppressClick showTooltip={false} />- </span>- </Show>- );-}--type ChannelOptionProps = {- id: string;- channel: ChannelEntity;- unread: boolean;- selected: boolean;- focused: boolean;- onActivate: () => void;-};--export function ChannelOption(props: ChannelOptionProps) {- return (- <button- id={props.id}- type="button"- role="treeitem"- tabIndex={-1}- class={cn(- 'relative flex w-full min-w-0 items-center gap-2 rounded-xl px-2 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-accent',- props.channel.channelType === 'direct_message'- ? 'min-h-10 py-2'- : 'h-8',- props.selected && 'bg-active text-ink',- !props.selected && props.focused && 'bg-hover text-ink',- !props.selected &&- !props.focused &&- 'text-ink-muted hover:bg-hover hover:text-ink'- )}- aria-current={props.selected ? 'page' : undefined}- onClick={props.onActivate}- >- <ChannelAvatar channel={props.channel} />- <span class="min-w-0 flex-1 truncate text-sm font-medium">- {props.channel.name}- </span>- <Show when={props.unread}>- <span- aria-label="Unread"- class="size-2 shrink-0 rounded-full bg-accent"- />- </Show>- </button>- );-}--export function SlimChannelOption(props: ChannelOptionProps) {- return (- <Tooltip label={props.channel.name} placement="right" class="size-10">- <button- id={props.id}- type="button"- role="treeitem"- tabIndex={-1}- class={cn(- 'relative flex size-10 min-h-10 items-center justify-center rounded-full text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-accent',- props.selected && 'bg-active text-ink',- !props.selected && props.focused && 'bg-hover text-ink',- !props.selected &&- !props.focused &&- 'text-ink-muted hover:bg-hover hover:text-ink'- )}- aria-current={props.selected ? 'page' : undefined}- onClick={props.onActivate}- >- <SlimChannelAvatar channel={props.channel} />- <Show when={props.unread}>- <span- aria-label="Unread"- class="absolute right-1.5 top-1 size-2 rounded-full bg-accent"- />- </Show>- </button>- </Tooltip>- );-}--type ConversationCardProps = {- id: string;- channel: ChannelEntity;- senderId?: string;- mentionedCurrentUser: boolean;- unread: boolean;- selected: boolean;- focused: boolean;- onActivate: () => void;-};--function UserDisplayName(props: { id: MacroId }) {- const displayName = () =>- getDisplayName(props.id, {- emailFallback: 'local-part',- });-- return <>{displayName()}</>;-}--function MessageSenderName(props: { id?: string }) {- const currentUserId = useUserId();- const macroId = () => (props.id ? tryMacroId(props.id) : undefined);- const isCurrentUser = () =>- props.id?.toLocaleLowerCase() === currentUserId()?.toLocaleLowerCase();-- return (- <Show when={props.id} fallback={<>Unknown sender</>}>- {(senderId) => (- <Show when={!isCurrentUser()} fallback={<>You</>}>- <Show- when={macroId()}- fallback={senderId().startsWith('bot|') ? 'Bot' : 'Someone'}- >- {(id) => <UserDisplayName id={id()} />}- </Show>- </Show>- )}- </Show>- );-}--export function ConversationCard(props: ConversationCardProps) {- const latestRootMessage = () => props.channel.latestRootMessage;-- return (- <div- id={props.id}- role="treeitem"- tabIndex={-1}- class={cn(- 'w-full min-w-0 overflow-hidden px-2 py-3 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent',- props.selected && 'bg-active',- !props.selected && props.focused && 'bg-hover',- !props.selected && !props.focused && 'bg-transparent hover:bg-hover'- )}- aria-current={props.selected ? 'page' : undefined}- onClick={props.onActivate}- >- <div class="flex min-w-0 items-start gap-3 overflow-hidden">- <ChannelAvatar channel={props.channel} size="md" />- <div class="min-w-0 flex-1 overflow-hidden">- <span class="flex min-w-0 items-center gap-2">- <span class="min-w-0 flex-1 truncate text-sm font-medium text-ink">- {props.channel.name}- </span>- <Show when={props.unread}>- <span- aria-label="Unread"- class="size-2 shrink-0 rounded-full bg-accent"- />- </Show>- <Show when={latestRootMessage()?.createdAt}>- {(createdAt) => (- <Tooltip- label={formatDetailedTimestamp(createdAt())}- placement="top"- >- <span class="shrink-0 text-xxs text-ink-extra-muted">- <Entity.Timestamp- entity={props.channel}- overrideTimeStamp={createdAt()}- />- </span>- </Tooltip>- )}- </Show>- </span>- <Show- when={latestRootMessage()?.threadId || props.mentionedCurrentUser}- >- <span class="flex min-w-0 items-center gap-2 text-xxs leading-4 text-ink-extra-muted">- <Show when={latestRootMessage()?.threadId}>- <span- class="flex shrink-0 items-center gap-1"- title="Reply in thread"- >- <ReplyIcon class="size-3" />- <span>Reply</span>- </span>- </Show>- <Show when={props.mentionedCurrentUser}>- <span class="flex shrink-0 items-center gap-1 text-accent">- <AtIcon class="size-3" />- <span>Mentioned you</span>- </span>- </Show>- </span>- </Show>- <div class="flex min-w-0 items-center gap-1 overflow-hidden whitespace-nowrap text-xs leading-4">- <span class="shrink-0 font-medium text-ink-muted">- <MessageSenderName id={props.senderId} />:- </span>- <Show- when={latestRootMessage()?.content.trim()}- fallback={- <span class="min-w-0 flex-1 text-ink-extra-muted">- No messages yet- </span>- }- >- {(content) => (- <div class="min-w-0 flex-1 truncate text-ink-muted [&_*]:my-0 [&_*]:truncate">- <StaticMarkdown markdown={content()} singleLine />- </div>- )}- </Show>- </div>- </div>- </div>- </div>- );-}--export function SlimConversationCard(props: ConversationCardProps) {- return (- <Tooltip- label={props.channel.name}- placement="right"- class="size-10 self-center"- >- <button- id={props.id}- type="button"- role="treeitem"- tabIndex={-1}- class={cn(- 'flex size-10 items-center justify-center rounded-full outline-none transition-colors focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent',- props.selected && 'bg-active',- !props.selected && props.focused && 'bg-hover',- !props.selected && !props.focused && 'bg-transparent hover:bg-hover'- )}- aria-current={props.selected ? 'page' : undefined}- onClick={props.onActivate}- >- <span class="relative">- <SlimChannelAvatar channel={props.channel} />- <Show when={props.unread}>- <span- aria-label="Unread"- class="absolute -right-0.5 -top-0.5 size-2 rounded-full bg-accent ring-2 ring-surface"- />- </Show>- </span>- </button>- </Tooltip>- );-}diff --git a/apps/web/src/features/channels-view/components/ChannelsEmptyState.tsx b/apps/web/src/features/channels-view/components/ChannelsEmptyState.tsxnew file mode 100644index 0000000000..deb55108a1--- /dev/null+++ b/apps/web/src/features/channels-view/components/ChannelsEmptyState.tsx@@ -0,0 +1,85 @@+import { DOCS_BASE } from '@app/constants/docs-links';+import {+ runCreateAction,+ useCreatableEnabled,+} from '@app/features/command/Launcher';+import { openNewChannelModal } from '@channel/CreateChannelModal';+import EmptyStateChannelsGraphic from '@design/empty-state-channels.svg';+import BookOpenIcon from '@phosphor/book-open.svg';+import PlusIcon from '@phosphor/plus.svg';+import { type EmptyStateAction, EmptyStatePanel } from '@ui';+import type { ChannelsQueryScope } from '../types';++type ChannelsEmptyStateContent = {+ title: string;+ description: string;+ action: EmptyStateAction;+};++function emptyStateContent(+ scope: ChannelsQueryScope+): ChannelsEmptyStateContent {+ if (scope === 'channels') {+ return {+ title: 'No channels to show',+ description: 'Channels you join or create will appear here.',+ action: {+ label: 'New channel',+ icon: PlusIcon,+ onClick: openNewChannelModal,+ },+ };+ }++ if (scope === 'direct_messages') {+ return {+ title: 'No direct messages',+ description: 'Start a private conversation with someone.',+ action: {+ label: 'Start direct message',+ icon: PlusIcon,+ onClick: () => runCreateAction('channel'),+ },+ };+ }++ return {+ title: 'No recent conversations',+ description: 'Your latest conversations will appear here.',+ action: {+ label: 'Start a conversation',+ icon: PlusIcon,+ onClick: () => runCreateAction('channel'),+ },+ };+}++export function ChannelsEmptyState(props: {+ scope: ChannelsQueryScope;+ topAligned?: boolean;+}) {+ const isCreatableEnabled = useCreatableEnabled();+ const content = () => emptyStateContent(props.scope);++ return (+ <EmptyStatePanel+ centered+ graphic={EmptyStateChannelsGraphic}+ graphicClass="aspect-square h-auto w-[clamp(12rem,70%,18rem)] self-center"+ title={content().title}+ description={content().description}+ descriptionClass="mt-1 text-balance"+ actionsClass="mt-5 flex-row @max-sm:flex-row"+ primaryAction={+ isCreatableEnabled('channel') ? content().action : undefined+ }+ documentationUrl={`${DOCS_BASE}/product/channels`}+ documentationIcon={BookOpenIcon}+ class={+ props.topAligned+ ? 'px-4 pt-4 @4xl:px-4 [&>div:first-child]:basis-0'+ : 'px-4 @4xl:px-4'+ }+ />+ );+}diff --git a/apps/web/src/features/channels-view/components/ChannelsMobileView.tsx b/apps/web/src/features/channels-view/components/ChannelsMobileView.tsxnew file mode 100644index 0000000000..f50d159a3a--- /dev/null+++ b/apps/web/src/features/channels-view/components/ChannelsMobileView.tsx@@ -0,0 +1,212 @@+import { openEntityInSplitFromUnifiedList } from '@app/features/next-soup/utils';+import { DEBUG_SETTING_KEYS, useDebugSetting } from '@app/lib/debugSettings';+import { useGlobalNotificationSource } from '@components/app/GlobalAppState';+import { type PillTabItem, PillTabs } from '@components/app/mobile/PillTabs';+import { SplitHeaderLeft } from '@components/app/split-layout/components/SplitHeader';+import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';+import { useUserId } from '@core/context/user';+import type { ChannelEntity } from '@entity';+import SpinnerIcon from '@phosphor/spinner.svg';+import type { SoupAstItemsQuery } from '@queries/soup/items';+import { createElementSize } from '@solid-primitives/resize-observer';+import { Button } from '@ui';+import {+ createMemo,+ createSignal,+ createUniqueId,+ Match,+ Show,+ Switch,+} from 'solid-js';+import { Virtualizer, type VirtualizerHandle } from 'virtua/solid';+import { useChannelsView } from '../channels-view-context';+import { filterChannelsForScope } from '../queries';+import type { ChannelsQueryScope } from '../types';+import { channelMentionsUser } from '../utils';+import { ChannelsEmptyState } from './ChannelsEmptyState';+import { ConversationCard } from './rail/ConversationCard';+import { useChannelCalls } from './rail/hooks/useChannelCalls';+import { useChannelRailActivity } from './rail/hooks/useChannelRailActivity';++const MOBILE_CHANNEL_TABS: PillTabItem<ChannelsQueryScope>[] = [+ { value: 'recents', label: 'Recents' },+ { value: 'channels', label: 'Channels' },+ { value: 'direct_messages', label: 'DMs' },+];+const MOBILE_TAB_STRIP_CLASS =+ '-ml-(--mobile-chrome-gutter) w-[100cqw] max-w-none flex-none';+const MOBILE_TAB_CONTENT_CLASS = 'px-(--mobile-chrome-gutter)';+const MOBILE_CHANNEL_ITEM_SIZE = 72;+const MOBILE_CHANNEL_BUFFER_SIZE = MOBILE_CHANNEL_ITEM_SIZE * 6;+const LOAD_MORE_THRESHOLD = 300;++export function ChannelsMobileView(props: {+ channels: ChannelEntity[];+ source: SoupAstItemsQuery;+ tab: ChannelsQueryScope;+ onTabChange: (tab: ChannelsQueryScope) => void;+}) {+ const panel = useSplitPanelOrThrow();+ const notificationSource = useGlobalNotificationSource();+ const currentUserId = useUserId();+ const { state, setSelectedChannelId } = useChannelsView();+ const [viewport, setViewport] = createSignal<HTMLDivElement>();+ const [virtualizer, setVirtualizer] = createSignal<VirtualizerHandle>();+ const [topSpacer, setTopSpacer] = createSignal<HTMLDivElement>();+ const topSpacerSize = createElementSize(topSpacer);+ const forceEmptyState = useDebugSetting(+ DEBUG_SETTING_KEYS.FORCE_EMPTY_STATES+ );+ const listId = createUniqueId();+ const { callActivity, incomingCallIds, callStatuses } = useChannelCalls();+ const channelActivity = useChannelRailActivity(+ () => props.channels,+ callActivity+ );++ const visibleChannels = createMemo(() =>+ filterChannelsForScope(props.tab, props.channels)+ );++ const selectTab = (tab: ChannelsQueryScope) => {+ props.onTabChange(tab);+ viewport()?.scrollTo({ top: 0 });+ };++ const topInset = () => topSpacerSize.height ?? 0;++ function loadNextPage() {+ if (+ props.source.isFetching ||+ props.source.isFetchingNextPage ||+ !props.source.hasNextPage+ ) {+ return;+ }++ void props.source.fetchNextPage();+ }++ function checkNearEnd(offset?: number) {+ const handle = virtualizer();+ if (!handle) return;++ const distance =+ handle.scrollSize - handle.viewportSize - (offset ?? handle.scrollOffset);+ if (distance >= LOAD_MORE_THRESHOLD) return;++ loadNextPage();+ }++ const openChannel = (channel: ChannelEntity) => {+ setSelectedChannelId(channel.id);+ void openEntityInSplitFromUnifiedList(channel, {+ splitHandle: panel.handle,+ referredFrom: 'channels',+ notificationSource,+ });+ };++ return (+ <>+ <SplitHeaderLeft>+ <div class="flex h-full w-full min-w-0 flex-1 items-center">+ <PillTabs+ scrollable+ class={MOBILE_TAB_STRIP_CLASS}+ contentClass={MOBILE_TAB_CONTENT_CLASS}+ items={MOBILE_CHANNEL_TABS}+ value={props.tab}+ onChange={selectTab}+ />+ </div>+ </SplitHeaderLeft>++ <div+ role="tree"+ aria-label={`${MOBILE_CHANNEL_TABS.find((tab) => tab.value === props.tab)?.label ?? 'Channels'} conversations`}+ aria-busy={props.source.isFetchingNextPage}+ class="size-full min-h-0 overflow-hidden"+ >+ <div+ ref={setViewport}+ class="scrollbar-hidden size-full min-h-0 overflow-y-auto overscroll-none"+ >+ <div+ ref={setTopSpacer}+ aria-hidden="true"+ class="h-[calc(var(--mobile-content-inset-top,0px)+0.75rem)]"+ />+ <Switch>+ <Match when={!forceEmptyState() && props.source.isLoading}>+ <div class="grid min-h-32 place-items-center text-ink-muted">+ <SpinnerIcon+ aria-label="Loading conversations"+ class="size-5 animate-spin"+ />+ </div>+ </Match>+ <Match when={!forceEmptyState() && props.source.error}>+ <div class="flex min-h-32 flex-col items-center justify-center gap-3 px-(--mobile-chrome-gutter) text-sm text-ink-muted">+ <span>Conversations couldn’t be loaded.</span>+ <Button+ variant="outline"+ size="sm"+ onClick={() => void props.source.refresh()}+ >+ Try again+ </Button>+ </div>+ </Match>+ <Match when={forceEmptyState() || visibleChannels().length === 0}>+ <ChannelsEmptyState scope={props.tab} />+ </Match>+ <Match when={true}>+ <Virtualizer+ ref={(handle) => setVirtualizer(handle)}+ data={visibleChannels()}+ scrollRef={viewport()}+ startMargin={topInset()}+ itemSize={MOBILE_CHANNEL_ITEM_SIZE}+ bufferSize={MOBILE_CHANNEL_BUFFER_SIZE}+ onScroll={checkNearEnd}+ >+ {(channel) => (+ <ConversationCard+ id={`${listId}-channel:${channel.id}`}+ class="border-b border-edge-muted/50 px-(--mobile-chrome-gutter) touch:pl-6"+ channel={channel}+ showLatestMessage={props.tab === 'recents'}+ senderId={channel.latestRootMessage?.senderId}+ mentionedCurrentUser={channelMentionsUser(+ channel,+ currentUserId()+ )}+ unread={channelActivity.unreadChannelIds().has(channel.id)}+ callStatus={callStatuses().get(channel.id)}+ incomingCallId={incomingCallIds().get(channel.id)}+ selected={state.selectedChannelId === channel.id}+ focused={false}+ onActivate={() => openChannel(channel)}+ />+ )}+ </Virtualizer>+ <Show when={props.source.isFetchingNextPage}>+ <div class="flex h-12 items-center justify-center text-ink-muted">+ <SpinnerIcon+ aria-label="Loading more conversations"+ class="size-4 animate-spin"+ />+ </div>+ </Show>+ </Match>+ </Switch>+ <div+ aria-hidden="true"+ class="h-[max(1rem,var(--mobile-content-inset-bottom,0px))]"+ />+ </div>+ </div>+ </>+ );+}diff --git a/apps/web/src/features/channels-view/components/ChannelsRail.tsx b/apps/web/src/features/channels-view/components/ChannelsRail.tsxdeleted file mode 100644index 4a50f97fdf..0000000000--- a/apps/web/src/features/channels-view/components/ChannelsRail.tsx+++ /dev/null@@ -1,846 +0,0 @@-import {- createListController,- type ListScrollHandle,- listOwnedSlotName,- useListInteractions,-} from '@app/components/list';-import { useViewTabHotkeys } from '@app/components/view-shell';-import { CommandState } from '@app/features/command';-import { openNewChannelModal } from '@channel/CreateChannelModal';-import { useGlobalNotificationSource } from '@components/app/GlobalAppState';-import {- useSplitPanelOrThrow,- withSplitPanelOwner,-} from '@components/app/split-layout/layoutUtils';-import { SplitPanel } from '@components/app/split-panel';-import { useUserId } from '@core/context/user';-import { createHotkeyGroup, registerHotkey } from '@core/hotkey/hotkeys';-import { compareDateDesc } from '@core/util/date';-import type { ChannelEntity } from '@entity';-import { notificationIsRead } from '@entity/utils/notification';-import ChannelIcon from '@icon/wide-channel.svg';-import CaretDownIcon from '@phosphor/caret-down.svg';-import ChatTeardropIcon from '@phosphor/chat-teardrop.svg';-import ChatTextIcon from '@phosphor/chat-text.svg';-import ChatsIcon from '@phosphor/chats-circle.svg';-import { Key } from '@solid-primitives/keyed';-import { cn, Tabs } from '@ui';-import {- createEffect,- createMemo,- createUniqueId,- Match,- on,- onCleanup,- Show,- Switch,-} from 'solid-js';-import { useChannelsView } from '../channels-view-context';-import type { ChannelsGroup, ChannelsTab } from '../types';-import {- ChannelOption,- ConversationCard,- SlimChannelOption,- SlimConversationCard,-} from './ChannelRailItems';-import { CollapsibleSection, CreateRailAction } from './ChannelsRailSection';--const CHANNEL_TABS = [- {- value: 'browse',- label: 'Browse',- },- {- value: 'recents',- label: 'Recents',- },-];-const SLIM_CHANNEL_TABS = [- {- value: 'browse',- label: (- <>- <span class="sr-only">Browse</span>- <span aria-hidden="true" class="[&_svg]:size-4">- <ChatsIcon />- </span>- </>- ),- },- {- value: 'recents',- label: (- <>- <span class="sr-only">Recents</span>- <span aria-hidden="true" class="[&_svg]:size-4">- <ChatTextIcon />- </span>- </>- ),- },-];-const CHANNEL_TAB_IDS: ChannelsTab[] = ['browse', 'recents'];-const CHANNEL_GROUPS: ChannelsGroup[] = ['channels', 'direct_messages'];--type ChannelRailRow =- | {- kind: 'section';- id: `section:${ChannelsGroup}`;- group: ChannelsGroup;- }- | {- kind: 'conversation';- id: `channel:${string}`;- group?: ChannelsGroup;- channel: ChannelEntity;- };--const sectionRow = (group: ChannelsGroup): ChannelRailRow => ({- kind: 'section',- id: `section:${group}`,- group,-});--const conversationRow = (- channel: ChannelEntity,- group?: ChannelsGroup-): ChannelRailRow => ({- kind: 'conversation',- id: `channel:${channel.id}`,- group,- channel,-});--const rowKeyForChannel = (channelId: string) => `channel:${channelId}`;-const rowKeyForSection = (group: ChannelsGroup) => `section:${group}`;--/** V2 Chat navigation rail with Browse and Recents destinations. */-export function ChannelsRail(props: {- channels: ChannelEntity[];- mode: 'full' | 'slim';-}) {- const { state, setGroupOpen, setSelectedChannelId, setTab } =- useChannelsView();- const panel = useSplitPanelOrThrow();- const currentUserId = useUserId();- const notificationSource = useGlobalNotificationSource();- const listDomId = createUniqueId();- const sectionScrollRoots: Partial<Record<ChannelsGroup, HTMLDivElement>> = {};-- useViewTabHotkeys({- scopeId: panel.splitHotkeyScope,- enabled: panel.isPanelActive,- ids: () => CHANNEL_TAB_IDS,- activeId: () => state.tab,- setActiveId: setTab,- });-- const unreadChannelIds = createMemo(() => {- const ids = new Set<string>();-- for (const notification of notificationSource.notifications()) {- if (- notification.entity_type === 'channel' &&- !notificationIsRead(notification)- ) {- ids.add(notification.entity_id);- }- }-- return ids;- });-- const teamChannels = createMemo(() =>- props.channels.filter((channel) => channel.channelType !== 'direct_message')- );- const directMessages = createMemo(() =>- props.channels.filter((channel) => channel.channelType === 'direct_message')- );- const unreadTeamChannelCount = createMemo(- () =>- teamChannels().filter((channel) => unreadChannelIds().has(channel.id))- .length- );- const unreadDirectMessageCount = createMemo(- () =>- directMessages().filter((channel) => unreadChannelIds().has(channel.id))- .length- );- const recentConversations = createMemo(() =>- props.channels- .filter((channel) => channel.latestRootMessage)- .sort((a, b) =>- compareDateDesc(- a.latestRootMessage?.createdAt,- b.latestRootMessage?.createdAt- )- )- );- const visibleRows = createMemo<ChannelRailRow[]>(() => {- if (state.tab === 'recents') {- return recentConversations().map((channel) => conversationRow(channel));- }-- const rows: ChannelRailRow[] = [sectionRow('channels')];- if (state.expandedGroups.channels) {- rows.push(- ...teamChannels().map((channel) => conversationRow(channel, 'channels'))- );- }-- rows.push(sectionRow('direct_messages'));- if (state.expandedGroups.direct_messages) {- rows.push(- ...directMessages().map((channel) =>- conversationRow(channel, 'direct_messages')- )- );- }-- return rows;- });-- const list = withSplitPanelOwner(listOwnedSlotName('controller'), () =>- createListController<ChannelRailRow>({- items: visibleRows,- getKey: (row) => row.id,- isSelectable: () => false,- initialFocusKey:- state.selectedChannelId === undefined- ? undefined- : rowKeyForChannel(state.selectedChannelId),- onActivate: ({ item }) => {- if (item.kind === 'section') {- setGroupOpen(item.group, !state.expandedGroups[item.group]);- return;- }-- setSelectedChannelId(item.channel.id);- },- })- );-- const domIdForRow = (rowId: string) => `${listDomId}-${rowId}`;- let listRoot: HTMLDivElement | undefined;- const setSectionScrollRoot =- (group: ChannelsGroup) => (element: HTMLDivElement) => {- sectionScrollRoots[group] = element;- };- const scrollHandle: ListScrollHandle = {- scrollToIndex: (index) => {- const row = list.items.at(index);- if (!row) return;-- const element = document.getElementById(domIdForRow(row.id));- const scrollRoot =- row.kind === 'conversation' && row.group- ? sectionScrollRoots[row.group]- : state.tab === 'recents'- ? listRoot- : undefined;- if (!element || !scrollRoot) return;-- const elementBounds = element.getBoundingClientRect();- const scrollBounds = scrollRoot.getBoundingClientRect();- if (elementBounds.top < scrollBounds.top) {- scrollRoot.scrollTop -= scrollBounds.top - elementBounds.top;- } else if (elementBounds.bottom > scrollBounds.bottom) {- scrollRoot.scrollTop += elementBounds.bottom - scrollBounds.bottom;- }- },- };-- withSplitPanelOwner(listOwnedSlotName('navigation-hotkeys'), () =>- useListInteractions({- controller: list,- scopeId: panel.splitHotkeyScope,- scrollHandle: () => scrollHandle,- enabled: panel.isPanelActive,- navigation: {- onNavigate: (event) => {- listRoot?.focus({ preventScroll: true });-- const row = event.result?.item;- if (row?.kind === 'conversation') {- setSelectedChannelId(row.channel.id);- }- },- },- disclosure: {- getKey: (row) => row.group,- isExpanded: (group) => state.expandedGroups[group as ChannelsGroup],- setExpanded: (group, expanded) =>- setGroupOpen(group as ChannelsGroup, expanded),- getFocusKey: (group) => rowKeyForSection(group as ChannelsGroup),- },- })- );-- const jumpToSection = (offset: 1 | -1) => {- const currentGroup = list.focus.item()?.group;- const currentIndex = currentGroup- ? CHANNEL_GROUPS.indexOf(currentGroup)- : -1;- const origin = currentIndex === -1 ? (offset === 1 ? -1 : 0) : currentIndex;-- const nextIndex =- (origin + offset + CHANNEL_GROUPS.length) % CHANNEL_GROUPS.length;- const nextGroup = CHANNEL_GROUPS[nextIndex];- if (!nextGroup) return false;-- const result = list.focus.set(rowKeyForSection(nextGroup), {- reason: 'keyboard',- });- if (!result) return false;-- listRoot?.focus({ preventScroll: true });- scrollHandle.scrollToIndex(result.index);- return true;- };-- withSplitPanelOwner(listOwnedSlotName('section-hotkeys'), () => {- const group = createHotkeyGroup();- const enabled = () => panel.isPanelActive() && state.tab === 'browse';-- registerHotkey({- hotkey: ']',- scopeId: panel.splitHotkeyScope,- description: 'Next channel section',- condition: enabled,- keyDownHandler: () => jumpToSection(1),- }).withGroup(group);-- registerHotkey({- hotkey: '[',- scopeId: panel.splitHotkeyScope,- description: 'Previous channel section',- condition: enabled,- keyDownHandler: () => jumpToSection(-1),- }).withGroup(group);-- onCleanup(() => group.dispose());- return group;- });-- const mentionsCurrentUser = (channel: ChannelEntity) => {- const userId = currentUserId()?.toLocaleLowerCase();-- return Boolean(- userId &&- channel.latestRootMessage?.mentions.some(- (mention) => mention.toLocaleLowerCase() === userId- )- );- };- const activateRow = (rowId: string) => {- list.activate.key(rowId, { reason: 'pointer' });- };- const activeDescendant = () => {- const rowId = list.focus.key();- return rowId === undefined ? undefined : domIdForRow(rowId);- };-- createEffect(- on(- () => props.mode,- () => {- const focusedIndex = list.focus.index();- if (focusedIndex < 0) return;-- const frame = requestAnimationFrame(() => {- scrollHandle.scrollToIndex(focusedIndex);- });-- onCleanup(() => cancelAnimationFrame(frame));- },- { defer: true }- )- );-- return (- <aside- aria-label="Chat navigation"- class="flex size-full min-h-0 flex-col bg-inset pb-5 pt-2"- >- <Switch>- <Match when={props.mode === 'full'}>- <div class="flex min-h-8 shrink-0 items-center px-4">- <SplitPanel.ControlGroup>- <SplitPanel.CloseButton />- <SplitPanel.BackButton />- <SplitPanel.ForwardButton />- </SplitPanel.ControlGroup>- </div>- <div class="flex shrink-0 items-center px-4 pt-3">- <h1 class="m-0 min-w-0 flex-1 truncate text-2xl font-semibold tracking-[-0.03em] text-ink">- Chat- </h1>- </div>-- <div class="shrink-0 px-4 pt-3">- <Tabs- aria-label="Chat sidebar views"- fullWidth- list={CHANNEL_TABS}- value={state.tab}- onChange={(value) => {- if (value !== 'browse' && value !== 'recents') return;-- setTab(value);- }}- />- </div>-- <div- ref={(element) => {- listRoot = element;- }}- role="tree"- tabIndex={-1}- aria-activedescendant={activeDescendant()}- class={cn(- 'scrollbar-hidden min-h-0 flex-1 pt-3 outline-none',- state.tab === 'browse' ? 'overflow-hidden' : 'overflow-y-auto'- )}- >- <Switch>- <Match when={state.tab === 'browse'}>- <div class="flex h-full min-h-0 flex-col gap-3 px-4">- <CollapsibleSection.Root open={state.expandedGroups.channels}>- <CollapsibleSection.Header- focused={- list.focus.key() === rowKeyForSection('channels')- }- focusWithin={list.focus.item()?.group === 'channels'}- class="h-9 has-[[data-section-action]:hover]:bg-transparent has-[[data-section-action]:focus-within]:bg-transparent"- >- <button- id={domIdForRow(rowKeyForSection('channels'))}- type="button"- role="treeitem"- tabIndex={-1}- class="relative flex h-full min-w-0 flex-1 items-center gap-2 rounded-xl px-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-accent"- aria-expanded={state.expandedGroups.channels}- onClick={() =>- activateRow(rowKeyForSection('channels'))- }- >- <CaretDownIcon- class={cn(- 'size-3 shrink-0 transition-transform',- !state.expandedGroups.channels && '-rotate-90'- )}- />- <span class="min-w-0 flex-1 truncate">Channels</span>- <Show when={unreadTeamChannelCount() > 0}>- <span class="text-xxs tabular-nums">- {unreadTeamChannelCount()}- </span>- </Show>- </button>- <div data-section-action="" class="pr-1">- <CreateRailAction- label="Create channel"- onClick={() => openNewChannelModal()}- />- </div>- </CollapsibleSection.Header>- <CollapsibleSection.Content- open={state.expandedGroups.channels}- contentRef={setSectionScrollRoot('channels')}- class="flex min-h-0 flex-col gap-0.5"- >- <Show- when={teamChannels().length > 0}- fallback={- <div class="px-2 py-2 text-xs text-ink-extra-muted">- No channels- </div>- }- >- <Key each={teamChannels()} by={(channel) => channel.id}>- {(channel) => (- <ChannelOption- id={domIdForRow(rowKeyForChannel(channel().id))}- channel={channel()}- unread={unreadChannelIds().has(channel().id)}- selected={- state.selectedChannelId === channel().id- }- focused={- list.focus.key() ===- rowKeyForChannel(channel().id)- }- onActivate={() =>- activateRow(rowKeyForChannel(channel().id))- }- />- )}- </Key>- </Show>- </CollapsibleSection.Content>- </CollapsibleSection.Root>-- <CollapsibleSection.Root- open={state.expandedGroups.direct_messages}- >- <CollapsibleSection.Header- focused={- list.focus.key() === rowKeyForSection('direct_messages')- }- focusWithin={- list.focus.item()?.group === 'direct_messages'- }- class="h-9 has-[[data-section-action]:hover]:bg-transparent has-[[data-section-action]:focus-within]:bg-transparent"- >- <button- id={domIdForRow(rowKeyForSection('direct_messages'))}- type="button"- role="treeitem"- tabIndex={-1}- class="relative flex h-full min-w-0 flex-1 items-center gap-2 rounded-xl px-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-accent"- aria-expanded={state.expandedGroups.direct_messages}- onClick={() =>- activateRow(rowKeyForSection('direct_messages'))- }- >- <CaretDownIcon- class={cn(- 'size-3 shrink-0 transition-transform',- !state.expandedGroups.direct_messages &&- '-rotate-90'- )}- />- <span class="min-w-0 flex-1 truncate">DMs</span>- <Show when={unreadDirectMessageCount() > 0}>- <span class="text-xxs tabular-nums">- {unreadDirectMessageCount()}- </span>- </Show>- </button>- <div data-section-action="" class="pr-1">- <CreateRailAction- label="Start direct message"- onClick={() => {- CommandState.clearQuery();- CommandState.setCategoryFilter('dms');- CommandState.open();- }}- />- </div>- </CollapsibleSection.Header>- <CollapsibleSection.Content- open={state.expandedGroups.direct_messages}- contentRef={setSectionScrollRoot('direct_messages')}- class="flex min-h-0 flex-col gap-0.5"- >- <Show- when={directMessages().length > 0}- fallback={- <div class="px-2 py-2 text-xs text-ink-extra-muted">- No direct messages- </div>- }- >- <Key- each={directMessages()}- by={(channel) => channel.id}- >- {(channel) => (- <ChannelOption- id={domIdForRow(rowKeyForChannel(channel().id))}- channel={channel()}- unread={unreadChannelIds().has(channel().id)}- selected={- state.selectedChannelId === channel().id- }- focused={- list.focus.key() ===- rowKeyForChannel(channel().id)- }- onActivate={() =>- activateRow(rowKeyForChannel(channel().id))- }- />- )}- </Key>- </Show>- </CollapsibleSection.Content>- </CollapsibleSection.Root>- </div>- </Match>- <Match when={state.tab === 'recents'}>- <Show- when={recentConversations().length > 0}- fallback={- <div class="px-3 py-8 text-center text-sm text-ink-extra-muted">- No recent messages- </div>- }- >- <div class="flex w-full flex-col divide-y divide-edge-muted">- <Key- each={recentConversations()}- by={(channel) => channel.id}- >- {(channel) => (- <ConversationCard- id={domIdForRow(rowKeyForChannel(channel().id))}- channel={channel()}- senderId={channel().latestRootMessage?.senderId}- mentionedCurrentUser={mentionsCurrentUser(channel())}- unread={unreadChannelIds().has(channel().id)}- selected={state.selectedChannelId === channel().id}- focused={- list.focus.key() === rowKeyForChannel(channel().id)- }- onActivate={() =>- activateRow(rowKeyForChannel(channel().id))- }- />- )}- </Key>- </div>- </Show>- </Match>- </Switch>- </div>- </Match>- <Match when={props.mode === 'slim'}>- <div class="flex shrink-0 justify-center px-2 pb-2">- <SplitPanel.ControlGroup>- <div class="grid w-12 grid-cols-2 justify-items-center">- <div class="col-span-2">- <SplitPanel.CloseButton size="icon-sm" />- </div>- <div>- <SplitPanel.BackButton size="icon-sm" />- </div>- <div>- <SplitPanel.ForwardButton size="icon-sm" />- </div>- </div>- </SplitPanel.ControlGroup>- </div>- <div class="shrink-0 px-3">- <Tabs- aria-label="Chat sidebar views"- class="h-[76px] flex-col"- itemClass="h-auto min-h-0 w-full"- labelClass="size-full p-0"- fullWidth- list={SLIM_CHANNEL_TABS}- value={state.tab}- onChange={(value) => {- if (value !== 'browse' && value !== 'recents') return;-- setTab(value);- }}- />- </div>-- <div- ref={(element) => {- listRoot = element;- }}- role="tree"- tabIndex={-1}- aria-activedescendant={activeDescendant()}- class={cn(- 'scrollbar-hidden min-h-0 flex-1 pt-3 outline-none',- state.tab === 'browse' ? 'overflow-hidden' : 'overflow-y-auto'- )}- >- <Switch>- <Match when={state.tab === 'browse'}>- <div class="flex h-full min-h-0 flex-col gap-3 px-2">- <CollapsibleSection.Root- open={state.expandedGroups.channels}- class="items-center"- >- <CollapsibleSection.Header- focused={- list.focus.key() === rowKeyForSection('channels')- }- focusWithin={list.focus.item()?.group === 'channels'}- class="h-10 justify-center"- >- <button- id={domIdForRow(rowKeyForSection('channels'))}- type="button"- role="treeitem"- tabIndex={-1}- class="relative flex size-10 min-w-10 flex-none items-center justify-center rounded-full outline-none focus-visible:ring-2 focus-visible:ring-accent"- aria-expanded={state.expandedGroups.channels}- aria-label="Channels"- onClick={() =>- activateRow(rowKeyForSection('channels'))- }- >- <span class="flex items-center justify-center [&_svg]:size-4">- <ChannelIcon />- </span>- <Show when={unreadTeamChannelCount() > 0}>- <span class="text-xxs absolute right-0.5 top-0 tabular-nums">- {unreadTeamChannelCount()}- </span>- </Show>- </button>- </CollapsibleSection.Header>- <div class="w-full px-2">- <div class="border-t border-edge-muted" />- </div>- <CollapsibleSection.Content- open={state.expandedGroups.channels}- contentRef={setSectionScrollRoot('channels')}- containerClass="w-full"- class="flex min-h-0 w-full flex-col items-center gap-0.5"- >- <div class="flex justify-center">- <CreateRailAction- label="Create channel"- slim- onClick={() => openNewChannelModal()}- />- </div>- <Show when={teamChannels().length > 0}>- <Key each={teamChannels()} by={(channel) => channel.id}>- {(channel) => (- <SlimChannelOption- id={domIdForRow(rowKeyForChannel(channel().id))}- channel={channel()}- unread={unreadChannelIds().has(channel().id)}- selected={- state.selectedChannelId === channel().id- }- focused={- list.focus.key() ===- rowKeyForChannel(channel().id)- }- onActivate={() =>- activateRow(rowKeyForChannel(channel().id))- }- />- )}- </Key>- </Show>- </CollapsibleSection.Content>- </CollapsibleSection.Root>-- <CollapsibleSection.Root- open={state.expandedGroups.direct_messages}- class="items-center"- >- <CollapsibleSection.Header- focused={- list.focus.key() === rowKeyForSection('direct_messages')- }- focusWithin={- list.focus.item()?.group === 'direct_messages'- }- class="h-10 justify-center"- >- <button- id={domIdForRow(rowKeyForSection('direct_messages'))}- type="button"- role="treeitem"- tabIndex={-1}- class="relative flex size-10 min-w-10 flex-none items-center justify-center rounded-full outline-none focus-visible:ring-2 focus-visible:ring-accent"- aria-expanded={state.expandedGroups.direct_messages}- aria-label="DMs"- onClick={() =>- activateRow(rowKeyForSection('direct_messages'))- }- >- <span class="flex items-center justify-center [&_svg]:size-4">- <ChatTeardropIcon />- </span>- <Show when={unreadDirectMessageCount() > 0}>- <span class="text-xxs absolute right-0.5 top-0 tabular-nums">- {unreadDirectMessageCount()}- </span>- </Show>- </button>- </CollapsibleSection.Header>- <div class="w-full px-2">- <div class="border-t border-edge-muted" />- </div>- <CollapsibleSection.Content- open={state.expandedGroups.direct_messages}- contentRef={setSectionScrollRoot('direct_messages')}- containerClass="w-full"- class="flex min-h-0 w-full flex-col items-center gap-0.5"- >- <div class="flex justify-center">- <CreateRailAction- label="Start direct message"- slim- onClick={() => {- CommandState.clearQuery();- CommandState.setCategoryFilter('dms');- CommandState.open();- }}- />- </div>- <Show when={directMessages().length > 0}>- <Key- each={directMessages()}- by={(channel) => channel.id}- >- {(channel) => (- <SlimChannelOption- id={domIdForRow(rowKeyForChannel(channel().id))}- channel={channel()}- unread={unreadChannelIds().has(channel().id)}- selected={- state.selectedChannelId === channel().id- }- focused={- list.focus.key() ===- rowKeyForChannel(channel().id)- }- onActivate={() =>- activateRow(rowKeyForChannel(channel().id))- }- />- )}- </Key>- </Show>- </CollapsibleSection.Content>- </CollapsibleSection.Root>- </div>- </Match>- <Match when={state.tab === 'recents'}>- <Show when={recentConversations().length > 0}>- <div class="flex w-full flex-col gap-0.5">- <Key- each={recentConversations()}- by={(channel) => channel.id}- >- {(channel) => (- <SlimConversationCard- id={domIdForRow(rowKeyForChannel(channel().id))}- channel={channel()}- senderId={channel().latestRootMessage?.senderId}- mentionedCurrentUser={mentionsCurrentUser(channel())}- unread={unreadChannelIds().has(channel().id)}- selected={state.selectedChannelId === channel().id}- focused={- list.focus.key() === rowKeyForChannel(channel().id)- }- onActivate={() =>- activateRow(rowKeyForChannel(channel().id))- }- />- )}- </Key>- </div>- </Show>- </Match>- </Switch>- </div>- </Match>- </Switch>- </aside>- );-}diff --git a/apps/web/src/features/channels-view/components/ChannelsRailSection.tsx b/apps/web/src/features/channels-view/components/ChannelsRailSection.tsxdeleted file mode 100644index f64a341836..0000000000--- a/apps/web/src/features/channels-view/components/ChannelsRailSection.tsx+++ /dev/null@@ -1,121 +0,0 @@-import { ScrollIndicators } from '@core/component/VerticalScrollIndicators';-import PlusIcon from '@phosphor/plus.svg';-import { cn, Scroll } from '@ui';-import { createSignal, type JSX, Show } from 'solid-js';--function SectionScrollArea(props: {- contentRef: (element: HTMLDivElement) => void;- containerClass?: string;- class?: string;- children: JSX.Element;-}) {- const [scrollRoot, setScrollRoot] = createSignal<HTMLDivElement>();-- return (- <div class={cn('relative min-h-0 flex-1', props.containerClass)}>- <Scroll- scrollRef={(element) => {- setScrollRoot(element);- props.contentRef(element);- }}- >- <div role="group" class={props.class}>- {props.children}- </div>- </Scroll>- <ScrollIndicators- scrollRef={scrollRoot}- appearance="gradient"- gradientColor="inset"- />- </div>- );-}--function CollapsibleSectionRoot(props: {- open: boolean;- class?: string;- children: JSX.Element;-}) {- return (- <section- class={cn(- 'flex min-h-0 flex-col gap-1',- props.open && 'shrink',- !props.open && 'shrink-0',- props.open && 'max-h-[calc(50%_-_0.375rem)]',- props.class- )}- >- {props.children}- </section>- );-}--function CollapsibleSectionHeader(props: {- focused: boolean;- focusWithin: boolean;- class?: string;- children: JSX.Element;-}) {- return (- <div- class={cn(- 'flex w-full items-center rounded-xl text-xs font-semibold uppercase tracking-wide text-ink-extra-muted transition-colors hover:bg-hover hover:text-ink-muted',- props.focused && 'bg-hover text-ink-muted',- !props.focused && props.focusWithin && 'text-ink-muted',- props.class- )}- >- {props.children}- </div>- );-}--function CollapsibleSectionContent(props: {- open: boolean;- contentRef: (element: HTMLDivElement) => void;- containerClass?: string;- class?: string;- children: JSX.Element;-}) {- return (- <Show when={props.open}>- <SectionScrollArea- contentRef={props.contentRef}- containerClass={props.containerClass}- class={props.class}- >- {props.children}- </SectionScrollArea>- </Show>- );-}--export const CollapsibleSection = {- Root: CollapsibleSectionRoot,- Header: CollapsibleSectionHeader,- Content: CollapsibleSectionContent,-};--export function CreateRailAction(props: {- label: string;- slim?: boolean;- onClick: () => void;-}) {- return (- <button- type="button"- class={cn(- 'flex shrink-0 items-center justify-center text-ink-muted transition-colors hover:bg-hover hover:text-ink focus-visible:ring-2 focus-visible:ring-accent',- props.slim &&- 'size-10 rounded-full border border-edge-muted bg-transparent',- !props.slim && 'size-7 rounded-lg'- )}- aria-label={props.label}- onClick={props.onClick}- >- <PlusIcon class="size-3.5" />- </button>- );-}diff --git a/apps/web/src/features/channels-view/components/rail/Browse.tsx b/apps/web/src/features/channels-view/components/rail/Browse.tsxnew file mode 100644index 0000000000..a191339f12--- /dev/null+++ b/apps/web/src/features/channels-view/components/rail/Browse.tsx@@ -0,0 +1,219 @@+import { runCreateAction } from '@app/features/command/Launcher';+import { DEBUG_SETTING_KEYS, useDebugSetting } from '@app/lib/debugSettings';+import { openNewChannelModal } from '@channel/CreateChannelModal';+import ChannelIcon from '@icon/wide-channel.svg';+import CaretDownIcon from '@phosphor/caret-down.svg';+import ChatTeardropIcon from '@phosphor/chat-teardrop.svg';+import { Key } from '@solid-primitives/keyed';+import { cn } from '@ui';+import { type Component, For, Match, Show, Switch } from 'solid-js';+import { Dynamic } from 'solid-js/web';+import type { ChannelsGroup } from '../../types';+import { ChannelsEmptyState } from '../ChannelsEmptyState';+import { useChannelRail } from './Context';+import { ChannelOption, SlimChannelItem } from './Item';+import { CollapsibleSection, CreateRailAction } from './Section';++type GroupConfig = {+ group: ChannelsGroup;+ label: string;+ emptyLabel: string;+ createLabel: string;+ icon: Component;+ onCreate: () => void;+};++const GROUPS: GroupConfig[] = [+ {+ group: 'channels',+ label: 'Channels',+ emptyLabel: 'No channels',+ createLabel: 'Create channel',+ icon: ChannelIcon,+ onCreate: openNewChannelModal,+ },+ {+ group: 'direct_messages',+ label: 'DMs',+ emptyLabel: 'No direct messages',+ createLabel: 'Start direct message',+ icon: ChatTeardropIcon,+ onCreate: () => runCreateAction('channel'),+ },+];++function ChannelGroupSection(props: { config: GroupConfig }) {+ const rail = useChannelRail();+ const forceEmptyState = useDebugSetting(+ DEBUG_SETTING_KEYS.FORCE_EMPTY_STATES+ );++ const group = () => props.config.group;++ const expanded = () => rail.mode() === 'full';++ const channels = () => rail.items(group());++ return (+ <CollapsibleSection.Root+ open={rail.section.isOpen(group())}+ fillAvailable={+ group() === 'direct_messages' && !rail.section.isOpen('channels')+ }+ class={expanded() ? undefined : 'items-center'}+ >+ <CollapsibleSection.Header+ focused={rail.section.isFocused(group())}+ focusWithin={rail.section.containsFocus(group())}+ class={+ expanded()+ ? 'h-9 has-[[data-section-action]:hover]:bg-transparent has-[[data-section-action]:focus-within]:bg-transparent'+ : 'h-10 justify-center'+ }+ >+ <button+ id={rail.section.domId(group())}+ type="button"+ role="treeitem"+ tabIndex={-1}+ class={cn(+ 'relative flex outline-none focus-visible:ring-2 focus-visible:ring-accent',+ expanded()+ ? 'h-full min-w-0 flex-1 items-center gap-2 rounded-xl px-2 text-left'+ : 'size-10 min-w-10 flex-none items-center justify-center rounded-full'+ )}+ aria-expanded={rail.section.isOpen(group())}+ aria-label={expanded() ? undefined : props.config.label}+ onClick={() => rail.section.activate(group())}+ >+ <Switch>+ <Match when={expanded()}>+ <CaretDownIcon+ class={cn(+ 'size-3 shrink-0 transition-transform',+ !rail.section.isOpen(group()) && '-rotate-90'+ )}+ />+ <span class="min-w-0 truncate">{props.config.label}</span>+ </Match>+ <Match when={true}>+ <span class="flex items-center justify-center [&_svg]:size-4">+ <Dynamic component={props.config.icon} />+ </span>+ </Match>+ </Switch>+ <Show when={rail.activity.unreadCount(group()) > 0}>+ <span+ class={cn(+ 'flex h-4 min-w-4 items-center justify-center rounded-full bg-accent px-1 text-xs font-medium leading-none text-accent-contrast',+ expanded()+ ? 'tabular-nums'+ : 'absolute right-0 top-0 ring-2 ring-surface'+ )}+ >+ {rail.activity.unreadCount(group())}+ </span>+ </Show>+ </button>+ <Show when={expanded()}>+ <div data-section-action="" class="pr-1">+ <CreateRailAction+ label={props.config.createLabel}+ onClick={props.config.onCreate}+ />+ </div>+ </Show>+ </CollapsibleSection.Header>+ <CollapsibleSection.Content+ open={rail.section.isOpen(group())}+ contentRef={rail.section.registerScrollRef(group())}+ containerClass={expanded() ? undefined : 'w-full'}+ class={+ expanded()+ ? 'flex min-h-0 flex-col gap-0.5'+ : 'flex min-h-0 w-full flex-col items-center gap-0.5'+ }+ activityTargetId={rail.activity.targetId(group())}+ activityLabel={expanded() ? rail.activity.label(group()) : undefined}+ activityTooltip={!expanded()}+ onActivityVisible={(targetId) =>+ rail.activity.onVisible(group(), targetId)+ }+ >+ <Switch>+ <Match when={!forceEmptyState() && channels().length > 0}>+ <Key each={channels()} by={(channel) => channel.id}>+ {(channel) => (+ <Switch>+ <Match when={expanded()}>+ <ChannelOption+ id={rail.item.domId(channel().id)}+ channel={channel()}+ unread={rail.activity.isUnread(channel().id)}+ callStatus={rail.activity.callStatus(channel().id)}+ incomingCallId={rail.activity.incomingCallId(+ channel().id+ )}+ selected={rail.item.isSelected(channel().id)}+ focused={rail.item.isFocused(channel().id)}+ onActivate={() => rail.item.activate(channel().id)}+ />+ </Match>+ <Match when={true}>+ <SlimChannelItem+ id={rail.item.domId(channel().id)}+ channel={channel()}+ unread={rail.activity.isUnread(channel().id)}+ callStatus={rail.activity.callStatus(channel().id)}+ selected={rail.item.isSelected(channel().id)}+ focused={rail.item.isFocused(channel().id)}+ onActivate={() => rail.item.activate(channel().id)}+ />+ </Match>+ </Switch>+ )}+ </Key>+ </Match>+ <Match when={expanded()}>+ <div class="px-2 py-2 text-xs text-ink-extra-muted">+ {props.config.emptyLabel}+ </div>+ </Match>+ </Switch>+ </CollapsibleSection.Content>+ </CollapsibleSection.Root>+ );+}++export function ChannelsRailBrowse() {+ const rail = useChannelRail();+ const forceEmptyState = useDebugSetting(+ DEBUG_SETTING_KEYS.FORCE_EMPTY_STATES+ );++ const hasItems = () =>+ rail.items('channels').length > 0 ||+ rail.items('direct_messages').length > 0;++ return (+ <Switch>+ <Match+ when={rail.mode() === 'full' && (forceEmptyState() || !hasItems())}+ >+ <ChannelsEmptyState scope="channels" topAligned />+ </Match>+ <Match when={true}>+ <div+ class={cn(+ 'flex h-full min-h-0 flex-col gap-3',+ rail.mode() === 'full' ? 'px-4' : 'px-2'+ )}+ >+ <For each={GROUPS}>+ {(config) => <ChannelGroupSection config={config} />}+ </For>+ </div>+ </Match>+ </Switch>+ );+}diff --git a/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx b/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsxnew file mode 100644index 0000000000..790a75d7eb--- /dev/null+++ b/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx@@ -0,0 +1,336 @@+import {+ createListController,+ type ListScrollHandle,+ listOwnedSlotName,+ useListInteractions,+} from '@app/components/list';+import { useViewTabHotkeys } from '@app/components/view-shell';+import {+ useSplitPanelOrThrow,+ withSplitPanelOwner,+} from '@components/app/split-layout/layoutUtils';+import { createHotkeyGroup, registerHotkey } from '@core/hotkey/hotkeys';+import type { ChannelEntity } from '@entity';+import { cn, Hotkey } from '@ui';+import {+ createEffect,+ createSignal,+ createUniqueId,+ Match,+ on,+ onCleanup,+ Show,+ Switch,+} from 'solid-js';+import { useChannelsView } from '../../channels-view-context';+import type { ChannelsGroup, ChannelsTab } from '../../types';+import { ChannelsRailBrowse } from './Browse';+import { type ChannelRailContext, ChannelRailProvider } from './Context';+import { ChannelsRailHeader } from './Header';+import { useChannelCalls } from './hooks/useChannelCalls';+import { useChannelRailActivity } from './hooks/useChannelRailActivity';+import { useChannelRailRows } from './hooks/useChannelRailRows';+import {+ CHANNEL_GROUPS,+ type ChannelRailRow,+ rowKeyForChannel,+ rowKeyForSection,+} from './model';+import { ChannelsRailRecents } from './Recents';++const CHANNEL_TAB_IDS: ChannelsTab[] = ['browse', 'recents'];++export function ChannelsRail(props: {+ channels: ChannelEntity[];+ mode: 'full' | 'slim';+ onModeChange: (mode: 'full' | 'slim') => void;+}) {+ const { state, setGroupOpen, setSelectedChannelId, setTab } =+ useChannelsView();++ const panel = useSplitPanelOrThrow();++ const listDomId = createUniqueId();++ const [sectionScrollRoots, setSectionScrollRoots] = createSignal<+ Partial<Record<ChannelsGroup, HTMLDivElement>>+ >({});++ const { callActivity, incomingCallIds, callStatuses } = useChannelCalls();++ const channelActivity = useChannelRailActivity(+ () => props.channels,+ callActivity+ );++ useViewTabHotkeys({+ scopeId: panel.splitHotkeyScope,+ enabled: panel.isPanelActive,+ ids: () => CHANNEL_TAB_IDS,+ activeId: () => state.tab,+ setActiveId: setTab,+ });++ const { directMessages, recentConversations, teamChannels, visibleRows } =+ useChannelRailRows({+ channels: () => props.channels,+ tab: () => state.tab,+ isGroupExpanded: (group) => state.expandedGroups[group],+ });++ const list = withSplitPanelOwner(listOwnedSlotName('controller'), () =>+ createListController<ChannelRailRow>({+ items: visibleRows,+ getKey: (row) => row.id,+ isSelectable: () => false,+ initialFocusKey:+ state.selectedChannelId === undefined+ ? undefined+ : rowKeyForChannel(state.selectedChannelId),+ onActivate: ({ item }) => {+ if (item.kind === 'section') {+ setGroupOpen(item.group, !state.expandedGroups[item.group]);+ return;+ }++ setSelectedChannelId(item.channel.id);+ },+ })+ );++ const domIdForRow = (rowId: string) => `${listDomId}-${rowId}`;++ const activityTargetId = (group: ChannelsGroup) => {+ const channelId = channelActivity.targetChannelId(group);+ return channelId === undefined+ ? undefined+ : domIdForRow(rowKeyForChannel(channelId));+ };++ const clearVisibleActivity = (+ group: ChannelsGroup,+ visibleTargetId: string+ ) => {+ const channelId = channelActivity.targetChannelId(group);+ if (+ channelId === undefined ||+ domIdForRow(rowKeyForChannel(channelId)) !== visibleTargetId+ ) {+ return;+ }++ channelActivity.clearTarget(group, channelId);+ };++ let listRoot: HTMLDivElement | undefined;++ const registerSectionScrollRef =+ (group: ChannelsGroup) => (element: HTMLDivElement) => {+ setSectionScrollRoots((current) => ({+ ...current,+ [group]: element,+ }));+ };++ const scrollHandle: ListScrollHandle = {+ scrollToIndex: (index) => {+ const row = list.items.at(index);+ if (!row) return;++ const element = document.getElementById(domIdForRow(row.id));+ const scrollRoot =+ row.kind === 'conversation' && row.group+ ? sectionScrollRoots()[row.group]+ : state.tab === 'recents'+ ? listRoot+ : undefined;+ if (!element || !scrollRoot) return;++ const elementBounds = element.getBoundingClientRect();+ const scrollBounds = scrollRoot.getBoundingClientRect();+ if (elementBounds.top < scrollBounds.top) {+ scrollRoot.scrollTop -= scrollBounds.top - elementBounds.top;+ } else if (elementBounds.bottom > scrollBounds.bottom) {+ scrollRoot.scrollTop += elementBounds.bottom - scrollBounds.bottom;+ }+ },+ };++ withSplitPanelOwner(listOwnedSlotName('navigation-hotkeys'), () =>+ useListInteractions({+ controller: list,+ scopeId: panel.splitHotkeyScope,+ scrollHandle: () => scrollHandle,+ enabled: panel.isPanelActive,+ navigation: {+ onNavigate: (event) => {+ listRoot?.focus({ preventScroll: true });++ const row = event.result?.item;+ if (row?.kind === 'conversation') {+ setSelectedChannelId(row.channel.id);+ }+ },+ },+ disclosure: {+ getKey: (row) => row.group,+ isExpanded: (group) => state.expandedGroups[group as ChannelsGroup],+ setExpanded: (group, expanded) =>+ setGroupOpen(group as ChannelsGroup, expanded),+ getFocusKey: (group) => rowKeyForSection(group as ChannelsGroup),+ },+ })+ );++ const jumpToSection = (offset: 1 | -1) => {+ const currentGroup = list.focus.item()?.group;+ const currentIndex = currentGroup+ ? CHANNEL_GROUPS.indexOf(currentGroup)+ : -1;+ const origin = currentIndex === -1 ? (offset === 1 ? -1 : 0) : currentIndex;++ const nextIndex =+ (origin + offset + CHANNEL_GROUPS.length) % CHANNEL_GROUPS.length;+ const nextGroup = CHANNEL_GROUPS[nextIndex];+ if (!nextGroup) return false;++ const result = list.focus.set(rowKeyForSection(nextGroup), {+ reason: 'keyboard',+ });+ if (!result) return false;++ listRoot?.focus({ preventScroll: true });+ scrollHandle.scrollToIndex(result.index);+ return true;+ };++ const sectionHotkeys = createHotkeyGroup();++ const sectionHotkeysEnabled = () =>+ panel.isPanelActive() && state.tab === 'browse';++ registerHotkey({+ hotkey: ']',+ scopeId: panel.splitHotkeyScope,+ description: 'Next channel section',+ condition: sectionHotkeysEnabled,+ keyDownHandler: () => jumpToSection(1),+ }).withGroup(sectionHotkeys);++ registerHotkey({+ hotkey: '[',+ scopeId: panel.splitHotkeyScope,+ description: 'Previous channel section',+ condition: sectionHotkeysEnabled,+ keyDownHandler: () => jumpToSection(-1),+ }).withGroup(sectionHotkeys);++ onCleanup(() => {+ sectionHotkeys.dispose();+ });++ const activateRow = (rowId: string) => {+ list.activate.key(rowId, { reason: 'pointer' });+ };++ const activeDescendant = () => {+ const rowId = list.focus.key();+ return rowId === undefined ? undefined : domIdForRow(rowId);+ };++ createEffect(+ on(+ () => props.mode,+ () => {+ const focusedIndex = list.focus.index();+ if (focusedIndex < 0) return;++ const frame = requestAnimationFrame(() => {+ scrollHandle.scrollToIndex(focusedIndex);+ });++ onCleanup(() => cancelAnimationFrame(frame));+ },+ { defer: true }+ )+ );++ const itemsForGroup = (group: ChannelsGroup) =>+ group === 'channels' ? teamChannels() : directMessages();++ const railContext: ChannelRailContext = {+ mode: () => props.mode,+ tab: () => state.tab,+ setTab,+ onModeChange: props.onModeChange,+ items: itemsForGroup,+ recentConversations,+ activity: {+ isUnread: (channelId) =>+ channelActivity.unreadChannelIds().has(channelId),+ callStatus: (channelId) => callStatuses().get(channelId),+ incomingCallId: (channelId) => incomingCallIds().get(channelId),+ unreadCount: channelActivity.unreadCount,+ targetId: activityTargetId,+ label: channelActivity.targetLabel,+ onVisible: clearVisibleActivity,+ },+ item: {+ domId: (channelId) => domIdForRow(rowKeyForChannel(channelId)),+ isSelected: (channelId) => state.selectedChannelId === channelId,+ isFocused: (channelId) =>+ list.focus.key() === rowKeyForChannel(channelId),+ activate: (channelId) => activateRow(rowKeyForChannel(channelId)),+ },+ section: {+ domId: (group) => domIdForRow(rowKeyForSection(group)),+ isOpen: (group) => state.expandedGroups[group],+ isFocused: (group) => list.focus.key() === rowKeyForSection(group),+ containsFocus: (group) => list.focus.item()?.group === group,+ activate: (group) => activateRow(rowKeyForSection(group)),+ registerScrollRef: registerSectionScrollRef,+ },+ };++ return (+ <ChannelRailProvider value={railContext}>+ <aside+ aria-label="Chat navigation"+ class="flex size-full min-h-0 flex-col gap-3 bg-inset pt-2"+ >+ <ChannelsRailHeader />+ <div class="flex min-h-0 flex-1 flex-col">+ <div+ ref={(element) => {+ listRoot = element;+ }}+ role="tree"+ tabIndex={-1}+ aria-activedescendant={activeDescendant()}+ class={cn(+ 'scrollbar-hidden min-h-0 flex-1 outline-none',+ state.tab === 'browse' ? 'overflow-hidden' : 'overflow-y-auto'+ )}+ >+ <Switch>+ <Match when={state.tab === 'browse'}>+ <ChannelsRailBrowse />+ </Match>+ <Match when={state.tab === 'recents'}>+ <ChannelsRailRecents />+ </Match>+ </Switch>+ </div>+ <Show when={props.mode === 'full' && state.tab === 'browse'}>+ <footer class="flex h-9 shrink-0 items-center justify-start gap-1 border-t border-edge-muted px-4 text-xxs text-ink-extra-muted">+ <span>Use</span>+ <Hotkey shortcut="[" theme="subtle" />+ <Hotkey shortcut="]" theme="subtle" />+ <span>to jump sections</span>+ </footer>+ </Show>+ </div>+ </aside>+ </ChannelRailProvider>+ );+}diff --git a/apps/web/src/features/channels-view/components/rail/Context.tsx b/apps/web/src/features/channels-view/components/rail/Context.tsxnew file mode 100644index 0000000000..1eb5d5542b--- /dev/null+++ b/apps/web/src/features/channels-view/components/rail/Context.tsx@@ -0,0 +1,50 @@+import { createAssertedContextProvider } from '@core/context/createContext';+import type { ChannelEntity } from '@entity';+import type { ContextProviderProps } from '@solid-primitives/context';+import type { Accessor } from 'solid-js';+import type { ChannelsGroup, ChannelsTab } from '../../types';+import type { ChannelCallStatus } from './Item';++export type ChannelRailContext = {+ mode: Accessor<'full' | 'slim'>;+ tab: Accessor<ChannelsTab>;+ setTab: (tab: ChannelsTab) => void;+ onModeChange: (mode: 'full' | 'slim') => void;+ items: (group: ChannelsGroup) => ChannelEntity[];+ recentConversations: Accessor<ChannelEntity[]>;+ activity: {+ isUnread: (channelId: string) => boolean;+ callStatus: (channelId: string) => ChannelCallStatus | undefined;+ incomingCallId: (channelId: string) => string | undefined;+ unreadCount: (group: ChannelsGroup) => number;+ targetId: (group: ChannelsGroup) => string | undefined;+ label: (group: ChannelsGroup) => string | undefined;+ onVisible: (group: ChannelsGroup, targetId: string) => void;+ };+ item: {+ domId: (channelId: string) => string;+ isSelected: (channelId: string) => boolean;+ isFocused: (channelId: string) => boolean;+ activate: (channelId: string) => void;+ };+ section: {+ domId: (group: ChannelsGroup) => string;+ isOpen: (group: ChannelsGroup) => boolean;+ isFocused: (group: ChannelsGroup) => boolean;+ containsFocus: (group: ChannelsGroup) => boolean;+ activate: (group: ChannelsGroup) => void;+ registerScrollRef: (+ group: ChannelsGroup+ ) => (element: HTMLDivElement) => void;+ };+};++type ChannelRailProviderProps = ContextProviderProps & {+ value: ChannelRailContext;+};++export const [ChannelRailProvider, useChannelRail] =+ createAssertedContextProvider<ChannelRailContext, ChannelRailProviderProps>(+ 'ChannelRail',+ (props) => props.value+ );diff --git a/apps/web/src/features/channels-view/components/rail/ConversationCard.tsx b/apps/web/src/features/channels-view/components/rail/ConversationCard.tsxnew file mode 100644index 0000000000..f1acf474e4--- /dev/null+++ b/apps/web/src/features/channels-view/components/rail/ConversationCard.tsx@@ -0,0 +1,170 @@+import { StaticMarkdown } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';+import { useUserId } from '@core/context/user';+import { isTouchDevice } from '@core/mobile/isTouchDevice';+import { getDisplayName, tryMacroId } from '@core/user';+import type { MacroId } from '@core/user/macroId';+import { Entity } from '@entity';+import ReplyIcon from '@phosphor/arrow-bend-up-left.svg';+import AtIcon from '@phosphor/at.svg';+import { cn, Tooltip } from '@ui';+import { Match, Show, Switch } from 'solid-js';+import { formatDetailedTimestamp } from '../../utils';+import {+ ChannelAvatar,+ ChannelCallIndicator,+ type ChannelRailItemProps,+ IncomingCallActions,+} from './Item';++export type ConversationCardProps = ChannelRailItemProps & {+ class?: string;+ showLatestMessage?: boolean;+ senderId?: string;+ mentionedCurrentUser: boolean;+};++function UserDisplayName(props: { id: MacroId }) {+ const displayName = () =>+ getDisplayName(props.id, {+ emailFallback: 'local-part',+ });++ return <>{displayName()}</>;+}++function MessageSenderName(props: { id?: string }) {+ const currentUserId = useUserId();++ const macroId = () => (props.id ? tryMacroId(props.id) : undefined);++ const isCurrentUser = () =>+ props.id?.toLocaleLowerCase() === currentUserId()?.toLocaleLowerCase();++ return (+ <Switch>+ <Match when={!props.id}>Unknown sender</Match>+ <Match when={isCurrentUser()}>You</Match>+ <Match when={macroId()}>{(id) => <UserDisplayName id={id()} />}</Match>+ <Match when={true}>+ {props.id?.startsWith('bot|') ? 'Bot' : 'Someone'}+ </Match>+ </Switch>+ );+}++export function ConversationCard(props: ConversationCardProps) {+ const latestRootMessage = () => props.channel.latestRootMessage;++ return (+ <div+ id={props.id}+ role="treeitem"+ tabIndex={-1}+ class={cn(+ 'relative w-full min-w-0 overflow-hidden px-2 py-3 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent touch:focus-visible:ring-0',+ props.selected && !isTouchDevice() && 'bg-active',+ !props.selected && !isTouchDevice() && props.focused && 'bg-hover',+ (!props.selected || isTouchDevice()) && 'bg-transparent',+ !props.selected &&+ !isTouchDevice() &&+ !props.focused &&+ 'hover:bg-hover',+ props.class+ )}+ aria-current={props.selected ? 'page' : undefined}+ onClick={props.onActivate}+ >+ <div+ class={cn(+ 'flex min-w-0 gap-3 overflow-hidden',+ props.showLatestMessage === false ? 'items-center' : 'items-start'+ )}+ >+ <ChannelAvatar channel={props.channel} size="md" />+ <div class="min-w-0 flex-1 overflow-hidden">+ <span class="flex min-w-0 items-center gap-2">+ <Show when={props.unread}>+ <span+ aria-label="Unread"+ class="size-2 shrink-0 rounded-full bg-accent touch:absolute touch:left-2 touch:top-7.5 touch:-translate-y-1/2"+ />+ </Show>+ <span class="min-w-0 flex-1 truncate text-sm font-medium text-ink">+ {props.channel.name}+ </span>+ <ChannelCallIndicator+ status={props.incomingCallId ? undefined : props.callStatus}+ />+ <IncomingCallActions+ callId={props.incomingCallId}+ channelId={props.channel.id}+ />+ <Show when={latestRootMessage()?.createdAt}>+ {(createdAt) => (+ <Tooltip+ label={formatDetailedTimestamp(createdAt())}+ placement="top"+ >+ <span class="shrink-0 text-xs text-ink-extra-muted">+ <Entity.Timestamp+ entity={props.channel}+ overrideTimeStamp={createdAt()}+ />+ </span>+ </Tooltip>+ )}+ </Show>+ </span>+ <Show when={props.showLatestMessage !== false}>+ <Show+ when={latestRootMessage()?.threadId || props.mentionedCurrentUser}+ >+ <span class="flex min-w-0 items-center gap-2 text-xxs leading-4 text-ink-extra-muted">+ <Show when={latestRootMessage()?.threadId}>+ <span+ class="flex shrink-0 items-center gap-1"+ title="Reply in thread"+ >+ <ReplyIcon class="size-3" />+ <span>Reply</span>+ </span>+ </Show>+ <Show when={props.mentionedCurrentUser}>+ <span class="flex shrink-0 items-center gap-1 text-accent">+ <AtIcon class="size-3" />+ <span>Mentioned you</span>+ </span>+ </Show>+ </span>+ </Show>+ <div class="flex min-w-0 items-center gap-1 overflow-hidden whitespace-nowrap text-xs leading-4">+ <Switch>+ <Match when={latestRootMessage()}>+ {(message) => (+ <>+ <span class="shrink-0 font-medium text-ink-muted">+ <MessageSenderName id={props.senderId} />:+ </span>+ <Show when={message().content.trim()}>+ {(content) => (+ <div class="min-w-0 flex-1 truncate text-ink-muted [&_*]:my-0 [&_*]:truncate">+ <StaticMarkdown markdown={content()} singleLine />+ </div>+ )}+ </Show>+ </>+ )}+ </Match>+ <Match when={true}>+ <span class="min-w-0 flex-1 text-ink-extra-muted">+ No messages yet+ </span>+ </Match>+ </Switch>+ </div>+ </Show>+ </div>+ </div>+ </div>+ );+}diff --git a/apps/web/src/features/channels-view/components/rail/Header.tsx b/apps/web/src/features/channels-view/components/rail/Header.tsxnew file mode 100644index 0000000000..894b2df599--- /dev/null+++ b/apps/web/src/features/channels-view/components/rail/Header.tsx@@ -0,0 +1,175 @@+import { runCreateAction } from '@app/features/command/Launcher';+import { openNewChannelModal } from '@channel/CreateChannelModal';+import { SplitPanel } from '@components/app/split-panel';+import { AnimatedSquareSidebarIcon } from '@icon/square-sidebar';+import ChannelIcon from '@icon/wide-channel.svg';+import ChatTeardropIcon from '@phosphor/chat-teardrop.svg';+import ChatTextIcon from '@phosphor/chat-text.svg';+import ChatsIcon from '@phosphor/chats-circle.svg';+import PlusIcon from '@phosphor/plus.svg';+import { Button, Dropdown, Tabs } from '@ui';+import { createSignal, Match, Switch } from 'solid-js';+import { useChannelRail } from './Context';++const CHANNEL_TABS = [+ {+ value: 'browse',+ label: 'Browse',+ },+ {+ value: 'recents',+ label: 'Recents',+ },+];++function BrowseTabLabel() {+ return (+ <>+ <span class="sr-only">Browse</span>+ <span aria-hidden="true" class="[&_svg]:size-4">+ <ChatsIcon />+ </span>+ </>+ );+}++function RecentsTabLabel() {+ return (+ <>+ <span class="sr-only">Recents</span>+ <span aria-hidden="true" class="[&_svg]:size-4">+ <ChatTextIcon />+ </span>+ </>+ );+}++const SLIM_CHANNEL_TABS = [+ {+ value: 'browse',+ label: BrowseTabLabel,+ },+ {+ value: 'recents',+ label: RecentsTabLabel,+ },+];++const openMessageComposer = () => runCreateAction('channel');++function RailModeButton() {+ const rail = useChannelRail();++ const expanded = () => rail.mode() === 'full';++ const [hovering, setHovering] = createSignal(false);++ return (+ <Button+ variant="ghost"+ size="icon-sm"+ label={expanded() ? 'Collapse chat rail' : 'Expand chat rail'}+ tooltipPlacement={expanded() ? 'bottom' : 'right'}+ onClick={() => rail.onModeChange(expanded() ? 'slim' : 'full')}+ onMouseEnter={() => setHovering(true)}+ onMouseLeave={() => setHovering(false)}+ >+ <AnimatedSquareSidebarIcon class="size-4" triggerAnimation={hovering()} />+ </Button>+ );+}++function SlimCreateMenu() {+ return (+ <Dropdown placement="right-start" gutter={8}>+ <Dropdown.Trigger+ variant="outline"+ size="icon-sm"+ class="size-10 rounded-full bg-transparent"+ label="Create conversation"+ >+ <PlusIcon class="size-4" />+ </Dropdown.Trigger>+ <Dropdown.Content class="min-w-44">+ <Dropdown.Group>+ <Dropdown.Item onSelect={() => openNewChannelModal()}>+ <ChannelIcon class="size-4 shrink-0" />+ <span>Create channel</span>+ </Dropdown.Item>+ <Dropdown.Item onSelect={openMessageComposer}>+ <ChatTeardropIcon class="size-4 shrink-0" />+ <span>Start direct message</span>+ </Dropdown.Item>+ </Dropdown.Group>+ </Dropdown.Content>+ </Dropdown>+ );+}++export function ChannelsRailHeader() {+ const rail = useChannelRail();++ const selectTab = (value: string) => {+ if (value !== 'browse' && value !== 'recents') return;++ rail.setTab(value);+ };++ return (+ <Switch>+ <Match when={rail.mode() === 'full'}>+ <div class="flex shrink-0 flex-col gap-3 px-4">+ <div class="flex items-center">+ <SplitPanel.ControlGroup>+ <SplitPanel.CloseButton />+ <SplitPanel.BackButton />+ <SplitPanel.ForwardButton />+ </SplitPanel.ControlGroup>+ </div>+ <div class="flex h-8 items-center gap-2">+ <RailModeButton />+ <h1 class="m-0 min-w-0 flex-1 truncate text-2xl font-semibold tracking-[-0.03em] text-ink">+ Chat+ </h1>+ </div>+ <Tabs+ aria-label="Chat sidebar views"+ fullWidth+ list={CHANNEL_TABS}+ value={rail.tab()}+ onChange={selectTab}+ />+ </div>+ </Match>+ <Match when={rail.mode() === 'slim'}>+ <div class="flex shrink-0 flex-col items-center gap-3">+ <div class="flex w-full items-center justify-center px-2">+ <SplitPanel.ControlGroup>+ <SplitPanel.CloseButton size="icon-sm" />+ </SplitPanel.ControlGroup>+ </div>+ <div class="flex h-8 w-full items-center justify-center px-2">+ <RailModeButton />+ </div>+ <div class="w-full px-3">+ <Tabs+ aria-label="Chat sidebar views"+ class="h-[76px] flex-col"+ itemClass="h-auto min-h-0 w-full"+ labelClass="size-full p-0"+ fullWidth+ list={SLIM_CHANNEL_TABS}+ value={rail.tab()}+ onChange={selectTab}+ />+ </div>+ <div class="w-full border-t border-edge-muted" />+ <div class="flex w-full justify-center px-2">+ <SlimCreateMenu />+ </div>+ <div class="w-full border-t border-edge-muted" />+ </div>+ </Match>+ </Switch>+ );+}diff --git a/apps/web/src/features/channels-view/components/rail/Item.tsx b/apps/web/src/features/channels-view/components/rail/Item.tsxnew file mode 100644index 0000000000..71189c5e6a--- /dev/null+++ b/apps/web/src/features/channels-view/components/rail/Item.tsx@@ -0,0 +1,249 @@+import { dismissIncomingCallEverywhere } from '@app/features/block-call/sidebar/incoming-calls';+import { joinChannelCall } from '@channel/Call/join-channel-call';+import { toast } from '@core/component/Toast/Toast';+import { isTouchDevice } from '@core/mobile/isTouchDevice';+import { type ChannelEntity, Entity } from '@entity';+import XIcon from '@phosphor/x.svg';+import PhoneCallIcon from '@phosphor-fill/phone-call-fill.svg';+import PhoneIncomingIcon from '@phosphor-fill/phone-incoming-fill.svg';+import { Button, cn, Tooltip } from '@ui';+import { Match, Show, Switch } from 'solid-js';+import { channelInitials, isDirectMessage } from '../../utils';++export type ChannelCallStatus = 'active' | 'incoming';++export type ChannelRailItemProps = {+ id: string;+ channel: ChannelEntity;+ unread: boolean;+ callStatus?: ChannelCallStatus;+ incomingCallId?: string;+ selected: boolean;+ focused: boolean;+ onActivate: () => void;+};++export function ChannelCallIndicator(props: {+ status: ChannelCallStatus | undefined;+ class?: string;+}) {+ return (+ <Show when={props.status}>+ {(status) => (+ <span+ aria-label={status() === 'incoming' ? 'Incoming call' : 'Active call'}+ class={cn(+ 'flex size-4 shrink-0 items-center justify-center text-accent',+ props.class+ )}+ >+ <Switch>+ <Match when={status() === 'incoming'}>+ <PhoneIncomingIcon class="incoming-call-shake size-full" />+ </Match>+ <Match when={true}>+ <PhoneCallIcon class="size-full" />+ </Match>+ </Switch>+ </span>+ )}+ </Show>+ );+}++export function IncomingCallActions(props: {+ callId: string | undefined;+ channelId: string;+}) {+ return (+ <Show when={props.callId}>+ {(callId) => (+ <span class="flex shrink-0 items-center gap-1">+ <Button+ variant="success"+ size="icon-xs"+ class="rounded-md"+ label="Accept incoming call"+ onPointerDown={(event) => event.stopPropagation()}+ onClick={(event) => {+ event.preventDefault();+ event.stopPropagation();+ void joinChannelCall(props.channelId).catch((error) => {+ console.error('Failed to join call', error);+ toast.failure('Failed to join call');+ });+ }}+ >+ <PhoneIncomingIcon class="incoming-call-shake size-3" />+ </Button>+ <Button+ variant="danger"+ size="icon-xs"+ class="rounded-md"+ label="Decline incoming call"+ onPointerDown={(event) => event.stopPropagation()}+ onClick={(event) => {+ event.preventDefault();+ event.stopPropagation();+ dismissIncomingCallEverywhere(callId());+ }}+ >+ <XIcon class="size-3" />+ </Button>+ </span>+ )}+ </Show>+ );+}++export function ChannelAvatar(props: {+ channel: ChannelEntity;+ size?: 'sm' | 'md';+}) {+ const sizeClass = () =>+ props.size === 'md' ? 'size-9 [&_svg]:size-4.5' : 'size-6 [&_svg]:size-3.5';++ return (+ <Switch>+ <Match when={isDirectMessage(props.channel)}>+ <span+ class={cn(+ 'relative flex shrink-0 items-center justify-center overflow-hidden rounded-full border border-edge bg-surface-2 [&_img]:size-full [&_svg]:shrink-0',+ sizeClass()+ )}+ >+ <Entity.Icon+ entity={props.channel}+ suppressClick+ showTooltip={false}+ />+ </span>+ </Match>+ <Match when={true}>+ <span+ class={cn(+ 'flex shrink-0 items-center justify-center text-ink-muted [&_svg]:shrink-0',+ sizeClass()+ )}+ >+ <Entity.Icon+ entity={props.channel}+ suppressClick+ showTooltip={false}+ />+ </span>+ </Match>+ </Switch>+ );+}++function SlimChannelAvatar(props: { channel: ChannelEntity }) {+ return (+ <Switch>+ <Match when={isDirectMessage(props.channel)}>+ <span class="relative flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-full border border-edge bg-surface-2 [&_img]:size-full [&_svg]:size-4 [&_svg]:shrink-0">+ <Entity.Icon+ entity={props.channel}+ suppressClick+ showTooltip={false}+ />+ </span>+ </Match>+ <Match when={true}>+ <span class="flex size-8 shrink-0 items-center justify-center rounded-full border border-edge bg-surface-2 text-xs font-semibold tracking-wide text-ink">+ {channelInitials(props.channel.name)}+ </span>+ </Match>+ </Switch>+ );+}++export function ChannelOption(props: ChannelRailItemProps) {+ return (+ <div+ id={props.id}+ role="treeitem"+ tabIndex={-1}+ class={cn(+ 'relative flex w-full min-w-0 items-center gap-2 rounded-xl px-2 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-accent touch:focus-visible:ring-0',+ isDirectMessage(props.channel) ? 'min-h-10 py-2' : 'h-8',+ props.selected && !isTouchDevice() && 'bg-active text-ink',+ (!props.selected || isTouchDevice()) && 'text-ink-muted',+ !props.selected &&+ !isTouchDevice() &&+ props.focused &&+ 'bg-hover text-ink',+ !props.selected &&+ !isTouchDevice() &&+ !props.focused &&+ 'hover:bg-hover hover:text-ink'+ )}+ aria-current={props.selected ? 'page' : undefined}+ onClick={props.onActivate}+ >+ <ChannelAvatar channel={props.channel} />+ <span class="min-w-0 flex-1 truncate text-sm font-medium">+ {props.channel.name}+ </span>+ <ChannelCallIndicator+ status={props.incomingCallId ? undefined : props.callStatus}+ />+ <IncomingCallActions+ callId={props.incomingCallId}+ channelId={props.channel.id}+ />+ <Show when={props.unread}>+ <span+ aria-label="Unread"+ class="size-2 shrink-0 rounded-full bg-accent"+ />+ </Show>+ </div>+ );+}++export function SlimChannelItem(props: ChannelRailItemProps) {+ return (+ <Tooltip+ label={props.channel.name}+ placement="right"+ class="size-10 self-center"+ >+ <button+ id={props.id}+ type="button"+ role="treeitem"+ tabIndex={-1}+ class={cn(+ 'flex size-10 items-center justify-center rounded-full text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent touch:focus-visible:ring-0',+ props.selected && !isTouchDevice() && 'bg-active text-ink',+ (!props.selected || isTouchDevice()) && 'text-ink-muted',+ !props.selected &&+ !isTouchDevice() &&+ props.focused &&+ 'bg-hover text-ink',+ !props.selected &&+ !isTouchDevice() &&+ !props.focused &&+ 'hover:bg-hover hover:text-ink'+ )}+ aria-current={props.selected ? 'page' : undefined}+ onClick={props.onActivate}+ >+ <span class="relative">+ <SlimChannelAvatar channel={props.channel} />+ <ChannelCallIndicator+ status={props.callStatus}+ class="absolute -bottom-0.5 -right-0.5 rounded-full bg-inset p-0.5"+ />+ <Show when={props.unread}>+ <span+ aria-label="Unread"+ class="absolute -right-0.5 -top-0.5 size-2.5 rounded-full bg-accent ring-2 ring-surface"+ />+ </Show>+ </span>+ </button>+ </Tooltip>+ );+}diff --git a/apps/web/src/features/channels-view/components/rail/Recents.tsx b/apps/web/src/features/channels-view/components/rail/Recents.tsxnew file mode 100644index 0000000000..32799ecb58--- /dev/null+++ b/apps/web/src/features/channels-view/components/rail/Recents.tsx@@ -0,0 +1,68 @@+import { DEBUG_SETTING_KEYS, useDebugSetting } from '@app/lib/debugSettings';+import { useUserId } from '@core/context/user';+import { Key } from '@solid-primitives/keyed';+import { Match, Switch } from 'solid-js';+import { channelMentionsUser } from '../../utils';+import { ChannelsEmptyState } from '../ChannelsEmptyState';+import { useChannelRail } from './Context';+import { ConversationCard } from './ConversationCard';+import { SlimChannelItem } from './Item';++export function ChannelsRailRecents() {+ const rail = useChannelRail();+ const currentUserId = useUserId();+ const forceEmptyState = useDebugSetting(+ DEBUG_SETTING_KEYS.FORCE_EMPTY_STATES+ );++ const hasItems = () =>+ !forceEmptyState() && rail.recentConversations().length > 0;++ return (+ <Switch>+ <Match when={rail.mode() === 'full' && !hasItems()}>+ <ChannelsEmptyState scope="recents" topAligned />+ </Match>+ <Match when={rail.mode() === 'full'}>+ <div class="flex w-full flex-col divide-y divide-edge-muted">+ <Key each={rail.recentConversations()} by={(channel) => channel.id}>+ {(channel) => (+ <ConversationCard+ id={rail.item.domId(channel().id)}+ channel={channel()}+ senderId={channel().latestRootMessage?.senderId}+ mentionedCurrentUser={channelMentionsUser(+ channel(),+ currentUserId()+ )}+ unread={rail.activity.isUnread(channel().id)}+ callStatus={rail.activity.callStatus(channel().id)}+ incomingCallId={rail.activity.incomingCallId(channel().id)}+ selected={rail.item.isSelected(channel().id)}+ focused={rail.item.isFocused(channel().id)}+ onActivate={() => rail.item.activate(channel().id)}+ />+ )}+ </Key>+ </div>+ </Match>+ <Match when={hasItems()}>+ <div class="flex w-full flex-col gap-0.5">+ <Key each={rail.recentConversations()} by={(channel) => channel.id}>+ {(channel) => (+ <SlimChannelItem+ id={rail.item.domId(channel().id)}+ channel={channel()}+ unread={rail.activity.isUnread(channel().id)}+ callStatus={rail.activity.callStatus(channel().id)}+ selected={rail.item.isSelected(channel().id)}+ focused={rail.item.isFocused(channel().id)}+ onActivate={() => rail.item.activate(channel().id)}+ />+ )}+ </Key>+ </div>+ </Match>+ </Switch>+ );+}diff --git a/apps/web/src/features/channels-view/components/rail/Section.tsx b/apps/web/src/features/channels-view/components/rail/Section.tsxnew file mode 100644index 0000000000..2adeda4b56--- /dev/null+++ b/apps/web/src/features/channels-view/components/rail/Section.tsx@@ -0,0 +1,172 @@+import { ScrollIndicators } from '@core/component/VerticalScrollIndicators';+import CaretDownIcon from '@phosphor/caret-down.svg';+import CaretUpIcon from '@phosphor/caret-up.svg';+import PlusIcon from '@phosphor/plus.svg';+import { cn, Scroll, Tooltip } from '@ui';+import { createSignal, type JSX, Match, Show, Switch } from 'solid-js';+import { useOffscreenActivity } from './hooks/useOffscreenActivity';++function SectionScrollArea(props: {+ contentRef: (element: HTMLDivElement) => void;+ containerClass?: string;+ class?: string;+ activityTargetId?: string;+ activityLabel?: string;+ activityTooltip?: boolean;+ onActivityVisible?: (targetId: string) => void;+ children: JSX.Element;+}) {+ const [scrollRoot, setScrollRoot] = createSignal<HTMLDivElement>();++ const activity = useOffscreenActivity({+ scrollRoot,+ targetId: () => props.activityTargetId,+ onTargetVisible: (targetId) => props.onActivityVisible?.(targetId),+ });++ return (+ <div class={cn('relative min-h-0 flex-1', props.containerClass)}>+ <Scroll+ scrollRef={(element) => {+ setScrollRoot(element);+ props.contentRef(element);+ }}+ >+ <div role="group" class={props.class}>+ {props.children}+ </div>+ </Scroll>+ <ScrollIndicators+ scrollRef={scrollRoot}+ appearance="gradient"+ gradientColor="inset"+ />+ <Show when={activity.direction()}>+ {(direction) => (+ <Tooltip+ label={props.activityLabel ?? 'New activity'}+ placement={direction() === 'start' ? 'bottom' : 'top'}+ disabled={!props.activityTooltip}+ class={cn(+ 'absolute left-1/2 z-annotation-layer max-w-[calc(100%-0.5rem)] -translate-x-1/2',+ direction() === 'start' ? 'top-1' : 'bottom-1'+ )}+ >+ <button+ type="button"+ class="flex h-7 max-w-full items-center gap-1 rounded-full border border-edge bg-lift px-2 text-xxs font-medium text-ink-muted shadow-sm transition-colors hover:bg-surface hover:text-ink focus-visible:ring-2 focus-visible:ring-accent"+ aria-label={`${props.activityLabel ?? 'New activity'} ${+ direction() === 'start' ? 'above' : 'below'+ }; scroll to it`}+ onClick={activity.scrollToTarget}+ >+ <Switch>+ <Match when={direction() === 'start'}>+ <CaretUpIcon class="size-3 shrink-0" />+ </Match>+ <Match when={true}>+ <CaretDownIcon class="size-3 shrink-0" />+ </Match>+ </Switch>+ <Show when={props.activityLabel}>+ {(label) => <span class="truncate">{label()}</span>}+ </Show>+ </button>+ </Tooltip>+ )}+ </Show>+ </div>+ );+}++function CollapsibleSectionRoot(props: {+ open: boolean;+ fillAvailable?: boolean;+ class?: string;+ children: JSX.Element;+}) {+ return (+ <section+ class={cn(+ 'flex min-h-0 flex-col gap-1',+ props.open && props.fillAvailable && 'flex-1',+ props.open && !props.fillAvailable && 'shrink',+ !props.open && 'shrink-0',+ props.open && !props.fillAvailable && 'max-h-[calc(50%_-_0.375rem)]',+ props.class+ )}+ >+ {props.children}+ </section>+ );+}++function CollapsibleSectionHeader(props: {+ focused: boolean;+ focusWithin: boolean;+ class?: string;+ children: JSX.Element;+}) {+ return (+ <div+ class={cn(+ 'flex w-full items-center rounded-xl text-xs font-semibold uppercase tracking-wide text-ink-extra-muted transition-colors hover:bg-hover hover:text-ink-muted',+ props.focused && 'bg-hover text-ink-muted',+ !props.focused && props.focusWithin && 'text-ink-muted',+ props.class+ )}+ >+ {props.children}+ </div>+ );+}++function CollapsibleSectionContent(props: {+ open: boolean;+ contentRef: (element: HTMLDivElement) => void;+ containerClass?: string;+ class?: string;+ activityTargetId?: string;+ activityLabel?: string;+ activityTooltip?: boolean;+ onActivityVisible?: (targetId: string) => void;+ children: JSX.Element;+}) {+ return (+ <Show when={props.open}>+ <SectionScrollArea+ contentRef={props.contentRef}+ containerClass={props.containerClass}+ class={props.class}+ activityTargetId={props.activityTargetId}+ activityLabel={props.activityLabel}+ activityTooltip={props.activityTooltip}+ onActivityVisible={props.onActivityVisible}+ >+ {props.children}+ </SectionScrollArea>+ </Show>+ );+}++export const CollapsibleSection = {+ Root: CollapsibleSectionRoot,+ Header: CollapsibleSectionHeader,+ Content: CollapsibleSectionContent,+};++export function CreateRailAction(props: {+ label: string;+ onClick: () => void;+}) {+ return (+ <button+ type="button"+ class="flex size-7 shrink-0 items-center justify-center rounded-lg text-ink-muted transition-colors hover:bg-hover hover:text-ink focus-visible:ring-2 focus-visible:ring-accent"+ aria-label={props.label}+ onClick={props.onClick}+ >+ <PlusIcon class="size-3.5" />+ </button>+ );+}diff --git a/apps/web/src/features/channels-view/components/rail/hooks/useChannelCalls.ts b/apps/web/src/features/channels-view/components/rail/hooks/useChannelCalls.tsnew file mode 100644index 0000000000..226b12dda2--- /dev/null+++ b/apps/web/src/features/channels-view/components/rail/hooks/useChannelCalls.ts@@ -0,0 +1,53 @@+import { useVisibleIncomingCalls } from '@app/features/block-call/sidebar/incoming-calls';+import { useActiveCallsQuery } from '@queries/call/call';+import { createMemo } from 'solid-js';+import type { ChannelCallStatus } from '../Item';++export function useChannelCalls() {+ const activeCallsQuery = useActiveCallsQuery();+ const incomingCalls = useVisibleIncomingCalls();++ const callActivity = createMemo(() => {+ const calls = new Map<+ string,+ {+ callId: string;+ channelId: string;+ status: ChannelCallStatus;+ }+ >();++ for (const call of incomingCalls()) {+ calls.set(call.callId, { ...call, status: 'incoming' });+ }+ for (const call of activeCallsQuery.data ?? []) {+ if (calls.has(call.callId)) continue;++ calls.set(call.callId, { ...call, status: 'active' });+ }++ return [...calls.values()];+ });++ const incomingCallIds = createMemo(+ () =>+ new Map(+ incomingCalls().map((call) => [call.channelId, call.callId] as const)+ )+ );++ const callStatuses = createMemo(() => {+ const statuses = new Map<string, ChannelCallStatus>();++ for (const call of activeCallsQuery.data ?? []) {+ statuses.set(call.channelId, 'active');+ }+ for (const call of incomingCalls()) {+ statuses.set(call.channelId, 'incoming');+ }++ return statuses;+ });++ return { callActivity, incomingCallIds, callStatuses };+}diff --git a/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailActivity.ts b/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailActivity.tsnew file mode 100644index 0000000000..79d84a8e50--- /dev/null+++ b/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailActivity.ts@@ -0,0 +1,227 @@+import { useGlobalNotificationSource } from '@components/app/GlobalAppState';+import { compareDateDesc, type DateValue } from '@core/util/date';+import type { ChannelEntity } from '@entity';+import { notificationIsRead } from '@entity/utils/notification';+import { type Accessor, createEffect, createMemo, onCleanup } from 'solid-js';+import { createStore } from 'solid-js/store';+import type { ChannelsGroup } from '../../../types';+import { channelGroup } from '../../../utils';+import { CHANNEL_GROUPS } from '../model';++type ChannelActivityTarget = {+ channelId: string;+ source:+ | { type: 'message' }+ | { type: 'notification'; notificationId: string }+ | {+ type: 'call';+ callId: string;+ };+};++type ChannelCallActivity = {+ callId: string;+ channelId: string;+ status: 'active' | 'incoming';+};++export function useChannelRailActivity(+ channels: Accessor<ChannelEntity[]>,+ calls: Accessor<ChannelCallActivity[]>+) {+ const notificationSource = useGlobalNotificationSource();+ const [activityTargets, setActivityTargets] = createStore<+ Partial<Record<ChannelsGroup, ChannelActivityTarget>>+ >({});+ const [acknowledgedNotificationIds, setAcknowledgedNotificationIds] =+ createStore<Record<string, boolean>>({});++ const channelsById = createMemo(+ () => new Map(channels().map((channel) => [channel.id, channel]))+ );++ const callStatuses = createMemo(+ () => new Map(calls().map((call) => [call.callId, call.status]))+ );++ const notificationActivity = createMemo(() => {+ const unreadChannelIds = new Set<string>();+ const unreadCounts: Record<ChannelsGroup, number> = {+ channels: 0,+ direct_messages: 0,+ };+ const notificationIdsByChannel = new Map<string, string[]>();+ const latestTargets: Partial<Record<ChannelsGroup, ChannelActivityTarget>> =+ {};+ const notifications = [...notificationSource.notifications()].sort((a, b) =>+ compareDateDesc(a.created_at, b.created_at)+ );++ for (const notification of notifications) {+ if (+ notification.entity_type !== 'channel' ||+ notificationIsRead(notification)+ ) {+ continue;+ }++ const isFirstUnreadForChannel = !unreadChannelIds.has(+ notification.entity_id+ );+ unreadChannelIds.add(notification.entity_id);+ const notificationIds =+ notificationIdsByChannel.get(notification.entity_id) ?? [];+ notificationIds.push(notification.id);+ notificationIdsByChannel.set(notification.entity_id, notificationIds);++ const channel = channelsById().get(notification.entity_id);+ if (!channel) continue;++ const group = channelGroup(channel);+ if (isFirstUnreadForChannel) unreadCounts[group] += 1;+ if (+ !latestTargets[group] &&+ !acknowledgedNotificationIds[notification.id]+ ) {+ latestTargets[group] = {+ channelId: channel.id,+ source: {+ type: 'notification',+ notificationId: notification.id,+ },+ };+ }+ }++ return {+ latestTargets,+ notificationIdsByChannel,+ unreadChannelIds,+ unreadCounts,+ };+ });++ const recordActivity = (+ channel: ChannelEntity,+ source: ChannelActivityTarget['source'] = { type: 'message' }+ ) => {+ const group = channelGroup(channel);+ setActivityTargets(group, {+ channelId: channel.id,+ source,+ });+ };++ onCleanup(+ notificationSource.subscribe((notification) => {+ if (+ notification.entity_type !== 'channel' ||+ notificationIsRead(notification)+ ) {+ return;+ }++ const channel = channelsById().get(notification.entity_id);+ if (channel) recordActivity(channel);+ })+ );++ let latestMessageTimes = new Map<string, DateValue | undefined>();++ createEffect(() => {+ const nextMessageTimes = new Map<string, DateValue | undefined>();++ for (const channel of channels()) {+ const nextMessageTime = channel.latestRootMessage?.createdAt;+ nextMessageTimes.set(channel.id, nextMessageTime);++ if (+ latestMessageTimes.has(channel.id) &&+ nextMessageTime !== undefined &&+ nextMessageTime !== latestMessageTimes.get(channel.id)+ ) {+ recordActivity(channel);+ }+ }++ latestMessageTimes = nextMessageTimes;+ });++ let activeCallStatuses = new Map<string, ChannelCallActivity['status']>();++ createEffect(() => {+ const nextActiveCallStatuses = callStatuses();+ const recordedGroups = new Set<ChannelsGroup>();++ for (const call of calls()) {+ const channel = channelsById().get(call.channelId);+ if (!channel) continue;++ const previousStatus = activeCallStatuses.get(call.callId);+ if (+ previousStatus !== undefined &&+ !(previousStatus === 'active' && call.status === 'incoming')+ ) {+ continue;+ }++ const group = channelGroup(channel);+ if (recordedGroups.has(group)) continue;++ recordActivity(channel, { type: 'call', callId: call.callId });+ recordedGroups.add(group);+ }++ for (const group of CHANNEL_GROUPS) {+ const target = activityTargets[group];+ if (target?.source.type !== 'call') continue;++ const status = nextActiveCallStatuses.get(target.source.callId);+ if (!status) setActivityTargets(group, undefined);+ }++ activeCallStatuses = nextActiveCallStatuses;+ });++ const target = (group: ChannelsGroup): ChannelActivityTarget | undefined => {+ const recordedTarget = activityTargets[group];+ if (recordedTarget) return recordedTarget;++ return notificationActivity().latestTargets[group];+ };++ const targetChannelId = (group: ChannelsGroup) => target(group)?.channelId;++ const targetLabel = (group: ChannelsGroup) => {+ const source = target(group)?.source;+ if (!source) return;+ if (source.type !== 'call') return 'New activity';++ return callStatuses().get(source.callId) === 'incoming'+ ? 'Incoming call'+ : 'Active call';+ };++ const clearTarget = (group: ChannelsGroup, channelId: string) => {+ if (targetChannelId(group) !== channelId) return;++ for (const notificationId of notificationActivity().notificationIdsByChannel.get(+ channelId+ ) ?? []) {+ setAcknowledgedNotificationIds(notificationId, true);+ }++ if (activityTargets[group]?.channelId === channelId) {+ setActivityTargets(group, undefined);+ }+ };++ return {+ clearTarget,+ targetChannelId,+ targetLabel,+ unreadChannelIds: () => notificationActivity().unreadChannelIds,+ unreadCount: (group: ChannelsGroup) =>+ notificationActivity().unreadCounts[group],+ };+}diff --git a/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailRows.ts b/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailRows.tsnew file mode 100644index 0000000000..c0e63d7b28--- /dev/null+++ b/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailRows.ts@@ -0,0 +1,63 @@+import { compareDateDesc } from '@core/util/date';+import type { ChannelEntity } from '@entity';+import { type Accessor, createMemo } from 'solid-js';+import type { ChannelsGroup, ChannelsTab } from '../../../types';+import { channelHasMessages, isDirectMessage } from '../../../utils';+import { type ChannelRailRow, conversationRow, sectionRow } from '../model';++export function useChannelRailRows(options: {+ channels: Accessor<ChannelEntity[]>;+ tab: Accessor<ChannelsTab>;+ isGroupExpanded: (group: ChannelsGroup) => boolean;+}) {+ const teamChannels = createMemo(() =>+ options.channels().filter((channel) => !isDirectMessage(channel))+ );++ const directMessages = createMemo(() =>+ options.channels().filter(isDirectMessage)+ );++ const recentConversations = createMemo(() =>+ options+ .channels()+ .filter(channelHasMessages)+ .sort((a, b) =>+ compareDateDesc(+ a.latestRootMessage?.createdAt,+ b.latestRootMessage?.createdAt+ )+ )+ );++ const visibleRows = createMemo<ChannelRailRow[]>(() => {+ if (options.tab() === 'recents') {+ return recentConversations().map((channel) => conversationRow(channel));+ }++ const rows: ChannelRailRow[] = [sectionRow('channels')];+ if (options.isGroupExpanded('channels')) {+ rows.push(+ ...teamChannels().map((channel) => conversationRow(channel, 'channels'))+ );+ }++ rows.push(sectionRow('direct_messages'));+ if (options.isGroupExpanded('direct_messages')) {+ rows.push(+ ...directMessages().map((channel) =>+ conversationRow(channel, 'direct_messages')+ )+ );+ }++ return rows;+ });++ return {+ directMessages,+ recentConversations,+ teamChannels,+ visibleRows,+ };+}diff --git a/apps/web/src/features/channels-view/components/rail/hooks/useOffscreenActivity.ts b/apps/web/src/features/channels-view/components/rail/hooks/useOffscreenActivity.tsnew file mode 100644index 0000000000..64f47068d6--- /dev/null+++ b/apps/web/src/features/channels-view/components/rail/hooks/useOffscreenActivity.ts@@ -0,0 +1,105 @@+import { type Accessor, createEffect, createSignal, onCleanup } from 'solid-js';++type ActivityDirection = 'start' | 'end';++export function useOffscreenActivity(options: {+ scrollRoot: Accessor<HTMLDivElement | undefined>;+ targetId: Accessor<string | undefined>;+ onTargetVisible?: (targetId: string) => void;+}) {+ const [direction, setDirection] = createSignal<ActivityDirection>();+ let measuredTargetId: string | undefined;++ const update = (root: HTMLDivElement) => {+ const targetId = options.targetId();+ if (!targetId) {+ measuredTargetId = undefined;+ setDirection(undefined);+ return;+ }++ if (targetId !== measuredTargetId) {+ measuredTargetId = targetId;+ setDirection(undefined);+ }++ const target = document.getElementById(targetId);+ if (!target) {+ setDirection(undefined);+ return;+ }++ const rootBounds = root.getBoundingClientRect();+ const targetBounds = target.getBoundingClientRect();+ const targetIsVisible =+ targetBounds.bottom > rootBounds.top &&+ targetBounds.top < rootBounds.bottom;++ if (targetIsVisible || root.scrollHeight <= root.clientHeight + 1) {+ const wasOffscreen = direction() !== undefined;+ setDirection(undefined);+ if (wasOffscreen) options.onTargetVisible?.(targetId);+ return;+ }++ setDirection(targetBounds.bottom <= rootBounds.top ? 'start' : 'end');+ };++ createEffect(() => {+ const root = options.scrollRoot();+ if (!root) {+ setDirection(undefined);+ return;+ }++ measuredTargetId = undefined;+ const updateForRoot = () => update(root);+ root.addEventListener('scroll', updateForRoot, { passive: true });++ const resizeObserver = new ResizeObserver(updateForRoot);+ resizeObserver.observe(root);+ if (root.firstElementChild instanceof HTMLElement) {+ resizeObserver.observe(root.firstElementChild);+ }++ const mutationObserver = new MutationObserver(updateForRoot);+ mutationObserver.observe(root, { childList: true, subtree: true });++ queueMicrotask(updateForRoot);++ onCleanup(() => {+ root.removeEventListener('scroll', updateForRoot);+ resizeObserver.disconnect();+ mutationObserver.disconnect();+ });+ });++ createEffect(() => {+ options.targetId();+ const root = options.scrollRoot();+ if (!root) return;++ queueMicrotask(() => {+ if (root === options.scrollRoot()) update(root);+ });+ });++ const scrollToTarget = () => {+ const root = options.scrollRoot();+ const targetId = options.targetId();+ const target = targetId ? document.getElementById(targetId) : undefined;+ if (!root || !target) return;++ const rootBounds = root.getBoundingClientRect();+ const targetBounds = target.getBoundingClientRect();+ const rootCenter = rootBounds.top + rootBounds.height / 2;+ const targetCenter = targetBounds.top + targetBounds.height / 2;++ root.scrollTo({+ top: root.scrollTop + targetCenter - rootCenter,+ behavior: 'smooth',+ });+ };++ return { direction, scrollToTarget };+}diff --git a/apps/web/src/features/channels-view/components/rail/model.ts b/apps/web/src/features/channels-view/components/rail/model.tsnew file mode 100644index 0000000000..2629e0de12--- /dev/null+++ b/apps/web/src/features/channels-view/components/rail/model.ts@@ -0,0 +1,37 @@+import type { ChannelEntity } from '@entity';+import type { ChannelsGroup } from '../../types';++export const CHANNEL_GROUPS: ChannelsGroup[] = ['channels', 'direct_messages'];++export type ChannelRailRow =+ | {+ kind: 'section';+ id: `section:${ChannelsGroup}`;+ group: ChannelsGroup;+ }+ | {+ kind: 'conversation';+ id: `channel:${string}`;+ group?: ChannelsGroup;+ channel: ChannelEntity;+ };++export const sectionRow = (group: ChannelsGroup): ChannelRailRow => ({+ kind: 'section',+ id: `section:${group}`,+ group,+});++export const conversationRow = (+ channel: ChannelEntity,+ group?: ChannelsGroup+): ChannelRailRow => ({+ kind: 'conversation',+ id: `channel:${channel.id}`,+ group,+ channel,+});++export const rowKeyForChannel = (channelId: string) => `channel:${channelId}`;++export const rowKeyForSection = (group: ChannelsGroup) => `section:${group}`;diff --git a/apps/web/src/features/channels-view/constants.ts b/apps/web/src/features/channels-view/constants.tsnew file mode 100644index 0000000000..2689a6e7ad--- /dev/null+++ b/apps/web/src/features/channels-view/constants.ts@@ -0,0 +1,13 @@+export const CHANNELS_NARROW_RAIL_WIDTH = 64;+export const CHANNELS_DEFAULT_RAIL_WIDTH = 360;+export const CHANNELS_MIN_RAIL_WIDTH = 224;+export const CHANNELS_MAX_RAIL_WIDTH = 420;++export function clampChannelsRailWidth(width: number): number {+ if (!Number.isFinite(width)) return CHANNELS_DEFAULT_RAIL_WIDTH;++ return Math.min(+ CHANNELS_MAX_RAIL_WIDTH,+ Math.max(CHANNELS_MIN_RAIL_WIDTH, width)+ );+}diff --git a/apps/web/src/features/channels-view/persistence.ts b/apps/web/src/features/channels-view/persistence.tsindex 7559b9da23..ed379d0814 100644--- a/apps/web/src/features/channels-view/persistence.ts+++ b/apps/web/src/features/channels-view/persistence.ts@@ -9,12 +9,19 @@ import {import { createUserScopedStorage } from '@core/util/userScopedStorage';import type { Accessor } from 'solid-js';import { z } from 'zod';+import {+ CHANNELS_DEFAULT_RAIL_WIDTH,+ clampChannelsRailWidth,+} from './constants';import type { ChannelsViewState } from './types';const CHANNELS_ENTRY_STATE_KEY = 'channels.view';const channelsLocalStateStorage = createUserScopedStorage('macro:channels:view-state:v1');+const channelsPreferencesStorage = createUserScopedStorage(+ 'macro:channels:preferences:v1'+);const channelsExpandedGroupsSchema = z.preprocess((value) => {@@ -37,6 +44,9 @@ const channelsExpandedGroupsSchema = z.preprocess(const channelsEntryStateSchemaWithDefaults = z.object({version: z.literal(1).default(1),tab: z.enum(['browse', 'recents']).default('browse'),+ mobileTab: z+ .enum(['channels', 'direct_messages', 'recents'])+ .default('channels'),selectedChannelId: z.string().optional(),expandedGroups: channelsExpandedGroupsSchema.default({channels: true,@@ -46,16 +56,40 @@ const channelsEntryStateSchemaWithDefaults = z.object({type ChannelsEntryState = z.infer<typeof channelsEntryStateSchemaWithDefaults>;-const DEFAULT_CHANNELS_ENTRY_STATE: ChannelsEntryState =- channelsEntryStateSchemaWithDefaults.parse({});-const channelsEntryStateSchema = channelsEntryStateSchemaWithDefaults.catch(- DEFAULT_CHANNELS_ENTRY_STATE-);+const DEFAULT_CHANNELS_ENTRY_STATE = {+ version: 1,+ tab: 'browse',+ mobileTab: 'channels',+ selectedChannelId: undefined,+ expandedGroups: {+ channels: true,+ direct_messages: true,+ },+} satisfies ChannelsEntryState;++const channelsPreferencesSchema = z.object({+ version: z.literal(1).default(1),+ asideWidth: z+ .number()+ .finite()+ .default(CHANNELS_DEFAULT_RAIL_WIDTH)+ .transform(clampChannelsRailWidth),+ railMode: z.enum(['auto', 'full', 'slim']).default('auto'),+});++type ChannelsPreferences = z.infer<typeof channelsPreferencesSchema>;++const DEFAULT_CHANNELS_PREFERENCES = {+ version: 1,+ asideWidth: CHANNELS_DEFAULT_RAIL_WIDTH,+ railMode: 'auto',+} satisfies ChannelsPreferences;function selectEntryState(state: ChannelsViewState): ChannelsEntryState {return {version: 1,tab: state.tab,+ mobileTab: state.mobileTab,...(state.selectedChannelId === undefined? {}: { selectedChannelId: state.selectedChannelId }),@@ -67,11 +101,13 @@ function restoreChannelsEntryState(current: ChannelsViewState,stored: unknown): ChannelsViewState {- const restored = channelsEntryStateSchema.parse(stored);+ const result = channelsEntryStateSchemaWithDefaults.safeParse(stored);+ const restored = result.success ? result.data : DEFAULT_CHANNELS_ENTRY_STATE;return {...current,tab: restored.tab,+ mobileTab: restored.mobileTab,selectedChannelId: restored.selectedChannelId,expandedGroups: restored.expandedGroups,};@@ -114,7 +150,7 @@ function createChannelsLocalStateStorage(options: {try {return restoreChannelsEntryState(current, JSON.parse(raw));} catch {- return undefined;+ return restoreChannelsEntryState(current, undefined);}},initialize: (current) => {@@ -133,14 +169,76 @@ function createChannelsLocalStateStorage(options: {};}+function createChannelsPreferencesStorage(options: {+ userId: Accessor<string | undefined>;+ restore: boolean;+}): PersistenceStorage<ChannelsViewState> {+ let previous: string | undefined;+ const serialize = (state: ChannelsViewState) =>+ JSON.stringify({+ version: 1,+ asideWidth: clampChannelsRailWidth(state.asideWidth),+ railMode: state.railMode,+ } satisfies ChannelsPreferences);++ return {+ restore: (current) => {+ if (!options.restore) return undefined;++ const userId = options.userId();+ if (!userId) return undefined;++ const raw = channelsPreferencesStorage.read(userId);+ if (raw === null) return undefined;++ try {+ const result = channelsPreferencesSchema.safeParse(JSON.parse(raw));+ const restored = result.success+ ? result.data+ : DEFAULT_CHANNELS_PREFERENCES;++ return {+ ...current,+ asideWidth: restored.asideWidth,+ railMode: restored.railMode,+ };+ } catch {+ return {+ ...current,+ asideWidth: DEFAULT_CHANNELS_PREFERENCES.asideWidth,+ railMode: DEFAULT_CHANNELS_PREFERENCES.railMode,+ };+ }+ },+ initialize: (current) => {+ previous = serialize(current);+ },+ write: (current) => {+ const userId = options.userId();+ if (!userId) return;++ const serialized = serialize(current);+ if (serialized === previous) return;++ previous = serialized;+ channelsPreferencesStorage.write(userId, serialized);+ },+ };+}+export function createChannelsViewPersistence(options: {handle: EntryPersistenceHandle;userId: Accessor<string | undefined>;restoreEntryState?: boolean;restoreLocalState?: boolean;+ restorePreferences?: boolean;}): MakePersistedStateOptions<ChannelsViewState> {return {storages: [+ createChannelsPreferencesStorage({+ userId: options.userId,+ restore: options.restorePreferences ?? true,+ }),createChannelsLocalStateStorage({userId: options.userId,restore: options.restoreLocalState ?? true,diff --git a/apps/web/src/features/channels-view/queries.ts b/apps/web/src/features/channels-view/queries.tsnew file mode 100644index 0000000000..e4d16d11af--- /dev/null+++ b/apps/web/src/features/channels-view/queries.ts@@ -0,0 +1,81 @@+import {+ compileToAst,+ defineQueryFilters,+ queryStateFrom,+} from '@app/features/next-soup/filters/filter-store';+import type { ChannelEntity } from '@entity';+import {+ type SoupAstItemsQueryArgs,+ type SoupAstParams,+ useSoupAstItemsQuery,+} from '@queries/soup/items';+import type { Accessor } from 'solid-js';+import type { ChannelsQueryScope } from './types';+import { channelHasMessages, isDirectMessage } from './utils';++const CHANNELS_QUERY_PARAMS = {+ limit: 100,+ sort_method: 'updated_at',+} satisfies SoupAstParams;++type ChannelsQueryDefinition = {+ params: SoupAstParams;+ filters: ReturnType<typeof defineQueryFilters>;+ matches: (channel: ChannelEntity) => boolean;+};++export const CHANNELS_QUERY_DEFINITIONS = {+ recents: {+ params: CHANNELS_QUERY_PARAMS,+ filters: defineQueryFilters({+ include: {+ channelImportance: true,+ channelIsParticipant: [true],+ },+ }),+ matches: channelHasMessages,+ },+ channels: {+ params: CHANNELS_QUERY_PARAMS,+ filters: defineQueryFilters({+ include: { channelIsParticipant: [true] },+ exclude: { channelType: ['direct_message'] },+ }),+ matches: (channel) => !isDirectMessage(channel),+ },+ direct_messages: {+ params: CHANNELS_QUERY_PARAMS,+ filters: defineQueryFilters({+ include: {+ channelType: ['direct_message'],+ channelIsParticipant: [true],+ },+ }),+ matches: isDirectMessage,+ },+} satisfies Record<ChannelsQueryScope, ChannelsQueryDefinition>;++export function channelsQueryArgs(+ scope: ChannelsQueryScope+): SoupAstItemsQueryArgs {+ const definition = CHANNELS_QUERY_DEFINITIONS[scope];++ return {+ params: definition.params,+ body: compileToAst(queryStateFrom(definition.filters)),+ };+}++export function filterChannelsForScope(+ scope: ChannelsQueryScope,+ channels: ChannelEntity[]+): ChannelEntity[] {+ return channels.filter(CHANNELS_QUERY_DEFINITIONS[scope].matches);+}++export function useChannelsQuery(scope: Accessor<ChannelsQueryScope>) {+ return useSoupAstItemsQuery(+ () => channelsQueryArgs(scope()),+ () => ({ staleTime: 30_000 })+ );+}diff --git a/apps/web/src/features/channels-view/types.ts b/apps/web/src/features/channels-view/types.tsindex 456833cb0b..479b02f60b 100644--- a/apps/web/src/features/channels-view/types.ts+++ b/apps/web/src/features/channels-view/types.ts@@ -2,10 +2,17 @@ export type ChannelsTab = 'browse' | 'recents';export type ChannelsGroup = 'channels' | 'direct_messages';+export type ChannelsQueryScope = ChannelsGroup | 'recents';++export type ChannelsRailMode = 'auto' | 'full' | 'slim';+export type ChannelsViewState = {tab: ChannelsTab;+ mobileTab: ChannelsQueryScope;selectedChannelId?: string;expandedGroups: Record<ChannelsGroup, boolean>;+ asideWidth: number;+ railMode: ChannelsRailMode;};export type ChannelsViewStateOptions = Partial<diff --git a/apps/web/src/features/channels-view/utils.ts b/apps/web/src/features/channels-view/utils.tsindex de745f1525..13581d214e 100644--- a/apps/web/src/features/channels-view/utils.ts+++ b/apps/web/src/features/channels-view/utils.ts@@ -1,4 +1,32 @@import type { DateValue } from '@core/util/date';+import type { ChannelEntity } from '@entity';+import type { ChannelsGroup } from './types';++export function isDirectMessage(channel: ChannelEntity) {+ return channel.channelType === 'direct_message';+}++export function channelGroup(channel: ChannelEntity): ChannelsGroup {+ return isDirectMessage(channel) ? 'direct_messages' : 'channels';+}++export function channelHasMessages(channel: ChannelEntity) {+ return Boolean(channel.latestRootMessage);+}++export function channelMentionsUser(+ channel: ChannelEntity,+ userId: string | undefined+) {+ if (!userId) return false;++ const normalizedUserId = userId.toLocaleLowerCase();+ return Boolean(+ channel.latestRootMessage?.mentions.some(+ (mention) => mention.toLocaleLowerCase() === normalizedUserId+ )+ );+}export function channelInitials(name: string) {const words = name.replace(/^#+/, '').trim().split(/\s+/).filter(Boolean);diff --git a/apps/web/src/features/inbox-view/components/InboxHeader.tsx b/apps/web/src/features/inbox-view/components/InboxHeader.tsxindex 0277b085b6..5ac3adadb8 100644--- a/apps/web/src/features/inbox-view/components/InboxHeader.tsx+++ b/apps/web/src/features/inbox-view/components/InboxHeader.tsx@@ -4,9 +4,9 @@ import { type ParentProps, Show } from 'solid-js';export function InboxHeader(props: ParentProps) {return (- <header class="shrink-0 px-4 pb-3 pt-2 touch:px-(--mobile-chrome-gutter) touch:pt-[calc(var(--safe-top,0px)+0.5rem)] @max-[480px]/view-shell:px-2 @max-[720px]/view-shell:px-3">+ <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)]"><Show when={!isTouchDevice()}>- <div class="flex min-h-7 items-center">+ <div class="flex items-center"><SplitPanel.ControlGroup><SplitPanel.CloseButton /><SplitPanel.BackButton />@@ -15,13 +15,13 @@ export function InboxHeader(props: ParentProps) {</div></Show><Show when={!isTouchDevice()}>- <div class="mt-1 flex min-h-10 min-w-0 items-center">+ <div class="flex h-8 min-w-0 items-center"><h1 class="m-0 min-w-0 flex-1 truncate text-2xl font-semibold tracking-[-0.035em] text-ink">Inbox</h1></div></Show>- <div class="mt-3 flex min-h-10 min-w-0 items-center touch:mt-0">+ <div class="flex h-8 min-w-0 items-center touch:h-10">{props.children}</div></header>diff --git a/apps/web/src/features/inbox-view/components/InboxList.tsx b/apps/web/src/features/inbox-view/components/InboxList.tsxindex c8b73b355b..4207623a56 100644--- a/apps/web/src/features/inbox-view/components/InboxList.tsx+++ b/apps/web/src/features/inbox-view/components/InboxList.tsx@@ -536,7 +536,7 @@ export function InboxList() {<div role="gridcell"><InboxListEntityclass="mx-0 w-full border-b border-edge touch:border-b-0"- cardClass="rounded-none px-4 py-3"+ cardClass="rounded-none px-4 py-3 mobile:pl-(--soup-row-padding-l)"entity={entityRow().entity}occurrenceKey={entityRow().id}checked={list.selection.isSelected(diff --git a/apps/web/src/features/inbox-view/inbox-view.tsx b/apps/web/src/features/inbox-view/inbox-view.tsxindex dcc31da6b0..ad84371760 100644--- a/apps/web/src/features/inbox-view/inbox-view.tsx+++ b/apps/web/src/features/inbox-view/inbox-view.tsx@@ -2,6 +2,7 @@ import { ViewShell } from '@app/components/view-shell';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 { ListEntityMetadataQueryProvider } from '@entity';import SpinnerIcon from '@phosphor/spinner.svg';import { createEffect, onMount, Suspense } from 'solid-js';@@ -41,7 +42,11 @@ function InboxViewRoot() {<StaticMarkdownContext><SplitPanel.Root><SplitPanel.Body>- <ViewShell.Root aside={false} main={{ min: 224 }}>+ <ViewShell.Root+ aside={false}+ main={{ min: 224 }}+ class={isTouchDevice() ? undefined : 'bg-inset'}+ ><ViewShell.Main><InboxHeader><InboxTabs />diff --git a/apps/web/src/features/inbox-view/persistence.ts b/apps/web/src/features/inbox-view/persistence.tsindex 8441b55f1f..d6fa9a33b3 100644--- a/apps/web/src/features/inbox-view/persistence.ts+++ b/apps/web/src/features/inbox-view/persistence.ts@@ -19,11 +19,10 @@ const inboxEntryStateSchemaWithDefaults = z.object({type InboxEntryState = z.infer<typeof inboxEntryStateSchemaWithDefaults>;-const DEFAULT_INBOX_ENTRY_STATE: InboxEntryState =- inboxEntryStateSchemaWithDefaults.parse({});-const inboxEntryStateSchema = inboxEntryStateSchemaWithDefaults.catch(- DEFAULT_INBOX_ENTRY_STATE-);+const DEFAULT_INBOX_ENTRY_STATE = {+ version: 1,+ tab: 'signal',+} satisfies InboxEntryState;const inboxListEntryStateSchemaWithDefaults = z.object({version: z.literal(1).default(1),@@ -35,11 +34,11 @@ type InboxListEntryState = z.infer<typeof inboxListEntryStateSchemaWithDefaults>;-const DEFAULT_INBOX_LIST_ENTRY_STATE: InboxListEntryState =- inboxListEntryStateSchemaWithDefaults.parse({});-const inboxListEntryStateSchema = inboxListEntryStateSchemaWithDefaults.catch(- DEFAULT_INBOX_LIST_ENTRY_STATE-);+const DEFAULT_INBOX_LIST_ENTRY_STATE = {+ version: 1,+ focusKey: undefined,+ scrollOffset: 0,+} satisfies InboxListEntryState;export type InboxListStateSnapshot = {focusKey: InboxListEntryState['focusKey'];@@ -47,8 +46,8 @@ export type InboxListStateSnapshot = {};export const DEFAULT_INBOX_LIST_STATE: InboxListStateSnapshot = {- focusKey: DEFAULT_INBOX_LIST_ENTRY_STATE.focusKey,- scrollOffset: DEFAULT_INBOX_LIST_ENTRY_STATE.scrollOffset,+ focusKey: undefined,+ scrollOffset: 0,};function selectEntryState(state: InboxViewState): InboxEntryState {@@ -68,7 +67,9 @@ function createInboxEntryStorage(options: {restore: (current, stored) => {if (!options.restore) return undefined;- const restored = inboxEntryStateSchema.parse(stored);+ const result = inboxEntryStateSchemaWithDefaults.safeParse(stored);+ const restored = result.success ? result.data : DEFAULT_INBOX_ENTRY_STATE;+return {...current,tab: restored.tab,@@ -90,7 +91,10 @@ export function createInboxListEntryStorage(handle,key: INBOX_LIST_ENTRY_STATE_KEY,restore: (current, stored) => {- const restored = inboxListEntryStateSchema.parse(stored);+ const result = inboxListEntryStateSchemaWithDefaults.safeParse(stored);+ const restored = result.success+ ? result.data+ : DEFAULT_INBOX_LIST_ENTRY_STATE;return {...current,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.tsindex b4803b18ca..a4e588104c 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@@ -3,7 +3,6 @@ import {buildFlatSoupRows,buildGroupedSoupRows,createSearchState,- createSoupLoadMoreRow,type SoupRow,testFacets,useSearchContext,@@ -264,15 +263,6 @@ export function useInboxDataSource(result = buildFlatSoupRows(entities().items);}- if (hasMore()) {- result.push(- createSoupLoadMoreRow({- scopeId: `inbox:${state.tab}`,- isLoading: isLoadingMore(),- })- );- }-return result;});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.tsxindex 50c683135f..f6d32a0e33 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@@ -67,6 +67,7 @@ export function InboxListEntity(props: InboxListEntityProps) {selected={props.checked}highlighted={props.highlighted}focusable={props.focusable}+ showUnreadIndicator={props.hideCheckbox}onClick={props.onClick}/></MaybeEntityRow>diff --git a/apps/web/src/features/next-soup/soup-view/views/inbox/inbox-card-layouts.tsx b/apps/web/src/features/next-soup/soup-view/views/inbox/inbox-card-layouts.tsxindex 401d8efe59..d270f573b2 100644--- a/apps/web/src/features/next-soup/soup-view/views/inbox/inbox-card-layouts.tsx+++ b/apps/web/src/features/next-soup/soup-view/views/inbox/inbox-card-layouts.tsx@@ -22,6 +22,7 @@ import {type EntityData,isGithubPrEntity,type Notification,+ UnreadIndicator,unreadFilterFn,type WithNotification,} from '@entity';@@ -73,6 +74,8 @@ export interface InboxCardLayoutProps {onClick?: (event: MouseEvent) => void;/** Set false when a parent list owns keyboard focus and activation. */focusable?: boolean;+ /** Render unread state beside the title instead of in a row gutter. */+ showUnreadIndicator?: boolean;}/** Glyph size inside the card's avatar bubble — grows with the circle on@@ -516,6 +519,7 @@ function BaseCard(props: {highlighted?: boolean;onClick?: (event: MouseEvent) => void;focusable?: boolean;+ showUnreadIndicator?: boolean;/** Contents of the avatar bubble (glyph or avatar); the circle is ours. */icon: JSX.Element;/**@@ -542,6 +546,9 @@ function BaseCard(props: {</div><InboxCard.Body class="contents"><InboxCard.Header class="col-start-2 row-start-1 self-center">+ <Show when={props.showUnreadIndicator && props.item.unread}>+ <UnreadIndicator active class="mobile:hidden" />+ </Show><InboxCard.Title class="flex items-center gap-1">{props.titleLeading}{/* A flex row can't ellipsize bare text, so the text run always@@ -889,6 +896,9 @@ export function ChannelThreadCardLayout(props: InboxCardLayoutProps) {<InboxCard.Body class="contents"><div class={cn('col-start-2 row-start-2')}><InboxCard.Header class="self-center">+ <Show when={props.showUnreadIndicator && props.item.unread}>+ <UnreadIndicator active class="mobile:hidden" />+ </Show><InboxCard.Title class="flex items-center gap-1"><span class="truncate">{text().title}</span></InboxCard.Title>diff --git a/apps/web/src/features/tasks-view/components/TasksControls.tsx b/apps/web/src/features/tasks-view/components/TasksControls.tsxindex 9cc9b4c7d1..cbda901764 100644--- a/apps/web/src/features/tasks-view/components/TasksControls.tsx+++ b/apps/web/src/features/tasks-view/components/TasksControls.tsx@@ -1,43 +1,31 @@import {ListFilterDropdown,- type ListFilterGroup,ListGroupDropdown,ListSortDropdown,useViewControlHotkeys,} from '@app/components/view-shell';-import { addUnique, removeValue } from '@app/lib/signals/store-array-updaters';import { PreviewButton } from '@components/app/split-layout/components/PreviewButton';import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';-import { UserIcon } from '@core/component/UserIcon';-import { useUserId } from '@core/context/user';-import { idToDisplayName } from '@core/user/util';-import { PropertyValueIcon } from '@property/component/propertyValue';-import { TagDot } from '@property/tags/TagDot';-import { useTagSets } from '@property/tags/tag-sets-context';-import { useContacts } from '@queries/contacts/contacts';-import { createMemo, Show } from 'solid-js';+import { createSignal, Show } from 'solid-js';import { TASK_GROUP_OPTIONS, TASK_SORT_OPTIONS } from '../constants';-import {- TASK_PRIORITY_OPTIONS,- TASK_STATUS_OPTIONS,-} from '../filters/task-facets';+import { useTaskFilters } from '../filters/use-task-filters';import { useTasksView } from '../tasks-view-context';-type TaskFilterGroupId =- | 'status'- | 'priority'- | 'assignees'- | 'created-by'- | 'tags';-export function TasksControls() {const panel = useSplitPanelOrThrow();- const { state, setFacets, setPrimarySort, setState } = useTasksView();- const contacts = useContacts();- const currentUserId = useUserId();- const tagSets = useTagSets();- let filterControl: HTMLDivElement | undefined;- let sortControl: HTMLDivElement | undefined;+ const { state, setPrimarySort, setState } = useTasksView();+ const filters = useTaskFilters();+ const [openMenu, setOpenMenu] = createSignal<'filters' | 'sort'>();+ let filterTrigger: HTMLButtonElement | undefined;+ let sortTrigger: HTMLButtonElement | undefined;++ const handleMenuOpenChange =+ (menu: 'filters' | 'sort') => (open: boolean) => {+ setOpenMenu((current) => {+ if (open) return menu;+ return current === menu ? undefined : current;+ });+ };useViewControlHotkeys({scopeId: panel.splitHotkeyScope,@@ -45,152 +33,56 @@ export function TasksControls() {filter: {description: 'Filter tasks',run: () => {- const trigger = filterControl?.querySelector('button');- trigger?.click();+ if (!filterTrigger) return false;- return trigger !== null && trigger !== undefined;+ setOpenMenu('filters');+ return true;},},sort: {description: 'Sort tasks',run: () => {- const trigger = sortControl?.querySelector('button');- trigger?.click();+ if (!sortTrigger) return false;- return trigger !== null && trigger !== undefined;+ setOpenMenu('sort');+ return true;},},});const primarySort = () => state.sort[0]?.id ?? 'updated_at';- const activeFilterCount = createMemo(() =>- Object.values(state.facets).reduce(- (count, optionIds) => count + optionIds.length,- 0- )- );-- const peopleOptions = createMemo(() => {- const people = [...contacts()];- const me = currentUserId();- if (me && !people.some((person) => person.id === me)) {- people.unshift({ id: me, email: '', name: idToDisplayName(me) });- }-- return people.map((person) => ({- id: person.id,- label:- person.id === me- ? person.name- ? `${person.name} (me)`- : 'Me'- : person.name || person.id,- icon: () => (- <UserIcon- id={person.id}- size="sm"- class="size-3.5"- suppressClick- showTooltip={false}- />- ),- }));- });-- const filterGroups = createMemo(- (): ListFilterGroup<TaskFilterGroupId, string>[] => [- {- id: 'status',- label: 'Status',- options: TASK_STATUS_OPTIONS.map((option) => ({- ...option,- icon: () => (- <PropertyValueIcon- optionId={option.propertyOptionId}- class="size-3.5"- />- ),- })),- },- {- id: 'priority',- label: 'Priority',- options: TASK_PRIORITY_OPTIONS.map((option) => ({- ...option,- icon: () => (- <PropertyValueIcon- optionId={option.propertyOptionId}- class="size-3.5"- />- ),- })),- },- {- id: 'assignees',- label: 'Assignees',- options: peopleOptions(),- },- {- id: 'created-by',- label: 'Created by',- options: peopleOptions(),- },- {- id: 'tags',- label: 'Tags',- options: tagSets().flatMap((set) =>- set.options.map((option) => ({- id: option.id,- label:- option.value.type === 'string' ? option.value.value : option.id,- icon: () => <TagDot color={option.color ?? undefined} />,- }))- ),- },- ]- );return (<div class="flex min-w-0 shrink-0 items-center justify-end gap-2 @max-[720px]/view-shell:gap-1">- <div ref={(element) => (sortControl = element)}>- <ListSortDropdown- label="Sort tasks"- value={primarySort()}- options={TASK_SORT_OPTIONS}- onChange={setPrimarySort}- />- </div>+ <ListSortDropdown+ label="Sort tasks"+ value={primarySort()}+ options={TASK_SORT_OPTIONS}+ open={openMenu() === 'sort'}+ onChange={setPrimarySort}+ onOpenChange={handleMenuOpenChange('sort')}+ triggerRef={(element) => (sortTrigger = element)}+ /><ListGroupDropdownlabel="Group tasks"value={state.groupBy}options={TASK_GROUP_OPTIONS}onChange={(groupBy) => setState('groupBy', groupBy)}/>- <div- ref={(element) => (filterControl = element)}- class="relative shrink-0"- >+ <div class="relative shrink-0"><ListFilterDropdownlabel="Filter tasks"- groups={filterGroups()}- isSelected={(groupId, optionId) =>- (state.facets[groupId] ?? []).includes(optionId)- }- onSelectionChange={(groupId, optionId, selected) => {- const update = selected- ? addUnique(optionId)- : removeValue(optionId);-- setFacets({- ...state.facets,- [groupId]: update(state.facets[groupId]),- });- }}- onClear={() => setFacets({})}+ groups={filters.groups()}+ open={openMenu() === 'filters'}+ onOpenChange={handleMenuOpenChange('filters')}+ triggerRef={(element) => (filterTrigger = element)}+ isSelected={filters.isSelected}+ onSelectionChange={filters.setSelected}+ onClear={filters.clear}/>- <Show when={activeFilterCount() > 0}>- <span class="absolute -top-0.5 right-0 flex size-4 translate-x-1/2 items-center justify-center rounded-full bg-accent text-xxs font-medium leading-none text-surface">- {activeFilterCount()}+ <Show when={filters.activeCount() > 0}>+ <span class="pointer-events-none absolute -top-0.5 right-0 z-10 flex size-4 translate-x-1/2 items-center justify-center rounded-full bg-accent text-xxs font-medium leading-none text-surface">+ {filters.activeCount()}</span></Show></div>diff --git a/apps/web/src/features/tasks-view/components/TasksFilterDrawer.tsx b/apps/web/src/features/tasks-view/components/TasksFilterDrawer.tsxnew file mode 100644index 0000000000..42ed9f375f--- /dev/null+++ b/apps/web/src/features/tasks-view/components/TasksFilterDrawer.tsx@@ -0,0 +1,226 @@+import { MobileDrawer } from '@components/app/mobile/MobileDrawer';+import { pressPulse } from '@components/app/mobile/pressPulse';+import { ScrollIndicators } from '@core/component/VerticalScrollIndicators';+import { Accordion } from '@kobalte/core/accordion';+import CaretDownIcon from '@phosphor/caret-down.svg';+import CheckIcon from '@phosphor/check.svg';+import XIcon from '@phosphor/x.svg';+import SlidersHorizontalIcon from '@phosphor-icons/core/regular/sliders-horizontal.svg?component-solid';+import { Button, cn } from '@ui';+import { createMemo, createSignal, For, Show } from 'solid-js';+import { TASK_GROUP_OPTIONS, TASK_SORT_OPTIONS } from '../constants';+import { useTaskFilters } from '../filters/use-task-filters';+import { useTasksView } from '../tasks-view-context';++export function TasksFilterDrawer() {+ const { state, setPrimarySort, setState } = useTasksView();+ const filters = useTaskFilters();+ const [scrollRef, setScrollRef] = createSignal<HTMLElement>();+ const primarySort = () => state.sort[0]?.id ?? 'updated_at';++ return (+ <MobileDrawer+ side="bottom"+ preventScroll={false}+ preventScrollbarShift={false}+ breakPoints={[0.85]}+ >+ <MobileDrawer.Trigger+ as={Button}+ aria-label="Open task filters"+ variant="ghost"+ size="sm"+ depth={3}+ class="island pointer-events-auto relative size-10 shrink-0 rounded-full bg-chrome"+ ref={pressPulse}+ >+ <SlidersHorizontalIcon class="size-6" />+ <Show when={filters.activeCount() > 0}>+ <span class="pointer-events-none absolute -top-0.5 right-0 z-10 flex size-4 translate-x-1/2 items-center justify-center rounded-full bg-accent text-xxs font-medium leading-none text-surface">+ {filters.activeCount()}+ </span>+ </Show>+ </MobileDrawer.Trigger>++ <MobileDrawer.Portal>+ <MobileDrawer.Overlay class="fixed inset-0 z-modal-overlay bg-modal-overlay pattern-diagonal-4 pattern-edge-muted" />+ <MobileDrawer.Content aria-label="Task list controls" class="h-[80vh]">+ <MobileDrawer.Handle class="pb-1" />++ <div class="relative min-h-0 flex-1">+ <ScrollIndicators scrollRef={scrollRef} noBorderStart noBorderEnd />+ <div+ ref={setScrollRef}+ class="h-full overflow-y-auto pb-1 scrollbar-hidden"+ >+ <MobileDrawer.Label id="task-sort-label" class="pt-4">+ Sort+ </MobileDrawer.Label>+ <MobileDrawer.Section+ role="radiogroup"+ aria-labelledby="task-sort-label"+ >+ <For each={TASK_SORT_OPTIONS}>+ {(option) => {+ const selected = () => primarySort() === option.id;++ return (+ <button+ type="button"+ role="radio"+ aria-checked={selected()}+ class="flex w-full items-center gap-3 bg-surface px-3 py-2.5 text-left text-sm transition-colors not-last:border-edge-muted not-last:border-b hover:bg-hover"+ onClick={() => setPrimarySort(option.id)}+ >+ <span class="min-w-0 flex-1 truncate">+ {option.label}+ </span>+ <Show when={selected()}>+ <CheckIcon class="size-3.5 shrink-0 text-accent" />+ </Show>+ </button>+ );+ }}+ </For>+ </MobileDrawer.Section>++ <MobileDrawer.Label id="task-group-label" class="pt-4">+ Group+ </MobileDrawer.Label>+ <MobileDrawer.Section+ role="radiogroup"+ aria-labelledby="task-group-label"+ >+ <For each={TASK_GROUP_OPTIONS}>+ {(option) => {+ const selected = () => state.groupBy === option.id;++ return (+ <button+ type="button"+ role="radio"+ aria-checked={selected()}+ class="flex w-full items-center gap-3 bg-surface px-3 py-2.5 text-left text-sm transition-colors not-last:border-edge-muted not-last:border-b hover:bg-hover"+ onClick={() => setState('groupBy', option.id)}+ >+ <span class="min-w-0 flex-1 truncate">+ {option.label}+ </span>+ <Show when={selected()}>+ <CheckIcon class="size-3.5 shrink-0 text-accent" />+ </Show>+ </button>+ );+ }}+ </For>+ </MobileDrawer.Section>++ <MobileDrawer.Label class="pt-4">Filters</MobileDrawer.Label>+ <Accordion+ multiple+ collapsible+ defaultValue={[filters.groups()[0]?.id ?? 'status']}+ >+ <div class="flex flex-col gap-3">+ <For each={filters.groups()}>+ {(group) => {+ const activeCount = createMemo(+ () =>+ group.options.filter((option) =>+ filters.isSelected(group.id, option.id)+ ).length+ );++ return (+ <MobileDrawer.Section+ as={Accordion.Item}+ value={group.id}+ >+ <Accordion.Header>+ <Accordion.Trigger class="group flex w-full items-center justify-between border-edge-muted border-b bg-surface p-3 text-sm text-ink outline-none transition-colors hover:bg-hover">+ <span class="font-medium">{group.label}</span>+ <div class="flex items-center gap-2">+ <Show when={activeCount() > 0}>+ <span class="group-data-expanded:hidden flex size-4 items-center justify-center rounded-full bg-accent text-xxs font-medium leading-none text-surface">+ {activeCount()}+ </span>+ </Show>+ <CaretDownIcon class="size-3.5 text-ink-muted transition-transform duration-200 group-data-expanded:rotate-180" />+ </div>+ </Accordion.Trigger>+ </Accordion.Header>++ <Accordion.Content>+ <For each={group.options}>+ {(option) => {+ const selected = () =>+ filters.isSelected(group.id, option.id);++ return (+ <button+ type="button"+ role="checkbox"+ aria-checked={selected()}+ class="flex w-full items-center gap-3 bg-surface px-3 py-2.5 text-left text-sm transition-colors not-last:border-edge-muted not-last:border-b hover:bg-hover"+ onClick={() =>+ filters.setSelected(+ group.id,+ option.id,+ !selected()+ )+ }+ >+ <span+ class={cn(+ 'flex size-4 shrink-0 items-center justify-center border transition-colors',+ selected()+ ? 'border-accent bg-accent'+ : 'border-edge'+ )}+ >+ <Show when={selected()}>+ <CheckIcon class="size-2.5 text-surface" />+ </Show>+ </span>+ <Show when={option.icon}>+ {(icon) => (+ <span class="flex size-4 shrink-0 items-center justify-center">+ {icon()()}+ </span>+ )}+ </Show>+ <span class="min-w-0 flex-1 truncate">+ {option.label}+ </span>+ </button>+ );+ }}+ </For>+ </Accordion.Content>+ </MobileDrawer.Section>+ );+ }}+ </For>+ </div>+ </Accordion>+ </div>+ </div>++ <Show when={filters.activeCount() > 0}>+ <div class="shrink-0 border-edge-muted border-t p-2">+ <Button+ variant="outline"+ size="sm"+ class="min-h-10 rounded-lg bg-active"+ onClick={filters.clear}+ >+ <XIcon class="size-3" />+ Clear all+ </Button>+ </div>+ </Show>+ </MobileDrawer.Content>+ </MobileDrawer.Portal>+ </MobileDrawer>+ );+}diff --git a/apps/web/src/features/tasks-view/components/TasksHeader.tsx b/apps/web/src/features/tasks-view/components/TasksHeader.tsxindex b4af95c2e1..bb4ed62eec 100644--- a/apps/web/src/features/tasks-view/components/TasksHeader.tsx+++ b/apps/web/src/features/tasks-view/components/TasksHeader.tsx@@ -2,12 +2,15 @@ import { SearchBar, useViewControlHotkeys } from '@app/components/view-shell';import { useSplitLayout } from '@components/app/split-layout/layout';import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';import { SplitPanel } from '@components/app/split-panel';-import MenuIcon from '@phosphor/list.svg';+import { isTouchDevice } from '@core/mobile/isTouchDevice';+import CaretDownIcon from '@phosphor/caret-down.svg';import PlusIcon from '@phosphor/plus.svg';import { Button, Dropdown } from '@ui';-import { createSignal } from 'solid-js';+import { createSignal, Show } from 'solid-js';+import { TASK_TABS } from '../constants';import { useTasksView } from '../tasks-view-context';import { TasksControls } from './TasksControls';+import { TasksMobileTabs } from './TasksMobileTabs';import { TasksNavigation } from './TasksSidebar';export function TasksHeader() {@@ -19,7 +22,7 @@ export function TasksHeader() {useViewControlHotkeys({scopeId: panel.splitHotkeyScope,- enabled: panel.isPanelActive,+ enabled: () => panel.isPanelActive() && !isTouchDevice(),search: {description: 'Search tasks',run: () => {@@ -34,62 +37,77 @@ export function TasksHeader() {layout.popoverSplit({ type: 'component', id: 'task-compose' });};+ const selectedTabLabel = () =>+ TASK_TABS.find((tab) => tab.id === state.tab)?.label;+return (- <div class="flex min-w-0 flex-col">- <SplitPanel.ControlGroup class="hidden px-2 pb-2 @max-[720px]/view-shell:flex">- <SplitPanel.CloseButton />- <SplitPanel.BackButton />- <SplitPanel.ForwardButton />- </SplitPanel.ControlGroup>+ <div class="flex min-w-0 flex-col @max-[720px]/view-shell:gap-3">+ <Show+ when={isTouchDevice()}+ fallback={+ <>+ <div class="hidden items-center @max-[720px]/view-shell:flex">+ <SplitPanel.ControlGroup>+ <SplitPanel.CloseButton />+ <SplitPanel.BackButton />+ <SplitPanel.ForwardButton />+ </SplitPanel.ControlGroup>+ </div>- <div class="mb-4 hidden min-w-0 items-center gap-2 @max-[720px]/view-shell:flex">- <Dropdown- open={navigationOpen()}- onOpenChange={setNavigationOpen}- placement="bottom-start"- >- <Dropdown.Trigger- variant="ghost"- size="sm"- square- class="size-8 shrink-0 rounded-full"- aria-label="Open Tasks navigation"- >- <MenuIcon class="size-4" />- </Dropdown.Trigger>- <Dropdown.Content class="w-72 rounded-2xl p-2">- <div class="rounded-xl bg-menu">- <TasksNavigation onNavigate={() => setNavigationOpen(false)} />+ <div class="hidden h-8 min-w-0 items-center gap-2 @max-[720px]/view-shell:flex">+ <Dropdown+ open={navigationOpen()}+ onOpenChange={setNavigationOpen}+ placement="bottom-start"+ >+ <h1 class="min-w-0">+ <Dropdown.Trigger+ variant="ghost"+ size="sm"+ class="h-auto min-w-0 max-w-full gap-1 rounded-lg px-2 py-1 text-xl font-semibold tracking-[-0.03em] text-ink"+ aria-label={`Select task view: ${selectedTabLabel()}`}+ >+ <span class="truncate">{selectedTabLabel()}</span>+ <CaretDownIcon class="size-3.5 shrink-0 text-ink-muted" />+ </Dropdown.Trigger>+ </h1>+ <Dropdown.Content class="w-72 rounded-2xl p-2">+ <div class="rounded-xl bg-menu">+ <TasksNavigation+ onNavigate={() => setNavigationOpen(false)}+ />+ </div>+ </Dropdown.Content>+ </Dropdown>+ <Button+ type="button"+ variant="cta"+ size="md"+ class="ml-auto"+ onClick={createTask}+ >+ <PlusIcon class="size-4 shrink-0" />+ New+ </Button></div>- </Dropdown.Content>- </Dropdown>- <h1 class="min-w-0 truncate text-xl font-semibold tracking-[-0.03em] text-ink">- Tasks- </h1>- <Button- type="button"- variant="cta"- size="md"- class="ml-auto rounded-lg px-3"- onClick={createTask}- >- <PlusIcon class="size-4 shrink-0" />- New- </Button>- </div>- <div class="flex min-w-0 items-center justify-between gap-3">- <SearchBar- ref={(element) => (searchInput = element)}- label="Search tasks"- value={state.search}- hotkey="cmd+f"- onValueChange={(search) => setState('search', search)}- placeholder="Search tasks"- class="max-w-md flex-1"- />- <TasksControls />- </div>+ <div class="flex min-w-0 items-center justify-between gap-3">+ <SearchBar+ ref={(element) => (searchInput = element)}+ label="Search tasks"+ value={state.search}+ hotkey="cmd+f"+ onValueChange={(search) => setState('search', search)}+ placeholder="Search tasks"+ class="max-w-md flex-1"+ />+ <TasksControls />+ </div>+ </>+ }+ >+ <TasksMobileTabs />+ </Show></div>);}diff --git a/apps/web/src/features/tasks-view/components/TasksMobileTabs.tsx b/apps/web/src/features/tasks-view/components/TasksMobileTabs.tsxnew file mode 100644index 0000000000..9e4a8eda28--- /dev/null+++ b/apps/web/src/features/tasks-view/components/TasksMobileTabs.tsx@@ -0,0 +1,27 @@+import { type PillTabItem, PillTabs } from '@components/app/mobile/PillTabs';+import { TASK_TABS, type TaskTabItem } from '../constants';+import { useTasksView } from '../tasks-view-context';+import type { TaskTab } from '../types';+import { TasksFilterDrawer } from './TasksFilterDrawer';++const toPill = (tab: TaskTabItem): PillTabItem<TaskTab> => ({+ value: tab.id,+ label: tab.label,+});++export function TasksMobileTabs() {+ const { state, setTab } = useTasksView();+ const items = (): PillTabItem<TaskTab>[] => TASK_TABS.map(toPill);++ return (+ <div class="h-10 min-w-0 flex-1">+ <PillTabs+ scrollable+ leading={<TasksFilterDrawer />}+ items={items()}+ value={state.tab}+ onChange={setTab}+ />+ </div>+ );+}diff --git a/apps/web/src/features/tasks-view/components/TasksSidebar.tsx b/apps/web/src/features/tasks-view/components/TasksSidebar.tsxindex 74635010ad..317b23597f 100644--- a/apps/web/src/features/tasks-view/components/TasksSidebar.tsx+++ b/apps/web/src/features/tasks-view/components/TasksSidebar.tsx@@ -132,15 +132,17 @@ export function TasksSidebar() {return (<ViewSidebar.Rootaria-label="Tasks navigation"- class="gap-4 border-r-0 pt-2"+ class="gap-3 border-r-0 pt-2">- <SplitPanel.ControlGroup>- <SplitPanel.CloseButton />- <SplitPanel.BackButton />- <SplitPanel.ForwardButton />- </SplitPanel.ControlGroup>+ <div class="flex items-center">+ <SplitPanel.ControlGroup>+ <SplitPanel.CloseButton />+ <SplitPanel.BackButton />+ <SplitPanel.ForwardButton />+ </SplitPanel.ControlGroup>+ </div>- <ViewSidebar.Header>+ <ViewSidebar.Header class="h-8"><ViewSidebar.Title>Tasks</ViewSidebar.Title><Buttontype="button"@@ -154,7 +156,7 @@ export function TasksSidebar() {</Button></ViewSidebar.Header>- <ViewSidebar.Content class="pt-1">+ <ViewSidebar.Content><TasksNavigation /></ViewSidebar.Content></ViewSidebar.Root>diff --git a/apps/web/src/features/tasks-view/components/task-list/TaskList.tsx b/apps/web/src/features/tasks-view/components/task-list/TaskList.tsxindex 147bbd5206..d1865d5bbc 100644--- a/apps/web/src/features/tasks-view/components/task-list/TaskList.tsx+++ b/apps/web/src/features/tasks-view/components/task-list/TaskList.tsx@@ -15,6 +15,7 @@ import {SoupEntityContextMenu,useSoupListNavigationHotkeys,} from '@app/features/soup';+import { DEBUG_SETTING_KEYS, useDebugSetting } from '@app/lib/debugSettings';import { makePersistedState } from '@app/lib/persistence';import {addUnique,@@ -102,6 +103,9 @@ export function TaskList() {const panel = useSplitPanelOrThrow();const { state, setState } = useTasksView();const userId = useUserId();+ const forceEmptyState = useDebugSetting(+ DEBUG_SETTING_KEYS.FORCE_EMPTY_STATES+ );const isGroupExpanded = (groupId: string) =>!state.collapsedGroupIds.includes(groupId);const setGroupExpanded = (groupId: string, expanded: boolean) =>@@ -420,14 +424,21 @@ export function TaskList() {return (<MaybeSoupEntityActionDrawerManager><Surface- depth={2}+ depth={isTouchDevice() ? 0 : 2}+ hideBorder={isTouchDevice()}ref={setGrid}role="grid"aria-label="Tasks"aria-multiselectable="true"aria-activedescendant={list.focus.key()}tabIndex={0}- class="@container/u-list flex min-h-0 min-w-0 flex-col rounded-2xl p-2 outline-none"+ class={cn(+ '@container/u-list flex min-h-0 min-w-0 flex-col outline-none',+ {+ 'rounded-2xl p-2': !isTouchDevice(),+ 'rounded-none bg-transparent p-0': isTouchDevice(),+ }+ )}><ListLayoutProvider ref={grid}><ResponsiveTaskListHeader />@@ -439,13 +450,13 @@ export function TaskList() {triggerBehavior="spring-back"><Switch>- <Match when={source.isLoading()}>+ <Match when={!forceEmptyState() && source.isLoading()}><div class="grid min-h-0 flex-1 place-items-center text-ink-muted"><SpinnerIcon class="size-5 animate-spin" /></div></Match>- <Match when={source.error()}>+ <Match when={!forceEmptyState() && source.error()}><div class="flex min-h-0 flex-1 flex-col items-center justify-center gap-3 text-sm text-ink-muted"><span>Tasks couldn’t be loaded.</span><Button@@ -459,10 +470,10 @@ export function TaskList() {</div></Match>- <Match when={visibleRows().length === 0}>+ <Match when={forceEmptyState() || visibleRows().length === 0}><div class="flex min-h-0 flex-1 flex-col items-center justify-center gap-3 text-sm text-ink-muted"><span>{emptyMessage()}</span>- <Show when={source.hasMore()}>+ <Show when={!forceEmptyState() && source.hasMore()}><Buttonvariant="outline"size="sm"diff --git a/apps/web/src/features/tasks-view/constants.ts b/apps/web/src/features/tasks-view/constants.tsindex a009785c85..f3e25c8de3 100644--- a/apps/web/src/features/tasks-view/constants.ts+++ b/apps/web/src/features/tasks-view/constants.ts@@ -17,6 +17,8 @@ export const TEAM_TASK_TABS: TaskTabItem[] = [{ id: 'team-tasks', label: 'Team tasks' },];+export const TASK_TABS = [...PERSONAL_TASK_TABS, ...TEAM_TASK_TABS];+export const TASK_DEFAULT_GROUP_BY: Record<TaskTab, TaskGroupBy> = {'my-tasks': 'priority','created-by-me': 'status',diff --git a/apps/web/src/features/tasks-view/filters/use-task-filters.tsx b/apps/web/src/features/tasks-view/filters/use-task-filters.tsxnew file mode 100644index 0000000000..09e046c194--- /dev/null+++ b/apps/web/src/features/tasks-view/filters/use-task-filters.tsx@@ -0,0 +1,135 @@+import type { ListFilterGroup } from '@app/components/view-shell';+import { addUnique, removeValue } from '@app/lib/signals/store-array-updaters';+import { UserIcon } from '@core/component/UserIcon';+import { useUserId } from '@core/context/user';+import { idToDisplayName } from '@core/user/util';+import { PropertyValueIcon } from '@property/component/propertyValue';+import { TagDot } from '@property/tags/TagDot';+import { useTagSets } from '@property/tags/tag-sets-context';+import { useContacts } from '@queries/contacts/contacts';+import { createMemo } from 'solid-js';+import { useTasksView } from '../tasks-view-context';+import { TASK_PRIORITY_OPTIONS, TASK_STATUS_OPTIONS } from './task-facets';++export type TaskFilterGroupId =+ | 'status'+ | 'priority'+ | 'assignees'+ | 'created-by'+ | 'tags';++export function useTaskFilters() {+ const { state, setFacets } = useTasksView();+ const contacts = useContacts();+ const currentUserId = useUserId();+ const tagSets = useTagSets();++ const peopleOptions = createMemo(() => {+ const people = [...contacts()];+ const me = currentUserId();+ if (me && !people.some((person) => person.id === me)) {+ people.unshift({ id: me, email: '', name: idToDisplayName(me) });+ }++ return people.map((person) => ({+ id: person.id,+ label:+ person.id === me+ ? person.name+ ? `${person.name} (me)`+ : 'Me'+ : person.name || person.id,+ icon: () => (+ <UserIcon+ id={person.id}+ size="sm"+ class="size-3.5"+ suppressClick+ showTooltip={false}+ />+ ),+ }));+ });++ const groups = createMemo(+ (): ListFilterGroup<TaskFilterGroupId, string>[] => [+ {+ id: 'status',+ label: 'Status',+ options: TASK_STATUS_OPTIONS.map((option) => ({+ ...option,+ icon: () => (+ <PropertyValueIcon+ optionId={option.propertyOptionId}+ class="size-3.5"+ />+ ),+ })),+ },+ {+ id: 'priority',+ label: 'Priority',+ options: TASK_PRIORITY_OPTIONS.map((option) => ({+ ...option,+ icon: () => (+ <PropertyValueIcon+ optionId={option.propertyOptionId}+ class="size-3.5"+ />+ ),+ })),+ },+ {+ id: 'assignees',+ label: 'Assignees',+ options: peopleOptions(),+ },+ {+ id: 'created-by',+ label: 'Created by',+ options: peopleOptions(),+ },+ {+ id: 'tags',+ label: 'Tags',+ options: tagSets().flatMap((set) =>+ set.options.map((option) => ({+ id: option.id,+ label:+ option.value.type === 'string' ? option.value.value : option.id,+ icon: () => <TagDot color={option.color ?? undefined} />,+ }))+ ),+ },+ ]+ );++ const isSelected = (groupId: TaskFilterGroupId, optionId: string) =>+ (state.facets[groupId] ?? []).includes(optionId);++ const setSelected = (+ groupId: TaskFilterGroupId,+ optionId: string,+ selected: boolean+ ) => {+ const update = selected ? addUnique(optionId) : removeValue(optionId);+ setFacets({+ ...state.facets,+ [groupId]: update(state.facets[groupId]),+ });+ };++ const activeCount = () =>+ Object.values(state.facets).reduce(+ (count, optionIds) => count + optionIds.length,+ 0+ );++ return {+ activeCount,+ clear: () => setFacets({}),+ groups,+ isSelected,+ setSelected,+ };+}diff --git a/apps/web/src/features/tasks-view/persistence.ts b/apps/web/src/features/tasks-view/persistence.tsindex 67a2718ed3..0f0b21f7e5 100644--- a/apps/web/src/features/tasks-view/persistence.ts+++ b/apps/web/src/features/tasks-view/persistence.ts@@ -52,11 +52,15 @@ const tasksEntryStateSchemaWithDefaults = z.object({type TasksEntryState = z.infer<typeof tasksEntryStateSchemaWithDefaults>;-const DEFAULT_TASKS_ENTRY_STATE: TasksEntryState =- tasksEntryStateSchemaWithDefaults.parse({});-const tasksEntryStateSchema = tasksEntryStateSchemaWithDefaults.catch(- DEFAULT_TASKS_ENTRY_STATE-);+const DEFAULT_TASKS_ENTRY_STATE = {+ version: 1,+ tab: 'my-tasks',+ search: '',+ groupBy: 'priority',+ sort: [{ id: 'updated_at' }],+ facets: normalizeFacetSelection(DEFAULT_TASK_FACET_SELECTION),+ collapsedGroupIds: [],+} satisfies TasksEntryState;const tasksPreferencesSchemaWithDefaults = z.object({version: z.literal(1).default(1),@@ -65,11 +69,10 @@ const tasksPreferencesSchemaWithDefaults = z.object({type TasksPreferences = z.infer<typeof tasksPreferencesSchemaWithDefaults>;-const DEFAULT_TASKS_PREFERENCES: TasksPreferences =- tasksPreferencesSchemaWithDefaults.parse({});-const tasksPreferencesSchema = tasksPreferencesSchemaWithDefaults.catch(- DEFAULT_TASKS_PREFERENCES-);+const DEFAULT_TASKS_PREFERENCES = {+ version: 1,+ collapsedSidebarSectionIds: [],+} satisfies TasksPreferences;const tasksListStateSchemaWithDefaults = z.object({version: z.literal(1).default(1),@@ -79,11 +82,11 @@ const tasksListStateSchemaWithDefaults = z.object({type TasksListEntryState = z.infer<typeof tasksListStateSchemaWithDefaults>;-const DEFAULT_TASKS_LIST_ENTRY_STATE: TasksListEntryState =- tasksListStateSchemaWithDefaults.parse({});-const tasksListStateSchema = tasksListStateSchemaWithDefaults.catch(- DEFAULT_TASKS_LIST_ENTRY_STATE-);+const DEFAULT_TASKS_LIST_ENTRY_STATE = {+ version: 1,+ focusKey: undefined,+ scrollOffset: 0,+} satisfies TasksListEntryState;export type TasksListStateSnapshot = {focusKey: TasksListEntryState['focusKey'];@@ -91,8 +94,8 @@ export type TasksListStateSnapshot = {};export const DEFAULT_TASKS_LIST_STATE: TasksListStateSnapshot = {- focusKey: DEFAULT_TASKS_LIST_ENTRY_STATE.focusKey,- scrollOffset: DEFAULT_TASKS_LIST_ENTRY_STATE.scrollOffset,+ focusKey: undefined,+ scrollOffset: 0,};function selectEntryState(state: TasksViewState): TasksEntryState {@@ -117,7 +120,8 @@ function createTasksEntryStorage(options: {restore: (current, stored) => {if (!options.restore) return undefined;- const restored = tasksEntryStateSchema.parse(stored);+ const result = tasksEntryStateSchemaWithDefaults.safeParse(stored);+ const restored = result.success ? result.data : DEFAULT_TASKS_ENTRY_STATE;return {...current,tab: restored.tab,@@ -139,7 +143,10 @@ export function createTasksListEntryStorage(handle,key: TASKS_LIST_ENTRY_STATE_KEY,restore: (current, stored) => {- const restored = tasksListStateSchema.parse(stored);+ const result = tasksListStateSchemaWithDefaults.safeParse(stored);+ const restored = result.success+ ? result.data+ : DEFAULT_TASKS_LIST_ENTRY_STATE;return {...current,@@ -182,13 +189,24 @@ function createTasksPreferencesStorage(options: {if (raw === null) return undefined;try {- const parsed = tasksPreferencesSchema.parse(JSON.parse(raw));+ const result = tasksPreferencesSchemaWithDefaults.safeParse(+ JSON.parse(raw)+ );+ const restored = result.success+ ? result.data+ : DEFAULT_TASKS_PREFERENCES;+return {...current,- collapsedSidebarSectionIds: [...parsed.collapsedSidebarSectionIds],+ collapsedSidebarSectionIds: [...restored.collapsedSidebarSectionIds],};} catch {- return undefined;+ return {+ ...current,+ collapsedSidebarSectionIds: [+ ...DEFAULT_TASKS_PREFERENCES.collapsedSidebarSectionIds,+ ],+ };}},initialize: (current) => {diff --git a/apps/web/src/features/tasks-view/tasks-view.tsx b/apps/web/src/features/tasks-view/tasks-view.tsxindex 1f4480cf87..8cccce7b1c 100644--- a/apps/web/src/features/tasks-view/tasks-view.tsx+++ b/apps/web/src/features/tasks-view/tasks-view.tsx@@ -1,9 +1,10 @@import { ViewShell } from '@app/components/view-shell';import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';import { SplitPanel } from '@components/app/split-panel';+import { isTouchDevice } from '@core/mobile/isTouchDevice';import { ListEntityMetadataQueryProvider } from '@entity';import SpinnerIcon from '@phosphor/spinner.svg';-import { Surface } from '@ui';+import { cn, Surface } from '@ui';import { onMount, Suspense } from 'solid-js';import { TasksHeader } from './components/TasksHeader';import { TasksSidebar } from './components/TasksSidebar';@@ -19,8 +20,12 @@ export type TasksViewProps = {function TasksListFallback() {return (<Surface- depth={2}- class="grid min-h-0 min-w-0 place-items-center rounded-2xl text-ink-muted"+ depth={isTouchDevice() ? 0 : 2}+ hideBorder={isTouchDevice()}+ class={cn('grid min-h-0 min-w-0 place-items-center text-ink-muted', {+ 'rounded-2xl': !isTouchDevice(),+ 'rounded-none bg-transparent': isTouchDevice(),+ })}><SpinnerIcon aria-label="Loading tasks" class="size-5 animate-spin" /></Surface>diff --git a/apps/web/src/index.css b/apps/web/src/index.cssindex e3de960cd7..bc9f437df8 100644--- a/apps/web/src/index.css+++ b/apps/web/src/index.css@@ -693,6 +693,23 @@ html[data-theme-light='false'] {50% { transform: scale(0.6); opacity: 0.5; }}+@keyframes incoming-call-shake {+ 0%, 60%, 100% { transform: rotate(0); }+ 10%, 30%, 50% { transform: rotate(-12deg); }+ 20%, 40% { transform: rotate(12deg); }+}++.incoming-call-shake {+ transform-origin: center;+ animation: incoming-call-shake 1.2s ease-in-out infinite;+}++@media (prefers-reduced-motion: reduce) {+ .incoming-call-shake {+ animation: none;+ }+}+/* Big hammer fix for cursor pointer. */@utility cursor-pointer {cursor: default;diff --git a/apps/web/src/lib/core/component/Resize/Resize.tsx b/apps/web/src/lib/core/component/Resize/Resize.tsxindex 3989fb91d6..538849d4e8 100644--- a/apps/web/src/lib/core/component/Resize/Resize.tsx+++ b/apps/web/src/lib/core/component/Resize/Resize.tsx@@ -6,7 +6,6 @@ import {createMemo,createSignal,Index,- on,onCleanup,type ParentProps,Show,@@ -128,6 +127,42 @@ function Zone(props: ParentProps<ZoneProps>) {return layouts().filter((layout) => !solver.isHidden(layout.id));});+ const sizeChangeEndHandlers = new Map<PanelId, (size: number) => void>();+ let sizesBeforeChange: ReadonlyMap<PanelId, number> | undefined;++ const registerSizeChangeEndHandler: ResizeZoneCtx['registerSizeChangeEndHandler'] =+ (id, handler) => {+ sizeChangeEndHandlers.set(id, handler);+ return () => {+ if (sizeChangeEndHandlers.get(id) === handler) {+ sizeChangeEndHandlers.delete(id);+ }+ };+ };++ const beginResizeChange = () => {+ sizesBeforeChange = new Map(solver.solve().sizes);+ };++ const endResizeChange = () => {+ const before = sizesBeforeChange;+ sizesBeforeChange = undefined;+ if (!before) return;++ const after = solver.solve().sizes;+ for (const [id, handler] of sizeChangeEndHandlers) {+ const previousSize = before.get(id);+ const size = after.get(id);+ if (+ previousSize !== undefined &&+ size !== undefined &&+ previousSize !== size+ ) {+ handler(size);+ }+ }+ };+const offsetOf = (id: PanelId) =>createMemo(() => solver.solve().offsets.get(id) ?? 0);@@ -143,6 +178,7 @@ function Zone(props: ParentProps<ZoneProps>) {size: zoneSize,offsetOf,sizeOf,+ registerSizeChangeEndHandler,canFit: solver.canFitPanel,swap: solver.swap,hide: solver.hide,@@ -180,6 +216,8 @@ function Zone(props: ParentProps<ZoneProps>) {offset={panel().offset + panel().size}index={actualIndex}nudge={solver.moveHandle}+ onChangeStart={beginResizeChange}+ onChangeEnd={endResizeChange}root={root}/></Show>@@ -235,6 +273,8 @@ type PanelProps = {/** The index position for this panel in the layout order */index?: number;persistent?: boolean;+ /** Called with the solved panel size after a drag or keyboard resize. */+ onSizeChangeEnd?: (size: number) => void;};/**@@ -276,83 +316,47 @@ function Panel(props: ParentProps<PanelProps>) {return props.target;};- let registered = false;- createEffect(- on(ctx.size, (size) => {- if (size <= 0 || registered || props.collapsed?.() === false) return;-- registered = true;-- ctx.register(- {- id: props.id,- minSize: props.minSize,- maxSize: props.maxSize ?? Infinity,- redistributionPreferredSize: props.redistributionPreferredSize,- shareGroup: props.shareGroup,- target: getTarget(),- },- props.index- );- })- );+ const config = (): PanelConfig => ({+ id: props.id,+ minSize: props.minSize,+ maxSize: props.maxSize ?? Infinity,+ redistributionPreferredSize: props.redistributionPreferredSize,+ shareGroup: props.shareGroup,+ target: getTarget(),+ });createEffect(() => {- ctx.update(props.id, {- minSize: props.minSize,- maxSize: props.maxSize ?? Infinity,- redistributionPreferredSize: props.redistributionPreferredSize,- shareGroup: props.shareGroup,+ const next = config();+ const collapsed = props.collapsed?.() ?? false;+ const hidden = props.hidden?.() ?? false;++ if (collapsed || (hidden && !props.persistent)) {+ ctx.unregister(next.id);+ return;+ }++ if (ctx.size() <= 0) return;++ ctx.register(next, props.index);+ ctx.update(next.id, {+ minSize: next.minSize,+ maxSize: next.maxSize,+ redistributionPreferredSize: next.redistributionPreferredSize,+ shareGroup: next.shareGroup,});- });- createEffect(() => {- const collapsed = props.collapsed?.();- if (collapsed === undefined) return;- if (collapsed) {- ctx.unregister(props.id);+ if (hidden) {+ ctx.hide(next.id);} else {- ctx.register(- {- id: props.id,- minSize: props.minSize,- maxSize: props.maxSize ?? Infinity,- redistributionPreferredSize: props.redistributionPreferredSize,- shareGroup: props.shareGroup,- target: getTarget(),- },- props.index- );+ ctx.show(next.id);}});createEffect(() => {- const hidden = props.hidden?.();- if (hidden === undefined) return;-- if (props.persistent) {- if (hidden) {- ctx.hide(props.id);- } else {- ctx.show(props.id);- }- } else {- if (hidden) {- ctx.unregister(props.id);- } else {- ctx.register(- {- id: props.id,- minSize: props.minSize,- maxSize: props.maxSize ?? Infinity,- redistributionPreferredSize: props.redistributionPreferredSize,- shareGroup: props.shareGroup,- target: getTarget(),- },- props.index- );- }- }+ const handler = props.onSizeChangeEnd;+ if (!handler) return;++ onCleanup(ctx.registerSizeChangeEndHandler(props.id, handler));});onCleanup(() => ctx.unregister(props.id));@@ -407,6 +411,8 @@ type GutterProps = {offset: number;index: number;nudge: (index: number, amt: number) => void;+ onChangeStart: () => void;+ onChangeEnd: () => void;root: () => HTMLDivElement | undefined;};@@ -455,6 +461,7 @@ function Gutter(props: GutterProps) {function onPointerDown(ev: PointerEvent) {if (ev.button !== 0) return;+ props.onChangeStart();(ev.currentTarget as HTMLElement).setPointerCapture?.(ev.pointerId);window.addEventListener('pointermove', onPointerMove);window.addEventListener('pointerup', onPointerUp, { once: true });@@ -480,6 +487,7 @@ function Gutter(props: GutterProps) {window.removeEventListener('pointercancel', onPointerUp);lastPointerPosition = undefined;setPtrDown(false);+ props.onChangeEnd();}function onKeyDown(ev: KeyboardEvent) {@@ -494,6 +502,7 @@ function Gutter(props: GutterProps) {ev.stopImmediatePropagation();const step = ev.shiftKey ? 100 : 20;+ props.onChangeStart();if (ctx?.direction() === 'horizontal') {const sign = ev.key === 'ArrowLeft' ? -1 : 1;props.nudge(props.index, sign * step);@@ -501,6 +510,7 @@ function Gutter(props: GutterProps) {const sign = ev.key === 'ArrowUp' ? -1 : 1;props.nudge(props.index, sign * step);}+ queueMicrotask(props.onChangeEnd);}return (diff --git a/apps/web/src/lib/core/component/Resize/types.ts b/apps/web/src/lib/core/component/Resize/types.tsindex 82f897d54e..203c438582 100644--- a/apps/web/src/lib/core/component/Resize/types.ts+++ b/apps/web/src/lib/core/component/Resize/types.ts@@ -56,6 +56,10 @@ export type ResizeZoneCtx = {size: () => number;sizeOf: (id: PanelId) => () => number;offsetOf: (id: PanelId) => () => number;+ registerSizeChangeEndHandler: (+ id: PanelId,+ handler: (size: number) => void+ ) => () => void;canFit: (panel: Partial<PanelConfig>) => boolean;/** Swap two registered panels without changing their sizing intent. */swap: (firstId: PanelId, secondId: PanelId) => void;diff --git a/docs/AGENT_GUIDE/tasks.md b/docs/AGENT_GUIDE/tasks.mdindex 93b4da9a8a..87072e855a 100644--- a/docs/AGENT_GUIDE/tasks.md+++ b/docs/AGENT_GUIDE/tasks.md@@ -2,11 +2,11 @@## Surface-`Go to Tasks` → `/app/component/tasks`. Tabs `My tasks` / `All`. Table columns: Task, Status,-Priority, Assignees, Created By, Updated; grouped by priority by default (`Group` menu to-change). Toolbar: `Task` (create), search (`Ctrl+F`), `Sort`, `Group`, `Filter`, `Preview`,-and an active filter row (`Status: In Progress +2`, `Add filters`, `Clear all` — note the-default filter hides Done tasks).+`Go to Tasks` → `/app/component/tasks`. Tabs: `My tasks`, `Created by me`, and `Team tasks`.+The desktop toolbar contains search (`Ctrl+F`), `Sort`, `Group`, `Filter`, and `Preview`;+task creation is available from the `New` button in the Tasks sidebar. On mobile, the tabs+are pills and the leading sliders button opens one drawer containing Sort, Group, and+Filters. Mobile intentionally omits the search and create controls.New accounts are seeded with three sample tasks (`Intro to tasks`, `Advanced task features`,`How we use tasks at Macro`).