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(new-layout): various views and sidebar ui/ux changes (#6426)

dev-rb587b046dd7cb
diff --git a/apps/web/src/components/view-shell/CollapsibleSection.tsx b/apps/web/src/components/view-shell/CollapsibleSection.tsx
index c7b73eb5e6..1d30ec5744 100644
--- a/apps/web/src/components/view-shell/CollapsibleSection.tsx
+++ b/apps/web/src/components/view-shell/CollapsibleSection.tsx
@@ -21,7 +21,7 @@ function Trigger(props: ComponentProps<typeof Collapsible.Trigger>) {
<Collapsible.Trigger
{...rest}
class={cn(
- 'group flex h-9 w-full min-w-0 items-center gap-2.5 rounded-xl px-3 py-2 text-left text-sm font-medium text-ink-muted outline-none hover:text-ink focus-visible:ring-2 focus-visible:ring-accent/30',
+ 'group flex h-9 w-full min-w-0 items-center gap-1 rounded-xl px-3 py-2 text-left text-sm font-medium text-ink-extra-muted outline-none hover:text-ink-muted',
local.class
)}
>
@@ -37,13 +37,13 @@ function Indicator(props: JSX.HTMLAttributes<HTMLSpanElement>) {
{...rest}
aria-hidden="true"
class={cn(
- 'ml-auto flex size-4 shrink-0 items-center justify-center text-ink-extra-muted transition-transform group-data-expanded:rotate-90',
+ 'flex size-4 shrink-0 items-center justify-center text-ink-extra-muted opacity-0 transition-[opacity,transform] group-hover:opacity-100 group-focus-visible:opacity-100 group-data-closed:opacity-100 group-data-expanded:rotate-90',
local.class
)}
>
<Show
when={local.children}
- fallback={<CaretDownIcon class="size-3 -rotate-90" />}
+ fallback={<CaretDownIcon class="size-2.5 -rotate-90" />}
>
{local.children}
</Show>
diff --git a/apps/web/src/components/view-shell/ViewShell.tsx b/apps/web/src/components/view-shell/ViewShell.tsx
index d0225d7609..426585e130 100644
--- a/apps/web/src/components/view-shell/ViewShell.tsx
+++ b/apps/web/src/components/view-shell/ViewShell.tsx
@@ -379,7 +379,7 @@ function Header(props: JSX.HTMLAttributes<HTMLElement>) {
<header
{...rest}
class={cn(
- 'shrink-0 border-b border-edge touch:border-b-0 px-4 py-4 touch:px-(--mobile-chrome-gutter) touch:pt-[calc(var(--safe-top,0px)+0.5rem)]',
+ 'shrink-0 px-4 py-4 touch:px-(--mobile-chrome-gutter) touch:pt-[calc(var(--safe-top,0px)+0.5rem)]',
local.class
)}
data-view-shell-header=""
diff --git a/apps/web/src/features/agents-view/components/AgentsSidebar.tsx b/apps/web/src/features/agents-view/components/AgentsSidebar.tsx
index bb9f771753..437e18d9d3 100644
--- a/apps/web/src/features/agents-view/components/AgentsSidebar.tsx
+++ b/apps/web/src/features/agents-view/components/AgentsSidebar.tsx
@@ -20,7 +20,7 @@ import { SplitPanel } from '@components/app/split-panel';
import { ScrollIndicators } from '@core/component/VerticalScrollIndicators';
import EmptyStateAiGraphic from '@design/empty-state-ai.svg';
import EmptyStateNoSearchMatchGraphic from '@design/empty-state-no-search-match.svg';
-import { EntityRowIcon } from '@entity';
+import { Entity, EntityRowIcon } from '@entity';
import BookOpenIcon from '@phosphor/book-open.svg';
import ClockIcon from '@phosphor/clock-clockwise.svg';
import MagnifyingGlassIcon from '@phosphor/magnifying-glass.svg';
@@ -123,8 +123,8 @@ function AgentFavorites(props: {
<Show when={favorites().length > 0}>
<CollapsibleSection.Root open={open()} onOpenChange={setOpen}>
<CollapsibleSection.Trigger class="text-xs">
- <CollapsibleSection.Indicator class="order-first ml-0" />
- <span class="truncate">Favorites</span>
+ <span class="min-w-0 truncate">Favorites</span>
+ <CollapsibleSection.Indicator />
</CollapsibleSection.Trigger>
<CollapsibleSection.Content>
<ViewSidebar.Nav aria-label="Favorite agent chats">
@@ -145,17 +145,32 @@ function ConversationRow(props: {
active: boolean;
onOpen: () => void;
}) {
+ const timestamp = () =>
+ props.conversation.updatedAt ?? props.conversation.createdAt;
+
return (
<ViewSidebar.Item
active={props.active}
- class="font-normal"
+ class="group/recent-chat relative font-normal"
title={props.conversation.name || 'Untitled chat'}
onClick={props.onOpen}
>
<span class="flex size-4 shrink-0 items-center justify-center">
<EntityRowIcon entity={props.conversation} class="size-4" />
</span>
- <span class="truncate">{props.conversation.name || 'Untitled chat'}</span>
+ <span class="min-w-0 flex-1 truncate text-left group-hover/recent-chat:pr-12">
+ {props.conversation.name || 'Untitled chat'}
+ </span>
+ <Show when={timestamp()}>
+ {(value) => (
+ <span class="absolute right-3 top-1/2 -translate-y-1/2 text-xs font-light text-ink-extra-muted opacity-0 transition-opacity group-hover/recent-chat:opacity-100 touch:hidden">
+ <Entity.Timestamp
+ entity={props.conversation}
+ overrideTimeStamp={value()}
+ />
+ </span>
+ )}
+ </Show>
</ViewSidebar.Item>
);
}
@@ -220,6 +235,7 @@ export function AgentsSidebar(props: AgentsSidebarProps) {
DEBUG_SETTING_KEYS.FORCE_EMPTY_STATES
);
const [searchOpen, setSearchOpen] = createSignal(false);
+ const [recentChatsOpen, setRecentChatsOpen] = createSignal(true);
const [scrollRoot, setScrollRoot] = createSignal<HTMLElement>();
const [loadMoreSentinel, setLoadMoreSentinel] =
createSignal<HTMLDivElement>();
@@ -237,6 +253,7 @@ export function AgentsSidebar(props: AgentsSidebarProps) {
});
const openSearch = () => {
+ setRecentChatsOpen(true);
setSearchOpen(true);
queueMicrotask(() => searchInput?.focus());
};
@@ -293,10 +310,6 @@ export function AgentsSidebar(props: AgentsSidebarProps) {
<SplitPanel.CloseButton />
<ViewSidebar.Title>Agents</ViewSidebar.Title>
</div>
- <SplitPanel.ControlGroup>
- <SplitPanel.BackButton />
- <SplitPanel.ForwardButton />
- </SplitPanel.ControlGroup>
</ViewSidebar.Header>
<ViewSidebar.Content class="flex flex-col gap-6 overflow-hidden pt-4">
@@ -323,9 +336,19 @@ export function AgentsSidebar(props: AgentsSidebarProps) {
<AgentFavorites onOpenConversation={props.onOpenConversation} />
</Show>
- <section class="flex min-h-0 flex-1 flex-col gap-1">
- <div class="flex h-7 shrink-0 items-center justify-between pr-1 pl-3 text-xs font-medium text-ink-subtle">
- <h2>Recent chats</h2>
+ <CollapsibleSection.Root
+ open={recentChatsOpen()}
+ onOpenChange={setRecentChatsOpen}
+ class={cn(
+ 'flex min-h-0 flex-col gap-1',
+ recentChatsOpen() ? 'flex-1' : 'shrink-0'
+ )}
+ >
+ <div class="flex h-7 shrink-0 items-center gap-1 pr-1">
+ <CollapsibleSection.Trigger class="h-7 min-w-0 flex-1 py-1 text-xs">
+ <span class="min-w-0 truncate">Recent chats</span>
+ <CollapsibleSection.Indicator />
+ </CollapsibleSection.Trigger>
<Button
variant="ghost"
size="icon-sm"
@@ -349,101 +372,109 @@ export function AgentsSidebar(props: AgentsSidebarProps) {
<MagnifyingGlassIcon class="size-3.5" />
</Button>
</div>
- <Show when={searchOpen()}>
- <SearchBar
- label="Search agent chats"
- placeholder="Search chats"
- ref={(element) => {
- searchInput = element;
- }}
- value={props.search}
- onValueChange={props.onSearchChange}
- onEscape={() => {
- if (!props.search) setSearchOpen(false);
- }}
- class="h-9 shrink-0 rounded-xl"
- />
- </Show>
- <div class="relative min-h-0 flex-1">
- <Scroll scrollRef={setScrollRoot}>
- <ViewSidebar.Nav aria-label="Recent agent chats">
- {/* Soup cache updates replace entity objects. Key rows by id so
- those updates preserve the list DOM and scroll position. */}
- <Key each={visibleConversations()} by="id">
- {(conversation) => (
- <SoupEntityContextMenu
- entity={conversation()}
- list={actionList}
- selectedEntities={() => []}
- viewContext={AGENT_ACTION_VIEW_CONTEXT}
- class="block w-full"
- onOpenChange={(open) => {
- if (!open) return;
- actionController.focus.set(conversation().id, {
- reason: 'pointer',
- force: true,
- });
- }}
- >
- <ConversationRow
- conversation={conversation()}
- active={
- props.activeConversationId === conversation().id
- }
- onOpen={() => props.onOpenConversation(conversation())}
- />
- </SoupEntityContextMenu>
- )}
- </Key>
- <Show when={!forceEmptyState() && props.loading}>
- <p class="px-3 py-2 text-xs text-ink-muted">Loading chats…</p>
- </Show>
- <Show when={!forceEmptyState() && props.error}>
- <Button variant="ghost" onClick={props.onRetry}>
- Retry loading chats
- </Button>
- </Show>
- <Show
- when={
- forceEmptyState() ||
- (!props.loading &&
- !props.error &&
- props.conversations.length === 0)
- }
- >
- <RecentChatsEmptyState
- search={forceEmptyState() ? '' : props.search}
- onStartChat={() => props.onNavigate('new')}
- />
- </Show>
- <Show when={!forceEmptyState() && props.hasNextPage}>
- <div
- ref={setLoadMoreSentinel}
- role={props.loadingNextPage ? 'status' : undefined}
- aria-label={
- props.loadingNextPage ? 'Loading more chats' : undefined
+ <CollapsibleSection.Content class="flex min-h-0 flex-1 flex-col gap-1">
+ <Show when={searchOpen()}>
+ <SearchBar
+ label="Search agent chats"
+ placeholder="Search chats"
+ ref={(element) => {
+ searchInput = element;
+ }}
+ value={props.search}
+ onValueChange={props.onSearchChange}
+ onEscape={() => {
+ if (!props.search) setSearchOpen(false);
+ }}
+ class="h-9 shrink-0 rounded-xl"
+ />
+ </Show>
+ <div class="relative min-h-0 flex-1">
+ <Scroll scrollRef={setScrollRoot}>
+ <ViewSidebar.Nav aria-label="Recent agent chats">
+ {/* Soup cache updates replace entity objects. Key rows by id so
+ those updates preserve the list DOM and scroll position. */}
+ <Key each={visibleConversations()} by="id">
+ {(conversation) => (
+ <SoupEntityContextMenu
+ entity={conversation()}
+ list={actionList}
+ selectedEntities={() => []}
+ viewContext={AGENT_ACTION_VIEW_CONTEXT}
+ class="block w-full"
+ onOpenChange={(open) => {
+ if (!open) return;
+ actionController.focus.set(conversation().id, {
+ reason: 'pointer',
+ force: true,
+ });
+ }}
+ >
+ <ConversationRow
+ conversation={conversation()}
+ active={
+ props.activeConversationId === conversation().id
+ }
+ onOpen={() =>
+ props.onOpenConversation(conversation())
+ }
+ />
+ </SoupEntityContextMenu>
+ )}
+ </Key>
+ <Show when={!forceEmptyState() && props.loading}>
+ <p class="px-3 py-2 text-xs text-ink-muted">
+ Loading chats…
+ </p>
+ </Show>
+ <Show when={!forceEmptyState() && props.error}>
+ <Button variant="ghost" onClick={props.onRetry}>
+ Retry loading chats
+ </Button>
+ </Show>
+ <Show
+ when={
+ forceEmptyState() ||
+ (!props.loading &&
+ !props.error &&
+ props.conversations.length === 0)
}
- class="grid h-9 shrink-0 place-items-center text-ink-muted"
>
- <Show when={props.loadMoreError}>
- <Button variant="ghost" onClick={props.onLoadMore}>
- Retry loading more chats
- </Button>
- </Show>
- <Show when={!props.loadMoreError && props.loadingNextPage}>
- <SpinnerIcon class="size-4 animate-spin" />
- </Show>
- </div>
- </Show>
- </ViewSidebar.Nav>
- </Scroll>
- <ScrollIndicators
- scrollRef={scrollRoot}
- appearance="gradient"
- gradientColor="panel"
- />
- </div>
- </section>
+ <RecentChatsEmptyState
+ search={forceEmptyState() ? '' : props.search}
+ onStartChat={() => props.onNavigate('new')}
+ />
+ </Show>
+ <Show when={!forceEmptyState() && props.hasNextPage}>
+ <div
+ ref={setLoadMoreSentinel}
+ role={props.loadingNextPage ? 'status' : undefined}
+ aria-label={
+ props.loadingNextPage ? 'Loading more chats' : undefined
+ }
+ class="grid h-9 shrink-0 place-items-center text-ink-muted"
+ >
+ <Show when={props.loadMoreError}>
+ <Button variant="ghost" onClick={props.onLoadMore}>
+ Retry loading more chats
+ </Button>
+ </Show>
+ <Show
+ when={!props.loadMoreError && props.loadingNextPage}
+ >
+ <SpinnerIcon class="size-4 animate-spin" />
+ </Show>
+ </div>
+ </Show>
+ </ViewSidebar.Nav>
+ </Scroll>
+ <ScrollIndicators
+ scrollRef={scrollRoot}
+ appearance="gradient"
+ gradientColor="panel"
+ />
+ </div>
+ </CollapsibleSection.Content>
+ </CollapsibleSection.Root>
</ViewSidebar.Content>
</ViewSidebar.Root>
);
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 0af09d37f4..f896fc0153 100644
--- a/apps/web/src/features/channels-view/channels-view-context.tsx
+++ b/apps/web/src/features/channels-view/channels-view-context.tsx
@@ -6,10 +6,14 @@ import type { ContextProviderProps } from '@solid-primitives/context';
import { createStore, type Store } from 'solid-js/store';
import {
CHANNELS_DEFAULT_RAIL_WIDTH,
+ CHANNELS_DEFAULT_SLIM_GROUPS,
+ CHANNELS_DEFAULT_SORT_BY,
clampChannelsRailWidth,
} from './constants';
import { createChannelsViewPersistence } from './persistence';
import type {
+ ChannelListSort,
+ ChannelsGroup,
ChannelsQueryScope,
ChannelsRailMode,
ChannelsRailSection,
@@ -28,10 +32,54 @@ export type ChannelsViewContext = {
setMobileTab: (tab: ChannelsQueryScope) => void;
setSelectedChannelId: (channelId: string | undefined) => void;
setGroupOpen: (group: ChannelsRailSection, open: boolean) => void;
+ setSortBy: (group: ChannelsGroup, sort: ChannelListSort) => void;
+ setSlimGroupEnabled: (group: ChannelsGroup, enabled: boolean) => void;
setAsideWidth: (width: number) => void;
setRailMode: (mode: Exclude<ChannelsRailMode, 'auto'>) => void;
};
+function createInitialState(
+ initial: ChannelsViewStateOptions
+): ChannelsViewState {
+ return {
+ tab: initial.tab ?? 'browse',
+ mobileTab:
+ initial.mobileTab ?? (initial.tab === 'recents' ? 'recents' : 'channels'),
+ selectedChannelId: initial.selectedChannelId,
+ expandedGroups: {
+ favorites: initial.expandedGroups?.favorites ?? true,
+ channels: initial.expandedGroups?.channels ?? true,
+ direct_messages: initial.expandedGroups?.direct_messages ?? true,
+ },
+ sortBy: {
+ channels: initial.sortBy?.channels ?? CHANNELS_DEFAULT_SORT_BY.channels,
+ direct_messages:
+ initial.sortBy?.direct_messages ??
+ CHANNELS_DEFAULT_SORT_BY.direct_messages,
+ },
+ slimGroups: {
+ channels:
+ initial.slimGroups?.channels ?? CHANNELS_DEFAULT_SLIM_GROUPS.channels,
+ direct_messages:
+ initial.slimGroups?.direct_messages ??
+ CHANNELS_DEFAULT_SLIM_GROUPS.direct_messages,
+ },
+ asideWidth: clampChannelsRailWidth(
+ initial.asideWidth ?? CHANNELS_DEFAULT_RAIL_WIDTH
+ ),
+ railMode: initial.railMode ?? 'auto',
+ };
+}
+
+function shouldRestorePreferences(initial: ChannelsViewStateOptions): boolean {
+ return (
+ initial.asideWidth === undefined &&
+ initial.railMode === undefined &&
+ initial.sortBy === undefined &&
+ initial.slimGroups === undefined
+ );
+}
+
export const [ChannelsViewProvider, useChannelsView] =
createAssertedContextProvider<ChannelsViewContext, ChannelsViewProviderProps>(
'ChannelsView',
@@ -40,29 +88,13 @@ export const [ChannelsViewProvider, useChannelsView] =
const userId = useUserId();
const initial = props.initialState ?? {};
const [state, setState] = makePersistedState(
- createStore<ChannelsViewState>({
- tab: initial.tab ?? 'browse',
- mobileTab:
- initial.mobileTab ??
- (initial.tab === 'recents' ? 'recents' : 'channels'),
- selectedChannelId: initial.selectedChannelId,
- expandedGroups: {
- favorites: initial.expandedGroups?.favorites ?? true,
- channels: initial.expandedGroups?.channels ?? true,
- direct_messages: initial.expandedGroups?.direct_messages ?? true,
- },
- asideWidth: clampChannelsRailWidth(
- initial.asideWidth ?? CHANNELS_DEFAULT_RAIL_WIDTH
- ),
- railMode: initial.railMode ?? 'auto',
- }),
+ createStore(createInitialState(initial)),
createChannelsViewPersistence({
handle: panel.handle,
userId,
restoreEntryState: props.initialState === undefined,
restoreLocalState: props.initialState === undefined,
- restorePreferences:
- initial.asideWidth === undefined && initial.railMode === undefined,
+ restorePreferences: shouldRestorePreferences(initial),
})
);
@@ -73,6 +105,9 @@ export const [ChannelsViewProvider, useChannelsView] =
setSelectedChannelId: (channelId) =>
setState('selectedChannelId', channelId),
setGroupOpen: (group, open) => setState('expandedGroups', group, open),
+ setSortBy: (group, sort) => setState('sortBy', group, sort),
+ setSlimGroupEnabled: (group, enabled) =>
+ setState('slimGroups', group, enabled),
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.tsx
index 32da3daad3..d63ea7273f 100644
--- a/apps/web/src/features/channels-view/channels-view.tsx
+++ b/apps/web/src/features/channels-view/channels-view.tsx
@@ -63,14 +63,20 @@ function ChannelsViewRoot() {
preserveDuringResize: false,
};
- const sources = useChannelsSources((scope) => {
- if (isTouchDevice()) return scope !== 'search' && state.mobileTab === scope;
- if (railSearchOpen()) return scope === 'search';
- if (scope === 'search') return false;
- return scope === 'recents'
- ? state.tab === 'recents'
- : state.tab === 'browse';
- });
+ const sources = useChannelsSources(
+ (scope) => {
+ if (isTouchDevice())
+ return scope !== 'search' && state.mobileTab === scope;
+ if (railSearchOpen()) return scope === 'search';
+ if (scope === 'search') return false;
+ if (scope === 'recents') return state.tab === 'recents';
+ return (
+ state.tab === 'browse' &&
+ (railMode() === 'full' || state.slimGroups[scope])
+ );
+ },
+ (group) => state.sortBy[group]
+ );
const loadedChannels = createMemo(() =>
deduplicateChannels([
sources.channels.items(),
@@ -157,14 +163,6 @@ function ChannelsViewRoot() {
selectedEntity={channel()}
orchestrator={orchestrator}
splitPanelContext={panel}
- headerLeading={
- <Show when={railMode() === 'slim'}>
- <SplitPanel.ControlGroup class="mr-1">
- <SplitPanel.BackButton />
- <SplitPanel.ForwardButton />
- </SplitPanel.ControlGroup>
- </Show>
- }
/>
</Suspense>
)}
diff --git a/apps/web/src/features/channels-view/components/rail/ChannelRailItems.tsx b/apps/web/src/features/channels-view/components/rail/ChannelRailItems.tsx
index c168369fee..6ddc40c943 100644
--- a/apps/web/src/features/channels-view/components/rail/ChannelRailItems.tsx
+++ b/apps/web/src/features/channels-view/components/rail/ChannelRailItems.tsx
@@ -125,7 +125,7 @@ export function ChannelMutedIndicator(props: {
<Tooltip
as="span"
label="Notifications are muted"
- placement="right"
+ placement="top"
class={cn(
'size-4 shrink-0 justify-center text-ink-extra-muted',
props.class
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 e66193786f..b3ad230463 100644
--- a/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx
+++ b/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx
@@ -39,6 +39,7 @@ import {
deduplicateChannels,
} from '../../queries';
import type {
+ ChannelsGroup,
ChannelsQueryScope,
ChannelsRailSection,
ChannelsTab,
@@ -88,7 +89,11 @@ type ChannelRailItemsByScope = Record<
export function buildChannelRailRows(
tab: ChannelsTab,
expandedGroups: Record<ChannelsRailSection, boolean>,
- items: ChannelRailItemsByScope
+ items: ChannelRailItemsByScope,
+ options: {
+ mode: 'full' | 'slim';
+ slimGroups: Record<ChannelsGroup, boolean>;
+ }
): ChannelRailRow[] {
if (tab === 'recents') {
return items.recents.map((channel, localIndex) => ({
@@ -121,6 +126,28 @@ export function buildChannelRailRows(
}
}
+ if (options.mode === 'slim') {
+ let virtualIndex = 0;
+ for (const group of BROWSE_QUERY_SCOPES) {
+ if (!options.slimGroups[group]) continue;
+
+ rows.push(
+ ...items[group].map(
+ (channel, localIndex): ChannelRailRow => ({
+ kind: 'conversation',
+ id: `channel:${channel.id}`,
+ group,
+ scope: group,
+ localIndex,
+ virtualIndex: virtualIndex++,
+ channel,
+ })
+ )
+ );
+ }
+ return rows;
+ }
+
rows.push({
kind: 'section',
id: 'section:channels',
@@ -165,8 +192,14 @@ export function buildChannelRailRows(
}
export function ChannelsRail(props: ChannelsRailProps) {
- const { state, setGroupOpen, setSelectedChannelId, setTab } =
- useChannelsView();
+ const {
+ state,
+ setGroupOpen,
+ setSelectedChannelId,
+ setSlimGroupEnabled,
+ setSortBy,
+ setTab,
+ } = useChannelsView();
const panel = useSplitPanelOrThrow();
const layout = useSplitLayout();
const favoritesData = useFavoritesData({ entityType: ['channel'] });
@@ -288,12 +321,20 @@ export function ChannelsRail(props: ChannelsRailProps) {
);
}
- return buildChannelRailRows(state.tab, state.expandedGroups, {
- favorites: favorites(),
- channels: props.sources.channels.items(),
- direct_messages: props.sources.direct_messages.items(),
- recents: props.sources.recents.items(),
- });
+ return buildChannelRailRows(
+ state.tab,
+ state.expandedGroups,
+ {
+ favorites: favorites(),
+ channels: props.sources.channels.items(),
+ direct_messages: props.sources.direct_messages.items(),
+ recents: props.sources.recents.items(),
+ },
+ {
+ mode: props.mode,
+ slimGroups: state.slimGroups,
+ }
+ );
});
const list = withSplitPanelOwner(listOwnedSlotName('controller'), () =>
@@ -338,7 +379,10 @@ export function ChannelsRail(props: ChannelsRailProps) {
if (row.kind === 'conversation') {
const virtualizer = virtualizers()[row.scope];
if (virtualizer) {
- virtualizer.scrollToIndex(row.localIndex, options);
+ virtualizer.scrollToIndex(
+ row.virtualIndex ?? row.localIndex,
+ options
+ );
return;
}
}
@@ -536,7 +580,10 @@ export function ChannelsRail(props: ChannelsRailProps) {
},
},
disclosure: {
- getKey: (row) => row.group,
+ getKey: (row) =>
+ props.mode === 'slim' && row.kind === 'conversation'
+ ? undefined
+ : row.group,
isExpanded: (group) =>
state.expandedGroups[group as ChannelsRailSection],
setExpanded: (group, expanded) =>
@@ -570,7 +617,10 @@ export function ChannelsRail(props: ChannelsRailProps) {
const sectionHotkeys = createHotkeyGroup();
const sectionHotkeysEnabled = () =>
- panel.isPanelActive() && !props.searchOpen && state.tab === 'browse';
+ panel.isPanelActive() &&
+ props.mode === 'full' &&
+ !props.searchOpen &&
+ state.tab === 'browse';
registerHotkey({
hotkey: ']',
@@ -643,6 +693,11 @@ export function ChannelsRail(props: ChannelsRailProps) {
favorites,
selectedChannelId: () => state.selectedChannelId,
isGroupOpen: (group) => state.expandedGroups[group],
+ toggleGroup: (group) => setGroupOpen(group, !state.expandedGroups[group]),
+ sortBy: (group) => state.sortBy[group],
+ setSortBy,
+ slimGroupEnabled: (group) => state.slimGroups[group],
+ setSlimGroupEnabled,
registerRootRef: setListRoot,
activateRow,
registerScrollRef: (group, element) => {
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 aea77a5b98..6c5f8f2d73 100644
--- a/apps/web/src/features/channels-view/components/rail/ChannelsRailContext.ts
+++ b/apps/web/src/features/channels-view/components/rail/ChannelsRailContext.ts
@@ -7,6 +7,7 @@ import type { Accessor } from 'solid-js';
import type { VirtualizerHandle } from 'virtua/solid';
import type { ChannelsSourceScope, ChannelsSources } from '../../queries';
import type {
+ ChannelListSort,
ChannelsGroup,
ChannelsRailSection,
ChannelsTab,
@@ -33,6 +34,7 @@ export type ChannelRailRow =
group?: ChannelsGroup;
scope: ChannelsSourceScope;
localIndex: number;
+ virtualIndex?: number;
channel: ChannelEntity;
};
@@ -58,6 +60,11 @@ export type ChannelsRailContext = {
favorites: Accessor<readonly Favorite[]>;
selectedChannelId: Accessor<string | undefined>;
isGroupOpen: (group: ChannelsRailSection) => boolean;
+ toggleGroup: (group: ChannelsRailSection) => void;
+ sortBy: (group: ChannelsGroup) => ChannelListSort;
+ setSortBy: (group: ChannelsGroup, sort: ChannelListSort) => void;
+ slimGroupEnabled: (group: ChannelsGroup) => boolean;
+ setSlimGroupEnabled: (group: ChannelsGroup, enabled: boolean) => void;
registerRootRef: (element: HTMLDivElement) => void;
activateRow: (rowId: ChannelRailRow['id']) => void;
registerScrollRef: (
diff --git a/apps/web/src/features/channels-view/components/rail/ChannelsRailSection.tsx b/apps/web/src/features/channels-view/components/rail/ChannelsRailSection.tsx
index 4454a1fb2f..72422dda96 100644
--- a/apps/web/src/features/channels-view/components/rail/ChannelsRailSection.tsx
+++ b/apps/web/src/features/channels-view/components/rail/ChannelsRailSection.tsx
@@ -1,4 +1,3 @@
-import { ScrollIndicators } from '@core/component/VerticalScrollIndicators';
import { AnimatedSquareSidebarIcon } from '@icon/square-sidebar';
import CaretDownIcon from '@phosphor/caret-down.svg';
import CaretUpIcon from '@phosphor/caret-up.svg';
@@ -37,11 +36,6 @@ function SectionScrollArea(props: {
{props.children}
</div>
</Scroll>
- <ScrollIndicators
- scrollRef={scrollRoot}
- appearance="gradient"
- gradientColor="panel"
- />
<Show when={activity.direction()}>
{(direction) => (
<Tooltip
@@ -111,7 +105,7 @@ function CollapsibleSectionHeader(props: {
return (
<div
class={cn(
- 'flex w-full items-center rounded-xl text-xs font-semibold uppercase tracking-wide text-ink-extra-muted hover:bg-hover hover:text-ink-muted',
+ 'group/section-header flex w-full items-center rounded-xl text-xs font-medium uppercase tracking-wide text-ink-extra-muted transition-colors hover:text-ink-muted',
props.focused && 'bg-hover text-ink-muted',
!props.focused && props.focusWithin && 'text-ink-muted',
props.class
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 ac25d58fb0..43abf4b4a1 100644
--- a/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx
+++ b/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx
@@ -8,12 +8,22 @@ import { SplitPanel } from '@components/app/split-panel';
import { useUserId } from '@core/context/user';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import EmptyStateNoSearchMatchGraphic from '@design/empty-state-no-search-match.svg';
-import type { ChannelEntity } from '@entity';
+import { type ChannelEntity, Entity } from '@entity';
import CaretDownIcon from '@phosphor/caret-down.svg';
+import CheckIcon from '@phosphor/check.svg';
+import FunnelIcon from '@phosphor/funnel-simple.svg';
import MagnifyingGlassIcon from '@phosphor/magnifying-glass.svg';
import XIcon from '@phosphor/x.svg';
import type { Favorite } from '@service-storage/generated/schemas/favorite';
-import { Button, cn, EmptyStatePanel, Hotkey, Tabs } from '@ui';
+import {
+ Button,
+ cn,
+ Dropdown,
+ EmptyStatePanel,
+ Hotkey,
+ Tabs,
+ Tooltip,
+} from '@ui';
import {
type Accessor,
createSignal,
@@ -23,8 +33,8 @@ import {
Switch,
} from 'solid-js';
import { Virtualizer } from 'virtua/solid';
-import type { ChannelsGroup } from '../../types';
-import { channelMentionsUser, isDirectMessage } from '../../utils';
+import type { ChannelListSort, ChannelsGroup } from '../../types';
+import { channelMentionsUser, formatDetailedTimestamp } from '../../utils';
import { ChannelsEmptyState } from '../ChannelsEmptyState';
import {
ChannelAvatar,
@@ -40,7 +50,6 @@ import {
domIdForRow,
rowKeyForChannel,
rowKeyForFavorite,
- rowKeyForSection,
useChannelsRail,
} from './ChannelsRailContext';
import {
@@ -103,6 +112,55 @@ const GROUPS: GroupConfig[] = [
},
];
+const CHANNEL_SORT_OPTIONS: {
+ value: ChannelListSort;
+ label: string;
+}[] = [
+ { value: 'viewed_at', label: 'Last viewed' },
+ { value: 'updated_at', label: 'Last updated' },
+ { value: 'created_at', label: 'Date created' },
+];
+
+function ChannelSortDropdown(props: { group: ChannelsGroup; label: string }) {
+ const rail = useChannelsRail();
+ const setSort = (value: string) => {
+ const option = CHANNEL_SORT_OPTIONS.find((item) => item.value === value);
+ if (option) rail.setSortBy(props.group, option.value);
+ };
+
+ return (
+ <Dropdown placement="bottom-end">
+ <Dropdown.Trigger
+ variant="ghost"
+ size="icon-sm"
+ class="size-7 rounded-lg"
+ label={`Sort ${props.label.toLowerCase()}`}
+ >
+ <FunnelIcon class="size-3.5" />
+ </Dropdown.Trigger>
+ <Dropdown.Content class="min-w-40">
+ <Dropdown.Group>
+ <Dropdown.RadioGroup
+ value={rail.sortBy(props.group)}
+ onChange={setSort}
+ >
+ <For each={CHANNEL_SORT_OPTIONS}>
+ {(option) => (
+ <Dropdown.RadioItem closeOnSelect value={option.value}>
+ <span class="flex-1">{option.label}</span>
+ <Dropdown.ItemIndicator>
+ <CheckIcon class="size-3.5 text-accent" />
+ </Dropdown.ItemIndicator>
+ </Dropdown.RadioItem>
+ )}
+ </For>
+ </Dropdown.RadioGroup>
+ </Dropdown.Group>
+ </Dropdown.Content>
+ </Dropdown>
+ );
+}
+
function FavoriteOption(props: { favorite: Favorite }) {
const rail = useChannelsRail();
const displayName = useFavoriteDisplayName(props.favorite);
@@ -131,7 +189,7 @@ function FavoriteOption(props: { favorite: Favorite }) {
onClick={() => rail.activateRow(rowKeyForFavorite(props.favorite))}
>
<span class="flex size-6 shrink-0 items-center justify-center">
- <FavoriteIcon favorite={props.favorite} class="size-4" />
+ <FavoriteIcon favorite={props.favorite} avatarSize="md" />
</span>
<span class="min-w-0 flex-1 truncate text-sm font-medium">
{displayName()}
@@ -143,6 +201,8 @@ function FavoriteOption(props: { favorite: Favorite }) {
function ChannelOption(props: { channel: ChannelEntity }) {
const rail = useChannelsRail();
const item = useChannelRailItemState(() => props.channel.id);
+ const timestamp = () =>
+ props.channel.latestRootMessage?.createdAt ?? props.channel.updatedAt;
return (
<ChannelRailItemContextMenu channel={props.channel} class="block w-full">
@@ -151,8 +211,7 @@ function ChannelOption(props: { channel: ChannelEntity }) {
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',
- isDirectMessage(props.channel) ? 'min-h-10 py-2' : 'h-8',
+ 'group/channel-option relative flex h-8 w-full min-w-0 items-center gap-2 rounded-xl px-2 text-left outline-none',
item().selected && !isTouchDevice() && 'bg-active text-ink',
(!item().selected || isTouchDevice()) && 'text-ink-muted',
!item().selected &&
@@ -174,20 +233,49 @@ function ChannelOption(props: { channel: ChannelEntity }) {
<span class="min-w-0 flex-1 truncate text-sm font-medium">
{props.channel.name}
</span>
- <ChannelMutedIndicator muted={item().muted} />
- <ChannelCallIndicator
- status={item().incomingCallId ? undefined : item().callStatus}
- />
+ <span class="flex shrink-0 items-center gap-2">
+ <ChannelMutedIndicator muted={item().muted} />
+ <ChannelCallIndicator
+ status={item().incomingCallId ? undefined : item().callStatus}
+ />
+ <Show when={item().unread}>
+ <span
+ aria-label="Unread"
+ class="size-2 shrink-0 rounded-full bg-accent"
+ />
+ </Show>
+ <Show when={!item().incomingCallId && timestamp()}>
+ {(value) => (
+ <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"
+ >
+ <Entity.Timestamp
+ entity={props.channel}
+ overrideTimeStamp={value()}
+ />
+ </span>
+ <Tooltip
+ label={formatDetailedTimestamp(value())}
+ placement="top"
+ class="absolute inset-0 flex items-center"
+ >
+ <span class="whitespace-nowrap text-xs font-light text-ink-extra-muted">
+ <Entity.Timestamp
+ entity={props.channel}
+ overrideTimeStamp={value()}
+ />
+ </span>
+ </Tooltip>
+ </span>
+ )}
+ </Show>
+ </span>
<IncomingCallActions
callId={item().incomingCallId}
channelId={props.channel.id}
/>
- <Show when={item().unread}>
- <span
- aria-label="Unread"
- class="size-2 shrink-0 rounded-full bg-accent"
- />
- </Show>
</div>
</ChannelRailItemContextMenu>
);
@@ -210,17 +298,22 @@ function ExpandedFavoritesSection() {
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"
+ 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}
- onClick={() => rail.activateRow(rowKeyForSection('favorites'))}
+ onMouseDown={(event) => {
+ if (!isPrimaryMouseDown(event)) return;
+ event.preventDefault();
+ rail.toggleGroup('favorites');
+ }}
>
+ <span class="min-w-0 truncate">Favorites</span>
<CaretDownIcon
class={cn(
- 'size-3 shrink-0 transition-transform',
- !section().open && '-rotate-90'
+ 'size-2.5 shrink-0 opacity-0 transition-[opacity,transform] group-hover/section-header:opacity-100 group-focus-within/section-header:opacity-100',
+ section().focused && 'opacity-100',
+ !section().open && '-rotate-90 opacity-100'
)}
/>
- <span class="min-w-0 truncate">Favorites</span>
</button>
</CollapsibleSection.Header>
<CollapsibleSection.Content
@@ -253,8 +346,6 @@ function ExpandedHeader(props: { search: ChannelRailSearch }) {
<ViewSidebar.Title>Chat</ViewSidebar.Title>
</div>
<SplitPanel.ControlGroup>
- <SplitPanel.BackButton />
- <SplitPanel.ForwardButton />
<RailModeButton expanded onToggle={() => rail.setMode('slim')} />
</SplitPanel.ControlGroup>
</ViewSidebar.Header>
@@ -415,34 +506,40 @@ function ExpandedGroupSection(props: { config: GroupConfig }) {
<CollapsibleSection.Header
focused={section().focused}
focusWithin={section().containsFocus}
- class="h-9 has-[[data-section-action]:hover]:bg-transparent has-[[data-section-action]:focus-within]:bg-transparent"
+ class="h-9"
>
<button
id={section().domId}
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"
+ 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;
- rail.activateRow(rowKeyForSection(props.config.group));
+ event.preventDefault();
+ rail.toggleGroup(props.config.group);
}}
>
+ <span class="min-w-0 truncate">{props.config.label}</span>
<CaretDownIcon
class={cn(
- 'size-3 shrink-0 transition-transform',
- !section().open && '-rotate-90'
+ 'size-2.5 shrink-0 opacity-0 transition-[opacity,transform] group-hover/section-header:opacity-100 group-focus-within/section-header:opacity-100',
+ section().focused && 'opacity-100',
+ !section().open && '-rotate-90 opacity-100'
)}
/>
- <span class="min-w-0 truncate">{props.config.label}</span>
<Show when={section().unreadCount > 0}>
<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().unreadCount}
</span>
</Show>
</button>
- <div data-section-action="" class="pr-1">
+ <div data-section-action="" class="flex items-center gap-0.5 pr-1">
+ <ChannelSortDropdown
+ group={props.config.group}
+ label={props.config.label}
+ />
<CreateRailAction
label={props.config.createLabel}
onClick={props.config.onCreate}
@@ -472,7 +569,7 @@ function ExpandedGroupSection(props: { config: GroupConfig }) {
ref={pagination.registerVirtualizer}
data={section().items}
scrollRef={scrollRoot()}
- itemSize={props.config.group === 'channels' ? 34 : 42}
+ itemSize={34}
bufferSize={240}
keepMounted={section().keepMounted}
onScroll={pagination.loadMoreNearEnd}
@@ -526,7 +623,7 @@ function ExpandedBrowse() {
<ChannelsEmptyState scope="channels" topAligned />
</Match>
<Match when={true}>
- <div class="flex h-full min-h-0 flex-col gap-3 px-4">
+ <div class="flex h-full min-h-0 flex-col gap-2 px-4">
<ExpandedFavoritesSection />
<For each={GROUPS}>
{(config) => <ExpandedGroupSection config={config} />}
diff --git a/apps/web/src/features/channels-view/components/rail/SlimChannelsRail.tsx b/apps/web/src/features/channels-view/components/rail/SlimChannelsRail.tsx
index f9c77f349c..2f523eca05 100644
--- a/apps/web/src/features/channels-view/components/rail/SlimChannelsRail.tsx
+++ b/apps/web/src/features/channels-view/components/rail/SlimChannelsRail.tsx
@@ -11,25 +11,29 @@ import { UserIcon } from '@core/component/UserIcon';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { type ChannelEntity, Entity } from '@entity';
import ChannelIcon from '@icon/wide-channel.svg';
+import { Popover } from '@kobalte/core/popover';
import ArrowClockwiseIcon from '@phosphor/arrow-clockwise.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 CheckIcon from '@phosphor/check.svg';
+import GearIcon from '@phosphor/gear.svg';
import PlusIcon from '@phosphor/plus.svg';
import StarIcon from '@phosphor/star.svg';
import type { Favorite } from '@service-storage/generated/schemas/favorite';
-import { Button, cn, Dropdown, Tabs, Tooltip } from '@ui';
+import { Button, cn, Dropdown, Layer, Tabs, ToggleSwitch, Tooltip } from '@ui';
import {
- type Component,
+ createMemo,
createSignal,
For,
Match,
+ onCleanup,
Show,
Switch,
} from 'solid-js';
-import { Dynamic } from 'solid-js/web';
-import { Virtualizer } from 'virtua/solid';
-import type { ChannelsGroup } from '../../types';
+import { Virtualizer, type VirtualizerHandle } from 'virtua/solid';
+import type { ChannelListSort, ChannelsGroup } from '../../types';
import { channelInitials, isDirectMessage } from '../../utils';
import {
ChannelCallIndicator,
@@ -41,7 +45,6 @@ import {
domIdForRow,
rowKeyForChannel,
rowKeyForFavorite,
- rowKeyForSection,
useChannelsRail,
} from './ChannelsRailContext';
import {
@@ -55,7 +58,6 @@ import {
useChannelRailFavoritesState,
useChannelRailItemState,
useChannelRailScopeState,
- useChannelRailSectionState,
useChannelRailVirtualizer,
} from './hooks/useChannelRailState';
@@ -86,21 +88,23 @@ const SLIM_CHANNEL_TABS = [
{ value: 'recents', label: RecentTabLabel },
];
-type GroupConfig = {
+const SLIM_GROUPS: {
group: ChannelsGroup;
label: string;
- icon: Component;
-};
-
-const GROUPS: GroupConfig[] = [
- { group: 'channels', label: 'Channels', icon: ChannelIcon },
- {
- group: 'direct_messages',
- label: 'DMs',
- icon: ChatTeardropIcon,
- },
+}[] = [
+ { group: 'channels', label: 'Channels' },
+ { group: 'direct_messages', label: 'DMs' },
];
+const SLIM_SORT_OPTIONS: { value: ChannelListSort; label: string }[] = [
+ { value: 'viewed_at', label: 'Last viewed' },
+ { value: 'updated_at', label: 'Last updated' },
+ { value: 'created_at', label: 'Date created' },
+];
+
+const SLIM_ROW_HEIGHT = 42;
+const LOAD_MORE_THRESHOLD = 300;
+
function SlimFavoriteAvatar(props: {
favorite: Favorite;
displayName: () => string;
@@ -148,21 +152,24 @@ function SlimFavoriteItem(props: { favorite: Favorite }) {
role="treeitem"
tabIndex={-1}
class={cn(
- 'flex size-10 items-center justify-center rounded-full text-left outline-none transition-colors',
- item().selected && !isTouchDevice() && 'bg-active text-ink',
- (!item().selected || isTouchDevice()) && 'text-ink-muted',
+ 'relative flex size-10 items-center justify-center rounded-full text-left outline-none transition-colors',
+ item().selected && 'text-ink',
+ !item().selected && 'text-ink-muted',
+ !item().selected && !isTouchDevice() && item().focused && 'text-ink',
!item().selected &&
!isTouchDevice() &&
- item().focused &&
- 'bg-hover text-ink',
- !item().selected &&
- !isTouchDevice() &&
- !item().focused &&
'hover:bg-hover hover:text-ink'
)}
aria-current={item().selected ? 'page' : undefined}
onClick={() => rail.activateRow(rowKeyForFavorite(props.favorite))}
>
+ <span
+ aria-hidden="true"
+ class={cn(
+ 'absolute -left-3 top-1/2 z-1 h-3 w-1 -translate-y-1/2 rounded-r-full bg-ink transition-[opacity,transform] duration-150 ease-out motion-reduce:transition-none',
+ item().selected ? 'scale-y-100 opacity-100' : 'scale-y-90 opacity-0'
+ )}
+ />
<SlimFavoriteAvatar
favorite={props.favorite}
displayName={displayName}
@@ -196,22 +203,32 @@ function SlimFavoritesSection() {
<Show when={section().items.length > 0}>
<CollapsibleSection.Root open={section().open} class="items-center">
<CollapsibleSection.Header
- focused={section().focused}
+ focused={false}
focusWithin={section().containsFocus}
class="h-10 justify-center"
>
- <button
- id={section().domId}
- type="button"
- role="treeitem"
- tabIndex={-1}
- class="relative flex size-10 min-w-10 flex-none items-center justify-center rounded-full outline-none"
- aria-expanded={section().open}
- aria-label="Favorites"
- onClick={() => rail.activateRow(rowKeyForSection('favorites'))}
+ <Tooltip
+ label={`Favorites (${section().open ? 'expanded' : 'collapsed'})`}
+ placement="right"
+ class="size-10"
>
- <StarIcon class="size-4" />
- </button>
+ <button
+ id={section().domId}
+ type="button"
+ role="treeitem"
+ tabIndex={-1}
+ class="relative flex size-10 min-w-10 flex-none items-center justify-center rounded-full outline-none"
+ aria-expanded={section().open}
+ aria-label="Favorites"
+ onMouseDown={(event) => {
+ if (!isPrimaryMouseDown(event)) return;
+ event.preventDefault();
+ rail.toggleGroup('favorites');
+ }}
+ >
+ <StarIcon class="size-4" />
+ </button>
+ </Tooltip>
</CollapsibleSection.Header>
<CollapsibleSection.Content
open={section().open}
@@ -269,16 +286,15 @@ function SlimChannelItem(props: { channel: ChannelEntity }) {
role="treeitem"
tabIndex={-1}
class={cn(
- 'flex size-10 items-center justify-center rounded-full text-left outline-none',
- item().selected && !isTouchDevice() && 'bg-active text-ink',
- (!item().selected || isTouchDevice()) && 'text-ink-muted',
+ 'relative flex size-10 items-center justify-center rounded-full text-left outline-none',
+ item().selected && 'text-ink',
+ !item().selected && 'text-ink-muted',
!item().selected &&
!isTouchDevice() &&
item().focused &&
- 'bg-hover text-ink',
+ 'text-ink',
!item().selected &&
!isTouchDevice() &&
- !item().focused &&
'hover:bg-hover hover:text-ink'
)}
aria-current={item().selected ? 'page' : undefined}
@@ -287,6 +303,15 @@ function SlimChannelItem(props: { channel: ChannelEntity }) {
rail.activateRow(rowKeyForChannel(props.channel.id));
}}
>
+ <span
+ aria-hidden="true"
+ class={cn(
+ 'absolute -left-3 top-1/2 z-1 h-3 w-1 -translate-y-1/2 rounded-r-full bg-ink transition-[opacity,transform] duration-150 ease-out motion-reduce:transition-none',
+ item().selected
+ ? 'scale-y-100 opacity-100'
+ : 'scale-y-90 opacity-0'
+ )}
+ />
<span class="relative">
<SlimChannelAvatar channel={props.channel} />
<Show
@@ -355,12 +380,8 @@ function SlimHeader() {
return (
<div class="flex shrink-0 flex-col items-center gap-3 pt-2">
- <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">
+ <div class="flex h-8 w-full items-center justify-center px-1">
+ <SplitPanel.CloseButton size="icon-sm" />
<RailModeButton
expanded={false}
onToggle={() => rail.setMode('full')}
@@ -387,115 +408,137 @@ function SlimHeader() {
);
}
-function SlimGroupSection(props: { config: GroupConfig }) {
+function SlimBrowseConversations() {
const rail = useChannelsRail();
const [scrollRoot, setScrollRoot] = createSignal<HTMLDivElement>();
+ const [virtualizer, setVirtualizer] = createSignal<VirtualizerHandle>();
const forceEmptyState = useDebugSetting(
DEBUG_SETTING_KEYS.FORCE_EMPTY_STATES
);
- const { state: section } = useChannelRailSectionState(
- () => props.config.group
- );
- const pagination = useChannelRailVirtualizer(() => props.config.group);
- const registerScrollRef = (element: HTMLDivElement) => {
+ const channels = useChannelRailScopeState(() => 'channels');
+ const directMessages = useChannelRailScopeState(() => 'direct_messages');
+ const channelItems = () =>
+ rail.slimGroupEnabled('channels') ? channels().items : [];
+ const directMessageItems = () =>
+ rail.slimGroupEnabled('direct_messages') ? directMessages().items : [];
+ const items = createMemo(() => [...channelItems(), ...directMessageItems()]);
+ const keepMounted = createMemo(() => {
+ const indexes = rail.slimGroupEnabled('channels')
+ ? [...(channels().keepMounted ?? [])]
+ : [];
+ if (rail.slimGroupEnabled('direct_messages')) {
+ const offset = channelItems().length;
+ indexes.push(
+ ...(directMessages().keepMounted ?? []).map((index) => offset + index)
+ );
+ }
+ return indexes.length > 0 ? [...new Set(indexes)] : undefined;
+ });
+
+ let unregisterVirtualizers: (() => void)[] = [];
+ const registerVirtualizer = (handle?: VirtualizerHandle) => {
+ for (const unregister of unregisterVirtualizers) unregister();
+ unregisterVirtualizers = [];
+ setVirtualizer(handle);
+ if (!handle) return;
+
+ unregisterVirtualizers = SLIM_GROUPS.map(({ group }) =>
+ rail.registerVirtualizer(group, handle)
+ );
+ };
+ onCleanup(() => {
+ for (const unregister of unregisterVirtualizers) unregister();
+ });
+
+ const registerScrollRoot = (element: HTMLDivElement) => {
setScrollRoot(element);
- rail.registerScrollRef(props.config.group, element);
+ for (const { group } of SLIM_GROUPS) {
+ rail.registerScrollRef(group, element);
+ }
+ };
+ const visibleGroups = () =>
+ SLIM_GROUPS.filter(({ group }) => rail.slimGroupEnabled(group));
+ const isInitialLoading = () =>
+ items().length === 0 &&
+ visibleGroups().some(({ group }) => rail.sources[group].isLoading());
+ const hasError = () =>
+ visibleGroups().some(({ group }) => rail.sources[group].error());
+ const isLoadingMore = () =>
+ visibleGroups().some(({ group }) => rail.sources[group].isLoadingMore());
+ const retry = async () => {
+ await Promise.all(
+ visibleGroups().map(({ group }) => rail.sources[group].refresh())
+ );
+ };
+ const loadMoreNearEnd = (offset?: number) => {
+ const handle = virtualizer();
+ if (!handle) return;
+
+ const viewportEnd = (offset ?? handle.scrollOffset) + handle.viewportSize;
+ let groupEnd = 0;
+ for (const { group } of visibleGroups()) {
+ const source = rail.sources[group];
+ groupEnd += source.items().length * SLIM_ROW_HEIGHT;
+ if (
+ groupEnd - viewportEnd > LOAD_MORE_THRESHOLD ||
+ source.isLoadingMore() ||
+ !source.hasMore()
+ ) {
+ continue;
+ }
+ void source.loadMore();
+ }
};
return (
- <CollapsibleSection.Root
- open={section().open}
- fillAvailable={section().fillAvailable}
- class="items-center"
- >
- <CollapsibleSection.Header
- focused={section().focused}
- focusWithin={section().containsFocus}
- class="h-10 justify-center"
- >
- <button
- id={section().domId}
- type="button"
- role="treeitem"
- tabIndex={-1}
- class="relative flex size-10 min-w-10 flex-none items-center justify-center rounded-full outline-none"
- aria-expanded={section().open}
- aria-label={props.config.label}
- onMouseDown={(event) => {
- if (!isPrimaryMouseDown(event)) return;
- rail.activateRow(rowKeyForSection(props.config.group));
- }}
+ <Switch>
+ <Match when={forceEmptyState()}>{null}</Match>
+ <Match when={isInitialLoading()}>
+ <RailListLoading />
+ </Match>
+ <Match when={hasError() && items().length === 0}>
+ <SlimListError retry={retry} />
+ </Match>
+ <Match when={items().length > 0}>
+ <div
+ ref={registerScrollRoot}
+ class="scrollbar-hidden size-full min-h-0 overflow-y-auto"
+ aria-busy={isLoadingMore()}
>
- <span class="flex items-center justify-center [&_svg]:size-4">
- <Dynamic component={props.config.icon} />
- </span>
- <Show when={section().unreadCount > 0}>
- <span class="absolute right-0 top-0 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 ring-2 ring-surface">
- {section().unreadCount}
- </span>
- </Show>
- </button>
- </CollapsibleSection.Header>
- <CollapsibleSection.Content
- open={section().open}
- contentRef={registerScrollRef}
- containerClass="w-full"
- class="flex min-h-0 w-full flex-col items-center gap-0.5"
- activityTargetId={section().targetId}
- activityTooltip
- >
- <Switch>
- <Match when={forceEmptyState()}>{null}</Match>
- <Match
- when={section().source.isLoading() && section().items.length === 0}
- >
- <RailListLoading />
- </Match>
- <Match
- when={section().source.error() && section().items.length === 0}
+ <Virtualizer
+ ref={registerVirtualizer}
+ data={items()}
+ scrollRef={scrollRoot()}
+ itemSize={SLIM_ROW_HEIGHT}
+ bufferSize={240}
+ keepMounted={keepMounted()}
+ onScroll={loadMoreNearEnd}
>
- <SlimListError retry={section().source.refresh} />
- </Match>
- <Match when={section().items.length > 0}>
- <Virtualizer
- ref={pagination.registerVirtualizer}
- data={section().items}
- scrollRef={scrollRoot()}
- itemSize={42}
- bufferSize={240}
- keepMounted={section().keepMounted}
- onScroll={pagination.loadMoreNearEnd}
- >
- {(channel) => (
- <div class="flex justify-center pb-0.5">
- <SlimChannelItem channel={channel} />
- </div>
- )}
- </Virtualizer>
- <Show when={section().source.isLoadingMore()}>
- <RailListLoadingMore variant="slim" />
- </Show>
- <Show
- when={
- section().source.error() && !section().source.isLoadingMore()
- }
- >
- <SlimListError retry={section().source.refresh} />
- </Show>
- </Match>
- </Switch>
- </CollapsibleSection.Content>
- </CollapsibleSection.Root>
+ {(channel) => (
+ <div class="flex justify-center pb-0.5">
+ <SlimChannelItem channel={channel} />
+ </div>
+ )}
+ </Virtualizer>
+ <Show when={isLoadingMore()}>
+ <RailListLoadingMore variant="slim" />
+ </Show>
+ <Show when={hasError() && !isLoadingMore()}>
+ <SlimListError retry={retry} />
+ </Show>
+ </div>
+ </Match>
+ </Switch>
);
}
function SlimBrowse() {
return (
- <div class="flex h-full min-h-0 flex-col gap-3 px-2">
+ <div class="flex h-full min-h-0 flex-col gap-2">
<SlimFavoritesSection />
- <For each={GROUPS}>
- {(config) => <SlimGroupSection config={config} />}
- </For>
+ <div class="min-h-0 flex-1">
+ <SlimBrowseConversations />
+ </div>
</div>
);
}
@@ -552,6 +595,112 @@ function SlimRecents() {
);
}
+function SlimSortDropdown(props: { group: ChannelsGroup; label: string }) {
+ const rail = useChannelsRail();
+ const selected = () =>
+ SLIM_SORT_OPTIONS.find(
+ (option) => option.value === rail.sortBy(props.group)
+ );
+ const setSort = (value: string) => {
+ const option = SLIM_SORT_OPTIONS.find((item) => item.value === value);
+ if (option) rail.setSortBy(props.group, option.value);
+ };
+
+ return (
+ <Dropdown placement="right-start">
+ <Dropdown.Trigger
+ variant="ghost"
+ size="sm"
+ class="h-7 min-w-28 justify-between gap-1 rounded-lg px-2 text-sm font-normal"
+ aria-label={`Sort ${props.label.toLowerCase()}`}
+ >
+ <span class="truncate">{selected()?.label}</span>
+ <CaretDownIcon class="size-2.5 shrink-0" />
+ </Dropdown.Trigger>
+ <Dropdown.Content class="min-w-36">
+ <Dropdown.Group>
+ <Dropdown.RadioGroup
+ value={rail.sortBy(props.group)}
+ onChange={setSort}
+ >
+ <For each={SLIM_SORT_OPTIONS}>
+ {(option) => (
+ <Dropdown.RadioItem closeOnSelect value={option.value}>
+ <span class="flex-1">{option.label}</span>
+ <Dropdown.ItemIndicator>
+ <CheckIcon class="size-3.5 text-accent" />
+ </Dropdown.ItemIndicator>
+ </Dropdown.RadioItem>
+ )}
+ </For>
+ </Dropdown.RadioGroup>
+ </Dropdown.Group>
+ </Dropdown.Content>
+ </Dropdown>
+ );
+}
+
+function SlimRailSettings() {
+ const rail = useChannelsRail();
+
+ return (
+ <footer class="flex h-12 shrink-0 items-center justify-center border-t border-edge-muted px-2">
+ <Popover placement="right-end" gutter={8}>
+ <Popover.Trigger
+ as={Button}
+ variant="ghost"
+ size="icon-md"
+ class="rounded-lg data-expanded:bg-active data-expanded:text-ink"
+ label="Chat rail settings"
+ >
+ <GearIcon class="size-4" />
+ </Popover.Trigger>
+ <Popover.Portal>
+ <Layer depth={3}>
+ <Popover.Content
+ class="portal-scope z-action-menu w-56 overflow-hidden rounded-xl border border-edge bg-menu-glass text-sm [--color-surface:var(--color-menu)] glass menu-open-animation"
+ onOpenAutoFocus={(event) => event.preventDefault()}
+ onCloseAutoFocus={(event) => event.preventDefault()}
+ >
+ <Popover.Title class="sr-only">Chat rail settings</Popover.Title>
+ <div class="flex size-full flex-col gap-(--app-border-width) bg-edge-muted/60">
+ <For each={SLIM_GROUPS}>
+ {(config) => (
+ <section class="flex flex-col bg-menu p-1.5">
+ <h3 class="flex h-7 items-center px-2 text-xs font-normal text-ink-extra-muted">
+ {config.label}
+ </h3>
+ <div class="flex h-8 items-center justify-between gap-3 rounded-lg px-2 font-normal text-ink">
+ <span>Visible</span>
+ <ToggleSwitch
+ size="xs"
+ checked={rail.slimGroupEnabled(config.group)}
+ onChange={(enabled) =>
+ rail.setSlimGroupEnabled(config.group, enabled)
+ }
+ label={`Show ${config.label.toLowerCase()}`}
+ labelClass="sr-only"
+ />
+ </div>
+ <div class="flex h-8 items-center justify-between gap-3 rounded-lg px-2 font-normal text-ink">
+ <span>Sort by</span>
+ <SlimSortDropdown
+ group={config.group}
+ label={config.label}
+ />
+ </div>
+ </section>
+ )}
+ </For>
+ </div>
+ </Popover.Content>
+ </Layer>
+ </Popover.Portal>
+ </Popover>
+ </footer>
+ );
+}
+
export function SlimChannelsRail() {
const rail = useChannelsRail();
const activeDescendant = () => {
@@ -580,6 +729,7 @@ export function SlimChannelsRail() {
</Switch>
</div>
</div>
+ <SlimRailSettings />
</>
);
}
diff --git a/apps/web/src/features/channels-view/constants.ts b/apps/web/src/features/channels-view/constants.ts
index 2689a6e7ad..e6c06686b0 100644
--- a/apps/web/src/features/channels-view/constants.ts
+++ b/apps/web/src/features/channels-view/constants.ts
@@ -1,8 +1,20 @@
+import type { ChannelListSort, ChannelsGroup } from './types';
+
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 const CHANNELS_DEFAULT_SORT_BY = {
+ channels: 'updated_at',
+ direct_messages: 'updated_at',
+} satisfies Record<ChannelsGroup, ChannelListSort>;
+
+export const CHANNELS_DEFAULT_SLIM_GROUPS = {
+ channels: true,
+ direct_messages: true,
+} satisfies Record<ChannelsGroup, boolean>;
+
export function clampChannelsRailWidth(width: number): number {
if (!Number.isFinite(width)) return CHANNELS_DEFAULT_RAIL_WIDTH;
diff --git a/apps/web/src/features/channels-view/persistence.ts b/apps/web/src/features/channels-view/persistence.ts
index f88eee1f44..e72c8c7653 100644
--- a/apps/web/src/features/channels-view/persistence.ts
+++ b/apps/web/src/features/channels-view/persistence.ts
@@ -11,6 +11,8 @@ import type { Accessor } from 'solid-js';
import { z } from 'zod';
import {
CHANNELS_DEFAULT_RAIL_WIDTH,
+ CHANNELS_DEFAULT_SLIM_GROUPS,
+ CHANNELS_DEFAULT_SORT_BY,
clampChannelsRailWidth,
} from './constants';
import type { ChannelsViewState } from './types';
@@ -78,6 +80,24 @@ const channelsPreferencesSchema = z.object({
.default(CHANNELS_DEFAULT_RAIL_WIDTH)
.transform(clampChannelsRailWidth),
railMode: z.enum(['auto', 'full', 'slim']).default('auto'),
+ sortBy: z
+ .object({
+ channels: z
+ .enum(['viewed_at', 'updated_at', 'created_at'])
+ .default(CHANNELS_DEFAULT_SORT_BY.channels),
+ direct_messages: z
+ .enum(['viewed_at', 'updated_at', 'created_at'])
+ .default(CHANNELS_DEFAULT_SORT_BY.direct_messages),
+ })
+ .default(CHANNELS_DEFAULT_SORT_BY),
+ slimGroups: z
+ .object({
+ channels: z.boolean().default(CHANNELS_DEFAULT_SLIM_GROUPS.channels),
+ direct_messages: z
+ .boolean()
+ .default(CHANNELS_DEFAULT_SLIM_GROUPS.direct_messages),
+ })
+ .default(CHANNELS_DEFAULT_SLIM_GROUPS),
});
type ChannelsPreferences = z.infer<typeof channelsPreferencesSchema>;
@@ -86,6 +106,8 @@ const DEFAULT_CHANNELS_PREFERENCES = {
version: 1,
asideWidth: CHANNELS_DEFAULT_RAIL_WIDTH,
railMode: 'auto',
+ sortBy: CHANNELS_DEFAULT_SORT_BY,
+ slimGroups: CHANNELS_DEFAULT_SLIM_GROUPS,
} satisfies ChannelsPreferences;
function selectEntryState(state: ChannelsViewState): ChannelsEntryState {
@@ -182,6 +204,8 @@ function createChannelsPreferencesStorage(options: {
version: 1,
asideWidth: clampChannelsRailWidth(state.asideWidth),
railMode: state.railMode,
+ sortBy: state.sortBy,
+ slimGroups: state.slimGroups,
} satisfies ChannelsPreferences);
return {
@@ -204,12 +228,16 @@ function createChannelsPreferencesStorage(options: {
...current,
asideWidth: restored.asideWidth,
railMode: restored.railMode,
+ sortBy: restored.sortBy,
+ slimGroups: restored.slimGroups,
};
} catch {
return {
...current,
asideWidth: DEFAULT_CHANNELS_PREFERENCES.asideWidth,
railMode: DEFAULT_CHANNELS_PREFERENCES.railMode,
+ sortBy: DEFAULT_CHANNELS_PREFERENCES.sortBy,
+ slimGroups: DEFAULT_CHANNELS_PREFERENCES.slimGroups,
};
}
},
diff --git a/apps/web/src/features/channels-view/queries.ts b/apps/web/src/features/channels-view/queries.ts
index 6aa9d25cd1..8a31af31db 100644
--- a/apps/web/src/features/channels-view/queries.ts
+++ b/apps/web/src/features/channels-view/queries.ts
@@ -12,7 +12,11 @@ import {
useSoupAstItemsQuery,
} from '@queries/soup/items';
import { type Accessor, createMemo } from 'solid-js';
-import type { ChannelsQueryScope } from './types';
+import type {
+ ChannelListSort,
+ ChannelsGroup,
+ ChannelsQueryScope,
+} from './types';
import { channelHasMessages, isDirectMessage } from './utils';
const CHANNELS_QUERY_PARAMS = {
@@ -70,12 +74,16 @@ export const CHANNELS_QUERY_DEFINITIONS = {
} satisfies Record<ChannelsSourceScope, ChannelsQueryDefinition>;
export function channelsQueryArgs(
- scope: ChannelsSourceScope
+ scope: ChannelsSourceScope,
+ sortMethod?: ChannelListSort
): SoupAstItemsQueryArgs {
const definition = CHANNELS_QUERY_DEFINITIONS[scope];
return {
- params: definition.params,
+ params: {
+ ...definition.params,
+ sort_method: sortMethod ?? definition.params.sort_method,
+ },
body: compileToAst(queryStateFrom(definition.filters)),
};
}
@@ -138,10 +146,11 @@ export function resolveSelectedChannel(
function useChannelsDataSource(
scope: ChannelsSourceScope,
- enabled: Accessor<boolean>
+ enabled: Accessor<boolean>,
+ sortMethod: Accessor<ChannelListSort | undefined>
): ChannelsDataSource {
const query = useSoupAstItemsQuery(
- () => channelsQueryArgs(scope),
+ () => channelsQueryArgs(scope, sortMethod()),
() => ({ enabled: enabled(), staleTime: 30_000 })
);
const items = createMemo<ChannelEntity[]>((previous) => {
@@ -152,11 +161,20 @@ function useChannelsDataSource(
(query.data?.entities ?? []).filter(isChannelEntity)
);
- if (scope !== 'direct_messages' && scope !== 'search') return channels;
+ if (scope === 'recents') return channels;
+
+ const activeSort =
+ sortMethod() ?? CHANNELS_QUERY_DEFINITIONS[scope].params.sort_method;
+ const sortDate = (channel: ChannelEntity) =>
+ activeSort === 'created_at'
+ ? channel.createdAt
+ : activeSort === 'viewed_at'
+ ? channel.viewedAt
+ : channel.updatedAt;
return channels
.slice()
- .sort((left, right) => compareDateDesc(left.updatedAt, right.updatedAt));
+ .sort((left, right) => compareDateDesc(sortDate(left), sortDate(right)));
}, []);
return {
@@ -181,15 +199,30 @@ function useChannelsDataSource(
}
export function useChannelsSources(
- enabled: (scope: ChannelsSourceScope) => boolean
+ enabled: (scope: ChannelsSourceScope) => boolean,
+ sortBy: (group: ChannelsGroup) => ChannelListSort
): ChannelsSources {
return {
- channels: useChannelsDataSource('channels', () => enabled('channels')),
- direct_messages: useChannelsDataSource('direct_messages', () =>
- enabled('direct_messages')
+ channels: useChannelsDataSource(
+ 'channels',
+ () => enabled('channels'),
+ () => sortBy('channels')
+ ),
+ direct_messages: useChannelsDataSource(
+ 'direct_messages',
+ () => enabled('direct_messages'),
+ () => sortBy('direct_messages')
+ ),
+ recents: useChannelsDataSource(
+ 'recents',
+ () => enabled('recents'),
+ () => undefined
+ ),
+ search: useChannelsDataSource(
+ 'search',
+ () => enabled('search'),
+ () => undefined
),
- recents: useChannelsDataSource('recents', () => enabled('recents')),
- search: useChannelsDataSource('search', () => enabled('search')),
};
}
diff --git a/apps/web/src/features/channels-view/types.ts b/apps/web/src/features/channels-view/types.ts
index f4f9d2b56a..6aef8f7878 100644
--- a/apps/web/src/features/channels-view/types.ts
+++ b/apps/web/src/features/channels-view/types.ts
@@ -2,6 +2,8 @@ export type ChannelsTab = 'browse' | 'recents';
export type ChannelsGroup = 'channels' | 'direct_messages';
+export type ChannelListSort = 'viewed_at' | 'updated_at' | 'created_at';
+
export type ChannelsRailSection = 'favorites' | ChannelsGroup;
export type ChannelsQueryScope = ChannelsGroup | 'recents';
@@ -13,12 +15,16 @@ export type ChannelsViewState = {
mobileTab: ChannelsQueryScope;
selectedChannelId?: string;
expandedGroups: Record<ChannelsRailSection, boolean>;
+ sortBy: Record<ChannelsGroup, ChannelListSort>;
+ slimGroups: Record<ChannelsGroup, boolean>;
asideWidth: number;
railMode: ChannelsRailMode;
};
export type ChannelsViewStateOptions = Partial<
- Omit<ChannelsViewState, 'expandedGroups'>
+ Omit<ChannelsViewState, 'expandedGroups' | 'sortBy' | 'slimGroups'>
> & {
expandedGroups?: Partial<ChannelsViewState['expandedGroups']>;
+ sortBy?: Partial<ChannelsViewState['sortBy']>;
+ slimGroups?: Partial<ChannelsViewState['slimGroups']>;
};
diff --git a/apps/web/src/features/email-view/components/EmailHeader.tsx b/apps/web/src/features/email-view/components/EmailHeader.tsx
index e856b0829b..4a02f13b06 100644
--- a/apps/web/src/features/email-view/components/EmailHeader.tsx
+++ b/apps/web/src/features/email-view/components/EmailHeader.tsx
@@ -61,8 +61,6 @@ export function EmailHeader(props: EmailHeaderProps) {
<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>
{/* Sidebar stand-in while the aside is collapsed: the tab menu, the
diff --git a/apps/web/src/features/email-view/components/EmailSidebar.tsx b/apps/web/src/features/email-view/components/EmailSidebar.tsx
index 4927d94549..236ac4aa5c 100644
--- a/apps/web/src/features/email-view/components/EmailSidebar.tsx
+++ b/apps/web/src/features/email-view/components/EmailSidebar.tsx
@@ -90,10 +90,6 @@ export function EmailSidebar() {
<SplitPanel.CloseButton />
<ViewSidebar.Title>Email</ViewSidebar.Title>
</div>
- <SplitPanel.ControlGroup>
- <SplitPanel.BackButton />
- <SplitPanel.ForwardButton />
- </SplitPanel.ControlGroup>
</ViewSidebar.Header>
<ViewSidebar.Content class="flex flex-col gap-6">
diff --git a/apps/web/src/features/favorites/FavoriteIcon.tsx b/apps/web/src/features/favorites/FavoriteIcon.tsx
index 1066281c4b..0dc0bd7f4b 100644
--- a/apps/web/src/features/favorites/FavoriteIcon.tsx
+++ b/apps/web/src/features/favorites/FavoriteIcon.tsx
@@ -3,7 +3,7 @@ import {
useFavoriteDmRecipientId,
} from '@app/util/favorites';
import { EntityIcon } from '@core/component/EntityIcon';
-import { UserIcon } from '@core/component/UserIcon';
+import { UserIcon, type UserIconSize } from '@core/component/UserIcon';
import type { Favorite } from '@service-storage/generated/schemas/favorite';
import { Show } from 'solid-js';
@@ -15,7 +15,11 @@ import { Show } from 'solid-js';
* The favorite's identity must be stable for the component's lifetime
* (favorites lists key rows by entity, so it is).
*/
-export function FavoriteIcon(props: { favorite: Favorite; class?: string }) {
+export function FavoriteIcon(props: {
+ favorite: Favorite;
+ avatarSize?: UserIconSize;
+ class?: string;
+}) {
const dmRecipientId = useFavoriteDmRecipientId(props.favorite);
return (
<Show
@@ -31,7 +35,7 @@ export function FavoriteIcon(props: { favorite: Favorite; class?: string }) {
{(recipientId) => (
<UserIcon
id={recipientId()}
- size="sm"
+ size={props.avatarSize ?? 'sm'}
suppressClick
showTooltip={false}
class={props.class}
diff --git a/apps/web/src/features/inbox-view/components/InboxHeader.tsx b/apps/web/src/features/inbox-view/components/InboxHeader.tsx
index 5cb03aa7c4..6a501db905 100644
--- a/apps/web/src/features/inbox-view/components/InboxHeader.tsx
+++ b/apps/web/src/features/inbox-view/components/InboxHeader.tsx
@@ -10,8 +10,6 @@ function InboxHeader(props: ParentProps) {
<div class="flex items-center">
<SplitPanel.ControlGroup>
<SplitPanel.CloseButton />
- <SplitPanel.BackButton />
- <SplitPanel.ForwardButton />
</SplitPanel.ControlGroup>
</div>
</Show>
diff --git a/apps/web/src/features/property/tags/SidebarTagsSection.tsx b/apps/web/src/features/property/tags/SidebarTagsSection.tsx
index 8c0c7c8a7f..679ff52c61 100644
--- a/apps/web/src/features/property/tags/SidebarTagsSection.tsx
+++ b/apps/web/src/features/property/tags/SidebarTagsSection.tsx
@@ -52,16 +52,15 @@ export function SidebarTagsSection(props: SidebarTagsSectionProps) {
>
<div class="flex items-center gap-1">
<CollapsibleSection.Trigger class="min-w-0 flex-1 text-xs">
- <CollapsibleSection.Indicator class="ml-0" />
- <span class="truncate">Tags</span>
+ <span class="min-w-0 truncate">Tags</span>
+ <CollapsibleSection.Indicator />
</CollapsibleSection.Trigger>
<Button
type="button"
variant="ghost"
size="icon-sm"
label="New tag"
- // Right edge inset so the plus centres on the trailing caret of other sections.
- class="mr-2 shrink-0 rounded-lg"
+ class="ml-auto mr-2 shrink-0 rounded-lg"
onClick={() => setCreating(true)}
>
<PlusIcon class="size-3.5" />
diff --git a/apps/web/src/features/tasks-view/components/TasksHeader.tsx b/apps/web/src/features/tasks-view/components/TasksHeader.tsx
index 63c8ef4ddb..36c4acdc8e 100644
--- a/apps/web/src/features/tasks-view/components/TasksHeader.tsx
+++ b/apps/web/src/features/tasks-view/components/TasksHeader.tsx
@@ -66,8 +66,6 @@ export function TasksHeader(props: TasksHeaderProps) {
<div class="hidden items-center @max-[720px]/view-shell:flex">
<SplitPanel.ControlGroup>
<SplitPanel.CloseButton />
- <SplitPanel.BackButton />
- <SplitPanel.ForwardButton />
</SplitPanel.ControlGroup>
</div>
diff --git a/apps/web/src/features/tasks-view/components/TasksSidebar.tsx b/apps/web/src/features/tasks-view/components/TasksSidebar.tsx
index df39e66bd3..84ed8b0cb6 100644
--- a/apps/web/src/features/tasks-view/components/TasksSidebar.tsx
+++ b/apps/web/src/features/tasks-view/components/TasksSidebar.tsx
@@ -109,8 +109,8 @@ function TaskFavorites(props: {
onOpenChange={props.onOpenChange}
>
<CollapsibleSection.Trigger class="text-xs">
- <CollapsibleSection.Indicator class="order-first ml-0" />
- <span class="truncate">Favorites</span>
+ <span class="min-w-0 truncate">Favorites</span>
+ <CollapsibleSection.Indicator />
</CollapsibleSection.Trigger>
<CollapsibleSection.Content>
<ViewSidebar.Nav aria-label="Favorite tasks">
@@ -156,10 +156,6 @@ export function TasksSidebar() {
<SplitPanel.CloseButton />
<ViewSidebar.Title>Tasks</ViewSidebar.Title>
</div>
- <SplitPanel.ControlGroup>
- <SplitPanel.BackButton />
- <SplitPanel.ForwardButton />
- </SplitPanel.ControlGroup>
</ViewSidebar.Header>
<ViewSidebar.Content class="flex flex-col gap-6">
diff --git a/docs/AGENT_GUIDE/channels.md b/docs/AGENT_GUIDE/channels.md
index 9ea777a1cd..5519d6e491 100644
--- a/docs/AGENT_GUIDE/channels.md
+++ b/docs/AGENT_GUIDE/channels.md
@@ -203,8 +203,19 @@ artwork and wraps long queries.
Collapsing a section does not discard its loaded pages. Recent has its own
pagination cursor. Each list is virtualized, so offscreen conversations may not
exist in the DOM.
-Rows and section headers act on primary-button mousedown, so the selection
-and highlight change before the click completes; a normal click still works.
+Channels and DMs each have a sort action before their create action. They can be
+sorted by last viewed, last updated, or date created, and each choice persists
+independently as a user preference.
+In slim mode, Favorites remains a separate collapsible section, while Channels
+and DMs render in one continuous list without section headings. The gear action
+in the footer controls whether each group appears and exposes the same
+independently persisted sort choices.
+Compact channel and DM rows in All have the same height. Section headings place
+their caret immediately after the title and reveal it on hover or while the
+section is collapsed; hovering only undims the heading text, while
+keyboard-focusing the heading with Arrow keys or `j` / `k` gives it a background.
+Clicking a section heading toggles it without moving the keyboard highlight;
+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