Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(channels): list team channels in their own sidebar section (#8041)
Eric Hayes275f69c0b716
diff --git a/apps/web/src/features/channels-view/channels-view-context.tsx b/apps/web/src/features/channels-view/channels-view-context.tsxindex 9640b9a591..f18cbf4d18 100644--- a/apps/web/src/features/channels-view/channels-view-context.tsx+++ b/apps/web/src/features/channels-view/channels-view-context.tsx@@ -74,12 +74,15 @@ function createInitialState(tab: initial.tab ?? 'browse',expandedGroups: {favorites: initial.expandedGroups?.favorites ?? true,+ team_channels: initial.expandedGroups?.team_channels ?? true,channels: initial.expandedGroups?.channels ?? true,direct_messages: initial.expandedGroups?.direct_messages ?? true,},collapsedLabels: initial.collapsedLabels ?? [],threadsChannelId: initial.threadsChannelId,sortBy: {+ team_channels:+ initial.sortBy?.team_channels ?? CHANNELS_DEFAULT_SORT_BY.team_channels,channels: initial.sortBy?.channels ?? CHANNELS_DEFAULT_SORT_BY.channels,direct_messages:initial.sortBy?.direct_messages ??diff --git a/apps/web/src/features/channels-view/channels-view.test.tsx b/apps/web/src/features/channels-view/channels-view.test.tsxindex 22b742b4b6..b12efb4cf5 100644--- a/apps/web/src/features/channels-view/channels-view.test.tsx+++ b/apps/web/src/features/channels-view/channels-view.test.tsx@@ -210,6 +210,7 @@ vi.mock('./queries', () => ({useChannelsSources: (enabled: (scope: string) => boolean) => {mocks.sourceEnabled = enabled;return {+ team_channels: { items: () => mocks.rows() },channels: { items: () => mocks.rows() },direct_messages: { items: () => mocks.rows() },recents: { items: () => mocks.rows() },diff --git a/apps/web/src/features/channels-view/channels-view.tsx b/apps/web/src/features/channels-view/channels-view.tsxindex 66b07766bb..313dd5a740 100644--- a/apps/web/src/features/channels-view/channels-view.tsx+++ b/apps/web/src/features/channels-view/channels-view.tsx@@ -122,6 +122,7 @@ function DesktopChannelThreads(props: { sources: ChannelsSources }) {new Map(deduplicateChannels([props.sources.threads.items(),+ props.sources.team_channels.items(),props.sources.channels.items(),props.sources.direct_messages.items(),props.sources.recents.items(),@@ -288,6 +289,7 @@ function ChannelDetailRouteContent() {channelId(),sources? deduplicateChannels([+ sources.team_channels.items(),sources.channels.items(),sources.direct_messages.items(),sources.recents.items(),diff --git a/apps/web/src/features/channels-view/components/rail/ChannelsRail.test.tsx b/apps/web/src/features/channels-view/components/rail/ChannelsRail.test.tsxindex 5eb8fc3296..72c1815c72 100644--- a/apps/web/src/features/channels-view/components/rail/ChannelsRail.test.tsx+++ b/apps/web/src/features/channels-view/components/rail/ChannelsRail.test.tsx@@ -234,6 +234,7 @@ const source = {refresh: async () => {},};const sources: ChannelsSources = {+ team_channels: { ...source, items: () => [] },channels: source,direct_messages: source,recents: source,diff --git a/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx b/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsxindex b7dc2d4b50..6d9ee83d7d 100644--- a/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx+++ b/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx@@ -108,11 +108,16 @@ import { useChannelRailActivity } from './hooks/useChannelRailActivity';const CHANNEL_RAIL_SECTIONS: ChannelsRailSection[] = ['favorites',+ 'team_channels','channels','direct_messages',];const LABEL_KEY_PREFIX = 'label:';-const BROWSE_QUERY_SCOPES = ['channels', 'direct_messages'] as const;+const BROWSE_QUERY_SCOPES = [+ 'team_channels',+ 'channels',+ 'direct_messages',+] as const;const CHANNEL_TAB_IDS: ChannelsTab[] = ['browse', 'recents'];const CHANNEL_TAB_IDS_WITH_THREADS: ChannelsTab[] = [...CHANNEL_TAB_IDS,@@ -316,6 +321,7 @@ export function ChannelsRail(props: ChannelsRailProps) {const channels = createMemo(() =>deduplicateChannels([+ props.sources.team_channels.items(),props.sources.channels.items(),props.sources.direct_messages.items(),props.sources.recents.items(),@@ -362,8 +368,8 @@ export function ChannelsRail(props: ChannelsRailProps) {.map((favorite) => favorite.entityId));- // A labelled or favorited channel has a row before the paginated Channels- // source reaches it, so fetch the ones the sources have not loaded: a label+ // A labelled or favorited channel has a row before the paginated Team+ // channels source reaches it, so fetch the ones the sources have not loaded: a label// needs them to list its channels, a favorite row to act on its channel.const referencedChannelIds = createMemo(() => [...new Set([@@ -413,7 +419,7 @@ export function ChannelsRail(props: ChannelsRailProps) {buildChannelSectionRows({labels: labels(),channels: deduplicateChannels([- props.sources.channels.items(),+ props.sources.team_channels.items(),labelledChannels(),]),channelsById: channelsById(),@@ -446,6 +452,7 @@ export function ChannelsRail(props: ChannelsRailProps) {state.expandedGroups,{favorites: favorites(),+ team_channels: props.sources.team_channels.items(),channels: props.sources.channels.items(),direct_messages: props.sources.direct_messages.items(),recents: props.sources.recents.items(),@@ -537,7 +544,7 @@ export function ChannelsRail(props: ChannelsRailProps) {if (row.kind === 'conversation' || row.kind === 'label') {const virtualizer =- virtualizers()[row.kind === 'label' ? 'channels' : row.scope];+ virtualizers()[row.kind === 'label' ? 'team_channels' : row.scope];if (virtualizer) {virtualizer.scrollToIndex(row.localIndex, options);return;@@ -569,10 +576,10 @@ export function ChannelsRail(props: ChannelsRailProps) {};const scrollScopeToSelectedOrStart = (scope: ChannelsQueryScope) => {- // The Channels section renders label headings between channels, so its- // indexes come from the rendered rows rather than the source.+ // The Team channels section renders label headings between channels, so+ // its indexes come from the rendered rows rather than the source.const rendered =- scope === 'channels'+ scope === 'team_channels'? channelSectionRows().map((row) =>row.kind === 'conversation' ? row.channel.id : undefined)@@ -723,7 +730,7 @@ export function ChannelsRail(props: ChannelsRailProps) {const source = props.sources[row.scope];const renderedCount =- row.scope === 'channels'+ row.scope === 'team_channels'? channelSectionRows().length: source.items().length;if (row.localIndex < renderedCount - 1) return true;@@ -944,7 +951,7 @@ export function ChannelsRail(props: ChannelsRailProps) {name,channelIds,});- setGroupOpen('channels', true);+ setGroupOpen('team_channels', true);setLabelOpen(created.id, true);},},@@ -975,7 +982,7 @@ export function ChannelsRail(props: ChannelsRailProps) {rule,channelIds: [],});- setGroupOpen('channels', true);+ setGroupOpen('team_channels', true);setLabelOpen(created.id, true);toast.success(`Created “${name}”`);},@@ -1032,8 +1039,8 @@ export function ChannelsRail(props: ChannelsRailProps) {: label.channelCount === 0? 'It has no channels in it.': label.channelCount === 1- ? 'Its 1 channel goes back to the main Channels list.'- : `Its ${label.channelCount} channels go back to the main Channels list.`;+ ? 'Its 1 channel goes back to the Team channels list.'+ : `Its ${label.channelCount} channels go back to the Team channels list.`;const confirmed = await confirmDialog({title: `Delete “${label.name}”?`,diff --git a/apps/web/src/features/channels-view/components/rail/ChannelsRailContext.ts b/apps/web/src/features/channels-view/components/rail/ChannelsRailContext.tsindex 40eb7d8f92..c54ab8bae4 100644--- a/apps/web/src/features/channels-view/components/rail/ChannelsRailContext.ts+++ b/apps/web/src/features/channels-view/components/rail/ChannelsRailContext.ts@@ -40,11 +40,11 @@ export type ChannelRailRow =favorite: Favorite;}| {- /** A team channel label heading inside the Channels section. */+ /** A team channel label heading inside the Team channels section. */kind: 'label';id: `label:${string}`;- group: 'channels';- /** Index in the Channels section's rendered rows (labels and channels). */+ group: 'team_channels';+ /** Index in the Team channels section's rendered rows (labels and channels). */localIndex: number;label: ChannelLabel;}@@ -54,7 +54,7 @@ export type ChannelRailRow =group?: ChannelsGroup;scope: ChannelsSourceScope;/**- * Index in the scope's rendered list. For `channels` that list mixes+ * Index in the scope's rendered list. For `team_channels` that list mixes* label headings and channels, so it is not an index into the source.*/localIndex: number;@@ -64,7 +64,7 @@ export type ChannelRailRow =};/**- * One rendered row of the Channels section: a label heading or a channel,+ * One rendered row of the Team channels section: a label heading or a channel,* nested (`labelId` set) or in the plain list below the labels.*/export type ChannelSectionRow =diff --git a/apps/web/src/features/channels-view/components/rail/ChannelsRailSection.tsx b/apps/web/src/features/channels-view/components/rail/ChannelsRailSection.tsxindex fb04ab509d..62a4a04807 100644--- a/apps/web/src/features/channels-view/components/rail/ChannelsRailSection.tsx+++ b/apps/web/src/features/channels-view/components/rail/ChannelsRailSection.tsx@@ -24,6 +24,8 @@ import {import { useOffscreenActivity } from './hooks/useOffscreenActivity';const LOADING_SKELETON_ROWS = [0, 1, 2];+/** Height a collapsed section keeps: its header row, in px. */+export const COLLAPSED_SECTION_HEIGHT = 32;const SectionContainerContext = createContext<() => HTMLElement | undefined>();function SectionScrollArea(props: {@@ -99,23 +101,26 @@ function SectionScrollArea(props: {/*** How an open section claims height in its flex column.*- * - `half`: natural height, capped at half the column after reserving the- * section gap. Keep two `half` sections in a column of their own so neither- * shrinks when the other expands.- * - `fill`: grows into whatever the column has left.+ * - `share`: natural height, shrinkable, capped by `maxHeight` — the even+ * split of the column its caller computes from how many siblings are open.+ * Without a cap one long list squeezes its siblings down to nothing.+ * - `fill`: grows into whatever the column has left. Give it to the+ * bottom-most open section only, so no slack is left under the list.* - `content`: natural height, never shrunk below it, capped at a third of* the column so a long list still leaves room for its siblings.*/-type CollapsibleSectionSizing = 'half' | 'fill' | 'content';+type CollapsibleSectionSizing = 'share' | 'fill' | 'content';function CollapsibleSectionRoot(props: {open: boolean;sizing?: CollapsibleSectionSizing;+ /** CSS length capping a `share` section, e.g. `calc(100% / 3)`. */+ maxHeight?: string;class?: string;children: JSX.Element;}) {let sectionRef: HTMLElement | undefined;- const sizing = () => props.sizing ?? 'half';+ const sizing = () => props.sizing ?? 'share';return (<SectionContainerContext.Provider value={() => sectionRef}>@@ -125,12 +130,15 @@ function CollapsibleSectionRoot(props: {'group/sidebar-section flex min-h-0 flex-col gap-(--sidebar-section-content-gap)',!props.open && 'shrink-0',props.open && sizing() === 'fill' && 'flex-1',- props.open &&- sizing() === 'half' &&- 'shrink max-h-[calc((100%-var(--sidebar-section-gap))/2)]',+ props.open && sizing() === 'share' && 'shrink',props.open && sizing() === 'content' && 'shrink-0 max-h-1/3',props.class)}+ style={+ props.open && sizing() === 'share' && props.maxHeight+ ? { 'max-height': props.maxHeight }+ : undefined+ }>{props.children}</section>@@ -176,7 +184,7 @@ function CollapsibleSectionContent(props: {<CollapseTransitionopen={props.open}container={container}- collapsedSize={32}+ collapsedSize={COLLAPSED_SECTION_HEIGHT}><SectionScrollAreacontentRef={props.contentRef}diff --git a/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx b/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsxindex 541f7b2199..727a9c56d0 100644--- a/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx+++ b/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx@@ -78,6 +78,7 @@ import {useChannelsRail,} from './ChannelsRailContext';import {+ COLLAPSED_SECTION_HEIGHT,CollapsibleSection,CreateRailAction,RailListError,@@ -85,6 +86,7 @@ import {RailListLoadingMore,} from './ChannelsRailSection';import {+ CHANNEL_LIST_GROUPS,useChannelRailItemState,useChannelRailScopeState,useChannelRailSectionState,@@ -122,6 +124,13 @@ type GroupConfig = {};const GROUPS: GroupConfig[] = [+ {+ group: 'team_channels',+ label: 'Team channels',+ emptyLabel: 'No team channels',+ createLabel: 'Create channel',+ onCreate: openNewChannelModal,+ },{group: 'channels',label: 'Channels',@@ -249,7 +258,7 @@ function ChannelOption(props: {rowId?: ChannelRailRow['id'];/** Nest under a label heading, with the branch rail. */labelId?: string;- /** Make a team-channel row draggable between labels (Channels section only). */+ /** Make a team-channel row draggable between labels (Team channels section only). */draggable?: boolean;}) {const rail = useChannelsRail();@@ -569,7 +578,7 @@ const channelRowOf = (row: ChannelSectionRow) =>row.kind === 'conversation' ? row : undefined;/**- * The Channels section body: an optional "new label" draft, then one+ * The Team channels section body: an optional "new label" draft, then one* virtualized list of label headings and channels. Dropping a dragged channel* on the list itself, outside any row, takes it out of its label.*/@@ -682,7 +691,11 @@ function ChannelHeadingDropTarget(props: { element: HTMLElement }) {return null;}-function ExpandedGroupSection(props: { config: GroupConfig }) {+function ExpandedGroupSection(props: {+ config: GroupConfig;+ /** The share of the column this section may claim while open. */+ maxHeight: string;+}) {// A conditional expression as `ref` is dropped by the Solid compiler, so// the target is chosen inside the callback.const createTarget = tourTarget(CHANNELS_TOUR.create);@@ -701,14 +714,15 @@ function ExpandedGroupSection(props: { config: GroupConfig }) {return (<CollapsibleSection.Rootopen={section().open}- sizing={section().fillAvailable ? 'fill' : 'half'}+ sizing={section().fillAvailable ? 'fill' : 'share'}+ maxHeight={props.maxHeight}><CollapsibleSection.Headerfocused={section().focused}focusWithin={section().containsFocus}class={cn(rail.channelTagsEnabled() &&- props.config.group === 'channels' &&+ props.config.group === 'team_channels' &&rail.activeDropTarget()?.kind === 'unlabelled' &&'bg-selected ring-1 ring-inset ring-accent')}@@ -717,7 +731,7 @@ function ExpandedGroupSection(props: { config: GroupConfig }) {<Showwhen={rail.channelTagsEnabled() &&- props.config.group === 'channels' &&+ props.config.group === 'team_channels' &&headerElement()}keyed@@ -762,7 +776,7 @@ function ExpandedGroupSection(props: { config: GroupConfig }) {label={props.config.label}/><Show- when={props.config.group === 'channels'}+ when={props.config.group === 'team_channels'}fallback={<CreateRailActionlabel={props.config.createLabel}@@ -870,13 +884,20 @@ function ExpandedBrowse() {const hasItems = () =>rail.labels().length > 0 ||rail.favorites().length > 0 ||- rail.sources.channels.items().length > 0 ||- rail.sources.direct_messages.items().length > 0;+ CHANNEL_LIST_GROUPS.some((group) => rail.sources[group].items().length > 0);const sourcesSettled = () =>- !rail.sources.channels.isLoading() &&- !rail.sources.direct_messages.isLoading() &&- !rail.sources.channels.error() &&- !rail.sources.direct_messages.error();+ CHANNEL_LIST_GROUPS.every(+ (group) =>+ !rail.sources[group].isLoading() && !rail.sources[group].error()+ );+ // Open sections share the column evenly; the collapsed headers and the gaps+ // come off the top first.+ const sectionMaxHeight = () => {+ const total = GROUPS.length;+ const open = GROUPS.filter(({ group }) => rail.isGroupOpen(group)).length;+ if (open === 0) return '100%';+ return `calc((100% - ${total - open} * ${COLLAPSED_SECTION_HEIGHT}px - ${total - 1} * var(--sidebar-section-gap)) / ${open})`;+ };return (<Switch>@@ -887,11 +908,16 @@ function ExpandedBrowse() {<ViewSidebar.Content class="h-full overflow-hidden"><ChannelFavoritesSection />{/* The groups split the height left after favorites between them.- Their half-height caps resolve against this column, not the- whole sidebar, so favorites is never squeezed out. */}+ Their caps resolve against this column, not the whole sidebar,+ so favorites is never squeezed out. */}<div class="flex min-h-0 flex-1 flex-col gap-(--sidebar-section-gap)"><For each={GROUPS}>- {(config) => <ExpandedGroupSection config={config} />}+ {(config) => (+ <ExpandedGroupSection+ config={config}+ maxHeight={sectionMaxHeight()}+ />+ )}</For></div></ViewSidebar.Content>diff --git a/apps/web/src/features/channels-view/components/rail/build-channel-rail-rows.test.ts b/apps/web/src/features/channels-view/components/rail/build-channel-rail-rows.test.tsindex 1d9885f81f..e2440dc4a0 100644--- a/apps/web/src/features/channels-view/components/rail/build-channel-rail-rows.test.ts+++ b/apps/web/src/features/channels-view/components/rail/build-channel-rail-rows.test.ts@@ -172,6 +172,7 @@ describe('buildChannelSectionRows', () => {describe('buildChannelRailRows', () => {const expanded = {favorites: true,+ team_channels: true,channels: true,direct_messages: true,};@@ -182,7 +183,8 @@ describe('buildChannelRailRows', () => {expanded,{favorites: [],- channels: [acme, zeta],+ team_channels: [acme, zeta],+ channels: [],direct_messages: [],recents: [],threads: [],@@ -196,9 +198,78 @@ describe('buildChannelRailRows', () => {);expect(rows.map((row) => row.id)).toEqual([- 'section:channels',+ 'section:team_channels','channel:acme','channel:zeta',+ 'section:channels',+ 'section:direct_messages',+ ]);+ });++ it('orders Team channels, Channels, then DMs, with labels only under Team channels', () => {+ const privateChannel = channel('private', 'private', 'private');+ const dm = channel('dm', 'Bob', 'direct_message');+ const rows = buildChannelRailRows(+ 'browse',+ expanded,+ {+ favorites: [],+ team_channels: [deals],+ channels: [privateChannel],+ direct_messages: [dm],+ recents: [],+ threads: [],+ },+ buildChannelSectionRows({+ labels: [label('l1', 'Enterprise', ['acme'])],+ channels: [deals],+ channelsById: byId,+ isLabelOpen: () => true,+ })+ );++ expect(rows.map((row) => row.id)).toEqual([+ 'section:team_channels',+ 'label:l1',+ 'channel:acme:label:l1',+ 'channel:deals',+ 'section:channels',+ 'channel:private',+ 'section:direct_messages',+ 'channel:dm',+ ]);+ expect(rows[5]).toMatchObject({+ group: 'channels',+ scope: 'channels',+ localIndex: 0,+ });+ });++ it('collapses each section on its own', () => {+ const privateChannel = channel('private', 'private', 'private');+ const rows = buildChannelRailRows(+ 'browse',+ { ...expanded, team_channels: false },+ {+ favorites: [],+ team_channels: [deals],+ channels: [privateChannel],+ direct_messages: [],+ recents: [],+ threads: [],+ },+ buildChannelSectionRows({+ labels: [],+ channels: [deals],+ channelsById: byId,+ isLabelOpen: () => true,+ })+ );++ expect(rows.map((row) => row.id)).toEqual([+ 'section:team_channels',+ 'section:channels',+ 'channel:private','section:direct_messages',]);});@@ -215,7 +286,8 @@ describe('buildChannelRailRows', () => {expanded,{favorites: [],- channels: [deals],+ team_channels: [deals],+ channels: [],direct_messages: [],recents: [],threads: [],@@ -230,7 +302,7 @@ describe('buildChannelRailRows', () => {id: 'channel:acme:label:l1',localIndex: 1,labelId: 'l1',- scope: 'channels',+ scope: 'team_channels',}),expect.objectContaining({kind: 'conversation',@@ -247,7 +319,8 @@ describe('buildChannelRailRows', () => {expanded,{favorites: [],- channels: [acme],+ team_channels: [acme],+ channels: [],direct_messages: [],recents: [zeta, acme],threads: [],@@ -264,7 +337,8 @@ describe('buildChannelRailRows', () => {expanded,{favorites: [],- channels: [acme],+ team_channels: [acme],+ channels: [],direct_messages: [],recents: [],threads: [dm, acme],@@ -310,10 +384,16 @@ it('renders a channel in every matching smart tag with unique navigation IDs, ex).toEqual(['deals']);const rows = buildChannelRailRows('browse',- { favorites: true, channels: true, direct_messages: true },+ {+ favorites: true,+ team_channels: true,+ channels: true,+ direct_messages: true,+ },{favorites: [],- channels: [acme, zeta, deals],+ team_channels: [acme, zeta, deals],+ channels: [],direct_messages: [],recents: [],threads: [],diff --git a/apps/web/src/features/channels-view/components/rail/build-channel-rail-rows.ts b/apps/web/src/features/channels-view/components/rail/build-channel-rail-rows.tsindex 8c136992f9..cbc0549570 100644--- a/apps/web/src/features/channels-view/components/rail/build-channel-rail-rows.ts+++ b/apps/web/src/features/channels-view/components/rail/build-channel-rail-rows.ts@@ -28,7 +28,7 @@ const compareChannelName = (left: ChannelEntity, right: ChannelEntity) =>left.id.localeCompare(right.id);/**- * Lay out the Channels section: each label in saved order with the+ * Lay out the Team channels section: each label in saved order with the* channels the user can see in it (A→Z, the same for everyone), then the* channels in no label in the section's own sort. Empty labels stay visible as drop targets; a collapsed label hides its channels.*@@ -128,10 +128,10 @@ export function buildChannelRailRows(rows.push({kind: 'section',- id: 'section:channels',- group: 'channels',+ id: 'section:team_channels',+ group: 'team_channels',});- if (expandedGroups.channels) {+ if (expandedGroups.team_channels) {rows.push(...channelSectionRows.map((row, localIndex): ChannelRailRow =>@@ -139,15 +139,15 @@ export function buildChannelRailRows(? {kind: 'label',id: rowKeyForLabel(row.label.id),- group: 'channels',+ group: 'team_channels',localIndex,label: row.label,}: {kind: 'conversation',id: rowKeyForChannel(row.channel.id, row.labelId),- group: 'channels',- scope: 'channels',+ group: 'team_channels',+ scope: 'team_channels',localIndex,channel: row.channel,labelId: row.labelId,@@ -156,19 +156,16 @@ export function buildChannelRailRows();}- rows.push({- kind: 'section',- id: 'section:direct_messages',- group: 'direct_messages',- });- if (expandedGroups.direct_messages) {+ for (const group of ['channels', 'direct_messages'] as const) {+ rows.push({ kind: 'section', id: `section:${group}`, group });+ if (!expandedGroups[group]) continue;rows.push(- ...items.direct_messages.map(+ ...items[group].map((channel, localIndex): ChannelRailRow => ({kind: 'conversation',- id: `channel:${channel.id}`,- group: 'direct_messages',- scope: 'direct_messages',+ id: rowKeyForChannel(channel.id),+ group,+ scope: group,localIndex,channel,})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.tsindex 543b9c5a35..16c3315abd 100644--- a/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailActivity.ts+++ b/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailActivity.ts@@ -9,7 +9,11 @@ import type { ChannelsGroup } from '../../../types';import { channelGroup } from '../../../utils';import type { useChannelCalls } from './useChannelCalls';-const CHANNEL_GROUPS: ChannelsGroup[] = ['channels', 'direct_messages'];+const CHANNEL_GROUPS: ChannelsGroup[] = [+ 'team_channels',+ 'channels',+ 'direct_messages',+];type ChannelActivityTarget = {channelId: string;@@ -44,6 +48,7 @@ export function useChannelRailActivity(const unreadChannelIds = new Set<string>();const unreadNotificationIds = new Set<string>();const unreadCounts: Record<ChannelsGroup, number> = {+ team_channels: 0,channels: 0,direct_messages: 0,};diff --git a/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailState.ts b/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailState.tsindex 6737bb24c7..412fac1cbc 100644--- a/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailState.ts+++ b/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailState.ts@@ -99,15 +99,15 @@ export function useChannelRailScopeState(const currentScope = scope();const source = rail.sources[currentScope];const items = source.items();- // The Channels section renders label headings between its channels, so- // its virtualizer indexes come from those rows, not the source.+ // The Team channels section renders label headings between its channels,+ // so its virtualizer indexes come from those rows, not the source.const rows =- currentScope === 'channels' ? rail.channelSectionRows() : undefined;+ currentScope === 'team_channels' ? rail.channelSectionRows() : undefined;const focusedRow = rail.list.focus.item();const focusedIndex =(focusedRow?.kind === 'conversation' &&focusedRow.scope === currentScope) ||- (focusedRow?.kind === 'label' && currentScope === 'channels')+ (focusedRow?.kind === 'label' && currentScope === 'team_channels')? focusedRow.localIndex: -1;const targetChannelId =@@ -179,19 +179,28 @@ export function useChannelRailVirtualizer(return { registerVirtualizer, loadMoreNearEnd };}+/** The All tab's list sections, top to bottom. */+export const CHANNEL_LIST_GROUPS: readonly ChannelsGroup[] = [+ 'team_channels',+ 'channels',+ 'direct_messages',+];+export function useChannelRailSectionState(group: Accessor<ChannelsGroup>) {const rail = useChannelsRail();const scope = useChannelRailScopeState(group);const state = createMemo(() => {const section = group();+ const lastOpen = CHANNEL_LIST_GROUPS.findLast((candidate) =>+ rail.isGroupOpen(candidate)+ );const rowId = rowKeyForSection(section);const targetChannelId = rail.channelActivity.targetChannelId(section);return {...scope(),open: rail.isGroupOpen(section),- fillAvailable:- section === 'direct_messages' && !rail.isGroupOpen('channels'),+ fillAvailable: lastOpen === section,focused: rail.list.focus.key() === rowId,containsFocus: rail.list.focus.item()?.group === section,domId: domIdForRow(rail.railId, rowId),diff --git a/apps/web/src/features/channels-view/constants.ts b/apps/web/src/features/channels-view/constants.tsindex 34a3926c5e..affcc46046 100644--- a/apps/web/src/features/channels-view/constants.ts+++ b/apps/web/src/features/channels-view/constants.ts@@ -6,6 +6,7 @@ export const CHANNELS_MIN_RAIL_WIDTH = DEFAULT_ASIDE_LAYOUT.min;export const CHANNELS_MAX_RAIL_WIDTH = DEFAULT_ASIDE_LAYOUT.max;export const CHANNELS_DEFAULT_SORT_BY = {+ team_channels: 'updated_at',channels: 'updated_at',direct_messages: 'updated_at',threads: 'updated_at',diff --git a/apps/web/src/features/channels-view/persistence.ts b/apps/web/src/features/channels-view/persistence.tsindex 5b221ce5ac..881cb1f633 100644--- a/apps/web/src/features/channels-view/persistence.ts+++ b/apps/web/src/features/channels-view/persistence.ts@@ -38,6 +38,7 @@ const channelsExpandedGroupsSchema = z.preprocess(},z.object({favorites: z.boolean().default(true),+ team_channels: z.boolean().default(true),channels: z.boolean().default(true),direct_messages: z.boolean().default(true),})@@ -48,6 +49,7 @@ const channelsEntryStateSchemaWithDefaults = z.object({tab: z.enum(['browse', 'recents', 'threads']).default('browse'),expandedGroups: channelsExpandedGroupsSchema.default({favorites: true,+ team_channels: true,channels: true,direct_messages: true,}),@@ -62,6 +64,7 @@ const DEFAULT_CHANNELS_ENTRY_STATE = {tab: 'browse',expandedGroups: {favorites: true,+ team_channels: true,channels: true,direct_messages: true,},@@ -78,6 +81,9 @@ const channelsPreferencesSchema = z.object({.transform(clampChannelsRailWidth),sortBy: z.object({+ team_channels: z+ .enum(['viewed_at', 'updated_at', 'created_at'])+ .default(CHANNELS_DEFAULT_SORT_BY.team_channels),channels: z.enum(['viewed_at', 'updated_at', 'created_at']).default(CHANNELS_DEFAULT_SORT_BY.channels),diff --git a/apps/web/src/features/channels-view/queries.test.ts b/apps/web/src/features/channels-view/queries.test.tsindex 2174c9d500..d14d522002 100644--- a/apps/web/src/features/channels-view/queries.test.ts+++ b/apps/web/src/features/channels-view/queries.test.ts@@ -101,21 +101,21 @@ describe('channel list query selection', () => {return dispose;});try {- // Four channel lists, the Threads rail's threads and their channels,+ // Five channel lists, the Threads rail's threads and their channels,// then the selected conversation.- expect(useSoupAstItemsQuery).toHaveBeenCalledTimes(7);- for (const [, options] of useSoupAstItemsQuery.mock.calls.slice(0, 4)) {+ expect(useSoupAstItemsQuery).toHaveBeenCalledTimes(8);+ for (const [, options] of useSoupAstItemsQuery.mock.calls.slice(0, 5)) {expect(options?.().graphqlProjection).toBe('channel-list');expect(options?.().staleTime).toBe(30_000);}- for (const [, options] of useSoupAstItemsQuery.mock.calls.slice(4, 6)) {+ for (const [, options] of useSoupAstItemsQuery.mock.calls.slice(5, 7)) {expect(options?.().staleTime).toBe(30_000);}// The Threads rail's channels, fetched by id, are rail rows too.- const [, channelsByIdOptions] = useSoupAstItemsQuery.mock.calls[5];+ const [, channelsByIdOptions] = useSoupAstItemsQuery.mock.calls[6];expect(channelsByIdOptions?.().graphqlProjection).toBe('channel-list');const [selectionArgs, selectionOptions] =- useSoupAstItemsQuery.mock.calls[6];+ useSoupAstItemsQuery.mock.calls[7];expect(selectionArgs().transport).toBe('rest');expect(selectionOptions?.().graphqlProjection).toBeUndefined();expect(selectionOptions?.().staleTime).toBe(0);diff --git a/apps/web/src/features/channels-view/queries.ts b/apps/web/src/features/channels-view/queries.tsindex c8273da419..0f92dd6d68 100644--- a/apps/web/src/features/channels-view/queries.ts+++ b/apps/web/src/features/channels-view/queries.ts@@ -25,7 +25,7 @@ import type {ChannelsQueryScope,ChannelsSortGroup,} from './types';-import { channelHasMessages, isDirectMessage } from './utils';+import { channelHasMessages, isDirectMessage, isTeamChannel } from './utils';/** Threads per page the Threads rail reads to find their channels. */const THREAD_CHANNELS_PAGE_SIZE = 100;@@ -66,13 +66,20 @@ export const CHANNELS_QUERY_DEFINITIONS = {}),matches: channelHasMessages,},+ team_channels: {+ params: { ...CHANNELS_QUERY_PARAMS, sort_method: 'created_at' },+ filters: defineQueryFilters({+ include: { channelType: ['team'], channelIsParticipant: [true] },+ }),+ matches: isTeamChannel,+ },channels: {params: { ...CHANNELS_QUERY_PARAMS, sort_method: 'created_at' },filters: defineQueryFilters({include: { channelIsParticipant: [true] },- exclude: { channelType: ['direct_message'] },+ exclude: { channelType: ['direct_message', 'team'] },}),- matches: (channel) => !isDirectMessage(channel),+ matches: (channel) => !isDirectMessage(channel) && !isTeamChannel(channel),},direct_messages: {params: { ...CHANNELS_QUERY_PARAMS, sort_method: 'updated_at' },@@ -381,6 +388,11 @@ export function useChannelsSources(sortBy: (group: ChannelsSortGroup) => ChannelListSort): ChannelsSources {return {+ team_channels: useChannelsDataSource(+ 'team_channels',+ () => enabled('team_channels'),+ () => sortBy('team_channels')+ ),channels: useChannelsDataSource('channels',() => enabled('channels'),diff --git a/apps/web/src/features/channels-view/queries/channel-search-source.test.ts b/apps/web/src/features/channels-view/queries/channel-search-source.test.tsindex 7b5650c777..35d9f87f54 100644--- a/apps/web/src/features/channels-view/queries/channel-search-source.test.ts+++ b/apps/web/src/features/channels-view/queries/channel-search-source.test.ts@@ -328,11 +328,14 @@ describe('shared channel search source', () => {'direct_message',]);expect(ids(s.source)).toEqual(['dm']);+ s.setScope('team_channels');+ expect(s.request().body.filters?.channel_filters?.channel_types).toEqual([+ 'team',+ ]);s.setScope('channels');expect(s.request().body.filters?.channel_filters?.channel_types).toEqual(['public','private',- 'team',]);expect(ids(s.source)).toEqual(['channel']);s.setScope('recents');diff --git a/apps/web/src/features/channels-view/queries/channel-search-source.ts b/apps/web/src/features/channels-view/queries/channel-search-source.tsindex 97c7cc4e61..bc7284bc7e 100644--- a/apps/web/src/features/channels-view/queries/channel-search-source.ts+++ b/apps/web/src/features/channels-view/queries/channel-search-source.ts@@ -47,7 +47,8 @@ export function createChannelSearchSource(options: {is_participant: true,channel_types: match(options.scope()).with('direct_messages', () => ['direct_message'])- .with('channels', () => ['public', 'private', 'team'])+ .with('team_channels', () => ['team'])+ .with('channels', () => ['public', 'private']).with('recents', 'search', 'threads', () => undefined).exhaustive(() => undefined),},diff --git a/apps/web/src/features/channels-view/types.ts b/apps/web/src/features/channels-view/types.tsindex 96893c69bc..ea73dddcf5 100644--- a/apps/web/src/features/channels-view/types.ts+++ b/apps/web/src/features/channels-view/types.ts@@ -1,6 +1,7 @@export type ChannelsTab = 'browse' | 'recents' | 'threads';-export type ChannelsGroup = 'channels' | 'direct_messages';+/** The All tab's conversation lists, each its own paginated query. */+export type ChannelsGroup = 'team_channels' | 'channels' | 'direct_messages';export type ChannelListSort = 'viewed_at' | 'updated_at' | 'created_at';diff --git a/apps/web/src/features/channels-view/utils.ts b/apps/web/src/features/channels-view/utils.tsindex 35922b702c..df2c1f9049 100644--- a/apps/web/src/features/channels-view/utils.ts+++ b/apps/web/src/features/channels-view/utils.ts@@ -6,8 +6,13 @@ export function isDirectMessage(channel: ChannelEntity) {return channel.channelType === 'direct_message';}+export function isTeamChannel(channel: ChannelEntity) {+ return channel.channelType === 'team';+}+export function channelGroup(channel: ChannelEntity): ChannelsGroup {- return isDirectMessage(channel) ? 'direct_messages' : 'channels';+ if (isDirectMessage(channel)) return 'direct_messages';+ return isTeamChannel(channel) ? 'team_channels' : 'channels';}export function channelHasMessages(channel: ChannelEntity) {diff --git a/docs/agent-guide/channels.md b/docs/agent-guide/channels.mdindex 28a9dfbaf1..f0f7a61def 100644--- a/docs/agent-guide/channels.md+++ b/docs/agent-guide/channels.md@@ -812,7 +812,11 @@ aligned with New. Choices use equal widths, a transparent outlined track with1px padding, and fully rounded pill shapes. The 32px selected state matchesNew's fill and border without an extra shadow. All contains an optional`Favorites` section and the-independently paginated `Channels` and `DMs` sections. Favorites appears when+independently paginated `Team channels`, `Channels`, and `DMs` sections, in+that order. `Team channels` lists team channels; `Channels` lists every other+non-DM channel (public and private). Each section collapses on its own and+keeps its own sort; open sections split the column evenly, and the bottom-most+open one takes any remaining height. Favorites appears whenthe user has channel favorites and only lists channels. Channel favorites openin the shared channel detail. Shift-clicking a favorite, channel, or DM opens thatconversation in a new split instead. Shift-click refreshes the notification@@ -822,7 +826,7 @@ Deferred navigation waits until the destination is applied; an unavailable splitmust leave unread state unchanged. Join-only channels remainblocked after hydration, including on mobile.-With GraphQL caching enabled, a current-query cached Channels or DMs page+With GraphQL caching enabled, a current-query cached Team channels, Channels, or DMs page(including an empty page) remains quiet on a response-free refresh failure.Hold or fail the refresh before local filtering finishes: cached rows must notflash **Couldn’t load conversations** while awaiting reconciliation. Changing@@ -871,7 +875,7 @@ until explicitly enabled, including in development. For a local frontend,`VITE_ENABLE_CHANNEL_TAGS=true` enables it and `VITE_ENABLE_CHANNEL_TAGS=false`forces it off; restart the frontend after changing the environment override.-With the flag off, Channels remains a flat list in its selected sort order.+With the flag off, Team channels remains a flat list in its selected sort order.The heading's `+` creates a channel directly. Label headings, creation dialogs,channel-menu label actions, and label drag targets are absent, and the app makesno channel-label list or smart-label preview requests. Existing saved labels@@ -891,7 +895,8 @@ dialog and cancel to check the controls without changing shared data. Thecreation, assignment, and persistence checks below require the label backendand an account where those changes are safe.-Labels group channels inside the `Channels` section. Team members share the+Labels group channels inside the `Team channels` section; the `Channels`+section's `+` only creates a channel. Team members share thesame labels and can create, rename, delete, or move their channels between them.Users without a team have labels private to their account. The naming and deletedialogs explain which scope applies. Collapse/expand state is per user.@@ -910,7 +915,7 @@ row has an unread count, a `···` menu (`Rename`, `Mark all as read`, `DeleteClicking the row or pressing Enter toggles it; `h` / `l` on a label or one of itschannels collapses or expands that label. `[` / `]` jump between section headings.-Creating: use the `Channels` heading's `+` → `New label`, including when the+Creating: use the `Team channels` heading's `+` → `New label`, including when theaccount has no team. The name field receives focus on opening and reopening.Enter or `Create label` saves; Escape or Cancel dismisses without saving.The dialog stays open while saving and shows a failure inline, preserving the@@ -922,7 +927,7 @@ private ones. Channels remain accessible after deleting their label.Moving: right-click a team channel for `Add to label` / `Move to label`, including a`New label…` option, or use `Ungroup from “<label>”`. Drag a channel onto a labelheading or one of its channels to move in. Drag a grouped channel onto a plain-team channel, the Channels heading, or empty space below the list to ungroup it.+team channel, the Team channels heading, or empty space below the list to ungroup it.Dragging one ungrouped team channel onto another opens a name dialog; saving createsthe label with both channels atomically. A failed save changes neither channel.Dropping on the source channel or its current label does nothing; Escape from