Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(channels): remove unread navigation section (#6839)

Peter Chinman8d17ccb71f66
diff --git a/apps/web/src/features/channels-view/channels-view-context.test.tsx b/apps/web/src/features/channels-view/channels-view-context.test.tsx
index c2308d4f51..b6c43816af 100644
--- a/apps/web/src/features/channels-view/channels-view-context.test.tsx
+++ b/apps/web/src/features/channels-view/channels-view-context.test.tsx
@@ -142,7 +142,11 @@ describe('ChannelsViewProvider preview selection', () => {
expect(first.context.state.collapsedLabels).toEqual(['enterprise']);
expect(JSON.parse(localStorage.getItem(storageKey)!)).toMatchObject({
collapsedLabels: ['enterprise'],
- expandedGroups: expect.objectContaining({ unread: true }),
+ expandedGroups: {
+ favorites: true,
+ channels: true,
+ direct_messages: true,
+ },
});
first.unmount();
diff --git a/apps/web/src/features/channels-view/channels-view-context.tsx b/apps/web/src/features/channels-view/channels-view-context.tsx
index 364962d2bc..46fed56fc0 100644
--- a/apps/web/src/features/channels-view/channels-view-context.tsx
+++ b/apps/web/src/features/channels-view/channels-view-context.tsx
@@ -54,7 +54,6 @@ function createInitialState(
selectedChannelId: initial.selectedChannelId,
expandedGroups: {
favorites: initial.expandedGroups?.favorites ?? true,
- unread: initial.expandedGroups?.unread ?? true,
channels: initial.expandedGroups?.channels ?? true,
direct_messages: initial.expandedGroups?.direct_messages ?? true,
},
diff --git a/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx b/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx
index ed04c66976..7b9267c991 100644
--- a/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx
+++ b/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx
@@ -64,7 +64,6 @@ import type {
ChannelsRailSection,
ChannelsTab,
} from '../../types';
-import { isDirectMessage } from '../../utils';
import {
buildChannelRailRows,
buildChannelSectionRows,
@@ -94,7 +93,6 @@ import { useChannelRailActivity } from './hooks/useChannelRailActivity';
const CHANNEL_RAIL_SECTIONS: ChannelsRailSection[] = [
'favorites',
- 'unread',
'channels',
'direct_messages',
];
@@ -329,17 +327,6 @@ export function ChannelsRail(props: ChannelsRailProps) {
})
);
- // The Unread section is channels only; DMs keep their own section.
- const unreadChannels = createMemo(() =>
- channelActivity
- .unreadChannelOrder()
- .map((id) => channelsById().get(id))
- .filter(
- (channel): channel is ChannelEntity =>
- channel !== undefined && !isDirectMessage(channel)
- )
- );
-
const labelUnreadCount = (label: ChannelLabel) => {
const unread = channelActivity.unreadChannelIds();
return filterChannelLabelMembers(label.channelIds, channelsById()).filter(
@@ -365,7 +352,6 @@ export function ChannelsRail(props: ChannelsRailProps) {
state.expandedGroups,
{
favorites: favorites(),
- unread: unreadChannels(),
channels: props.sources.channels.items(),
direct_messages: props.sources.direct_messages.items(),
recents: props.sources.recents.items(),
@@ -448,13 +434,11 @@ export function ChannelsRail(props: ChannelsRailProps) {
? listRoot()
: row.kind === 'favorite'
? sectionScrollRoots().favorites
- : row.kind === 'unread'
- ? sectionScrollRoots().unread
- : row.kind === 'conversation' && row.group
- ? sectionScrollRoots()[row.group]
- : state.tab === 'recents'
- ? listRoot()
- : undefined;
+ : row.kind === 'conversation' && row.group
+ ? sectionScrollRoots()[row.group]
+ : state.tab === 'recents'
+ ? listRoot()
+ : undefined;
if (!element || !scrollRoot) return;
const elementBounds = element.getBoundingClientRect();
@@ -642,7 +626,7 @@ export function ChannelsRail(props: ChannelsRailProps) {
previewAfterNavigation.clear();
const row = event.result?.item;
- if (row?.kind === 'conversation' || row?.kind === 'unread') {
+ if (row?.kind === 'conversation') {
previewAfterNavigation(row.channel.id);
} else if (
row?.kind === 'favorite' &&
@@ -685,11 +669,7 @@ export function ChannelsRail(props: ChannelsRailProps) {
const currentGroup = list.focus.item()?.group;
const sections = CHANNEL_RAIL_SECTIONS.filter((section) =>
- section === 'favorites'
- ? favorites().length > 0
- : section === 'unread'
- ? unreadChannels().length > 0
- : true
+ section === 'favorites' ? favorites().length > 0 : true
);
const currentIndex = currentGroup ? sections.indexOf(currentGroup) : -1;
@@ -1062,7 +1042,6 @@ export function ChannelsRail(props: ChannelsRailProps) {
isLabelOpen,
toggleLabel: (labelId) => setLabelOpen(labelId, !isLabelOpen(labelId)),
channelSectionRows,
- unreadChannels,
labelUnreadCount,
createLabel,
createSmartTag,
diff --git a/apps/web/src/features/channels-view/components/rail/ChannelsRailContext.ts b/apps/web/src/features/channels-view/components/rail/ChannelsRailContext.ts
index 9fda4c6b88..5caa2ec53d 100644
--- a/apps/web/src/features/channels-view/components/rail/ChannelsRailContext.ts
+++ b/apps/web/src/features/channels-view/components/rail/ChannelsRailContext.ts
@@ -29,14 +29,6 @@ export type ChannelRailRow =
group: 'favorites';
favorite: Favorite;
}
- | {
- /** A channel in the flat Unread list; the same channel also has a `conversation` row. */
- kind: 'unread';
- id: `unread:${string}`;
- group: 'unread';
- localIndex: number;
- channel: ChannelEntity;
- }
| {
/** A team channel label heading inside the Channels section. */
kind: 'label';
@@ -108,9 +100,6 @@ export const rowKeyForSection = (group: ChannelsRailSection) =>
export const rowKeyForLabel = (labelId: string) => `label:${labelId}` as const;
-export const rowKeyForUnread = (channelId: string) =>
- `unread:${channelId}` as const;
-
export const domIdForRow = (railId: string, rowId: string) =>
`${railId}-${rowId}`;
@@ -141,8 +130,6 @@ export type ChannelsRailContext = {
toggleLabel: (labelId: string) => void;
/** The Channels section's rendered rows: label headings and channels. */
channelSectionRows: Accessor<readonly ChannelSectionRow[]>;
- /** Channels with unread activity, newest first, for the Unread section. */
- unreadChannels: Accessor<readonly ChannelEntity[]>;
/** Number of channels in the label with unread activity. */
labelUnreadCount: (label: ChannelLabel) => number;
/**
diff --git a/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx b/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx
index 690dd14adc..eabd7de8b5 100644
--- a/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx
+++ b/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx
@@ -57,7 +57,6 @@ import {
domIdForRow,
rowKeyForChannel,
rowKeyForFavorite,
- rowKeyForUnread,
useChannelsRail,
} from './ChannelsRailContext';
import {
@@ -73,7 +72,6 @@ import {
useChannelRailItemState,
useChannelRailScopeState,
useChannelRailSectionState,
- useChannelRailUnreadState,
useChannelRailVirtualizer,
} from './hooks/useChannelRailState';
@@ -259,8 +257,6 @@ function ChannelOption(props: {
rowId?: ChannelRailRow['id'];
/** Nest under a label heading, with the branch rail. */
labelId?: string;
- /** Keep the timestamp visible instead of revealing it on hover. */
- alwaysShowTimestamp?: boolean;
/** Make a team-channel row draggable between labels (Channels section only). */
draggable?: boolean;
}) {
@@ -359,14 +355,7 @@ function ChannelOption(props: {
</Show>
<Show when={!item().incomingCallId && timestamp()}>
{(value) => (
- <span
- class={cn(
- 'relative shrink-0',
- props.alwaysShowTimestamp
- ? 'block'
- : 'hidden group-hover/channel-option:block touch:hidden'
- )}
- >
+ <span class="relative hidden shrink-0 group-hover/channel-option:block touch:hidden">
<span
aria-hidden="true"
class="invisible whitespace-nowrap text-xs font-light"
@@ -402,66 +391,6 @@ function ChannelOption(props: {
);
}
-/**
- * Channels with unread activity, newest notification first, so nothing gets
- * lost in the stable label groups below. Hidden when nothing is unread.
- */
-function ExpandedUnreadSection() {
- const rail = useChannelsRail();
- const section = useChannelRailUnreadState();
-
- return (
- <Show when={section().items.length > 0}>
- <CollapsibleSection.Root open={section().open} sizing="content">
- <CollapsibleSection.Header
- focused={section().focused}
- focusWithin={section().containsFocus}
- >
- <button
- id={section().domId}
- type="button"
- role="treeitem"
- tabIndex={-1}
- class="relative flex h-full min-w-0 flex-1 items-center gap-1 rounded-xl px-2 text-left outline-none"
- aria-expanded={section().open}
- onMouseDown={(event) => {
- if (!isPrimaryMouseDown(event)) return;
- event.preventDefault();
- rail.toggleGroup('unread');
- }}
- >
- <span class="min-w-0 truncate">Unread</span>
- <CaretDownIcon
- class={cn(
- 'size-2.5 shrink-0 opacity-0 transition-[opacity,rotate] duration-200 motion-reduce:transition-none group-hover/sidebar-section:opacity-100',
- !section().open && '-rotate-90 opacity-100'
- )}
- />
- <span class="flex h-4 min-w-4 items-center justify-center rounded-full bg-accent px-1 text-xs font-medium leading-none tabular-nums text-accent-contrast">
- {section().items.length}
- </span>
- </button>
- </CollapsibleSection.Header>
- <CollapsibleSection.Content
- open={section().open}
- contentRef={(element) => rail.registerScrollRef('unread', element)}
- class="flex min-h-0 flex-col gap-0.5"
- >
- <For each={section().items}>
- {(channel) => (
- <ChannelOption
- channel={channel}
- rowId={rowKeyForUnread(channel.id)}
- alwaysShowTimestamp
- />
- )}
- </For>
- </CollapsibleSection.Content>
- </CollapsibleSection.Root>
- </Show>
- );
-}
-
function ExpandedFavoritesSection() {
const rail = useChannelsRail();
const section = useChannelRailFavoritesState();
@@ -973,7 +902,6 @@ function ExpandedBrowse() {
<Match when={true}>
<ViewSidebar.Content class="h-full overflow-hidden">
<ExpandedFavoritesSection />
- <ExpandedUnreadSection />
{/* 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. */}
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.ts
index f412140ec2..a5a2b0c402 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,18 +172,16 @@ describe('buildChannelSectionRows', () => {
describe('buildChannelRailRows', () => {
const expanded = {
favorites: true,
- unread: true,
channels: true,
direct_messages: true,
};
- it('puts the unread section between favorites and channels, newest first', () => {
+ it('lists channels once in their section and source order', () => {
const rows = buildChannelRailRows(
'browse',
expanded,
{
favorites: [],
- unread: [zeta, acme],
channels: [acme, zeta],
direct_messages: [],
recents: [],
@@ -197,9 +195,6 @@ describe('buildChannelRailRows', () => {
);
expect(rows.map((row) => row.id)).toEqual([
- 'section:unread',
- 'unread:zeta',
- 'unread:acme',
'section:channels',
'channel:acme',
'channel:zeta',
@@ -207,32 +202,6 @@ describe('buildChannelRailRows', () => {
]);
});
- it('skips the unread section when nothing is unread and honours its collapse', () => {
- const items = {
- favorites: [],
- unread: [] as ChannelEntity[],
- channels: [],
- direct_messages: [],
- recents: [],
- };
- expect(
- buildChannelRailRows('browse', expanded, items, []).map((row) => row.id)
- ).toEqual(['section:channels', 'section:direct_messages']);
-
- expect(
- buildChannelRailRows(
- 'browse',
- { ...expanded, unread: false },
- { ...items, unread: [acme] },
- []
- ).map((row) => row.id)
- ).toEqual([
- 'section:unread',
- 'section:channels',
- 'section:direct_messages',
- ]);
- });
-
it('gives label headings and nested channels indexes into the rendered section', () => {
const sectionRows = buildChannelSectionRows({
labels: [label('l1', 'Enterprise', ['acme'])],
@@ -245,7 +214,6 @@ describe('buildChannelRailRows', () => {
expanded,
{
favorites: [],
- unread: [],
channels: [deals],
direct_messages: [],
recents: [],
@@ -277,7 +245,6 @@ describe('buildChannelRailRows', () => {
expanded,
{
favorites: [],
- unread: [acme],
channels: [acme],
direct_messages: [],
recents: [zeta, acme],
@@ -318,10 +285,9 @@ it('renders a channel in every matching smart tag with unique navigation IDs, ex
).toEqual(['deals']);
const rows = buildChannelRailRows(
'browse',
- { favorites: true, unread: true, channels: true, direct_messages: true },
+ { favorites: true, channels: true, direct_messages: true },
{
favorites: [],
- unread: [],
channels: [acme, zeta, deals],
direct_messages: [],
recents: [],
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.ts
index 0ba5165da5..61c2010576 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
@@ -13,7 +13,6 @@ import {
rowKeyForChannel,
rowKeyForFavorite,
rowKeyForLabel,
- rowKeyForUnread,
} from './ChannelsRailContext';
export type ChannelRailItemsByScope = Record<
@@ -21,8 +20,6 @@ export type ChannelRailItemsByScope = Record<
readonly ChannelEntity[]
> & {
favorites: readonly Favorite[];
- /** Channels with unread activity, newest first. Empty hides the section. */
- unread: readonly ChannelEntity[];
};
const compareChannelName = (left: ChannelEntity, right: ChannelEntity) =>
@@ -113,23 +110,6 @@ export function buildChannelRailRows(
}
}
- if (items.unread.length > 0) {
- rows.push({ kind: 'section', id: 'section:unread', group: 'unread' });
- if (expandedGroups.unread) {
- rows.push(
- ...items.unread.map(
- (channel, localIndex): ChannelRailRow => ({
- kind: 'unread',
- id: rowKeyForUnread(channel.id),
- group: 'unread',
- localIndex,
- channel,
- })
- )
- );
- }
- }
-
rows.push({
kind: 'section',
id: 'section:channels',
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.ts
index b45dfe47b0..d3f2a32ad7 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
@@ -41,9 +41,6 @@ export function useChannelRailActivity(
const notificationActivity = createMemo(() => {
const unreadChannelIds = new Set<string>();
- // Channels with unread activity, newest unread notification first; the
- // notifications are already sorted newest-first so first sight wins.
- const unreadChannelOrder: string[] = [];
const unreadNotificationIds = new Set<string>();
const unreadCounts: Record<ChannelsGroup, number> = {
channels: 0,
@@ -92,8 +89,6 @@ export function useChannelRailActivity(
notification.entity_id
);
unreadChannelIds.add(notification.entity_id);
- if (isFirstUnreadForChannel)
- unreadChannelOrder.push(notification.entity_id);
unreadNotificationIds.add(notification.id);
const channel = channelsById().get(notification.entity_id);
@@ -115,7 +110,6 @@ export function useChannelRailActivity(
return {
latestTargets,
unreadChannelIds,
- unreadChannelOrder,
unreadNotificationIds,
unreadCounts,
};
@@ -247,8 +241,6 @@ export function useChannelRailActivity(
targetChannelId,
targetLabel,
unreadChannelIds: () => notificationActivity().unreadChannelIds,
- /** Channel ids with unread activity, newest unread notification first. */
- unreadChannelOrder: () => notificationActivity().unreadChannelOrder,
unreadCount: (group: ChannelsGroup) =>
notificationActivity().unreadCounts[group],
};
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.ts
index ea972967db..bbefae67ff 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
@@ -212,19 +212,3 @@ export function useChannelRailLabelState(label: Accessor<ChannelLabel>) {
};
});
}
-
-export function useChannelRailUnreadState() {
- const rail = useChannelsRail();
-
- return createMemo(() => {
- const rowId = rowKeyForSection('unread');
-
- return {
- items: rail.unreadChannels(),
- open: rail.isGroupOpen('unread'),
- focused: rail.list.focus.key() === rowId,
- containsFocus: rail.list.focus.item()?.group === 'unread',
- domId: domIdForRow(rail.railId, rowId),
- };
- });
-}
diff --git a/apps/web/src/features/channels-view/persistence.ts b/apps/web/src/features/channels-view/persistence.ts
index cc6785a65b..91d933e807 100644
--- a/apps/web/src/features/channels-view/persistence.ts
+++ b/apps/web/src/features/channels-view/persistence.ts
@@ -38,7 +38,6 @@ const channelsExpandedGroupsSchema = z.preprocess(
},
z.object({
favorites: z.boolean().default(true),
- unread: z.boolean().default(true),
channels: z.boolean().default(true),
direct_messages: z.boolean().default(true),
})
@@ -53,7 +52,6 @@ const channelsEntryStateSchemaWithDefaults = z.object({
selectedChannelId: z.string().optional(),
expandedGroups: channelsExpandedGroupsSchema.default({
favorites: true,
- unread: true,
channels: true,
direct_messages: true,
}),
@@ -69,7 +67,6 @@ const DEFAULT_CHANNELS_ENTRY_STATE = {
selectedChannelId: undefined,
expandedGroups: {
favorites: true,
- unread: true,
channels: true,
direct_messages: true,
},
diff --git a/apps/web/src/features/channels-view/types.ts b/apps/web/src/features/channels-view/types.ts
index ccf99ce3dd..d84175bd6b 100644
--- a/apps/web/src/features/channels-view/types.ts
+++ b/apps/web/src/features/channels-view/types.ts
@@ -4,11 +4,8 @@ export type ChannelsGroup = 'channels' | 'direct_messages';
export type ChannelListSort = 'viewed_at' | 'updated_at' | 'created_at';
-/**
- * Collapsible sections of the All tab. `unread` is the flat, newest-first list
- * of channels with unread activity that sits above `channels`.
- */
-export type ChannelsRailSection = 'favorites' | 'unread' | ChannelsGroup;
+/** Collapsible sections of the All tab. */
+export type ChannelsRailSection = 'favorites' | ChannelsGroup;
export type ChannelsQueryScope = ChannelsGroup | 'recents';
diff --git a/docs/AGENT_GUIDE/channels.md b/docs/AGENT_GUIDE/channels.md
index 6c4e045247..b5c3c2d333 100644
--- a/docs/AGENT_GUIDE/channels.md
+++ b/docs/AGENT_GUIDE/channels.md
@@ -328,17 +328,12 @@ the shared 256px default sidebar width and resize limits. In splits narrower tha
with the same full sidebar contents. There is no separate skinny sidebar mode.
On desktop, the Chat rail has `All` and `Recent` tabs. All contains an
-optional `Favorites` section, an optional `Unread` section, and the
+optional `Favorites` section and the
independently paginated `Channels` and `DMs` sections. Favorites appears when
the user has channel favorites and only lists channels. Channel favorites open
in the channel preview. Shift-clicking a favorite, channel, or DM opens that
conversation in a new split instead.
-`Unread` appears only while at least one channel (not DM) has unread activity.
-It is a flat list, newest unread notification first, with each row's timestamp
-always visible, and a count pill on its heading. Marking a channel read drops
-it from the list. It is capped at a third of the column and scrolls inside.
-
### Channel labels
Channel labels require the `enable-channel-tags` feature flag. The flag is off
@@ -380,9 +375,8 @@ channels, including non-team channels and other teams' channels in shared labels
Names are unique within the team or account, case-insensitively.
Layout: labels come first in creation order, each showing its visible channels
-A→Z, followed by ungrouped channels in the section's selected sort order. The
-`Unread` section remains ordered by activity. A label row has an unread count,
-a `···` menu (`Rename`, `Mark all as read`, `Delete label`), and a disclosure caret.
+A→Z, followed by ungrouped channels in the section's selected sort order. A label
+row has an unread count, a `···` menu (`Rename`, `Mark all as read`, `Delete label`), and a disclosure caret.
Clicking the row or pressing Enter toggles it; `h` / `l` on a label or one of its
channels collapses or expands that label. `[` / `]` jump between section headings.
@@ -475,7 +469,7 @@ keyboard activation still toggles the highlighted section.
Arrow Down / `j` at the last loaded conversation holds focus while that
section loads its next page. Once loading finishes, the next press advances
into the appended rows. If the section has no next page, navigation proceeds
-to the next section. `[` and `]` jump between the visible Favorites, Unread,
+to the next section. `[` and `]` jump between the visible Favorites,
Channels, and DMs section headers.
On touch layouts, the `Recent`, `Channels`, and `DMs` pill tabs each retain