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.

chore(web): remove the new app views flag and legacy sidebar (#7059)

dev-rb68059f212872
diff --git a/apps/web/src/components/app/ItemDragAndDrop.tsx b/apps/web/src/components/app/ItemDragAndDrop.tsx
index 6f98d24cd3..40b6fe5898 100644
--- a/apps/web/src/components/app/ItemDragAndDrop.tsx
+++ b/apps/web/src/components/app/ItemDragAndDrop.tsx
@@ -4,7 +4,6 @@ import {
getEntityIconType,
} from '@core/component/EntityIcon';
import { TruncatedText } from '@core/component/FileList/TruncatedText';
-import { UserIcon } from '@core/component/UserIcon';
import type { EntityDragData } from '@entity';
import {
DragDropProvider,
@@ -48,23 +47,15 @@ function ItemDragOverlay() {
const iconType = createMemo((): EntityIconSelector => {
const data = activeDraggable()?.data;
if (!data) return 'default';
- // Favorite sortables carry a precomputed icon type (see FavoriteDragData
- // in app-sidebar/favorites-section) instead of an entity shape.
- if (data.dragType === 'favorite' || data.dragType === 'channel-label') {
+ // Channel label drags carry a precomputed icon type (see
+ // ChannelLabelDragData) instead of an entity shape.
+ if (data.dragType === 'channel-label') {
return data.iconType as EntityIconSelector;
}
if (data.dragType === 'stage') return 'default';
return getEntityIconType(data as EntityDragData);
});
- // DM channel favorites show the other participant's avatar instead of the
- // entity icon, matching their sidebar row (see FavoriteIcon).
- const dmRecipientId = createMemo((): string | undefined => {
- const data = activeDraggable()?.data;
- if (data?.dragType !== 'favorite') return undefined;
- return data.dmRecipientId as string | undefined;
- });
-
// Deal stage rows in CRM settings (see StageDragData in settings/Crm)
// carry no entity; their chip is the stage dot plus the label.
const isStage = createMemo(
@@ -94,19 +85,7 @@ function ItemDragOverlay() {
<span class="size-2 shrink-0 rounded-full bg-accent/70" />
}
>
- <Show
- when={dmRecipientId()}
- fallback={<EntityIcon size="xs" targetType={iconType()} />}
- >
- {(recipientId) => (
- <UserIcon
- id={recipientId()}
- size="sm"
- suppressClick
- showTooltip={false}
- />
- )}
- </Show>
+ <EntityIcon size="xs" targetType={iconType()} />
</Show>
<TruncatedText size="xs">
{activeDraggable()?.data.name}
diff --git a/apps/web/src/components/app/Layout.tsx b/apps/web/src/components/app/Layout.tsx
index 162f084732..ce66d912b2 100644
--- a/apps/web/src/components/app/Layout.tsx
+++ b/apps/web/src/components/app/Layout.tsx
@@ -4,8 +4,6 @@ import Banner from '@app/features/auth/banner/Banner';
import { CalendarPermissionPrompt } from '@app/features/auth/CalendarPermissionPrompt';
import { GithubReauthenticationPrompt } from '@app/features/auth/GithubReauthenticationPrompt';
import { GmailReauthenticationPrompt } from '@app/features/auth/GmailReauthenticationPrompt';
-import { SidebarActiveCallWidget } from '@app/features/block-call/sidebar/active-call-widget';
-import { useIncomingCallWidgetVisible } from '@app/features/block-call/sidebar/incoming-calls';
import { CommandMenu } from '@app/features/command';
import { FavoritesCommands } from '@app/features/command/FavoritesCommands';
import {
@@ -34,20 +32,12 @@ import { IosShareSheet } from '@app/features/sharing/ios-share-sheet/IosShareShe
import { ShowFeatureFlag } from '@app/lib/analytics/posthog';
import { mountGlobalFocusListener } from '@app/signal/focus';
import { AutomationComposer } from '@block-automation/component';
-import { useCallContextOptional } from '@channel/Call/CallContext';
-import { InCallPanel } from '@channel/Call/InCallPanel';
import { CreateChannelModal } from '@channel/CreateChannelModal';
-import {
- AppSidebar,
- GoToHotkeys,
- type SidebarState,
-} from '@components/app/app-sidebar/sidebar';
+import { GoToHotkeys } from '@components/app/app-sidebar/sidebar';
import { registerMailtoComposerHandler } from '@components/app/mailtoComposerHandler';
import { SidebarRail } from '@components/app/sidebar-next/sidebar-rail';
-import { useSidebarNextFlag } from '@components/app/sidebar-next/use-sidebar-next-flag';
import {
isSidebarVisible,
- SidebarCollapseContext,
SidebarVisibilityContext,
} from '@components/app/sidebarVisibility';
import { useIsAuthenticated } from '@core/auth';
@@ -63,7 +53,6 @@ import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { virtualKeyboardVisible } from '@core/mobile/virtualKeyboard';
import { updateCookie } from '@core/util/cookies';
import { useUserInfoQuery } from '@queries/auth/user-info';
-import { makePersisted } from '@solid-primitives/storage';
import {
type RouteSectionProps,
useLocation,
@@ -74,8 +63,6 @@ import { ScreencastHotkeys } from '@ui/components/ScreencastHotkeys';
import {
createEffect,
createMemo,
- createSignal,
- type JSX,
onCleanup,
onMount,
Show,
@@ -108,13 +95,6 @@ const AUTH_URLS = [
`${ROUTER_BASE_CONCAT}internal/invite-links`,
];
-const [sidebarState, setSidebarState] = makePersisted(
- createSignal<SidebarState>(!isTouchDevice() ? 'expanded' : 'hidden'),
- {
- name: 'sidebar-state',
- }
-);
-
export function Layout(props: RouteSectionProps) {
const isAuthenticated = useIsAuthenticated();
const location = useLocation();
@@ -129,189 +109,13 @@ export function Layout(props: RouteSectionProps) {
return (
<SidebarVisibilityContext.Provider value={sidebarVisible}>
- <SidebarCollapseContext.Provider
- value={{
- isCollapsed: () => sidebarVisible() && sidebarState() === 'slim',
- expand: () => setSidebarState('expanded'),
- }}
- >
- <MobileSettingsProvider>
- <LayoutInner {...props} />
- </MobileSettingsProvider>
- </SidebarCollapseContext.Provider>
+ <MobileSettingsProvider>
+ <LayoutInner {...props} />
+ </MobileSettingsProvider>
</SidebarVisibilityContext.Provider>
);
}
-function DraggableCallWidget(props: {
- visible: boolean;
- dragLabel: string;
- defaultBottomGap?: number;
- children: JSX.Element;
-}) {
- const EDGE_GAP = 12;
- const [root, setRoot] = createSignal<HTMLDivElement>();
- const [dragging, setDragging] = createSignal(false);
- const [position, setPosition] = createSignal<{ left: number; top: number }>();
- const defaultBottomGap = () => props.defaultBottomGap ?? 12;
-
- const clampPosition = (next: { left: number; top: number }) => {
- const el = root();
- if (!el) return next;
-
- const maxLeft = Math.max(
- EDGE_GAP,
- window.innerWidth - el.offsetWidth - EDGE_GAP
- );
- const maxTop = Math.max(
- EDGE_GAP,
- window.innerHeight - el.offsetHeight - EDGE_GAP
- );
-
- return {
- left: Math.min(Math.max(next.left, EDGE_GAP), maxLeft),
- top: Math.min(Math.max(next.top, EDGE_GAP), maxTop),
- };
- };
-
- const resetToDefaultPosition = (bottomGap = defaultBottomGap()) => {
- const el = root();
- if (!el) return;
- setPosition(
- clampPosition({
- left: Math.round((window.innerWidth - el.offsetWidth) / 2),
- top: window.innerHeight - el.offsetHeight - bottomGap,
- })
- );
- };
-
- createEffect(() => {
- if (!props.visible) return;
- const bottomGap = defaultBottomGap();
- requestAnimationFrame(() => resetToDefaultPosition(bottomGap));
- });
-
- createEffect(() => {
- if (!props.visible || !position()) return;
-
- const handleResize = () => {
- const next = position();
- if (!next) return;
- setPosition(clampPosition(next));
- };
-
- window.addEventListener('resize', handleResize);
- window.visualViewport?.addEventListener('resize', handleResize);
- onCleanup(() => {
- window.removeEventListener('resize', handleResize);
- window.visualViewport?.removeEventListener('resize', handleResize);
- });
- });
-
- // Set while a drag is in flight so hiding/unmounting can tear it down; a
- // cancelled pointer (touch interrupted, pointer takeover) never fires
- // pointerup, which would otherwise leave the move listener stuck on window.
- let stopActiveDrag: (() => void) | undefined;
-
- const startDrag: JSX.EventHandler<HTMLButtonElement, PointerEvent> = (e) => {
- if (!e.isPrimary || e.button !== 0) return;
-
- const el = root();
- if (!el) return;
-
- stopActiveDrag?.();
- e.preventDefault();
- const rect = el.getBoundingClientRect();
- const pointerStartX = e.clientX;
- const pointerStartY = e.clientY;
- const origin = { left: rect.left, top: rect.top };
-
- setDragging(true);
- setPosition(origin);
-
- const handleMove = (moveEvent: PointerEvent) => {
- setPosition(
- clampPosition({
- left: origin.left + (moveEvent.clientX - pointerStartX),
- top: origin.top + (moveEvent.clientY - pointerStartY),
- })
- );
- };
-
- const stopDrag = () => {
- setDragging(false);
- window.removeEventListener('pointermove', handleMove);
- window.removeEventListener('pointerup', stopDrag);
- window.removeEventListener('pointercancel', stopDrag);
- if (stopActiveDrag === stopDrag) stopActiveDrag = undefined;
- };
- stopActiveDrag = stopDrag;
-
- window.addEventListener('pointermove', handleMove);
- window.addEventListener('pointerup', stopDrag);
- window.addEventListener('pointercancel', stopDrag);
- };
-
- createEffect(() => {
- if (!props.visible) stopActiveDrag?.();
- });
- onCleanup(() => stopActiveDrag?.());
-
- return (
- <Show when={props.visible}>
- <div
- ref={setRoot}
- class="fixed z-float w-72 max-w-[calc(100vw-1.5rem)] pointer-events-auto"
- style={{
- left: position() ? `${position()!.left}px` : '50%',
- top: position() ? `${position()!.top}px` : undefined,
- bottom: position() ? undefined : `${defaultBottomGap()}px`,
- transform: position() ? undefined : 'translateX(-50%)',
- }}
- >
- <div class="relative rounded-xl border border-edge-muted bg-surface shadow-menu p-1">
- <button
- type="button"
- aria-label={props.dragLabel}
- class={cn(
- 'absolute left-1 right-10 top-1 z-10 h-8 rounded-t-lg rounded-b-md bg-transparent select-none',
- dragging() ? 'cursor-grabbing' : 'cursor-grab'
- )}
- onPointerDown={startDrag}
- />
- {props.children}
- </div>
- </div>
- </Show>
- );
-}
-
-function CollapsedSidebarCallWidget(props: { visible: boolean }) {
- return (
- <DraggableCallWidget
- visible={props.visible}
- dragLabel="Drag to move active call controls"
- >
- <InCallPanel isSlim={() => false} />
- </DraggableCallWidget>
- );
-}
-
-function CollapsedSidebarIncomingCallWidget(props: {
- visible: boolean;
- activeCallWidgetVisible: boolean;
-}) {
- return (
- <DraggableCallWidget
- visible={props.visible}
- dragLabel="Drag to move incoming calls"
- defaultBottomGap={props.activeCallWidgetVisible ? 168 : 12}
- >
- <SidebarActiveCallWidget sidebarState="expanded" />
- </DraggableCallWidget>
- );
-}
-
/**
* Sends first-time desktop users into the onboarding flow at /onboarding.
* Fires from anywhere in the app (marketing SSO lands on /app, not /login),
@@ -355,55 +159,6 @@ function LayoutInner(props: RouteSectionProps) {
const { paywallOpen, showPaywall } = usePaywallState();
const { usageLimitOpen } = useAiUsageLimitState();
const location = useLocation();
- const [sidebarOverlayOpen, setSidebarOverlayOpen] = createSignal(false);
- const [sidebarOverlayTriggerHovered, setSidebarOverlayTriggerHovered] =
- createSignal(false);
- const callCtx = useCallContextOptional();
- const incomingCallWidgetVisible = useIncomingCallWidgetVisible();
- const sidebarNextEnabled = useSidebarNextFlag();
- // SidebarRail is already narrow and has no slim mode, so nothing should arm
- // the hover-peek overlay strip or the slim-mode call widget under it.
- const sidebarCollapsed = createMemo(
- () =>
- !sidebarNextEnabled() && isSidebarVisible() && sidebarState() === 'slim'
- );
- const activeCallWidgetVisible = createMemo(
- () =>
- isSidebarVisible() &&
- sidebarState() === 'slim' &&
- !!callCtx?.isInCall() &&
- !callCtx?.isCallPage()
- );
- let sidebarOverlayCloseTimer: ReturnType<typeof setTimeout> | undefined;
-
- const clearSidebarOverlayCloseTimer = () => {
- if (sidebarOverlayCloseTimer === undefined) return;
- clearTimeout(sidebarOverlayCloseTimer);
- sidebarOverlayCloseTimer = undefined;
- };
-
- const setSidebarOverlayOpenGuarded = (open: boolean) => {
- clearSidebarOverlayCloseTimer();
- if (open) {
- setSidebarOverlayOpen(true);
- return;
- }
-
- sidebarOverlayCloseTimer = setTimeout(() => {
- sidebarOverlayCloseTimer = undefined;
- if (!sidebarOverlayTriggerHovered()) setSidebarOverlayOpen(false);
- }, 120);
- };
-
- createEffect(() => {
- if (!sidebarCollapsed()) {
- clearSidebarOverlayCloseTimer();
- setSidebarOverlayTriggerHovered(false);
- setSidebarOverlayOpen(false);
- }
- });
-
- onCleanup(clearSidebarOverlayCloseTimer);
useAppSquishHandlers();
@@ -503,43 +258,9 @@ function LayoutInner(props: RouteSectionProps) {
<AiUsageLimitDialog />
</Show>
<div class="max-h-full grow flex">
- {/* The provider spans the sidebar too so its favorites can register
- sortables with the same drag-drop context as the entity drags. */}
<ItemDndProvider>
<Show when={isSidebarVisible()}>
- <Show
- when={sidebarNextEnabled()}
- fallback={
- <AppSidebar
- sidebarState={sidebarState()}
- overlayOpen={sidebarOverlayOpen()}
- onOverlayOpenChange={setSidebarOverlayOpenGuarded}
- onOpenChange={(open) => {
- if (!open) {
- setSidebarState(isTouchDevice() ? 'hidden' : 'slim');
- return;
- }
-
- setSidebarState('expanded');
- }}
- />
- }
- >
- <SidebarRail />
- </Show>
- </Show>
- <Show when={sidebarCollapsed()}>
- <div
- class="fixed left-0 inset-y-0 z-modal-content w-[8px]"
- onPointerEnter={() => {
- setSidebarOverlayTriggerHovered(true);
- setSidebarOverlayOpenGuarded(true);
- }}
- onPointerLeave={() => {
- setSidebarOverlayTriggerHovered(false);
- setSidebarOverlayOpenGuarded(false);
- }}
- />
+ <SidebarRail />
</Show>
<div class="flex-1 w-full min-h-0 font-sans text-ink caret-current">
@@ -548,15 +269,6 @@ function LayoutInner(props: RouteSectionProps) {
</div>
</ItemDndProvider>
</div>
- <CollapsedSidebarIncomingCallWidget
- visible={
- isSidebarVisible() &&
- sidebarState() === 'slim' &&
- incomingCallWidgetVisible()
- }
- activeCallWidgetVisible={activeCallWidgetVisible()}
- />
- <CollapsedSidebarCallWidget visible={activeCallWidgetVisible()} />
<Show
when={
isTouchDevice() &&
diff --git a/apps/web/src/components/app/app-sidebar/calendar-sidebar-preview.tsx b/apps/web/src/components/app/app-sidebar/calendar-sidebar-preview.tsx
deleted file mode 100644
index 6c1f59442a..0000000000
--- a/apps/web/src/components/app/app-sidebar/calendar-sidebar-preview.tsx
+++ /dev/null
@@ -1,484 +0,0 @@
-import type { CalendarGridHandle } from '@app/features/calendar/components/CalendarGrid';
-import { CalendarGridSkeleton } from '@app/features/calendar/components/CalendarGridSkeleton';
-import { useCalendarOccurrenceData } from '@app/features/calendar/hooks/use-calendar-occurrence-data';
-import { useCalendarSources } from '@app/features/calendar/hooks/use-calendar-sources';
-import {
- type CalendarEvent,
- type CalendarTimeFormat,
- isCalendarEventVisible,
-} from '@app/features/calendar/types';
-import { parseLocalDate } from '@app/features/calendar/utils/calendar-date';
-import { groupCalendarSourcesByAccount } from '@app/features/calendar/utils/calendar-source-groups';
-import {
- formatCalendarTime,
- getDefaultCalendarTimeFormat,
-} from '@app/features/calendar/utils/time-format';
-import { openCalendarView } from '@app/features/calendar-view/calendar-navigation';
-import { useOpenEventComposer } from '@app/features/calendar-view/components/use-open-event-composer';
-import { HoverCard } from '@core/component/HoverCard';
-import { ScrollIndicators } from '@core/component/VerticalScrollIndicators';
-import { openExternalUrl } from '@core/util/url';
-import ArrowRightIcon from '@phosphor/arrow-right.svg';
-import CaretRightIcon from '@phosphor/caret-right.svg';
-import CheckIcon from '@phosphor/check.svg';
-import GearIcon from '@phosphor/gear.svg';
-import PlusIcon from '@phosphor/plus.svg';
-import VideoCameraIcon from '@phosphor/video-camera.svg';
-import XIcon from '@phosphor/x.svg';
-import type { CalendarOccurrenceQueryRange } from '@queries/calendar/occurrences';
-import { createCalendarOccurrenceQueryRange } from '@queries/calendar/occurrences';
-import { Button } from '@ui/components/Button';
-import { Dropdown } from '@ui/components/Dropdown';
-import { Layer } from '@ui/components/Layer';
-import { Surface } from '@ui/components/Surface';
-import {
- createEffect,
- createSignal,
- For,
- lazy,
- onCleanup,
- type ParentProps,
- type Setter,
- Show,
- Suspense,
-} from 'solid-js';
-
-const CalendarEmbed = lazy(() =>
- import('@app/features/calendar/components/CalendarEmbed').then((module) => ({
- default: module.CalendarEmbed,
- }))
-);
-
-function dayRange(date: Date): CalendarOccurrenceQueryRange {
- const start = new Date(date.getFullYear(), date.getMonth(), date.getDate());
- const end = new Date(start);
- end.setDate(end.getDate() + 1);
- return createCalendarOccurrenceQueryRange(start, end);
-}
-
-function PreviewSkeleton() {
- return <CalendarGridSkeleton showDayHeader={false} showAllDaySlot={false} />;
-}
-
-function CalendarScrollElement(props: {
- grid: CalendarGridHandle;
- setScrollElement: Setter<HTMLElement | undefined>;
-}) {
- createEffect(() => {
- const host = props.grid.element();
- if (!host) return;
-
- const updateScrollElement = () => {
- const scroller = Array.from(
- host.querySelectorAll<HTMLElement>('.fc-scroller')
- ).find((element) => element.querySelector('.fc-timegrid-body'));
- props.setScrollElement(scroller);
- };
- const observer = new MutationObserver(updateScrollElement);
- observer.observe(host, { childList: true, subtree: true });
- updateScrollElement();
-
- onCleanup(() => {
- observer.disconnect();
- props.setScrollElement(undefined);
- });
- });
-
- return null;
-}
-
-const PREVIEW_TIME_FORMAT_OPTIONS: Array<{
- value: CalendarTimeFormat;
- label: string;
-}> = [
- { value: '12-hour', label: '12-hour' },
- { value: '24-hour', label: '24-hour' },
-];
-
-const eventDateFormat = new Intl.DateTimeFormat(undefined, {
- weekday: 'short',
- month: 'short',
- day: 'numeric',
-});
-
-function eventDate(value: string) {
- return parseLocalDate(value) ?? new Date(value);
-}
-
-function eventSchedule(event: CalendarEvent) {
- const start = eventDate(event.start);
- if (event.allDay) return `${eventDateFormat.format(start)} · All day`;
-
- const end = eventDate(event.end);
- const timeFormat = getDefaultCalendarTimeFormat();
- return `${eventDateFormat.format(start)} · ${formatCalendarTime(start, timeFormat)}–${formatCalendarTime(end, timeFormat)}`;
-}
-
-function conferenceUrl(event: CalendarEvent) {
- if (!event.conferenceUrl) return undefined;
-
- try {
- const url = new URL(event.conferenceUrl);
- return url.protocol === 'https:' || url.protocol === 'http:'
- ? url.toString()
- : undefined;
- } catch {
- return undefined;
- }
-}
-
-function EventSummary(props: {
- event: CalendarEvent;
- onClose: () => void;
- onViewInCalendar: () => void;
-}) {
- return (
- <div class="shrink-0 border-t border-edge bg-surface">
- <div class="flex h-10 items-center justify-between px-2">
- <Button
- variant="ghost"
- size="icon-sm"
- class="rounded-lg"
- label="Close event details"
- onClick={props.onClose}
- >
- <XIcon class="size-4" />
- </Button>
- <Button
- variant="outline"
- size="sm"
- depth={4}
- class="rounded-lg bg-surface px-2"
- data-calendar-event-target-navigation
- onClick={props.onViewInCalendar}
- >
- Open
- <ArrowRightIcon class="size-4" />
- </Button>
- </div>
- <div class="flex flex-col gap-2 px-3 pb-3 pt-2">
- <div class="flex min-w-0 items-start gap-2">
- <span
- aria-hidden="true"
- class="mt-0.5 flex size-3 shrink-0 gap-px overflow-hidden rounded-sm"
- >
- <For each={props.event.visibleCalendars}>
- {(calendar) => (
- <span
- class="min-w-0 flex-1"
- style={{ 'background-color': calendar.color }}
- />
- )}
- </For>
- </span>
- <div class="min-w-0">
- <h3 class="truncate text-sm font-semibold text-ink">
- {props.event.title}
- </h3>
- <p class="text-xs text-ink-muted">{eventSchedule(props.event)}</p>
- </div>
- </div>
- <Show when={conferenceUrl(props.event)}>
- {(url) => (
- <Button
- fullWidth
- variant="cta"
- size="sm"
- class="h-8 rounded-lg"
- onClick={() => openExternalUrl(url())}
- >
- <VideoCameraIcon class="size-4" />
- {props.event.conferenceProvider === 'google_meet'
- ? 'Join Google Meet'
- : 'Join meeting'}
- </Button>
- )}
- </Show>
- </div>
- </div>
- );
-}
-
-function PreviewContent(props: { dropdownMount?: HTMLElement }) {
- const initialDate = new Date();
- const [range, setRange] = createSignal<CalendarOccurrenceQueryRange>(
- dayRange(initialDate)
- );
- const [selectedEventId, setSelectedEventId] = createSignal<string>();
- const [scrollElement, setScrollElement] = createSignal<HTMLElement>();
- const [hiddenSourceIds, setHiddenSourceIds] = createSignal<
- ReadonlySet<string>
- >(new Set());
- const [timeFormat, setTimeFormat] = createSignal<CalendarTimeFormat>(
- getDefaultCalendarTimeFormat()
- );
- const openEventComposer = useOpenEventComposer();
- const { sourceById, sources } = useCalendarSources();
- const isSourceVisible = (sourceId: string) =>
- !hiddenSourceIds().has(sourceId);
- const data = useCalendarOccurrenceData({
- range,
- sourceById,
- isSourceVisible,
- });
- const selectedEvent = () => {
- const eventId = selectedEventId();
- return eventId ? data.eventsById().get(eventId) : undefined;
- };
- const setSourceVisibility = (sourceId: string, visible: boolean) => {
- setHiddenSourceIds((current) => {
- const next = new Set(current);
- if (visible) next.delete(sourceId);
- else next.add(sourceId);
- return next;
- });
- const selected = selectedEvent();
- if (
- !visible &&
- selected &&
- !isCalendarEventVisible(selected, isSourceVisible)
- ) {
- setSelectedEventId(undefined);
- }
- };
- const openEventInCalendar = (event: CalendarEvent) => {
- openCalendarView(
- {
- eventId: event.eventId,
- occurrenceKey: event.occurrenceKey,
- range: range(),
- },
- { referredFrom: 'sidebar' }
- );
- };
-
- return (
- <div class="calendar-sidebar-preview portal-scope flex size-full min-h-0 flex-col bg-surface">
- <div class="relative min-h-0 flex-1">
- <CalendarEmbed
- initialDate={initialDate}
- events={data.visibleEvents()}
- eventsById={data.eventsById()}
- settings={{
- initialView: 'timeGridDay',
- dayCount: 1,
- showDayHeaders: false,
- collapseEmptyAllDaySlot: true,
- showWeekends: true,
- weekStartsOn: 0,
- timeFormat: timeFormat(),
- }}
- selection={{
- color: 'var(--color-accent)',
- eventId: selectedEventId(),
- onEventSelect: (event) => setSelectedEventId(event.id),
- }}
- onDatesSet={({ start, end }) => {
- const nextRange = createCalendarOccurrenceQueryRange(start, end);
- const previousRange = range();
- if (
- previousRange.start !== nextRange.start ||
- previousRange.end !== nextRange.end ||
- previousRange.startDate !== nextRange.startDate ||
- previousRange.endDate !== nextRange.endDate
- ) {
- setRange(nextRange);
- }
- }}
- >
- {(grid) => (
- <CalendarScrollElement
- grid={grid}
- setScrollElement={setScrollElement}
- />
- )}
- </CalendarEmbed>
- <ScrollIndicators
- scrollRef={scrollElement}
- appearance="gradient"
- gradientColor="panel"
- noBorderStart
- noBorderEnd
- />
-
- <Layer depth={4}>
- <div class="absolute right-2 bottom-2 z-anchored-controls flex items-center gap-2">
- <Button
- aria-label="New event"
- label="New event"
- tooltipPlacement="top"
- variant="outline"
- size="icon-md"
- depth={4}
- class="rounded-lg bg-surface"
- onClick={() => openEventComposer()}
- >
- <PlusIcon class="size-4" />
- </Button>
- <Dropdown placement="right" gutter={6}>
- <Dropdown.Trigger
- aria-label="Calendar settings"
- label="Calendar settings"
- tooltipPlacement="top"
- variant="outline"
- size="icon-md"
- depth={4}
- class="rounded-lg bg-surface"
- >
- <GearIcon class="size-4" />
- </Dropdown.Trigger>
- <Dropdown.Content
- mount={props.dropdownMount}
- depth={4}
- class="w-56"
- >
- <Dropdown.Group>
- <Dropdown.Sub>
- <Dropdown.SubTrigger>
- <span class="min-w-0 flex-1 truncate">Calendars</span>
- <CaretRightIcon class="size-3 shrink-0 text-ink-muted" />
- </Dropdown.SubTrigger>
- <Dropdown.SubContent
- mount={props.dropdownMount}
- depth={4}
- class="max-h-52 w-56 overflow-y-auto"
- >
- <Dropdown.Group>
- <For each={groupCalendarSourcesByAccount(sources())}>
- {(group) => (
- <Dropdown.CheckboxItem
- checked={group.calendars.every((source) =>
- isSourceVisible(source.id)
- )}
- closeOnSelect={false}
- onChange={(visible) => {
- for (const source of group.calendars) {
- setSourceVisibility(source.id, visible);
- }
- }}
- >
- <span class="min-w-0 flex-1 truncate">
- {group.emailAddress}
- </span>
- </Dropdown.CheckboxItem>
- )}
- </For>
- </Dropdown.Group>
- </Dropdown.SubContent>
- </Dropdown.Sub>
-
- <Dropdown.Sub>
- <Dropdown.SubTrigger>
- <span class="min-w-0 flex-1 truncate">Time format</span>
- <span class="text-xs text-ink-muted">
- {timeFormat() === '12-hour' ? '12-hour' : '24-hour'}
- </span>
- <CaretRightIcon class="size-3 shrink-0 text-ink-muted" />
- </Dropdown.SubTrigger>
- <Dropdown.SubContent
- mount={props.dropdownMount}
- depth={4}
- class="min-w-36"
- >
- <Dropdown.Group>
- <Dropdown.RadioGroup
- value={timeFormat()}
- onChange={(value) =>
- setTimeFormat(value as CalendarTimeFormat)
- }
- >
- <For each={PREVIEW_TIME_FORMAT_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.SubContent>
- </Dropdown.Sub>
- </Dropdown.Group>
- </Dropdown.Content>
- </Dropdown>
- </div>
- </Layer>
-
- <Show when={data.isLoading()}>
- <div class="absolute inset-0 bg-surface">
- <PreviewSkeleton />
- </div>
- </Show>
- <Show when={data.occurrencesQuery.isError}>
- <div class="absolute inset-x-3 bottom-3 rounded-lg border border-edge-muted bg-surface p-2 text-center text-xs text-ink-muted shadow-menu">
- Calendar events couldn’t be loaded.
- </div>
- </Show>
- </div>
-
- <Show when={selectedEvent()}>
- {(event) => (
- <Layer depth={3}>
- <EventSummary
- event={event()}
- onClose={() => setSelectedEventId(undefined)}
- onViewInCalendar={() => void openEventInCalendar(event())}
- />
- </Layer>
- )}
- </Show>
- </div>
- );
-}
-
-/** Calendar preview shown while hovering the Calendar sidebar row. */
-export function CalendarSidebarPreview(
- props: ParentProps<{ disabled?: boolean }>
-) {
- const [open, setOpen] = createSignal(false);
- const [contentElement, setContentElement] = createSignal<HTMLElement>();
-
- return (
- <HoverCard
- trigger={props.children}
- triggerAs="div"
- triggerClass="w-full"
- triggerTabIndex={-1}
- content={
- <Surface
- depth={2}
- hideBorder
- class="menu-surface h-[min(24rem,calc(100vh-2rem))] w-[min(20rem,calc(100vw-2rem))] overflow-hidden rounded-xl"
- >
- <div
- class="size-full"
- onContextMenu={(event) => {
- event.preventDefault();
- event.stopPropagation();
- }}
- >
- <Show when={open() && !props.disabled}>
- <Suspense fallback={<PreviewSkeleton />}>
- <PreviewContent dropdownMount={contentElement()} />
- </Suspense>
- </Show>
- </div>
- </Surface>
- }
- contentClass="max-w-[calc(100vw-1rem)] menu-open-animation"
- contentRef={setContentElement}
- openDelay={300}
- closeDelay={200}
- disabled={props.disabled}
- onOpenChange={setOpen}
- placement="right-start"
- requirePointerMovement
- />
- );
-}
diff --git a/apps/web/src/components/app/app-sidebar/collapsible-sidebar-section.tsx b/apps/web/src/components/app/app-sidebar/collapsible-sidebar-section.tsx
deleted file mode 100644
index 8273d40e49..0000000000
--- a/apps/web/src/components/app/app-sidebar/collapsible-sidebar-section.tsx
+++ /dev/null
@@ -1,120 +0,0 @@
-import type { HotkeyToken } from '@core/hotkey/tokens';
-import CaretDownIcon from '@phosphor/caret-down.svg';
-import { makePersisted } from '@solid-primitives/storage';
-import { cn, Tooltip } from '@ui';
-import { createSignal, For, type JSX, onCleanup, Show } from 'solid-js';
-
-export type CollapsibleSidebarSectionItem = {
- id: string;
- visible: () => JSX.Element;
- dropdown: () => JSX.Element;
-};
-
-export function CollapsibleSidebarSection(props: {
- label: string;
- items: readonly CollapsibleSidebarSectionItem[];
- headerMenu?: (open: boolean) => JSX.Element;
- headerWrapper?: (header: JSX.Element) => JSX.Element;
- headerTooltip?: {
- label: string;
- hotkey?: HotkeyToken | HotkeyToken[];
- };
- defaultOpen?: boolean;
- /** Persist the open state locally under this key. */
- persistKey?: string;
- onOpenChange?: (open: boolean) => void;
-}) {
- // With a `persistKey` the signal itself is persisted — the setter writes
- // through to local storage, so a refresh restores the toggled state.
- const [open, setOpen] =
- props.persistKey !== undefined
- ? makePersisted(createSignal(props.defaultOpen ?? true), {
- name: `sidebar-section-open:${props.persistKey}`,
- })
- : createSignal(props.defaultOpen ?? true);
- let openChangeTimer: ReturnType<typeof setTimeout> | undefined;
-
- onCleanup(() => {
- if (openChangeTimer !== undefined) clearTimeout(openChangeTimer);
- });
-
- const toggleOpen = () => {
- const next = !open();
- setOpen(next);
- props.onOpenChange?.(next);
- if (openChangeTimer !== undefined) clearTimeout(openChangeTimer);
- openChangeTimer = setTimeout(() => {
- openChangeTimer = undefined;
- props.onOpenChange?.(next);
- }, 130);
- };
-
- const headerButton = () => (
- <button
- type="button"
- class={cn(
- 'flex h-7 w-full min-w-0 items-center justify-start gap-1 rounded-md px-2 text-left text-[13px] font-medium text-ink-extra-muted/60 transition-colors group-hover/section:bg-ink/3 group-hover/section:text-ink-muted',
- props.headerMenu ? 'pr-18' : 'pr-2'
- )}
- aria-expanded={open()}
- onClick={toggleOpen}
- >
- <span class="min-w-0 truncate">{props.label}</span>
- <CaretDownIcon
- class={cn(
- 'size-3 shrink-0 transition-transform duration-[120ms] ease-in-out',
- !open() && '-rotate-90'
- )}
- />
- </button>
- );
-
- const header = () => (
- <header class="group/section relative">
- <Show when={props.headerTooltip} fallback={headerButton()}>
- {(tooltip) => (
- <Tooltip
- label={tooltip().label}
- hotkey={tooltip().hotkey}
- placement="right"
- class="w-full"
- >
- {headerButton()}
- </Tooltip>
- )}
- </Show>
- <Show when={props.headerMenu}>
- {(headerMenu) => (
- <div class="pointer-events-none absolute right-1 top-1/2 -translate-y-1/2 z-10 flex items-center">
- {headerMenu()(open())}
- </div>
- )}
- </Show>
- </header>
- );
-
- return (
- <section class="group/sidebar-section w-full flex flex-col">
- {props.headerWrapper ? props.headerWrapper(header()) : header()}
- <div
- class={cn('grid overflow-hidden', !open() && 'pointer-events-none')}
- aria-hidden={!open()}
- style={{
- 'grid-template-rows': open() ? '1fr' : '0fr',
- 'margin-top': open() ? '0.125rem' : '0',
- opacity: open() ? '1' : '0',
- visibility: open() ? 'visible' : 'hidden',
- transition: open()
- ? 'grid-template-rows 120ms ease-in-out, margin-top 120ms ease-in-out, opacity 120ms ease-in-out, visibility 0ms linear 0ms'
- : 'grid-template-rows 120ms ease-in-out, margin-top 120ms ease-in-out, opacity 120ms ease-in-out, visibility 0ms linear 120ms',
- }}
- >
- <div class="min-h-0 overflow-hidden flex flex-col gap-0.5">
- <For each={props.items}>
- {(item) => <div class="w-full">{item.visible()}</div>}
- </For>
- </div>
- </div>
- </section>
- );
-}
diff --git a/apps/web/src/components/app/app-sidebar/sidebar-promo.tsx b/apps/web/src/components/app/app-sidebar/sidebar-promo.tsx
deleted file mode 100644
index 5ec54de267..0000000000
--- a/apps/web/src/components/app/app-sidebar/sidebar-promo.tsx
+++ /dev/null
@@ -1,193 +0,0 @@
-import ClockIcon from '@phosphor/clock.svg';
-import XIcon from '@phosphor/x.svg';
-import { Button, cn, Layer } from '@ui';
-import { createSignal, onCleanup, onMount, Show } from 'solid-js';
-import { Dynamic } from 'solid-js/web';
-
-export const PROMO_HINT_DURATION_MS = 8000;
-
-type SidebarPromoCardAction = {
- label: string;
- onClick: () => void;
- disabled?: boolean;
-};
-
-type SidebarPromoCardProps = {
- label: string;
- description: string;
- onDismiss?: () => void;
- onClick?: () => void;
- primaryAction?: SidebarPromoCardAction;
- secondaryAction?: SidebarPromoCardAction;
-};
-
-export const SidebarPromoCard = (props: SidebarPromoCardProps) => {
- return (
- <Layer depth={1}>
- <section aria-label={props.label} class="relative group/promo w-full">
- <div class="rounded-lg border border-ink-muted/8 bg-ink-muted/2.5 overflow-hidden divide-y divide-ink-muted/8">
- <header class="flex items-center gap-2 min-w-0 px-2.5 py-1.5">
- <h3 class="flex-1 min-w-0 text-xs font-medium text-ink leading-tight m-0">
- {props.label}
- </h3>
- <Show when={props.onDismiss}>
- {(onDismiss) => (
- <Button
- size="icon-xs"
- variant="ghost"
- class="shrink-0 size-5 rounded-sm p-0 [&_svg]:size-3"
- label="Dismiss"
- onClick={(e) => {
- e.stopPropagation();
- onDismiss()();
- }}
- >
- <XIcon />
- </Button>
- )}
- </Show>
- </header>
- <Dynamic
- component={props.onClick ? 'button' : 'div'}
- type={props.onClick ? 'button' : undefined}
- class={cn(
- 'w-full text-left px-2.5 py-2',
- props.onClick && 'cursor-default hover:bg-ink-muted/6'
- )}
- onClick={props.onClick}
- >
- <p class="text-xs text-ink-extra-muted leading-snug m-0">
- {props.description}
- </p>
- </Dynamic>
- <Show when={props.primaryAction || props.secondaryAction}>
- <div
- role="group"
- aria-label={`${props.label} actions`}
- class="flex items-center justify-end gap-1 px-2.5 py-1.5"
- >
- <Show when={props.secondaryAction}>
- {(action) => (
- <Button
- variant="ghost"
- size="sm"
- disabled={action().disabled}
- onClick={(e) => {
- e.stopPropagation();
- action().onClick();
- }}
- >
- {action().label}
- </Button>
- )}
- </Show>
- <Show when={props.primaryAction}>
- {(action) => (
- <Button
- variant="cta"
- size="sm"
- disabled={action().disabled}
- onClick={(e) => {
- e.stopPropagation();
- action().onClick();
- }}
- >
- {action().label}
- </Button>
- )}
- </Show>
- </div>
- </Show>
- </div>
- </section>
- </Layer>
- );
-};
-
-type SidebarPromoHintProps = {
- title: string;
- message: string;
- onDone: () => void;
- secondaryAction?: SidebarPromoCardAction;
-};
-
-export const SidebarPromoHint = (props: SidebarPromoHintProps) => {
- const [fading, setFading] = createSignal(false);
- const [progressDepleted, setProgressDepleted] = createSignal(false);
-
- onMount(() => {
- // Kick the progress bar animation on the next frame so the
- // initial 100% width is committed before the transition starts.
- requestAnimationFrame(() => setProgressDepleted(true));
- const fadeTimer = setTimeout(
- () => setFading(true),
- PROMO_HINT_DURATION_MS - 400
- );
- const doneTimer = setTimeout(props.onDone, PROMO_HINT_DURATION_MS);
- onCleanup(() => {
- clearTimeout(fadeTimer);
- clearTimeout(doneTimer);
- });
- });
-
- return (
- <Layer depth={2}>
- <div
- role="status"
- aria-label={props.title}
- class={cn(
- 'w-full transition-opacity duration-300',
- fading() ? 'opacity-0' : 'opacity-100'
- )}
- >
- <div class="rounded-lg border border-ink-muted/8 bg-ink-muted/2.5 overflow-hidden">
- <div
- role="progressbar"
- aria-label="Auto-dismiss countdown"
- class="h-0.5 w-full bg-ink-muted/8"
- >
- <div
- class="h-full bg-accent ease-linear"
- style={{
- width: progressDepleted() ? '0%' : '100%',
- transition: `width ${PROMO_HINT_DURATION_MS}ms linear`,
- }}
- />
- </div>
- <div class="divide-y divide-ink-muted/8">
- <header class="flex items-center gap-2 min-w-0 px-2.5 py-1.5">
- <ClockIcon class="shrink-0 size-4 text-ink-muted" />
- <h3 class="flex-1 min-w-0 text-xs font-medium text-ink leading-tight m-0">
- {props.title}
- </h3>
- </header>
- <div class="px-2.5 py-2">
- <p class="text-xs text-ink-extra-muted leading-snug m-0 min-h-[3lh]">
- {props.message}
- </p>
- </div>
- <div class="flex items-center justify-end gap-1 px-2.5 py-1.5">
- <Show when={props.secondaryAction}>
- {(action) => (
- <Button
- variant="ghost"
- size="sm"
- onClick={() => {
- action().onClick();
- props.onDone();
- }}
- >
- {action().label}
- </Button>
- )}
- </Show>
- <Button variant="cta" size="sm" onClick={props.onDone}>
- Got it
- </Button>
- </div>
- </div>
- </div>
- </div>
- </Layer>
- );
-};
diff --git a/apps/web/src/components/app/app-sidebar/sidebar.tsx b/apps/web/src/components/app/app-sidebar/sidebar.tsx
index d035fdb650..5a81f2c43d 100644
--- a/apps/web/src/components/app/app-sidebar/sidebar.tsx
+++ b/apps/web/src/components/app/app-sidebar/sidebar.tsx
@@ -1,24 +1,11 @@
import { GO_TO_COMMAND_SCOPE, GO_TO_LEADER_KEY } from '@app/constants/hotkeys';
import { LIST_VIEW_PATHS, type ListView } from '@app/constants/list-views';
import { useActivityFeedFlag } from '@app/features/activity/use-activity-feed-flag';
-import { SidebarActiveCallWidget } from '@app/features/block-call/sidebar/active-call-widget';
import { useCalendarUiFlag } from '@app/features/calendar/hooks/use-calendar-ui-flag';
import { calendarPath } from '@app/features/calendar-view/calendar-url';
import { CALENDAR_VIEW_ID } from '@app/features/calendar-view/types';
-import { ChannelsRecentWidget } from '@app/features/channel/sidebar/channels-recent-widget';
-import { useHasActiveChannelsCall } from '@app/features/channels-view/use-has-active-call';
import { CommandState } from '@app/features/command';
-import { SidebarCreateMenu } from '@app/features/command/sidebar/sidebar-create-menu';
-import { FavoritesSection } from '@app/features/favorites/sidebar/favorites-section';
import { useGettingStartedEnabled } from '@app/features/getting-started/account-gate';
-import { createGettingStartedSidebarVisibility } from '@app/features/getting-started/sidebar-visibility';
-import { buildDocumentTypeQuery } from '@app/features/next-soup/filters/configs/document-type-query';
-import { getDocumentsFilterSplit } from '@app/features/next-soup/soup-view/documents-filter-controllers';
-import {
- getInboxFilterSplit,
- INBOX_FILTER_ENTRY_KEY,
- requestInboxFilter,
-} from '@app/features/next-soup/soup-view/inbox-filter-controllers';
import { requestSearchFocus } from '@app/features/next-soup/soup-view/search-controllers';
import { useRecentViewFlag } from '@app/features/next-soup/use-recent-view-flag';
import {
@@ -26,99 +13,53 @@ import {
setInviteModalOpen,
} from '@app/features/team-invitations/invite-modal';
import { useAnalytics } from '@app/lib/analytics/analytics-context';
-import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { useHotkeyInterceptor } from '@app/signal/hotkeyRoot';
import { globalSplitManager } from '@app/signal/splitLayout';
-import { useCallContextOptional } from '@channel/Call/CallContext';
-import { InCallPanel } from '@channel/Call/InCallPanel';
-import {
- CollapsibleSidebarSection,
- type CollapsibleSidebarSectionItem,
-} from '@components/app/app-sidebar/collapsible-sidebar-section';
-import {
- SidebarPromoCard,
- SidebarPromoHint,
-} from '@components/app/app-sidebar/sidebar-promo';
import { useSplitLayout } from '@components/app/split-layout/layout';
import type {
ReferredFrom,
SplitContent,
SplitHandle,
} from '@components/app/split-layout/layoutManager';
-import { useHasPaidAccess } from '@core/auth';
import { useLogout } from '@core/auth/logout';
import { ContextMenuContent, MenuItem } from '@core/component/ContextMenu';
import { getIconConfig } from '@core/component/EntityIcon';
-import { inboxIconProps } from '@core/component/inboxIcon';
import { toast } from '@core/component/Toast/Toast';
import { UserIcon } from '@core/component/UserIcon';
import {
ENABLE_CALLS,
enableCrm,
- enableNewPricing,
isFeatureEnabled,
} from '@core/constant/featureFlags';
-import {
- type SettingsTab,
- useSettingsState,
-} from '@core/constant/SettingsState';
-import {
- getSettingsTabItem,
- useSettingsTabAvailable,
-} from '@core/constant/settingsTabsConfig';
+import type { SettingsTab } from '@core/constant/SettingsState';
import { useEmail, useUserId } from '@core/context/user';
-import { hotkeyScopeNeutralAttribute } from '@core/dom-selectors';
import { registerHotkey } from '@core/hotkey/hotkeys';
import { clearPressedKeys } from '@core/hotkey/state';
import { type HotkeyToken, TOKENS } from '@core/hotkey/tokens';
import type { ValidHotkey } from '@core/hotkey/types';
import { activateClosestDOMScope } from '@core/hotkey/utils';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
-import { getDisplayName, tryMacroId } from '@core/user';
-import LogoIcon from '@icon/macro-logo.svg';
import { ContextMenu } from '@kobalte/core/context-menu';
import BellIcon from '@phosphor/bell.svg';
-import CaretRightIcon from '@phosphor/caret-right.svg';
import CaretUpIcon from '@phosphor/caret-up.svg';
import CompassIcon from '@phosphor/compass.svg';
-import DotsThreeIcon from '@phosphor/dots-three.svg';
import GearIcon from '@phosphor/gear.svg';
import HomeIcon from '@phosphor/house.svg';
import SearchIcon from '@phosphor/magnifying-glass.svg';
-import PhoneIcon from '@phosphor/phone-call.svg';
import ActivityIcon from '@phosphor/pulse.svg';
import SignOutIcon from '@phosphor/sign-out.svg';
-import UsersThreeIcon from '@phosphor/users-three.svg';
-import XIcon from '@phosphor/x.svg';
import { isRealNamePart, useOwnUserName } from '@queries/auth/user-name-self';
-import { useMailAccountsQuery } from '@queries/email/mail-accounts';
-import {
- useJoinTeamMutation,
- useRejectInvitationMutation,
- useUserInvitesQuery,
-} from '@queries/team/invitations';
-import { useCurrentTeamQuery } from '@queries/team/teams';
-import type { TeamInviteDetails } from '@service-auth/generated/schemas/teamInviteDetails';
-import { createElementSize } from '@solid-primitives/resize-observer';
import { debounce } from '@solid-primitives/scheduled';
-import { makePersisted } from '@solid-primitives/storage';
-import { useLocation } from '@solidjs/router';
-import { Button, cn, Dropdown, Hotkey, Layer, NavRow, Tooltip } from '@ui';
+import { cn, Dropdown, Hotkey } from '@ui';
import {
type Component,
- type ComponentProps,
createEffect,
createMemo,
createSignal,
- For,
type JSX,
onCleanup,
Show,
- Suspense,
} from 'solid-js';
-import { Dynamic } from 'solid-js/web';
-import { CalendarSidebarPreview } from './calendar-sidebar-preview';
-import { SidebarSearchMenu } from './sidebar-search-menu';
// TODO(sidebar-next): move to app-sidebar/navigation.tsx once SidebarRail ships.
export interface SidebarItem {
@@ -130,55 +71,8 @@ export interface SidebarItem {
hotkey?: ValidHotkey | ValidHotkey[];
hotkeyToken: HotkeyToken;
standaloneHotkey?: boolean;
- hiddenFromSidebar?: boolean;
}
-type SidebarSectionLinkId =
- | 'mail'
- | 'channels'
- | 'calls'
- | 'documents'
- | 'tasks'
- | 'calendar'
- | 'agents'
- | 'companies';
-
-type SidebarSectionVisibility = Record<SidebarSectionLinkId, boolean>;
-
-type TryItemId = 'connect' | 'invite' | 'mobile';
-
-type TryItemVisibility = Record<TryItemId, boolean>;
-
-const WORKSPACE_LINK_IDS = [
- 'mail',
- 'channels',
- 'calls',
- 'documents',
- 'tasks',
- 'calendar',
- 'agents',
- 'companies',
-] as const;
-
-const DEFAULT_SECTION_VISIBILITY: SidebarSectionVisibility = {
- mail: true,
- channels: true,
- calls: true,
- documents: true,
- tasks: true,
- calendar: true,
- agents: true,
- companies: true,
-};
-
-const DEFAULT_TRY_VISIBILITY: TryItemVisibility = {
- connect: true,
- invite: true,
- mobile: true,
-};
-
-const markdownDocumentsQuery = buildDocumentTypeQuery(['doc-markdown']);
-
const SIDEBAR_LINKS = [
{
id: 'home',
@@ -200,7 +94,6 @@ const SIDEBAR_LINKS = [
hotkey: '/',
hotkeyToken: TOKENS.sidebar.goTo.search,
standaloneHotkey: true,
- hiddenFromSidebar: true,
},
{
id: 'agents',
@@ -232,16 +125,10 @@ const SIDEBAR_LINKS = [
href: LIST_VIEW_PATHS.documents,
params: {
initialFacets: { type: ['doc-markdown'] },
- initialFilters: markdownDocumentsQuery ?? {},
- initialClientFilters: {
- and: ['document-or-file'],
- or: ['doc-markdown'],
- },
},
icon: getIconConfig('md').icon,
hotkey: 'd',
hotkeyToken: TOKENS.sidebar.goTo.markdownDocuments,
- hiddenFromSidebar: true,
},
{
id: 'tasks',
@@ -269,44 +156,8 @@ const SIDEBAR_LINKS = [
},
] satisfies SidebarItem[];
-export type SidebarState = 'hidden' | 'expanded' | 'slim';
-
-/** Root sidebar `max-width` transition (see `SIDEBAR_MAX_WIDTH_TRANSITION_STYLE`). */
-const SIDEBAR_MAX_WIDTH_TRANSITION_MS = 120;
-const SIDEBAR_MAX_WIDTH_TRANSITION_STYLE = [
- `max-width ease-in-out ${SIDEBAR_MAX_WIDTH_TRANSITION_MS}ms`,
- `width ease-in-out ${SIDEBAR_MAX_WIDTH_TRANSITION_MS}ms`,
- `opacity ease-in-out ${SIDEBAR_MAX_WIDTH_TRANSITION_MS}ms`,
- `transform ease-in-out ${SIDEBAR_MAX_WIDTH_TRANSITION_MS}ms`,
-].join(', ');
-
-type AppSidebarProps = {
- sidebarState?: SidebarState;
- onOpenChange: (open: boolean) => void;
- overlayOpen?: boolean;
- onOverlayOpenChange?: (open: boolean) => void;
-};
-
-type SidebarHotkeyDeps = {
- isSlim: () => boolean;
- onOpenChange: (open: boolean) => void;
-};
-
type OpenWithSplitFn = ReturnType<typeof useSplitLayout>['openWithSplit'];
-const isMarkdownDocumentsParams = (
- params: SidebarItem['params'] | undefined
-): boolean => {
- const facets = params?.initialFacets as
- | { type?: readonly unknown[] }
- | undefined;
- if (facets?.type?.includes('doc-markdown')) return true;
- const initialClientFilters = params?.initialClientFilters as
- | { or?: readonly unknown[] }
- | undefined;
- return initialClientFilters?.or?.includes('doc-markdown') ?? false;
-};
-
export function sidebarContent(
viewId: SidebarItem['id'],
params?: SidebarItem['params']
@@ -327,28 +178,10 @@ export function navigateToSidebarView(args: {
viewId: SidebarItem['id'];
params?: SidebarItem['params'];
shiftKey: boolean;
- activeSplit: SplitHandle | undefined;
openWithSplit: OpenWithSplitFn;
referredFrom?: ReferredFrom;
}): SplitHandle | undefined {
- const { viewId, params, shiftKey, activeSplit, openWithSplit, referredFrom } =
- args;
-
- const activeContent = activeSplit?.content();
- if (
- !shiftKey &&
- isMarkdownDocumentsParams(params) &&
- activeContent?.type === 'component' &&
- activeContent.id === 'documents'
- ) {
- const controller = activeSplit
- ? getDocumentsFilterSplit(activeSplit.id)
- : undefined;
- if (controller) {
- controller.toggleMarkdownFilter();
- return activeSplit;
- }
- }
+ const { viewId, params, shiftKey, openWithSplit, referredFrom } = args;
return openWithSplit(sidebarContent(viewId, params), {
preferNewSplit: shiftKey,
@@ -358,35 +191,7 @@ export function navigateToSidebarView(args: {
}).split;
}
-export const registerSidebarHotkeys = ({
- isSlim,
- onOpenChange,
-}: SidebarHotkeyDeps) => {
- // Scoped to the sidebar's lifecycle on purpose: it toggles sidebar +
- // side-panel state, which is force-hidden (and thus a no-op) on full-cover
- // routes like solo settings, where `AppSidebar` unmounts. Genuinely global
- // shortcuts that must survive those routes live in `GoToHotkeys` instead.
- registerHotkey({
- hotkey: 'cmd+.',
- scopeId: 'global',
- hotkeyToken: TOKENS.global.toggleSidebar,
- description: 'Toggle sidebar',
- runWithInputFocused: true,
- keyDownHandler: (e) => {
- e?.preventDefault();
- const show = isSlim();
- onOpenChange(show);
- return true;
- },
- });
-};
-
-/**
- * Whether the "g" leader key is currently awaiting a destination key. Lives
- * at module scope so it can drive the hint overlay on `AppSidebar`'s nav
- * icons even though the registration below is owned by `GoToHotkeys`, which
- * stays mounted regardless of whether the sidebar itself is visible.
- */
+/** Whether the "g" leader key is currently awaiting a destination key. */
const [goToHotkeyVisible, setGoToHotkeyVisible] = createSignal(false);
const resetGoToHotkeysState = () => {
@@ -400,9 +205,9 @@ const resetGoToHotkeysState = () => {
/**
* Hosts the always-on global shortcuts that must keep working even on
* full-cover routes like solo settings: the "g" leader key with its per-link
- * "go to" nav hotkeys (e.g. "g h" for Home), plus Send Invites. Rendered
- * unconditionally from `Layout` — unlike `AppSidebar`, which unmounts on those
- * routes — so none of them go dead there.
+ * "go to" nav hotkeys (e.g. "g h" for Home), plus Send Invites and the modal
+ * it opens. Rendered unconditionally from `Layout` — unlike the sidebar, which
+ * unmounts on those routes — so none of them go dead there.
*/
export const GoToHotkeys = () => {
const { openWithSplit } = useSplitLayout();
@@ -525,7 +330,6 @@ export const GoToHotkeys = () => {
viewId: link.id,
params: link.params,
shiftKey: !!e?.shiftKey,
- activeSplit: globalSplitManager()?.activeSplit(),
openWithSplit,
});
if (link.id === 'search' && handle) {
@@ -551,275 +355,13 @@ export const GoToHotkeys = () => {
});
});
- return null;
-};
-
-/** Session-only signal so a hint shows after dismissal until the user acknowledges or the timer expires. */
-const [premiumHintVisible, setPremiumHintVisible] = createSignal(false);
-
-const SidebarSectionMenu = (props: {
- label: string;
- options: { id: SidebarSectionLinkId; label: string; checked: boolean }[];
- onToggle: (id: SidebarSectionLinkId) => void;
- onOpenChange?: (open: boolean) => void;
-}) => (
- <Dropdown
- placement="right-start"
- gutter={8}
- onOpenChange={props.onOpenChange}
- >
- <Dropdown.Trigger
- size="icon-xs"
- variant="ghost"
- class="opacity-0 group-hover/section:opacity-100 focus-visible:opacity-100 transition-opacity rounded-md size-5 min-h-0 p-0 bg-transparent hover:bg-ink/6 [&_svg]:size-3.5"
- label={`Customize ${props.label}`}
- onMouseDown={(e: MouseEvent) => {
- if (e.button !== 0) return;
- e.preventDefault();
- e.stopPropagation();
- }}
- onClick={(e: MouseEvent) => e.stopPropagation()}
- >
- <DotsThreeIcon />
- </Dropdown.Trigger>
- <Dropdown.Content class="w-56">
- <Dropdown.Group>
- <Dropdown.GroupLabel>Customize</Dropdown.GroupLabel>
- <For each={props.options}>
- {(option) => (
- <Dropdown.CheckboxItem
- checked={option.checked}
- onChange={() => props.onToggle(option.id)}
- closeOnSelect={false}
- >
- <span class="flex-1 truncate">{option.label}</span>
- </Dropdown.CheckboxItem>
- )}
- </For>
- </Dropdown.Group>
- </Dropdown.Content>
- </Dropdown>
-);
-
-type TryCardItem = {
- id: TryItemId;
- label: string;
- icon: Component<{ class?: string }>;
- onClick: () => void;
-};
-
-const TryCardRow = (props: { item: TryCardItem }) => {
- return (
- <button
- type="button"
- aria-label={props.item.label}
- class="flex h-7 w-full items-center justify-start gap-2 rounded-md px-1.5 py-0 text-sm font-medium text-ink-muted outline-none hover:bg-ink/5 hover:text-ink focus-visible:bg-ink/5 focus-visible:text-ink [&_svg]:size-3.5"
- onMouseDown={(e) => {
- if (e.button !== 0) return;
- e.preventDefault();
- }}
- onClick={props.item.onClick}
- >
- <span class="size-5 shrink-0 flex items-center justify-center">
- <Dynamic component={props.item.icon} />
- </span>
- <span class="min-w-0 flex-1 truncate text-left">{props.item.label}</span>
- </button>
- );
-};
-
-const TryCard = (props: {
- items: readonly TryCardItem[];
- onDismiss: () => void;
-}) => (
- <Layer depth={1}>
- <section aria-label="Quick Start" class="relative group/try-card w-full">
- <div class="rounded-lg border border-ink-muted/8 bg-ink-muted/2.5 overflow-hidden">
- <header class="flex items-center gap-2 min-w-0 px-2.5 py-1.5 border-b border-ink-muted/8">
- <h3 class="flex-1 min-w-0 text-xs font-medium text-ink leading-tight m-0">
- Quick Start
- </h3>
- <Button
- size="icon-xs"
- variant="ghost"
- class="shrink-0 size-5 rounded-sm p-0 [&_svg]:size-3"
- label="Dismiss Quick Start"
- onClick={(e) => {
- e.stopPropagation();
- props.onDismiss();
- }}
- >
- <XIcon />
- </Button>
- </header>
- <div class="p-1 flex flex-col gap-0.5">
- <For each={props.items}>{(item) => <TryCardRow item={item} />}</For>
- </div>
- </div>
- </section>
- </Layer>
-);
-
-const SidebarDropdownLink = (
- props: SidebarItem & {
- onContextMenuOpenChange?: (open: boolean) => void;
- }
-) => {
- const analytics = useAnalytics();
- const layout = useSplitLayout();
- const location = useLocation();
- let contextMenuOpen = false;
-
- const isActive = () => {
- const activeContent = globalSplitManager()?.activeSplit()?.content();
- if (!activeContent) {
- return location.pathname.split('/').filter(Boolean).includes(props.id);
- }
- const expectedContent = sidebarContent(props.id, props.params);
- return (
- activeContent.type === expectedContent.type &&
- activeContent.id === expectedContent.id
- );
- };
-
- const handleContextMenuOpenChange = (open: boolean) => {
- contextMenuOpen = open;
- props.onContextMenuOpenChange?.(open);
- };
-
- onCleanup(() => {
- if (contextMenuOpen) props.onContextMenuOpenChange?.(false);
- });
-
- const open = (newSplit = false) => {
- analytics.track('sidebar_click', { view: props.id });
- const handle = navigateToSidebarView({
- viewId: props.id,
- params: props.params,
- shiftKey: newSplit,
- activeSplit: globalSplitManager()?.activeSplit(),
- openWithSplit: layout.openWithSplit,
- referredFrom: 'sidebar',
- });
- if (props.id === 'search' && handle) requestSearchFocus(handle.id);
- globalSplitManager()?.returnFocus();
- return handle;
- };
-
- const canOpenInNewSplit = () =>
- globalSplitManager()?.canAppendSplit() ?? false;
- const canOpenFullscreen = () => layout.getSplitCount() > 1;
- const openInNewSplit = () => {
- if (canOpenInNewSplit()) open(true);
- };
- const openInCurrentSplit = () => open(false);
- const openFullscreen = () => {
- analytics.track('sidebar_click', { view: props.id });
- const handle = layout.replaceAllSplits(
- sidebarContent(props.id, props.params),
- { referredFrom: 'sidebar' }
- );
- if (props.id === 'search' && handle) requestSearchFocus(handle.id);
- globalSplitManager()?.returnFocus();
- };
-
- const ContextMenuTriggerItem = (
- triggerProps: ComponentProps<typeof ContextMenu.Trigger>
- ) => (
- <ContextMenu onOpenChange={handleContextMenuOpenChange}>
- <ContextMenu.Trigger {...triggerProps} />
- <ContextMenu.Portal>
- <ContextMenuContent class="z-tool-tip! text-xs text-ink-muted">
- <MenuItem
- text="Open in new split"
- onClick={openInNewSplit}
- disabled={!canOpenInNewSplit()}
- />
- <Show when={canOpenFullscreen()}>
- <MenuItem text="Open fullscreen" onClick={openFullscreen} />
- </Show>
- <MenuItem text="Open in current split" onClick={openInCurrentSplit} />
- </ContextMenuContent>
- </ContextMenu.Portal>
- </ContextMenu>
- );
-
- return (
- <Dropdown.Item
- as={ContextMenuTriggerItem}
- class={cn(
- 'min-h-8 gap-2 px-2.5 text-[13px]',
- isActive() &&
- 'bg-ink/6 text-ink hover:bg-ink/6 data-highlighted:bg-ink/6'
- )}
- data-active={isActive() ? '' : undefined}
- onSelect={openInCurrentSplit}
- >
- <Show when={props.icon}>
- <div class="shrink-0 [&_svg]:size-3.5">
- <Dynamic component={props.icon} />
- </div>
- </Show>
- <span class="min-w-0 flex-1 truncate text-ink">{props.label}</span>
- <Hotkey token={props.hotkeyToken} theme="subtle" class="ml-6" />
- </Dropdown.Item>
- );
-};
-
-const SidebarHeaderSearchButton = (props: { link: SidebarItem }) => {
- const analytics = useAnalytics();
- const layout = useSplitLayout();
-
- const openSearch = (newSplit: boolean) => {
- analytics.track('sidebar_click', { view: props.link.id });
- let currentContentHandle = globalSplitManager()?.activeSplit();
- const content = currentContentHandle?.content();
-
- if (
- !newSplit &&
- currentContentHandle &&
- content?.type === 'component' &&
- content.id === 'search'
- ) {
- requestSearchFocus(currentContentHandle.id);
- globalSplitManager()?.returnFocus();
- return;
- }
-
- currentContentHandle = navigateToSidebarView({
- viewId: props.link.id,
- params: props.link.params,
- shiftKey: newSplit,
- activeSplit: currentContentHandle,
- openWithSplit: layout.openWithSplit,
- referredFrom: 'sidebar',
- });
- if (currentContentHandle) requestSearchFocus(currentContentHandle.id);
- globalSplitManager()?.returnFocus();
- };
-
- return (
- <SidebarSearchMenu
- onSearch={openSearch}
- triggerProps={{
- size: 'icon-sm',
- class: '[&_svg]:size-4!',
- hotkey: props.link.hotkeyToken,
- }}
- />
- );
+ return <InviteModal />;
};
type SidebarSettingsWidgetProps = {
isSlim: () => boolean;
onSelect: (tab: SettingsTab) => void;
onMenuOpenChange?: (open: boolean) => void;
- /**
- * The Getting Started link, surfaced here only while it's hidden from the
- * sidebar rows (see `AppSidebar`). Keeps the page reachable from the account
- * menu once the user removes its dedicated row.
- */
- gettingStartedLink?: SidebarItem;
/**
* Icon-only: drops the trigger's leading padding and start alignment so the
* avatar centres in its square, and grows the avatar to nearly fill it. For
@@ -832,24 +374,9 @@ export const SidebarSettingsWidget = (props: SidebarSettingsWidgetProps) => {
const userId = useUserId();
const email = useEmail();
const logout = useLogout();
- const layout = useSplitLayout();
const userName = useOwnUserName();
- const openGettingStarted = () => {
- const link = props.gettingStartedLink;
- if (!link) return;
- navigateToSidebarView({
- viewId: link.id,
- params: link.params,
- shiftKey: false,
- activeSplit: globalSplitManager()?.activeSplit(),
- openWithSplit: layout.openWithSplit,
- referredFrom: 'sidebar',
- });
- globalSplitManager()?.returnFocus();
- };
-
// Prefer the user's real name (first/last); fall back to their email.
const displayName = createMemo(() => {
const name = userName();
@@ -939,28 +466,6 @@ export const SidebarSettingsWidget = (props: SidebarSettingsWidgetProps) => {
</div>
</div>
<div class="-mx-1.5 mt-2 mb-1.5 h-px bg-edge-divider" />
- <Show when={props.gettingStartedLink}>
- {(link) => (
- <Dropdown.Item
- class="flex items-center gap-2 px-2.5 py-2 text-sm cursor-default outline-none text-ink-muted"
- onSelect={openGettingStarted}
- >
- <span class="size-5 flex items-center justify-center">
- <Dynamic
- component={link().icon}
- class="size-4 shrink-0 text-ink-extra-muted"
- />
- </span>
- <span class="flex-1 text-ink">{link().label}</span>
- <Hotkey
- // Hardcoding this so that we can include the command scope activation
- shortcut="g s"
- theme="subtle"
- class="ml-6"
- />
- </Dropdown.Item>
- )}
- </Show>
<Dropdown.Item
class="flex items-center gap-2 px-2.5 py-2 text-sm cursor-default outline-none text-ink-muted"
onSelect={() => CommandState.open()}
@@ -1055,14 +560,10 @@ const RECENT_LINK: SidebarItem = {
* Assemble the ordered sidebar link list: the static links plus Getting
* started and the flag-gated Recent, Activity, Calendar, Calls, and CRM
* entries in their correct positions.
- * Shared by the rendered sidebar (`AppSidebar.visibleLinks`) and the
- * always-mounted `GoToHotkeys` registrar so their link sets can't drift. Call
- * from a reactive context — it reads `ENABLE_CALLS` / `isFeatureEnabled(enableCrm)`.
+ * Call from a reactive context — it reads `ENABLE_CALLS` / `isFeatureEnabled(enableCrm)`.
* `showGettingStarted` is the account-age gate (`useGettingStartedEnabled`),
* passed in because this runs outside a component; when false the link is
- * fully absent — row, `g s` hotkey, and command menu entry.
- * Rendered sections additionally drop `hiddenFromSidebar` entries, which have
- * hotkeys but no sidebar row.
+ * fully absent — `g s` hotkey and command menu entry.
*/
const buildSidebarLinks = (
showGettingStarted: boolean,
@@ -1110,625 +611,9 @@ const buildSidebarLinks = (
return links;
};
-const TeamInviteSidebarPromo = (props: { invite: TeamInviteDetails }) => {
- const inviterName = () => getDisplayName(tryMacroId(props.invite.invited_by));
- const joinTeamMutation = useJoinTeamMutation();
- const rejectInvitationMutation = useRejectInvitationMutation();
- const mutationPending = () =>
- joinTeamMutation.isPending || rejectInvitationMutation.isPending;
-
- return (
- <SidebarPromoCard
- label="Team invitation"
- description={`${inviterName() || 'A teammate'} invited you to join a team as ${props.invite.team_role}.`}
- primaryAction={{
- label: 'Accept',
- disabled: mutationPending(),
- onClick: () =>
- joinTeamMutation.mutate({ teamInviteId: props.invite.id }),
- }}
- secondaryAction={{
- label: 'Decline',
- disabled: mutationPending(),
- onClick: () =>
- rejectInvitationMutation.mutate({ teamInviteId: props.invite.id }),
- }}
- />
- );
-};
-
-export const AppSidebar = (props: AppSidebarProps) => {
- const { openSettings, selectTab, settingsOpen } = useSettingsState();
- const isTabAvailable = useSettingsTabAvailable();
- const currentTeamQuery = useCurrentTeamQuery();
- const userInvitesQuery = useUserInvitesQuery();
- const firstTeamInvite = () => userInvitesQuery.data?.invites.at(0);
- const [sectionVisibility, setSectionVisibility] = makePersisted(
- createSignal<Partial<SidebarSectionVisibility>>(DEFAULT_SECTION_VISIBILITY),
- { name: 'sidebar-section-visibility' }
- );
- const [tryVisibility, setTryVisibility] = makePersisted(
- createSignal<TryItemVisibility>(DEFAULT_TRY_VISIBILITY),
- { name: 'sidebar-try-visibility' }
- );
- const callCtx = useCallContextOptional();
-
- const hasPaidAccess = useHasPaidAccess();
-
- /** Persisted dismissal for the Premium upgrade promo card. */
- const [premiumCardDismissed, setPremiumCardDismissed] = makePersisted(
- createSignal<boolean>(false),
- { name: 'sidebar-premium-card-dismissed' }
- );
-
- const newPricingFF = useFeatureFlag(enableNewPricing);
-
- const gettingStartedEnabled = useGettingStartedEnabled();
- const calendarUiEnabled = useCalendarUiFlag();
- const activityFeedEnabled = useActivityFeedFlag();
- const recentViewEnabled = useRecentViewFlag();
- const allLinks = createMemo((): SidebarItem[] =>
- buildSidebarLinks(
- gettingStartedEnabled(),
- calendarUiEnabled(),
- activityFeedEnabled(),
- recentViewEnabled()
- )
- );
-
- // Hides only the rendered row: the g+s hotkey and command menu entry keep
- // working (like `hiddenFromSidebar` links), so the page stays reachable.
- const gettingStartedVisibility = createGettingStartedSidebarVisibility();
-
- const openSettingsTab = (tab: SettingsTab) => {
- if (!isTabAvailable(tab)) return;
- if (settingsOpen()) {
- selectTab(tab);
- return;
- }
- openSettings(tab);
- };
-
- const isExpanded = () => props.sidebarState === 'expanded';
- const isCollapsed = () => props.sidebarState === 'slim';
- const overlayOpen = () => props.overlayOpen === true;
- const isOverlayExpanded = () => isCollapsed() && overlayOpen();
- const isExpandedView = () => isExpanded() || isOverlayExpanded();
- const isSlim = () => isCollapsed() && !isOverlayExpanded();
- const sidebarDisplayState = (): SidebarState =>
- isExpandedView() ? 'expanded' : (props.sidebarState ?? 'expanded');
- const currentTeamName = () => currentTeamQuery.data?.team.name?.trim();
-
- const [hasOverflowTop, setHasOverflowTop] = createSignal(false);
- const [hasOverflowBottom, setHasOverflowBottom] = createSignal(false);
- const [middleScrollRef, setMiddleScrollRef] = createSignal<HTMLDivElement>();
- const middleScrollSize = createElementSize(middleScrollRef);
- const [overlayPointerInside, setOverlayPointerInside] = createSignal(false);
- const [overlayDropdownOpen, setOverlayDropdownOpen] = createSignal(false);
- const [, setWorkspaceContextMenuOpen] = createSignal(false);
- let middleScrollFrame: number | undefined;
- let middleScrollObserver: MutationObserver | undefined;
- let overlayCloseTimer: ReturnType<typeof setTimeout> | undefined;
- let overlayDropdownCloseTimer: ReturnType<typeof setTimeout> | undefined;
-
- const cancelOverlayClose = () => {
- if (overlayCloseTimer !== undefined) {
- clearTimeout(overlayCloseTimer);
- overlayCloseTimer = undefined;
- }
- };
-
- const requestOverlayClose = () => {
- if (!isCollapsed()) return;
- cancelOverlayClose();
- overlayCloseTimer = setTimeout(() => {
- overlayCloseTimer = undefined;
- if (!overlayPointerInside() && !overlayDropdownOpen()) {
- props.onOverlayOpenChange?.(false);
- }
- }, SIDEBAR_MAX_WIDTH_TRANSITION_MS);
- };
-
- const handleOverlayDropdownOpenChange = (open: boolean) => {
- if (!isCollapsed()) return;
- if (overlayDropdownCloseTimer !== undefined) {
- clearTimeout(overlayDropdownCloseTimer);
- overlayDropdownCloseTimer = undefined;
- }
-
- if (open) {
- setOverlayDropdownOpen(true);
- props.onOverlayOpenChange?.(true);
- cancelOverlayClose();
- return;
- }
-
- overlayDropdownCloseTimer = setTimeout(() => {
- overlayDropdownCloseTimer = undefined;
- setOverlayDropdownOpen(false);
- if (!overlayPointerInside()) requestOverlayClose();
- }, SIDEBAR_MAX_WIDTH_TRANSITION_MS);
- };
-
- const handleWorkspaceContextMenuOpenChange = (open: boolean) => {
- setWorkspaceContextMenuOpen(open);
- handleOverlayDropdownOpenChange(open);
- };
-
- const updateMiddleScrollShadows = () => {
- const el = middleScrollRef();
- if (!el) return;
- const maxScrollTop = el.scrollHeight - el.clientHeight;
- setHasOverflowTop(el.scrollTop > 1);
- setHasOverflowBottom(maxScrollTop - el.scrollTop > 1);
- };
-
- const scheduleMiddleScrollUpdate = () => {
- if (middleScrollFrame !== undefined)
- cancelAnimationFrame(middleScrollFrame);
- middleScrollFrame = requestAnimationFrame(() => {
- middleScrollFrame = undefined;
- updateMiddleScrollShadows();
- });
- };
-
- const attachMiddleScrollRef = (el: HTMLDivElement) => {
- middleScrollObserver?.disconnect();
- setMiddleScrollRef(el);
- middleScrollObserver = new MutationObserver(scheduleMiddleScrollUpdate);
- middleScrollObserver.observe(el, {
- childList: true,
- subtree: true,
- characterData: true,
- attributes: true,
- });
- scheduleMiddleScrollUpdate();
- };
-
- onCleanup(() => {
- middleScrollObserver?.disconnect();
- if (middleScrollFrame !== undefined)
- cancelAnimationFrame(middleScrollFrame);
- if (overlayCloseTimer !== undefined) clearTimeout(overlayCloseTimer);
- if (overlayDropdownCloseTimer !== undefined) {
- clearTimeout(overlayDropdownCloseTimer);
- }
- });
-
- const findLink = (id: SidebarItem['id']) =>
- allLinks().find((link) => link.id === id && !link.hiddenFromSidebar);
- const searchLink = () => allLinks().find((link) => link.id === 'search');
- const channelsLink = () => allLinks().find((link) => link.id === 'channels');
- const channelsContent = () =>
- ({
- type: 'component',
- id: 'channels',
- params: channelsLink()?.params,
- }) as const;
-
- const renderSidebarLink = (link: SidebarItem) => (
- <Dynamic
- component={link.id === 'mail' ? SidebarMailLink : SidebarLink}
- {...link}
- sidebarState={sidebarDisplayState()}
- hotkeyVisible={goToHotkeyVisible()}
- onContextMenuOpenChange={handleOverlayDropdownOpenChange}
- trailing={link.id === 'channels' ? <ChannelsActiveCallIcon /> : undefined}
- removeAction={
- link.id === 'getting-started'
- ? {
- tooltip: 'Remove from sidebar',
- onRemove: () => {
- gettingStartedVisibility.hide();
- // Hiding drops the row only — the go-to hotkey and its
- // command-menu entry stay registered (see buildSidebarLinks),
- // so this stays true.
- toast.success('Removed from sidebar', {
- subtext:
- 'You can always find Getting Started in the account menu or command menu.',
- });
- },
- }
- : undefined
- }
- />
- );
-
- const toSectionItem = (link: SidebarItem): CollapsibleSidebarSectionItem => ({
- id: String(link.id),
- visible: () => renderSidebarLink(link),
- dropdown: () => (
- <SidebarDropdownLink
- {...link}
- onContextMenuOpenChange={handleWorkspaceContextMenuOpenChange}
- />
- ),
- });
-
- // Ids, not the built list: this group is a fixed set, and everything else
- // lives in the collapsible Workspace section. `findLink` drops ids that
- // `buildSidebarLinks` gated out, so flag-gated rows need no filter here.
- const topLinks = createMemo(() =>
- ['home', 'getting-started', 'recent', 'activity']
- .filter(
- (id) => id !== 'getting-started' || !gettingStartedVisibility.hidden()
- )
- .map((id) => findLink(id))
- .filter((link): link is SidebarItem => link !== undefined)
- );
-
- const isSectionVisible = (id: SidebarSectionLinkId) =>
- sectionVisibility()[id] ?? DEFAULT_SECTION_VISIBILITY[id];
-
- // While the Getting Started row is hidden (but still account-gated in via
- // `findLink`), surface it in the account menu so the page stays reachable.
- const gettingStartedMenuLink = createMemo(() =>
- gettingStartedVisibility.hidden() ? findLink('getting-started') : undefined
- );
-
- const sectionItemsFor = (ids: readonly SidebarSectionLinkId[]) =>
- ids
- .filter(isSectionVisible)
- .map((id) => findLink(id))
- .filter((link): link is SidebarItem => link !== undefined)
- .map(toSectionItem);
-
- const workspaceItems = createMemo(() => sectionItemsFor(WORKSPACE_LINK_IDS));
-
- const toggleSectionVisibility = (id: SidebarSectionLinkId) => {
- setSectionVisibility({
- ...sectionVisibility(),
- [id]: !isSectionVisible(id),
- });
- scheduleMiddleScrollUpdate();
- };
-
- const dismissTryItem = (id: TryItemId) => {
- setTryVisibility({ ...tryVisibility(), [id]: false });
- scheduleMiddleScrollUpdate();
- };
-
- const dismissTrySection = () => {
- setTryVisibility({
- connect: false,
- invite: false,
- mobile: false,
- });
- };
-
- const sectionMenuOptionsFor = (ids: readonly SidebarSectionLinkId[]) =>
- ids
- .map((id) => findLink(id))
- .filter((link): link is SidebarItem => link !== undefined)
- .map((link) => ({
- id: link.id as SidebarSectionLinkId,
- label: link.label,
- checked: isSectionVisible(link.id as SidebarSectionLinkId),
- }));
-
- const tryItems = createMemo<TryCardItem[]>(() => {
- const items: TryCardItem[] = [];
- const addTryItem = (
- id: TryItemId,
- label: string,
- icon: Component<{ class?: string }>,
- onClick: () => void
- ) => {
- if (!tryVisibility()[id]) return;
-
- items.push({
- id,
- label,
- icon,
- onClick: () => {
- onClick();
- dismissTryItem(id);
- },
- });
- };
-
- const connected = getSettingsTabItem('Connected');
- if (connected && isTabAvailable('Connected')) {
- addTryItem('connect', 'Connect', connected.icon, () =>
- openSettingsTab('Connected')
- );
- }
-
- addTryItem('invite', 'Invite', UsersThreeIcon, () =>
- setInviteModalOpen(true)
- );
-
- const mobile = getSettingsTabItem('Mobile App');
- if (mobile && isTabAvailable('Mobile App')) {
- addTryItem('mobile', 'Mobile', mobile.icon, () =>
- openSettingsTab('Mobile App')
- );
- }
- return items;
- });
-
- createEffect(() => {
- middleScrollSize.width;
- middleScrollSize.height;
- workspaceItems().length;
- tryItems().length;
- props.overlayOpen;
- scheduleMiddleScrollUpdate();
- });
-
- createEffect(() => {
- if (isCollapsed() && !overlayOpen()) {
- cancelOverlayClose();
- setOverlayPointerInside(false);
- setOverlayDropdownOpen(false);
- setWorkspaceContextMenuOpen(false);
- }
- });
-
- registerSidebarHotkeys({
- isSlim: isCollapsed,
- onOpenChange: props.onOpenChange,
- });
-
- // hotkeyScopeNeutralAttribute: focusing anything in the sidebar (rows, the
- // workspace toggle, ...) must not flip the active hotkey scope to 'global',
- // which would mute the active split's hotkeys until the user clicks back
- // into a split. The sidebar's own hotkeys register on the 'global' scope,
- // which every scope chain reaches, so they don't need the flip either.
- return (
- <div
- {...hotkeyScopeNeutralAttribute}
- class={cn(
- 'group/sidebar flex flex-col gap-0 overflow-hidden bg-surface px-3 pb-3 pt-4 text-[13px]',
- isExpanded() &&
- 'relative h-full shrink-0 max-w-55 w-55 border-edge-frame opacity-100',
- isExpanded() &&
- (globalSplitManager()?.splits().length ?? 1) <= 1 &&
- 'border-r',
- props.sidebarState === 'hidden' &&
- 'fixed left-0 top-0 bottom-0 h-full -translate-x-full max-w-0 w-0 opacity-0 pointer-events-none',
- isCollapsed() && 'fixed z-modal-content',
- isCollapsed() &&
- !overlayOpen() &&
- 'left-0 inset-y-0 h-full max-w-0 w-0 opacity-0 pointer-events-none -translate-x-2',
- isOverlayExpanded() &&
- 'left-0 inset-y-0 h-full max-w-55 w-55 opacity-100 translate-x-0 rounded-r-xl shadow-menu ring-1 ring-edge-frame'
- )}
- data-expanded={isExpandedView()}
- data-slim={isSlim()}
- style={{ transition: SIDEBAR_MAX_WIDTH_TRANSITION_STYLE }}
- onPointerEnter={() => {
- if (!isCollapsed()) return;
- setOverlayPointerInside(true);
- props.onOverlayOpenChange?.(true);
- cancelOverlayClose();
- }}
- onPointerLeave={() => {
- if (!isCollapsed()) return;
- setOverlayPointerInside(false);
- requestOverlayClose();
- }}
- >
- <div class="shrink-0 flex items-center justify-between w-full relative group/logo-area">
- <div class="text-accent min-w-0 flex flex-1 items-center gap-2 pl-2">
- <div class="size-5 shrink-0 flex items-center justify-center">
- <LogoIcon class="size-4" />
- </div>
- <Show when={currentTeamName()}>
- {(teamName) => (
- <span class="min-w-0 truncate text-[13px] font-medium text-ink">
- {teamName()}
- </span>
- )}
- </Show>
- </div>
- <div class="flex shrink-0 items-center gap-1">
- <Show when={searchLink()}>
- {(link) => <SidebarHeaderSearchButton link={link()} />}
- </Show>
- <SidebarCreateMenu
- isSlim={isSlim}
- variant="icon"
- onMenuOpenChange={handleOverlayDropdownOpenChange}
- />
- </div>
- </div>
-
- <nav class="shrink-0 mt-2">
- <ul class="size-full flex flex-col gap-0.5">
- <For each={topLinks()}>
- {(link) => (
- <li class="flex flex-col items-center justify-center">
- {renderSidebarLink(link)}
- </li>
- )}
- </For>
- </ul>
- </nav>
-
- <div class="relative min-h-0 flex-1 my-3">
- <div
- ref={attachMiddleScrollRef}
- onScroll={updateMiddleScrollShadows}
- class="size-full overflow-y-auto flex flex-col gap-3"
- >
- <CollapsibleSidebarSection
- label="Workspace"
- persistKey="workspace"
- items={workspaceItems()}
- headerMenu={() => (
- <div class="pointer-events-auto">
- <SidebarSectionMenu
- label="Workspace"
- options={sectionMenuOptionsFor(WORKSPACE_LINK_IDS)}
- onToggle={toggleSectionVisibility}
- onOpenChange={handleWorkspaceContextMenuOpenChange}
- />
- </div>
- )}
- onOpenChange={scheduleMiddleScrollUpdate}
- />
-
- <Suspense>
- <FavoritesSection
- sidebarState={sidebarDisplayState()}
- onContextMenuOpenChange={handleOverlayDropdownOpenChange}
- />
- </Suspense>
-
- <Suspense>
- <ChannelsRecentWidget
- sidebarState={sidebarDisplayState()}
- onSectionOpenChange={scheduleMiddleScrollUpdate}
- onDropdownOpenChange={handleOverlayDropdownOpenChange}
- headerWrapper={(header) => (
- <SidebarOpenInSplitMenu
- content={channelsContent}
- onOpenChange={handleOverlayDropdownOpenChange}
- >
- {header}
- </SidebarOpenInSplitMenu>
- )}
- />
- </Suspense>
- </div>
- <div
- class={cn(
- 'pointer-events-none absolute inset-x-0 top-0 h-3 transition-opacity bg-gradient-to-b from-surface to-transparent',
- hasOverflowTop() ? 'opacity-100' : 'opacity-0'
- )}
- />
- <div
- class={cn(
- 'pointer-events-none absolute inset-x-0 bottom-0 h-3 transition-opacity bg-gradient-to-t from-surface to-transparent',
- hasOverflowBottom() ? 'opacity-100' : 'opacity-0'
- )}
- />
- </div>
-
- <div class="shrink-0 w-full pt-2 flex flex-col gap-2">
- <Show when={isExpandedView()}>
- <SidebarActiveCallWidget
- sidebarState="expanded"
- class="rounded-xl border border-edge-muted bg-surface shadow-menu p-1"
- />
- </Show>
- <Show when={isExpandedView() && callCtx?.isInCall()}>
- <div data-ui="sidebar-in-call-panel">
- <InCallPanel isSlim={() => false} />
- </div>
- </Show>
- <Show keyed when={isExpandedView() ? firstTeamInvite() : undefined}>
- {(invite) => <TeamInviteSidebarPromo invite={invite} />}
- </Show>
- <Show
- when={
- !hasPaidAccess() &&
- isExpandedView() &&
- !userInvitesQuery.isLoading &&
- !firstTeamInvite() &&
- !premiumCardDismissed() &&
- newPricingFF().enabled
- }
- >
- <SidebarPromoCard
- label="Upgrade to Premium"
- description="Unlock MCP integrations, better AI models, and team collaboration."
- onDismiss={() => {
- setPremiumCardDismissed(true);
- setPremiumHintVisible(true);
- }}
- primaryAction={{
- label: 'Upgrade',
- onClick: () => openSettingsTab('Billing'),
- }}
- secondaryAction={{
- label: 'Later',
- onClick: () => {
- setPremiumCardDismissed(true);
- setPremiumHintVisible(true);
- },
- }}
- />
- </Show>
- <Show
- when={
- !hasPaidAccess() &&
- isExpandedView() &&
- !userInvitesQuery.isLoading &&
- !firstTeamInvite() &&
- premiumHintVisible() &&
- premiumCardDismissed() &&
- newPricingFF().enabled
- }
- >
- <SidebarPromoHint
- title="Maybe later"
- message="You can upgrade anytime from Account settings."
- onDone={() => setPremiumHintVisible(false)}
- secondaryAction={{
- label: 'Take me there',
- onClick: () => openSettingsTab('Account'),
- }}
- />
- </Show>
- <Show when={isExpandedView() && tryItems().length > 0}>
- <TryCard items={tryItems()} onDismiss={dismissTrySection} />
- </Show>
- <SidebarSettingsWidget
- isSlim={isSlim}
- onSelect={openSettingsTab}
- onMenuOpenChange={handleOverlayDropdownOpenChange}
- gettingStartedLink={gettingStartedMenuLink()}
- />
- </div>
- <InviteModal />
- </div>
- );
-};
-
-interface SidebarLinkProps extends SidebarItem {
- sidebarState: SidebarState;
- hotkeyVisible: boolean;
- onContextMenuOpenChange?: (open: boolean) => void;
- /**
- * Skip the active background/text even when the view is active — used when
- * a nested row (e.g. a single selected inbox) carries the highlight instead.
- */
- suppressActiveStyle?: boolean;
- /** Called when the link is clicked while its view is already active. */
- onActiveClick?: () => void;
- /**
- * Rendered at the link's right edge while the view is active, in place of
- * the hover hotkey hints (the shortcut is redundant once active) — e.g. the
- * Email link's expand chevron.
- */
- trailingWhenActive?: JSX.Element;
- /**
- * Always-visible indicator at the link's right edge (unlike
- * `trailingWhenActive`). In slim mode it overlays the icon's top-right
- * corner instead, since the label region is hidden.
- */
- trailing?: JSX.Element;
- /**
- * Swaps the icon for an X while the row is hovered (expanded sidebar only —
- * in slim mode the icon is the whole row, so the swap would hijack
- * navigation). Clicking the X calls `onRemove` instead of navigating.
- */
- removeAction?: { tooltip: string; onRemove: () => void };
-}
-
-/** Which action of {@link SidebarOpenInSplitMenu} placed the content. */
-type SidebarOpenAction = 'current-split' | 'new-split' | 'fullscreen';
-
interface SidebarOpenInSplitMenuProps {
/** The content the menu's actions open. */
content?: () => SplitContent;
- /**
- * Runs once an action has placed the content in a split — e.g. the Email
- * account rows scope the freshly opened mail list to their inbox.
- */
- onOpened?: (split: SplitHandle, action: SidebarOpenAction) => void;
/** View-owned navigation for rows that select a location inside this split. */
onOpenCurrentSplit?: () => void;
onOpenNewSplit?: () => void;
@@ -1746,8 +631,7 @@ interface SidebarOpenInSplitMenuProps {
/**
* The shared sidebar right-click menu: open the row's content in the current
- * split, in a new split, or fullscreen. Wraps any sidebar row — the top-level
- * links and the nested Email account rows both use it.
+ * split, in a new split, or fullscreen.
*/
export const SidebarOpenInSplitMenu = (props: SidebarOpenInSplitMenuProps) => {
const analytics = useAnalytics();
@@ -1772,8 +656,6 @@ export const SidebarOpenInSplitMenu = (props: SidebarOpenInSplitMenuProps) => {
if (result.status === 'reused' && result.owner !== result.sourceOwner) {
toast.alert('Content already open');
}
- const split = result.split;
- if (split) props.onOpened?.(split, 'current-split');
};
const openInNewSplit = () => {
@@ -1799,8 +681,6 @@ export const SidebarOpenInSplitMenu = (props: SidebarOpenInSplitMenuProps) => {
if (result.status === 'reused' && result.owner !== result.sourceOwner) {
toast.alert('Content already open');
}
- const split = result.split;
- if (split) props.onOpened?.(split, 'new-split');
};
const openFullscreen = () => {
@@ -1812,10 +692,9 @@ export const SidebarOpenInSplitMenu = (props: SidebarOpenInSplitMenuProps) => {
if (!props.content) return;
- const split = layout.replaceAllSplits(props.content(), {
+ layout.replaceAllSplits(props.content(), {
referredFrom: 'sidebar',
});
- if (split) props.onOpened?.(split, 'fullscreen');
globalSplitManager()?.returnFocus();
};
@@ -1842,437 +721,3 @@ export const SidebarOpenInSplitMenu = (props: SidebarOpenInSplitMenuProps) => {
</ContextMenu>
);
};
-
-/**
- * Accent phone icon for a visible active channel call or Quick Call.
- */
-const ChannelsActiveCallIcon = () => {
- return (
- <Suspense>
- <ChannelsActiveCallIconContent />
- </Suspense>
- );
-};
-
-const ChannelsActiveCallIconContent = () => {
- const hasActiveCall = useHasActiveChannelsCall();
-
- return (
- <Show when={hasActiveCall()}>
- <PhoneIcon class="size-4 shrink-0 text-accent fill-accent" />
- </Show>
- );
-};
-
-const SidebarLinkRow = (props: SidebarLinkProps) => {
- const [isHovering, setIsHovering] = createSignal(false);
-
- const analytics = useAnalytics();
- const layout = useSplitLayout();
-
- const location = useLocation();
- const content = () => sidebarContent(props.id, props.params);
-
- // Always read the manager signal live: it is undefined until the split
- // layout mounts, which happens after the sidebar.
- const isActive = () => {
- const activeContent = globalSplitManager()?.activeSplit()?.content();
-
- // In case we can't match on the active split, use the url path to determine
- // if this link is active
- if (!activeContent) {
- const paths = location.pathname.split('/').filter(Boolean);
- return paths.includes(props.id);
- }
-
- const expectedContent = content();
- return (
- activeContent.type === expectedContent.type &&
- activeContent.id === expectedContent.id
- );
- };
-
- return (
- <NavRow
- draggable={false}
- data-sidebar-link={props.id}
- data-active={isActive() ? '' : undefined}
- active={isActive() && !props.suppressActiveStyle}
- class="h-7"
- fullWidth
- tooltipPlacement="right"
- onMouseEnter={() => setIsHovering(true)}
- label={`Go to ${props.label}`}
- hotkey={
- props.hotkey
- ? props.standaloneHotkey
- ? props.hotkeyToken
- : [TOKENS.sidebar.goToLeader, props.hotkeyToken]
- : undefined
- }
- tooltipDisabled={props.sidebarState !== 'slim' || props.id === 'calendar'}
- onMouseLeave={() => setIsHovering(false)}
- onMouseDown={(e) => {
- if (e.button !== 0) return;
- analytics.track('sidebar_click', {
- view: props.id,
- });
-
- e.preventDefault();
- let currentContentHandle = globalSplitManager()?.activeSplit();
-
- const currentContent = currentContentHandle?.content();
- const expectedContent = content();
- const isSameContent =
- currentContent?.type === expectedContent.type &&
- currentContent.id === expectedContent.id;
-
- if (!isSameContent || e.shiftKey) {
- currentContentHandle = navigateToSidebarView({
- viewId: props.id,
- params: props.params,
- shiftKey: e.shiftKey,
- activeSplit: currentContentHandle,
- openWithSplit: layout.openWithSplit,
- referredFrom: 'sidebar',
- });
- } else {
- props.onActiveClick?.();
- }
-
- if (props.id === 'search' && currentContentHandle) {
- requestSearchFocus(currentContentHandle.id);
- }
-
- globalSplitManager()?.returnFocus();
- }}
- >
- <Show when={props.icon}>
- <div class="size-5 shrink-0 flex items-center justify-center [&_svg]:size-3.5">
- <Show
- when={
- isHovering() && props.sidebarState !== 'slim'
- ? props.removeAction
- : undefined
- }
- fallback={<Dynamic component={props.icon} />}
- >
- {(removeAction) => (
- <Tooltip label={removeAction().tooltip} as="span" placement="top">
- <span
- role="button"
- tabIndex={0}
- aria-label={removeAction().tooltip}
- class="flex items-center justify-center text-ink-muted
- rounded-md hover:bg-failure hover:text-surface p-1"
- onMouseDown={(e) => {
- // The row navigates on mousedown; the X must not.
- e.stopPropagation();
- e.preventDefault();
- }}
- onClick={(e) => {
- e.stopPropagation();
- removeAction().onRemove();
- }}
- onKeyDown={(e) => {
- if (e.key === 'Enter' || e.key === ' ') {
- e.preventDefault();
- e.stopPropagation();
- removeAction().onRemove();
- }
- }}
- >
- <XIcon />
- </span>
- </Tooltip>
- )}
- </Show>
- </div>
- </Show>
-
- <div class="flex items-center gap-1 group-data-[slim=true]/sidebar:hidden">
- <span class="whitespace-nowrap">{props.label}</span>
- </div>
-
- <Show when={props.trailing}>
- <div
- class={cn(
- 'flex items-center',
- props.sidebarState === 'slim'
- ? 'absolute -top-1 -right-1'
- : 'ml-auto'
- )}
- >
- {props.trailing}
- </div>
- </Show>
-
- <Show
- when={
- isActive() &&
- props.trailingWhenActive !== undefined &&
- !props.hotkeyVisible
- }
- >
- <div class="group-data-[slim=true]/sidebar:hidden ml-auto flex items-center text-ink-muted">
- {props.trailingWhenActive}
- </div>
- </Show>
-
- <Show
- when={
- props.hotkey &&
- isHovering() &&
- !props.hotkeyVisible &&
- !(isActive() && props.trailingWhenActive !== undefined)
- }
- >
- <div class="group-data-[slim=true]/sidebar:hidden ml-auto">
- <div class="flex gap-1 items-center text-ink-extra-muted font-normal text-xxs">
- <Show when={!props.standaloneHotkey}>
- <div class="text-xxs text-ink-extra-muted rounded-sm ml-auto border border-ink/5 px-1.5 py-0.5 -my-1">
- <Hotkey token={TOKENS.sidebar.goToLeader} />
- </div>
- <div class="text-xxs text-ink-extra-muted rounded-sm ml-auto border border-ink/5 px-1.5 py-0.5 -my-1">
- <Hotkey token={props.hotkeyToken} />
- </div>
- </Show>
- <Show when={props.standaloneHotkey}>
- <div class="text-xxs text-ink-extra-muted rounded-sm ml-auto border border-ink/5 px-1.5 py-0.5 -my-1">
- <Hotkey token={props.hotkeyToken} />
- </div>
- </Show>
- </div>
- </div>
- </Show>
- <Show when={props.hotkey && props.hotkeyVisible}>
- <div
- class={cn(
- 'text-xs size-4 rounded-xs flex items-center justify-center overflow-hidden bg-accent/10 border border-accent/30 text-accent',
- props.sidebarState === 'slim' && 'absolute -bottom-1 -right-1',
- props.sidebarState !== 'slim' && 'relative p-1 ml-auto'
- )}
- >
- <Hotkey token={props.hotkeyToken} />
- </div>
- </Show>
- </NavRow>
- );
-};
-
-const SidebarLink = (props: SidebarLinkProps) => {
- const [contextMenuOpen, setContextMenuOpen] = createSignal(false);
- const content = () => sidebarContent(props.id, props.params);
- const handleContextMenuOpenChange = (open: boolean) => {
- setContextMenuOpen(open);
- // Keep the collapsed sidebar overlay mounted while its portaled menu is open.
- props.onContextMenuOpenChange?.(open);
- };
-
- return (
- <SidebarOpenInSplitMenu
- content={content}
- onOpenChange={handleContextMenuOpenChange}
- onOpened={(split, action) => {
- if (action === 'fullscreen' && props.id === 'search')
- requestSearchFocus(split.id);
- }}
- >
- <Show
- when={props.id === 'calendar'}
- fallback={<SidebarLinkRow {...props} />}
- >
- <CalendarSidebarPreview disabled={contextMenuOpen()}>
- <SidebarLinkRow {...props} />
- </CalendarSidebarPreview>
- </Show>
- </SidebarOpenInSplitMenu>
- );
-};
-
-/**
- * The Email sidebar link, acting as a dropdown for the user's linked inboxes.
- * With multiple inboxes linked, the active link swaps its hotkey hint for a
- * chevron; clicking the already-active link fans out a nested row per inbox,
- * and clicking it again collapses the rows and returns to the unified inbox
- * (all inboxes).
- *
- * The open/closed state is a plain user toggle, persisted across reloads —
- * navigating to other views or into an email block never collapses the rows.
- *
- * Clicking an inbox row scopes the email list to only that inbox (the same
- * `inboxFilter` the topbar inbox dropdown drives), navigating back to the
- * list first if some other view is active. A row carries the active highlight
- * only when it is the single selected inbox (read from the live mail view, or
- * from the filter its history entry captured when something else is on top),
- * in which case the parent link yields its own.
- *
- * Each row carries the same right-click menu as the parent link (open in the
- * current split, a new split, or fullscreen), scoping whichever split it opens
- * to that inbox.
- */
-const SidebarMailLink = (props: SidebarLinkProps) => {
- const layout = useSplitLayout();
- const linksQuery = useMailAccountsQuery();
- const [expanded, setExpanded] = makePersisted(createSignal(false), {
- name: 'sidebar-mail-accounts-expanded',
- });
-
- const links = createMemo(() =>
- [...(linksQuery.data?.links ?? [])].sort((a, b) =>
- a.email_address.localeCompare(b.email_address)
- )
- );
-
- const isMailList = (content: SplitContent | undefined) =>
- content?.type === 'component' && content.id === 'mail';
-
- /** The mail list content an account row's right-click menu opens. */
- const mailContent = () =>
- ({
- type: 'component',
- id: props.id,
- params: props.params,
- }) as const;
-
- const canShow = () => props.sidebarState === 'expanded' && links().length > 1;
-
- const showAccounts = () => canShow() && expanded();
-
- const selectedIds = () => {
- // Read the manager signal live: it is undefined until the split layout
- // mounts, which can be after the sidebar.
- const split = globalSplitManager()?.activeSplit();
- if (!split) return undefined;
- // Registered only while the split's mail list view is mounted.
- const controller = getInboxFilterSplit(split.id);
- if (controller) return controller.inboxFilter();
- // Something else is on top (an email block, another view) — read the
- // filter the mail list captured into its history entry on nav-away.
- const entries = split.history();
- for (let i = entries.length - 1; i >= 0; i--) {
- const entry = entries[i];
- if (isMailList(entry)) {
- return entry.state?.[INBOX_FILTER_ENTRY_KEY] as string[] | undefined;
- }
- }
- return undefined;
- };
-
- const onlySelectedId = () => {
- const ids = selectedIds();
- return ids?.length === 1 ? ids[0] : undefined;
- };
-
- // Scope the list to one inbox, first returning to the mail list (restoring
- // the history entry if there is one) when some other view is active. The
- // filter request is queued and applied as the list mounts.
- const selectOnly = (linkId: string) => {
- const manager = globalSplitManager();
- let split = manager?.activeSplit();
- if (!isMailList(split?.content())) {
- split = navigateToSidebarView({
- viewId: 'mail',
- shiftKey: false,
- activeSplit: split,
- openWithSplit: layout.openWithSplit,
- referredFrom: 'sidebar',
- });
- }
- if (!split) return;
- requestInboxFilter(split.id, [linkId]);
- manager?.returnFocus();
- };
-
- return (
- <>
- <SidebarLink
- {...props}
- suppressActiveStyle={showAccounts() && onlySelectedId() !== undefined}
- onActiveClick={() => {
- if (!canShow()) return;
- if (!expanded()) {
- setExpanded(true);
- return;
- }
- // Collapsing also returns to the unified inbox. Only fired while
- // the mail list is the active content, so target the active split.
- setExpanded(false);
- const split = globalSplitManager()?.activeSplit();
- if (split) requestInboxFilter(split.id, undefined);
- }}
- trailingWhenActive={
- canShow() ? (
- <CaretRightIcon
- class={cn(
- 'size-3 transition-transform duration-200',
- expanded() && 'rotate-90'
- )}
- />
- ) : undefined
- }
- />
- <Show when={canShow()}>
- <div
- class="grid w-full transition-[grid-template-rows] duration-200 ease-out"
- style={{ 'grid-template-rows': expanded() ? '1fr' : '0fr' }}
- >
- <ul class="min-h-0 overflow-hidden flex flex-col gap-0.5">
- <For each={links()}>
- {(link, index) => (
- <li
- class={cn(
- 'flex items-center justify-center first:mt-0.5 transition-[opacity,transform] duration-200 ease-out',
- expanded()
- ? 'opacity-100 translate-y-0'
- : 'opacity-0 -translate-y-2'
- )}
- style={{
- 'transition-delay': expanded()
- ? `${index() * 30}ms`
- : '0ms',
- }}
- >
- <SidebarOpenInSplitMenu
- content={mailContent}
- // Keeps the hover overlay open over a slim sidebar while
- // the menu is up, same as the parent link's menu.
- onOpenChange={props.onContextMenuOpenChange}
- onOpened={(split) =>
- requestInboxFilter(split.id, [link.id])
- }
- >
- <NavRow
- draggable={false}
- disabled={!expanded()}
- data-sidebar-mail-account={link.email_address}
- data-active={
- onlySelectedId() === link.id ? '' : undefined
- }
- active={onlySelectedId() === link.id}
- class="h-7 pl-6 pr-2"
- onMouseDown={(e) => {
- if (e.button !== 0) return;
- e.preventDefault();
- selectOnly(link.id);
- }}
- >
- <UserIcon
- {...inboxIconProps(link.email_address)}
- photoUrl={link.photo_url ?? undefined}
- size="sm"
- suppressClick
- showTooltip={false}
- />
- <span class="truncate">{link.email_address}</span>
- </NavRow>
- </SidebarOpenInSplitMenu>
- </li>
- )}
- </For>
- </ul>
- </div>
- </Show>
- </>
- );
-};
diff --git a/apps/web/src/components/app/sidebar-next/footer-actions.tsx b/apps/web/src/components/app/sidebar-next/footer-actions.tsx
index bb1b7e21ef..4e51f1c3d5 100644
--- a/apps/web/src/components/app/sidebar-next/footer-actions.tsx
+++ b/apps/web/src/components/app/sidebar-next/footer-actions.tsx
@@ -15,8 +15,8 @@ export const FooterActions = (props: {
const { openSettings, selectTab, settingsOpen } = useSettingsState();
const isTabAvailable = useSettingsTabAvailable();
- // Same handling as `AppSidebar`: retarget the panel when it is already open
- // rather than reopening it, and ignore tabs this account cannot reach.
+ // Retarget the panel when it is already open rather than reopening it, and
+ // ignore tabs this account cannot reach.
const openSettingsTab = (tab: SettingsTab) => {
if (!isTabAvailable(tab)) return;
if (settingsOpen()) {
@@ -28,10 +28,10 @@ export const FooterActions = (props: {
return (
/*
- The account card from the old sidebar, reused whole. Its trigger already
- collapses to the bare avatar under that sidebar's slim contract, so the
- group is scoped to this wrapper — setting `data-slim` on the rail root
- would expose every descendant to those selectors.
+ The account card's trigger collapses to the bare avatar under
+ `group-data-[slim=true]/sidebar`, so the group is scoped to this
+ wrapper — setting `data-slim` on the rail root would expose every
+ descendant to those selectors.
*/
<div
class="group/sidebar flex w-full shrink-0 justify-center"
diff --git a/apps/web/src/components/app/sidebar-next/list-nav.tsx b/apps/web/src/components/app/sidebar-next/list-nav.tsx
index 4d496ea322..67d35c1b3d 100644
--- a/apps/web/src/components/app/sidebar-next/list-nav.tsx
+++ b/apps/web/src/components/app/sidebar-next/list-nav.tsx
@@ -141,7 +141,6 @@ export const ListNav = (props: ListNavProps) => {
viewId: props.item.id,
params: props.item.params,
shiftKey,
- activeSplit: globalSplitManager()?.activeSplit(),
openWithSplit: layout.openWithSplit,
referredFrom: 'sidebar',
});
@@ -197,8 +196,7 @@ export const ListNav = (props: ListNavProps) => {
draggable={false}
aria-current={isActive() ? 'page' : undefined}
// An attribute rather than a class-only state, so the styling can be
- // retargeted from CSS and the `data-active` selectors the old sidebar's
- // tests use keep working.
+ // retargeted from CSS and tests can select the active item.
data-active={isActive() ? '' : undefined}
data-sidebar-next-item={props.item.id}
data-unread={props.unread ? '' : undefined}
diff --git a/apps/web/src/components/app/sidebar-next/nav-items.ts b/apps/web/src/components/app/sidebar-next/nav-items.ts
index 341756e4ba..eb144249d7 100644
--- a/apps/web/src/components/app/sidebar-next/nav-items.ts
+++ b/apps/web/src/components/app/sidebar-next/nav-items.ts
@@ -34,15 +34,13 @@ export type SidebarNextNavItem = SidebarItem & {
/**
* SidebarRail's nav buttons, in render order.
*
- * Phosphor icons rather than the animated `wide-*` set the old sidebar uses:
- * they are plain `fill="currentColor"` SVGs, so the active button's
- * `text-ink-muted` colours the glyph.
+ * Phosphor icons rather than the animated `wide-*` set: they are plain
+ * `fill="currentColor"` SVGs, so the active button's `text-ink-muted` colours
+ * the glyph.
*
- * The labels are new but every destination is an existing view id, so the
- * `hotkeyToken`s are the ones `GoToHotkeys` already registers — `g h`
- * reaches Home, `g f` still reaches Drive. `GoToHotkeys` is mounted from
- * `Layout` off `buildSidebarLinks` and is independent of which sidebar renders,
- * so the shortcuts work unchanged; these tokens only label the tooltips.
+ * Every destination is an existing view id, so the `hotkeyToken`s are the ones
+ * `GoToHotkeys` registers off `buildSidebarLinks` — `g h` reaches Home, `g f`
+ * reaches Drive. These tokens only label the tooltips.
*/
const SIDEBAR_NEXT_NAV_ITEMS = [
{
@@ -119,7 +117,7 @@ const SIDEBAR_NEXT_NAV_ITEMS = [
},
] satisfies SidebarNextNavItem[];
-/** The flag gates Calendar and Customers keep from `AppSidebar`. */
+/** Feature flag gates for the Calendar and Customers buttons. */
export type NavItemGates = {
showCalendar: boolean;
showCustomers: boolean;
diff --git a/apps/web/src/components/app/sidebar-next/search-bar-button.tsx b/apps/web/src/components/app/sidebar-next/search-bar-button.tsx
index af5d916bd9..0a19084f88 100644
--- a/apps/web/src/components/app/sidebar-next/search-bar-button.tsx
+++ b/apps/web/src/components/app/sidebar-next/search-bar-button.tsx
@@ -31,7 +31,6 @@ export const SearchRailButton = () => {
split = navigateToSidebarView({
viewId: 'search',
shiftKey: newSplit,
- activeSplit: split,
openWithSplit: layout.openWithSplit,
referredFrom: 'sidebar',
});
diff --git a/apps/web/src/components/app/sidebar-next/sidebar-rail.tsx b/apps/web/src/components/app/sidebar-next/sidebar-rail.tsx
index 1457de81fe..c4b7ce0adb 100644
--- a/apps/web/src/components/app/sidebar-next/sidebar-rail.tsx
+++ b/apps/web/src/components/app/sidebar-next/sidebar-rail.tsx
@@ -20,15 +20,14 @@ function ChannelsListNav(props: Omit<ListNavProps, 'activeCall'>) {
}
/**
- * The rebuilt app sidebar, behind `enable-new-app-views`: a single always-narrow
- * column of 40px icon buttons, labels in tooltips.
+ * The app sidebar: a single always-narrow column of 40px icon buttons, labels
+ * in tooltips.
*
* Always narrow by design — there is no slim mode or hover-peek overlay.
* `cmd+.` toggles navigation in the active workspace. The `g`-prefixed
- * nav shortcuts are unaffected: `GoToHotkeys` is mounted from `Layout` and does
- * not depend on which sidebar renders. There is no room for the leader-key
- * hints the old sidebar paints on its rows, so each button's tooltip carries
- * its shortcut instead.
+ * nav shortcuts are registered by `GoToHotkeys`, which `Layout` mounts
+ * separately. There is no room for leader-key hints on the buttons, so each
+ * button's tooltip carries its shortcut instead.
*/
export const SidebarRail = () => {
const gates = useNavItemGates();
@@ -43,7 +42,6 @@ export const SidebarRail = () => {
navigateToSidebarView({
viewId: 'home',
shiftKey: event.shiftKey,
- activeSplit: globalSplitManager()?.activeSplit(),
openWithSplit: layout.openWithSplit,
referredFrom: 'sidebar',
});
diff --git a/apps/web/src/components/app/sidebar-next/use-sidebar-next-flag.ts b/apps/web/src/components/app/sidebar-next/use-sidebar-next-flag.ts
deleted file mode 100644
index 6ded5ae785..0000000000
--- a/apps/web/src/components/app/sidebar-next/use-sidebar-next-flag.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { useFeatureFlag } from '@app/lib/analytics/posthog';
-import { enableNewAppViews } from '@core/constant/featureFlags';
-import type { Accessor } from 'solid-js';
-
-/**
- * Whether `SidebarRail` renders in place of `AppSidebar`. Shares the
- * `enable-new-app-views` gate with the rebuilt app surfaces.
- */
-export function useSidebarNextFlag(): Accessor<boolean> {
- const flag = useFeatureFlag(enableNewAppViews);
- return () => flag().enabled;
-}
diff --git a/apps/web/src/components/app/sidebarVisibility.ts b/apps/web/src/components/app/sidebarVisibility.ts
index b930c55a26..799bc6e23b 100644
--- a/apps/web/src/components/app/sidebarVisibility.ts
+++ b/apps/web/src/components/app/sidebarVisibility.ts
@@ -4,16 +4,3 @@ export const SidebarVisibilityContext = createContext<() => boolean>(
() => false
);
export const isSidebarVisible = () => useContext(SidebarVisibilityContext)();
-
-export type SidebarCollapseContextValue = {
- isCollapsed: () => boolean;
- expand: () => void;
-};
-
-export const SidebarCollapseContext =
- createContext<SidebarCollapseContextValue>({
- isCollapsed: () => false,
- expand: () => {},
- });
-
-export const useSidebarCollapse = () => useContext(SidebarCollapseContext);
diff --git a/apps/web/src/components/app/split-layout/SplitLayoutRoute.tsx b/apps/web/src/components/app/split-layout/SplitLayoutRoute.tsx
index fb58b286e5..20dd7743be 100644
--- a/apps/web/src/components/app/split-layout/SplitLayoutRoute.tsx
+++ b/apps/web/src/components/app/split-layout/SplitLayoutRoute.tsx
@@ -1,6 +1,4 @@
-import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { setGlobalSplitManager } from '@app/signal/splitLayout';
-import { enableNewAppViews } from '@core/constant/featureFlags';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import type { WithRequired } from '@core/util/withRequired';
import type { RouteDefinition, RouteSectionProps } from '@solidjs/router';
@@ -9,11 +7,7 @@ import { createAppSplitRouterMiddleware } from './split-router/app-middleware';
import { appSplitRoutes } from './split-router/app-routes';
function LayoutRoute(props: RouteSectionProps) {
- const newAppViews = useFeatureFlag(enableNewAppViews);
- const middleware = createAppSplitRouterMiddleware({
- newAppViews,
- isTouchDevice,
- });
+ const middleware = createAppSplitRouterMiddleware({ isTouchDevice });
return (
<SplitLayoutContainer
diff --git a/apps/web/src/components/app/split-layout/componentRegistry.tsx b/apps/web/src/components/app/split-layout/componentRegistry.tsx
index bfd28f90bd..9f7c161f92 100644
--- a/apps/web/src/components/app/split-layout/componentRegistry.tsx
+++ b/apps/web/src/components/app/split-layout/componentRegistry.tsx
@@ -38,7 +38,6 @@ import { LoadingBlock } from '@core/component/LoadingBlock';
import {
DEV_MODE_ENV,
enableChatV3Agents,
- enableNewAppViews,
enableProjects,
isFeatureEnabled,
LOCAL_ONLY,
@@ -84,10 +83,8 @@ type ComponentRegistration = {
const REGISTRY = new Map<string, ComponentRegistration>();
-/** Shell for views that draw their own top bar. New app views are on by default,
- * so this is fixed when the mount is created instead of written after paint. */
+/** Shell for views that draw their own top bar. */
function composableLayout(onTouch = false): ComponentMeta | undefined {
- if (!isFeatureEnabled(enableNewAppViews)) return;
if (isTouchDevice() && !onTouch) return;
return { splitPanelLayout: 'composable' };
}
diff --git a/apps/web/src/components/app/split-layout/components/SplitHeader.tsx b/apps/web/src/components/app/split-layout/components/SplitHeader.tsx
index e1f4f9b225..8d2d3b6793 100644
--- a/apps/web/src/components/app/split-layout/components/SplitHeader.tsx
+++ b/apps/web/src/components/app/split-layout/components/SplitHeader.tsx
@@ -9,7 +9,6 @@ import { openEntityInSplitFromUnifiedList } from '@app/features/next-soup/utils'
import { projectRouteId } from '@app/features/projects/core/route';
import { useSplitRouter } from '@app/lib/split-router';
import { useGlobalNotificationSource } from '@components/app/GlobalAppState';
-import { useSidebarCollapse } from '@components/app/sidebarVisibility';
import { type BlockName, NonDocumentBlockTypes } from '@core/block';
import {
ContextMenuContent,
@@ -34,7 +33,6 @@ import CaretLeft from '@phosphor/caret-left.svg';
import CaretUp from '@phosphor/caret-up.svg';
import SplitIcon from '@phosphor/columns.svg';
import CopyIcon from '@phosphor/copy.svg';
-import SidebarIcon from '@phosphor/sidebar-simple.svg';
import CloseIcon from '@phosphor/x.svg';
import { mergeRefs } from '@solid-primitives/refs';
import { createDroppable, useDragDropContext } from '@thisbeyond/solid-dnd';
@@ -145,41 +143,6 @@ function SplitBackButton() {
);
}
-function SidebarExpandButton() {
- const panel = useContext(SplitPanelContext);
- const layout = useContext(SplitLayoutContext);
- const sidebar = useSidebarCollapse();
-
- const isLeftmostSplit = () =>
- layout?.manager.splits()[0]?.id === panel?.handle.id;
- const visible = () => sidebar.isCollapsed() && isLeftmostSplit();
-
- return (
- <div
- class={cn(
- 'overflow-hidden transition-[width,opacity,margin] duration-[120ms] ease-in-out',
- visible()
- ? 'w-8 @max-[380px]/split-header:w-0 @max-[380px]/split-header:opacity-0 opacity-100 mr-1 @max-[380px]/split-header:mr-0'
- : 'w-0 opacity-0 mr-0'
- )}
- aria-hidden={!visible()}
- >
- <Button
- class="rounded-lg"
- square
- size="sm"
- label="Expand Sidebar"
- hotkey={TOKENS.global.toggleSidebar}
- disabled={!visible()}
- tabindex={visible() ? undefined : -1}
- onClick={() => sidebar.expand()}
- >
- <SidebarIcon class="size-4" />
- </Button>
- </div>
- );
-}
-
function _SplitSpotlightButton() {
const context = useContext(SplitPanelContext);
const layout = useContext(SplitLayoutContext);
@@ -629,7 +592,6 @@ export function SplitHeader(props: {
when={isTouchDevice()}
fallback={
<div class="relative flex items-center pl-2 h-full">
- <SidebarExpandButton />
<SplitCloseButton />
<SplitDriveReturnButton />
</div>
diff --git a/apps/web/src/components/app/split-layout/split-router/app-middleware.ts b/apps/web/src/components/app/split-layout/split-router/app-middleware.ts
index 400b9afe79..1c54b77873 100644
--- a/apps/web/src/components/app/split-layout/split-router/app-middleware.ts
+++ b/apps/web/src/components/app/split-layout/split-router/app-middleware.ts
@@ -30,13 +30,7 @@ import { match } from 'ts-pattern';
import { appSplitRoutes } from './app-routes';
import { decodeLegacyPair } from './legacy-route';
-type NewAppViewsState = {
- enabled: boolean;
- loading: boolean;
-};
-
type AppMiddlewareState = {
- newAppViews: () => NewAppViewsState;
isTouchDevice: () => boolean;
};
@@ -92,11 +86,7 @@ function redirectLegacyRoutes(
: undefined
)
.when(
- () => {
- if (isTouch) return true;
- const flag = options.newAppViews();
- return flag.loading || !flag.enabled;
- },
+ () => isTouch,
() => undefined
)
.with({ type: 'email' }, ({ id }) => `/mail/${encodeURIComponent(id)}`)
diff --git a/apps/web/src/components/app/split-layout/split-router/app-route-shell.tsx b/apps/web/src/components/app/split-layout/split-router/app-route-shell.tsx
index 9f4a740541..c03cfafefc 100644
--- a/apps/web/src/components/app/split-layout/split-router/app-route-shell.tsx
+++ b/apps/web/src/components/app/split-layout/split-router/app-route-shell.tsx
@@ -1,20 +1,11 @@
import { useAnalytics } from '@app/lib/analytics/analytics-context';
-import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { useSplitRouter } from '@app/lib/split-router';
import { parseSearchState } from '@app/lib/split-router/search';
import { isRecord } from '@app/lib/split-router/utils';
import { useIsAuthenticated } from '@core/auth';
import { LoadingBlock } from '@core/component/LoadingBlock';
-import { enableNewAppViews } from '@core/constant/featureFlags';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
-import {
- type Component,
- createSignal,
- type JSX,
- onCleanup,
- onMount,
- Show,
-} from 'solid-js';
+import { type Component, type JSX, onMount, Show } from 'solid-js';
import type { SplitContent, SplitId } from '../layoutManager';
import { useSplitPanelOrThrow } from '../layoutUtils';
@@ -60,52 +51,22 @@ export function RedirectSplit(props: { to: SplitContent }) {
return null;
}
-/** App-only feature gating and shell metadata; feature views stay route-agnostic. */
-export function NewAppView(props: {
+/** App-only page tracking and detail gating; feature views stay route-agnostic. */
+export function AppView(props: {
id: string;
children: JSX.Element;
- fallback: JSX.Element;
- desktopOnly?: boolean;
- composableOnTouch?: boolean;
detailRequested?: () => boolean;
detailFallback?: JSX.Element;
detailDesktopOnly?: boolean;
- /** Keep routed details in their host shell when the list view flag is off. */
- alwaysRenderDetail?: boolean;
}) {
usePageViewTracking(props.id);
- const flag = useFeatureFlag(enableNewAppViews);
- const [timedOut, setTimedOut] = createSignal(false);
- const timer = setTimeout(() => setTimedOut(true), 5_000);
- onCleanup(() => clearTimeout(timer));
- const ready = () => !flag().loading || timedOut();
- const enabled = () => ready() && flag().enabled;
const detailUnsupported = () =>
Boolean(
props.detailRequested?.() && props.detailDesktopOnly && isTouchDevice()
);
- const surfaceSupported = () => !props.desktopOnly || !isTouchDevice();
- const renderModern = () =>
- (enabled() ||
- (ready() &&
- Boolean(props.alwaysRenderDetail && props.detailRequested?.()))) &&
- surfaceSupported() &&
- !detailUnsupported();
- const fallback = () => {
- if (!props.detailRequested?.()) return props.fallback;
- const detail = props.detailFallback;
- return detail === undefined ? props.fallback : detail;
- };
return (
- <Show
- when={
- ready() || (props.desktopOnly && isTouchDevice()) || detailUnsupported()
- }
- fallback={<LoadingBlock />}
- >
- <Show when={renderModern()} fallback={fallback()}>
- {props.children}
- </Show>
+ <Show when={!detailUnsupported()} fallback={props.detailFallback}>
+ {props.children}
</Show>
);
}
diff --git a/apps/web/src/components/app/split-layout/tests/layoutManager.test.ts b/apps/web/src/components/app/split-layout/tests/layoutManager.test.ts
index 9d27ce1da3..86eed5c5a8 100644
--- a/apps/web/src/components/app/split-layout/tests/layoutManager.test.ts
+++ b/apps/web/src/components/app/split-layout/tests/layoutManager.test.ts
@@ -839,10 +839,7 @@ describe('layoutManager', () => {
});
describe('router layout synchronization', () => {
- function ingressRouter(
- url: string,
- options: { enabled?: boolean; loading?: boolean; touch?: boolean } = {}
- ) {
+ function ingressRouter(url: string, options: { touch?: boolean } = {}) {
return createRoot((dispose) => {
const manager = createSplitLayout(createMockOrchestrator(), [
{ type: 'component', id: 'home' },
@@ -854,10 +851,6 @@ describe('layoutManager', () => {
layout: createAppSplitRouterLayout(manager, routes),
location,
middleware: createAppSplitRouterMiddleware({
- newAppViews: () => ({
- enabled: options.enabled ?? true,
- loading: options.loading ?? false,
- }),
isTouchDevice: () => options.touch ?? false,
}),
});
@@ -1819,7 +1812,7 @@ describe('layoutManager', () => {
it('applies a new-split location when an entity pane is reused', async () => {
const { manager, router, dispose } = ingressRouter('/channel/one', {
- enabled: false,
+ touch: true,
});
await router.settled();
const split = manager.splits()[0];
@@ -1877,33 +1870,26 @@ describe('layoutManager', () => {
dispose();
});
- it.each([
- { enabled: false, loading: false, touch: false },
- { enabled: true, loading: true, touch: false },
- { enabled: true, loading: false, touch: true },
- ])(
- 'preserves full-block legacy targets when inline detail is unsupported: %o',
- async (options) => {
- const { location, router, dispose } = ingressRouter(
- '/email/one/~/channel/c1?email_message_id=message&channel_message_id=first' +
- '&channel_message_id=last&channel_thread_id=thread',
- options
- );
- await router.settled();
- expect(location.read().pathname).toBe('/email/one/~/channel/c1');
- const query = new URLSearchParams(location.read().search);
- expect(query.getAll('email_message_id')).toEqual(['message']);
- expect(query.getAll('channel_message_id')).toEqual(['first', 'last']);
- expect(query.get('channel_thread_id')).toBe('thread');
- expect(
- [...query.keys()].some(
- (key) => key.startsWith('s0.') || key.startsWith('s1.')
- )
- ).toBe(false);
- router.dispose();
- dispose();
- }
- );
+ it('preserves full-block legacy targets on touch', async () => {
+ const { location, router, dispose } = ingressRouter(
+ '/email/one/~/channel/c1?email_message_id=message&channel_message_id=first' +
+ '&channel_message_id=last&channel_thread_id=thread',
+ { touch: true }
+ );
+ await router.settled();
+ expect(location.read().pathname).toBe('/email/one/~/channel/c1');
+ const query = new URLSearchParams(location.read().search);
+ expect(query.getAll('email_message_id')).toEqual(['message']);
+ expect(query.getAll('channel_message_id')).toEqual(['first', 'last']);
+ expect(query.get('channel_thread_id')).toBe('thread');
+ expect(
+ [...query.keys()].some(
+ (key) => key.startsWith('s0.') || key.startsWith('s1.')
+ )
+ ).toBe(false);
+ router.dispose();
+ dispose();
+ });
it.each(['company', 'contact'])(
'keeps a %s discussion link comment for the record page',
@@ -1939,7 +1925,6 @@ describe('layoutManager', () => {
layout: createAppSplitRouterLayout(manager, routes),
location,
middleware: createAppSplitRouterMiddleware({
- newAppViews: () => ({ enabled: true, loading: false }),
isTouchDevice: () => false,
}),
});
@@ -1957,39 +1942,31 @@ describe('layoutManager', () => {
dispose();
});
- it.each([
- { enabled: false, touch: false },
- { enabled: true, touch: true },
- { enabled: false, touch: true },
- ])(
- 'keeps legacy task detail when enabled=$enabled and touch=$touch',
- async ({ enabled, touch }) => {
- let dispose!: () => void;
- let router!: ReturnType<typeof createSplitRouter<string>>;
- let location!: ReturnType<typeof createMemorySplitRouterLocation>;
- createRoot((rootDispose) => {
- dispose = rootDispose;
- const manager = createSplitLayout(createMockOrchestrator(), [
- { type: 'task', id: 'task-1' },
- ]);
- const routes = createRoutesManifest(appSplitRoutes);
- location = createMemorySplitRouterLocation('/task/task-1');
- router = createSplitRouter({
- routes,
- layout: createAppSplitRouterLayout(manager, routes),
- location,
- middleware: createAppSplitRouterMiddleware({
- newAppViews: () => ({ enabled, loading: false }),
- isTouchDevice: () => touch,
- }),
- });
+ it('keeps legacy task detail on touch', async () => {
+ let dispose!: () => void;
+ let router!: ReturnType<typeof createSplitRouter<string>>;
+ let location!: ReturnType<typeof createMemorySplitRouterLocation>;
+ createRoot((rootDispose) => {
+ dispose = rootDispose;
+ const manager = createSplitLayout(createMockOrchestrator(), [
+ { type: 'task', id: 'task-1' },
+ ]);
+ const routes = createRoutesManifest(appSplitRoutes);
+ location = createMemorySplitRouterLocation('/task/task-1');
+ router = createSplitRouter({
+ routes,
+ layout: createAppSplitRouterLayout(manager, routes),
+ location,
+ middleware: createAppSplitRouterMiddleware({
+ isTouchDevice: () => true,
+ }),
});
+ });
- await router.settled();
- expect(location.read().pathname).toBe('/task/task-1');
- dispose();
- }
- );
+ await router.settled();
+ expect(location.read().pathname).toBe('/task/task-1');
+ dispose();
+ });
it('keeps a migrated workspace mounted across typed detail history', () => {
createRoot((dispose) => {
diff --git a/apps/web/src/features/block-call/sidebar/active-call-widget.tsx b/apps/web/src/features/block-call/sidebar/active-call-widget.tsx
deleted file mode 100644
index c813cda2c7..0000000000
--- a/apps/web/src/features/block-call/sidebar/active-call-widget.tsx
+++ /dev/null
@@ -1,313 +0,0 @@
-import { joinChannelCall } from '@channel/Call/join-channel-call';
-import { openChannelCallTab } from '@channel/Call/open-channel-call-tab';
-import type { SidebarState } from '@components/app/app-sidebar/sidebar';
-import { ContextMenuContent, MenuItem } from '@core/component/ContextMenu';
-import { UserIcon } from '@core/component/UserIcon';
-import { useChannelsContext } from '@core/context/channels';
-import { useUserId } from '@core/context/user';
-import { ContextMenu } from '@kobalte/core/context-menu';
-import PhoneIcon from '@phosphor/phone-call.svg';
-import XIcon from '@phosphor/x.svg';
-import type { ApiChannelWithLatest } from '@service-storage/channel-list-types';
-import { ChannelTypeEnum } from '@service-storage/client';
-import { Avatar, Button, cn, Tooltip } from '@ui';
-import { createMemo, type FlowComponent, For, Show } from 'solid-js';
-import {
- dismissIncomingCallEverywhere,
- useVisibleIncomingCalls,
-} from './incoming-calls';
-
-const SLIM_MAX = 4;
-
-function displayName(channel: ApiChannelWithLatest | undefined) {
- if (!channel) return 'Channel';
- if (channel.channel_type === ChannelTypeEnum.DirectMessage) {
- return channel.name || 'Direct message';
- }
- return channel.name ? `#${channel.name}` : 'Channel';
-}
-
-function ChannelCallBadge(props: {
- channel: ApiChannelWithLatest | undefined;
- letters: string;
- slim: boolean;
-}) {
- const userId = useUserId();
- const peer = () =>
- props.channel?.channel_type === ChannelTypeEnum.DirectMessage
- ? props.channel.participants.find((person) => person.user_id !== userId())
- ?.user_id
- : undefined;
- return (
- <div class="relative flex items-center justify-center shrink-0 size-[22px]">
- <Show
- when={peer()}
- keyed
- fallback={
- <Avatar size="fill" class="bg-ink-extra-muted/15 text-ink-muted">
- <Avatar.Fallback class="font-semibold">
- {props.letters}
- </Avatar.Fallback>
- </Avatar>
- }
- >
- {(id) => (
- <UserIcon id={id} size="fill" suppressClick showTooltip={false} />
- )}
- </Show>
- <Show when={props.slim}>
- <span class="absolute -top-0.5 -right-0.5 size-1.5 bg-success rounded-full ring-surface ring-2" />
- </Show>
- </div>
- );
-}
-
-function computeChannelLetters(
- calls: { channel: ApiChannelWithLatest | undefined; channelId: string }[],
- currentUserId?: string
-): Map<string, string> {
- const result = new Map<string, string>();
- const firstLetterCount = new Map<string, number>();
- const getName = (channel: ApiChannelWithLatest) => {
- const channelName = channel.name?.trim();
- if (channelName) return channelName;
-
- if (channel.channel_type !== ChannelTypeEnum.DirectMessage) return '';
-
- const participant =
- channel.participants.find((p) => p.user_id !== currentUserId) ??
- channel.participants[0];
- if (!participant) return '';
-
- const displayName =
- 'displayName' in participant &&
- typeof participant.displayName === 'string'
- ? participant.displayName
- : undefined;
- return displayName?.trim() || participant.user_id;
- };
-
- for (const call of calls) {
- const channel = call.channel;
- if (!channel) continue;
- const name = getName(channel);
- const first = name[0]?.toUpperCase() ?? '';
- firstLetterCount.set(first, (firstLetterCount.get(first) ?? 0) + 1);
- }
-
- for (const call of calls) {
- const channel = call.channel;
- if (!channel) continue;
- const name = getName(channel);
- const first = name[0]?.toUpperCase() ?? '';
- const needsTwo = (firstLetterCount.get(first) ?? 0) > 1 && name.length > 1;
- result.set(
- call.channelId,
- needsTwo ? first + name[1].toUpperCase() : first
- );
- }
-
- return result;
-}
-
-type IncomingCallContextMenuProps = {
- onJoin: () => void;
- onDismiss: () => void;
-};
-
-const IncomingCallContextMenu: FlowComponent<IncomingCallContextMenuProps> = (
- props
-) => {
- return (
- <ContextMenu>
- <ContextMenu.Trigger class="size-full group/cm-trigger">
- {props.children}
- </ContextMenu.Trigger>
-
- <ContextMenu.Portal>
- <ContextMenuContent class="text-xs text-ink-muted">
- <MenuItem text="Join call" onClick={props.onJoin} />
- <MenuItem text="Dismiss" onClick={props.onDismiss} />
- </ContextMenuContent>
- </ContextMenu.Portal>
- </ContextMenu>
- );
-};
-
-export function SidebarActiveCallWidget(props: {
- sidebarState: SidebarState;
- class?: string;
-}) {
- const channelsCtx = useChannelsContext();
- const userId = useUserId();
-
- const activeCalls = useVisibleIncomingCalls();
-
- const activeCallChannels = createMemo(() =>
- activeCalls().map((call) => ({
- channelId: call.channelId,
- channel: channelsCtx.channelsById()[call.channelId],
- }))
- );
-
- const channelLetters = createMemo(() =>
- computeChannelLetters(activeCallChannels(), userId())
- );
-
- const isSlim = () => props.sidebarState === 'slim';
- const slimVisible = () => activeCalls().slice(0, SLIM_MAX);
- const slimOverflow = () => Math.max(0, activeCalls().length - SLIM_MAX);
-
- return (
- <Show when={activeCalls().length > 0}>
- <Show
- when={!isSlim()}
- fallback={
- <section
- class={cn('w-full p-2 flex flex-col items-center', props.class)}
- >
- <For each={slimVisible()}>
- {(call) => {
- const channel = () =>
- channelsCtx.channelsById()[call.channelId];
- return (
- <div class="size-8">
- <IncomingCallContextMenu
- onJoin={() => void joinChannelCall(call.channelId)}
- onDismiss={() =>
- dismissIncomingCallEverywhere(call.callId)
- }
- >
- <Button
- aria-label={`${displayName(channel())} call`}
- class="relative flex items-center cursor-default rounded-md text-ink-extra-muted not-disabled:hover:bg-ink/3 justify-center size-8"
- draggable={false}
- variant="ghost"
- size="sm"
- onMouseDown={(e) => {
- if (e.button !== 0) return;
- e.preventDefault();
- void openChannelCallTab(call.channelId);
- }}
- >
- <ChannelCallBadge
- channel={channel()}
- letters={channelLetters().get(call.channelId) ?? '?'}
- slim
- />
- </Button>
- </IncomingCallContextMenu>
- </div>
- );
- }}
- </For>
- <Show when={slimOverflow() > 0}>
- <span class="text-xxs text-ink-muted mt-1">
- +{slimOverflow()}
- </span>
- </Show>
- </section>
- }
- >
- <section
- class={cn('size-full flex flex-col justify-center', props.class)}
- >
- <header class="text-xs font-medium text-ink-muted whitespace-nowrap p-2">
- <h1>Incoming call</h1>
- </header>
-
- <div class="flex-1 w-full">
- <For each={activeCalls()}>
- {(call) => {
- const channel = () =>
- channelsCtx.channelsById()[call.channelId];
- const dismissLabel = () =>
- `Dismiss ${displayName(channel())} call`;
- const openCall = () => {
- void openChannelCallTab(call.channelId);
- };
-
- return (
- <div class="w-full">
- <IncomingCallContextMenu
- onJoin={() => void joinChannelCall(call.channelId)}
- onDismiss={() =>
- dismissIncomingCallEverywhere(call.callId)
- }
- >
- <div class="flex items-center gap-1.5 w-full rounded-lg p-2 text-ink-extra-muted hover:bg-ink/3">
- <button
- type="button"
- class="flex min-w-0 flex-1 items-center justify-start gap-2 cursor-default"
- draggable={false}
- onMouseDown={(e) => {
- if (e.button !== 0) return;
- e.preventDefault();
- }}
- onClick={(e) => {
- e.preventDefault();
- openCall();
- }}
- >
- <ChannelCallBadge
- channel={channel()}
- letters={
- channelLetters().get(call.channelId) ?? '?'
- }
- slim={false}
- />
- <span class="text-sm font-medium truncate">
- {displayName(channel())}
- </span>
- </button>
- <button
- type="button"
- aria-label={`Join ${displayName(channel())} call`}
- class="shrink-0 size-5 flex items-center justify-center text-xs font-medium bg-success/15 text-success rounded-md"
- draggable={false}
- onMouseDown={(e) => {
- if (e.button !== 0) return;
- e.preventDefault();
- e.stopPropagation();
- }}
- onClick={(e) => {
- e.preventDefault();
- e.stopPropagation();
- openCall();
- }}
- >
- <PhoneIcon class="size-3" />
- </button>
- <Tooltip label={dismissLabel()} placement="right">
- <Button
- aria-label={dismissLabel()}
- class="shrink-0 size-5 p-0 flex items-center justify-center rounded-md bg-ink-muted/10 text-ink-muted/80 not-disabled:hover:bg-failure/10 not-disabled:hover:text-failure"
- draggable={false}
- variant="ghost"
- size="sm"
- onMouseDown={(e) => {
- if (e.button !== 0) return;
- e.preventDefault();
- e.stopPropagation();
- }}
- onClick={(e) => {
- e.preventDefault();
- e.stopPropagation();
- dismissIncomingCallEverywhere(call.callId);
- }}
- >
- <XIcon class="size-3" />
- </Button>
- </Tooltip>
- </div>
- </IncomingCallContextMenu>
- </div>
- );
- }}
- </For>
- </div>
- </section>
- </Show>
- </Show>
- );
-}
diff --git a/apps/web/src/features/block-call/sidebar/incoming-calls.ts b/apps/web/src/features/block-call/sidebar/incoming-calls.ts
index bc85c96811..8a518d07b6 100644
--- a/apps/web/src/features/block-call/sidebar/incoming-calls.ts
+++ b/apps/web/src/features/block-call/sidebar/incoming-calls.ts
@@ -151,11 +151,6 @@ export function useVisibleIncomingCalls(): Accessor<IncomingCall[]> {
});
}
-export function useIncomingCallWidgetVisible() {
- const visibleIncomingCalls = useVisibleIncomingCalls();
- return createMemo(() => visibleIncomingCalls().length > 0);
-}
-
/**
* Keeps the incoming-call store in sync with the call websocket events.
*
diff --git a/apps/web/src/features/calendar/calendar.css b/apps/web/src/features/calendar/calendar.css
index 282b381f96..11a3125f0f 100644
--- a/apps/web/src/features/calendar/calendar.css
+++ b/apps/web/src/features/calendar/calendar.css
@@ -17,10 +17,6 @@
--fc-now-indicator-color: var(--color-accent);
}
-.calendar-sidebar-preview .calendar-view {
- --fc-border-color: var(--color-edge);
-}
-
.calendar-view-content {
box-sizing: border-box;
padding: 0.5rem;
diff --git a/apps/web/src/features/channel/Call/CallControls/CallControls.tsx b/apps/web/src/features/channel/Call/CallControls/CallControls.tsx
index 8f901c2ba2..4ec5528874 100644
--- a/apps/web/src/features/channel/Call/CallControls/CallControls.tsx
+++ b/apps/web/src/features/channel/Call/CallControls/CallControls.tsx
@@ -1,14 +1,10 @@
import { type Accessor, Show } from 'solid-js';
import { useMaybeNativeCallState } from '../native-call-state';
import { CallControlsDefaultAndPanelRow } from './CallControlsDefaultAndPanelRow';
-import { CallControlsPanelSmallRow } from './CallControlsPanelSmallRow';
-
-export type CallControlsVariant = 'default' | 'panel' | 'panel-small';
export type CallControlsProps = {
/** Leave / hang up — parent supplies tab switch, `leaveCall()`, etc. */
onLeave: () => void | Promise<void>;
- variant?: CallControlsVariant;
when?: boolean | Accessor<boolean>;
};
@@ -17,23 +13,13 @@ function readWhen(when: boolean | Accessor<boolean> | undefined): boolean {
return typeof when === 'function' ? when() : when;
}
-/**
- * Mic / camera / screen / leave wired to `useCallContext()`. Single place for
- * control markup so the Call overlay and the sidebar InCall panel stay in
- * sync. The slim `panel-small` variant renders a single gear-menu instead of
- * the inline pill row.
- */
+/** Mic / camera / screen / leave wired to `useCallContext()`. */
export function CallControls(props: CallControlsProps) {
const nativeCall = useMaybeNativeCallState();
return (
<Show when={readWhen(props.when) && !nativeCall?.snapshot()}>
- <Show
- when={props.variant === 'panel-small'}
- fallback={<CallControlsDefaultAndPanelRow onLeave={props.onLeave} />}
- >
- <CallControlsPanelSmallRow />
- </Show>
+ <CallControlsDefaultAndPanelRow onLeave={props.onLeave} />
</Show>
);
}
diff --git a/apps/web/src/features/channel/Call/CallControls/CallControlsPanelSmallRow.tsx b/apps/web/src/features/channel/Call/CallControls/CallControlsPanelSmallRow.tsx
deleted file mode 100644
index 8c750561ee..0000000000
--- a/apps/web/src/features/channel/Call/CallControls/CallControlsPanelSmallRow.tsx
+++ /dev/null
@@ -1,160 +0,0 @@
-import { DropdownMenu } from '@kobalte/core/dropdown-menu';
-import Gear from '@phosphor/gear.svg';
-import Microphone from '@phosphor/microphone.svg';
-import MicrophoneSlash from '@phosphor/microphone-slash.svg';
-import Screencast from '@phosphor/screencast.svg';
-import VideoCamera from '@phosphor/video-camera.svg';
-import VideoCameraSlash from '@phosphor/video-camera-slash.svg';
-import { cn, Dropdown, InlineCheckbox } from '@ui';
-import { Show } from 'solid-js';
-import { match } from 'ts-pattern';
-import { useCallContext } from '../CallContext';
-import { CallDeviceList } from '../CallDeviceList';
-import { useActiveCallTeamShare } from '../use-toggle-share-with-team';
-import { MenuDivider, MenuLabel } from './CallMenuPrimitives';
-
-const ITEM_ICON_CLASS = 'size-3.5 shrink-0 text-ink-muted';
-
-export function CallControlsPanelSmallRow() {
- const callCtx = useCallContext();
- const isConnecting = () => callCtx.isConnecting();
- const teamShare = useActiveCallTeamShare();
- const noiseSuppressionModeLabel = () =>
- match(callCtx.noiseSuppressionMode())
- .with('krisp', () => 'Krisp')
- .with('browser', () => 'Browser')
- .with('off', () => 'Off')
- .exhaustive();
-
- const anyMediaActive = () =>
- !callCtx.isAudioMuted() ||
- !callCtx.isVideoMuted() ||
- callCtx.isScreenSharing();
-
- return (
- <div
- data-call-controls
- data-call-controls-panel-small
- class="flex flex-row flex-wrap items-center justify-center gap-0.5"
- >
- <Dropdown placement="top-start" gutter={6}>
- <DropdownMenu.Trigger
- disabled={isConnecting()}
- aria-label="Call options"
- class={cn(
- 'flex items-center justify-center size-5 shrink-0 rounded-md transition-colors',
- isConnecting() && 'opacity-50 pointer-events-none',
- !isConnecting() && anyMediaActive() ? 'text-ink' : 'text-ink-muted',
- !isConnecting() && 'hover:text-ink hover:bg-ink-muted/[0.06]'
- )}
- >
- <Gear class="size-4" />
- </DropdownMenu.Trigger>
-
- <Dropdown.Content class="min-w-56">
- <Dropdown.Group>
- <Dropdown.Item
- closeOnSelect={false}
- onSelect={() => void callCtx.toggleAudio()}
- >
- <Show
- when={!callCtx.isAudioMuted()}
- fallback={<MicrophoneSlash class={ITEM_ICON_CLASS} />}
- >
- <Microphone class={ITEM_ICON_CLASS} />
- </Show>
- <span class="flex-1 truncate">
- {callCtx.isAudioMuted()
- ? 'Unmute microphone'
- : 'Mute microphone'}
- </span>
- </Dropdown.Item>
-
- <MenuDivider />
-
- <CallDeviceList
- label="Microphone"
- devices={callCtx.audioInputDevices()}
- activeDeviceId={callCtx.activeAudioInputDeviceId()}
- onSelect={(id) => callCtx.switchAudioInput(id)}
- />
-
- <Show when={callCtx.audioOutputDevices().length > 0}>
- <MenuDivider />
- <CallDeviceList
- label="Speaker"
- devices={callCtx.audioOutputDevices()}
- activeDeviceId={callCtx.activeAudioOutputDeviceId()}
- onSelect={(id) => callCtx.switchAudioOutput(id)}
- />
- </Show>
-
- <MenuDivider />
-
- <MenuLabel>Audio processing</MenuLabel>
- <Dropdown.Item
- closeOnSelect={false}
- onSelect={() => void callCtx.toggleNoiseSuppression()}
- >
- <span class="flex-1 truncate">Noise suppression</span>
- <span class="text-xs text-ink-muted">
- {noiseSuppressionModeLabel()}
- </span>
- </Dropdown.Item>
-
- <MenuDivider />
-
- <Dropdown.Item
- closeOnSelect={false}
- onSelect={() => void callCtx.toggleVideo()}
- >
- <Show
- when={!callCtx.isVideoMuted()}
- fallback={<VideoCameraSlash class={ITEM_ICON_CLASS} />}
- >
- <VideoCamera class={ITEM_ICON_CLASS} />
- </Show>
- <span class="flex-1 truncate">
- {callCtx.isVideoMuted() ? 'Turn camera on' : 'Turn camera off'}
- </span>
- </Dropdown.Item>
-
- <MenuDivider />
-
- <CallDeviceList
- label="Camera"
- devices={callCtx.videoInputDevices()}
- activeDeviceId={callCtx.activeVideoInputDeviceId()}
- onSelect={(id) => callCtx.switchVideoInput(id)}
- />
-
- <MenuDivider />
-
- <Dropdown.Item
- closeOnSelect={false}
- onSelect={() => void callCtx.toggleScreenShare()}
- >
- <Screencast class={ITEM_ICON_CLASS} />
- <span class="flex-1 truncate">
- {callCtx.isScreenSharing()
- ? 'Stop sharing screen'
- : 'Share screen'}
- </span>
- </Dropdown.Item>
-
- <Show when={callCtx.activeChannelId() !== null}>
- <Dropdown.Item
- closeOnSelect={false}
- disabled={!teamShare.canToggle() || teamShare.isPending()}
- onSelect={() => void teamShare.toggle()}
- >
- <InlineCheckbox checked={callCtx.isSharedWithTeam()} />
- <span class="flex-1 truncate">Share with team</span>
- </Dropdown.Item>
- </Show>
- </Dropdown.Group>
- </Dropdown.Content>
- </Dropdown>
- </div>
- );
-}
diff --git a/apps/web/src/features/channel/Call/CallControls/CallMenuPrimitives.tsx b/apps/web/src/features/channel/Call/CallControls/CallMenuPrimitives.tsx
deleted file mode 100644
index 6538583347..0000000000
--- a/apps/web/src/features/channel/Call/CallControls/CallMenuPrimitives.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import { Dropdown } from '@ui';
-import type { Component, JSX } from 'solid-js';
-
-/**
- * Small section label rendered inside a `Dropdown.Group` (e.g. "Microphone",
- * "Audio processing"). Matches the soup filter/sort dropdown header tone.
- */
-export const MenuLabel: Component<{ children: JSX.Element }> = (props) => (
- <div class="px-2 pt-0.5 pb-1 text-xs font-medium text-ink-muted">
- {props.children}
- </div>
-);
-
-/**
- * Hairline divider between sections inside a `Dropdown.Group`. Negative
- * horizontal margin lets the line bleed to the edges of the group surface.
- */
-export const MenuDivider: Component = () => (
- <Dropdown.Separator class="my-1 h-px border-0 bg-edge-muted -mx-1.5" />
-);
diff --git a/apps/web/src/features/channel/Call/InCallPanel/InCallAvatarPlaceholder.tsx b/apps/web/src/features/channel/Call/InCallPanel/InCallAvatarPlaceholder.tsx
deleted file mode 100644
index 6897cf412f..0000000000
--- a/apps/web/src/features/channel/Call/InCallPanel/InCallAvatarPlaceholder.tsx
+++ /dev/null
@@ -1,50 +0,0 @@
-import type { UserIconProps } from '@core/component/UserIcon';
-import DotsThree from '@phosphor/dots-three.svg';
-import User from '@phosphor-icons/core/regular/user.svg?component-solid';
-import { cn } from '@ui';
-import { type Component, Show } from 'solid-js';
-
-export function inCallAvatarPlaceholderClasses(size: UserIconProps['size']) {
- const s = size ?? 'sm';
- const container = cn(
- 'flex shrink-0 items-center justify-center rounded-full bg-ink-extra-muted text-surface leading-none',
- s === 'sm' && 'size-4',
- s === 'md' && 'size-6',
- s === 'lg' && 'size-10',
- s === 'fill' && 'size-full'
- );
- const icon = cn(
- s === 'sm' && 'size-2',
- s === 'md' && 'size-3',
- s === 'lg' && 'size-5',
- s === 'fill' && 'size-4'
- );
- return { container, icon };
-}
-
-export const InCallAvatarPlaceholderShell: Component<{
- size?: UserIconProps['size'];
- variant?: 'placeholder' | 'view-more';
-}> = (props) => {
- const classes = () => inCallAvatarPlaceholderClasses(props.size);
- return (
- <div
- class={cn(
- classes().container,
- props.variant === 'view-more' &&
- 'bg-transparent border-2 border-accent/70 rounded-full'
- )}
- >
- <Show when={props.variant === 'placeholder'}>
- <User class={cn(classes().icon, 'block')} aria-hidden />
- </Show>
-
- <Show when={props.variant === 'view-more'}>
- <DotsThree
- class="block size-6 bg-transparent text-accent"
- aria-hidden
- />
- </Show>
- </div>
- );
-};
diff --git a/apps/web/src/features/channel/Call/InCallPanel/InCallPanelView.tsx b/apps/web/src/features/channel/Call/InCallPanel/InCallPanelView.tsx
deleted file mode 100644
index 3b0d18c6ef..0000000000
--- a/apps/web/src/features/channel/Call/InCallPanel/InCallPanelView.tsx
+++ /dev/null
@@ -1,282 +0,0 @@
-import { StackedAvatarsRow } from '@core/component/StackedAvatarsRow';
-import { useChannelsContext } from '@core/context/channels';
-import ArrowsOut from '@phosphor/arrows-out.svg';
-import PhoneDisconnect from '@phosphor/phone-disconnect.svg';
-import { useActiveCallQuery } from '@queries/call/call';
-import { Avatar, cn, Surface, Tooltip } from '@ui';
-import {
- type Component,
- createMemo,
- createSignal,
- onCleanup,
- Show,
-} from 'solid-js';
-import type { CallControlsVariant } from '../CallControls/CallControls';
-import { CallControls } from '../CallControls/CallControls';
-import type { InCallPanelProps } from '../InCallPanel/types';
-import { openChannelCallTab } from '../open-channel-call-tab';
-import {
- InCallParticipantsListPopover,
- InCallRosterListSection,
-} from './InCallParticipantsListPopover';
-import {
- IN_CALL_LOCAL_STRIP_PENDING_ID,
- IN_CALL_STRIP_IMAGE_SIZE,
- InCallStripAvatarImage,
- type InCallStripImage,
-} from './InCallStripAvatarImage';
-import { profilePictureIdForMember } from './profile-picture-id-for-member';
-import { useInCallPanel } from './use-in-call-panel';
-
-function formatDuration(startedAt: string | undefined, nowMs: number) {
- const startedAtMs = startedAt ? new Date(startedAt).getTime() : Number.NaN;
- if (!Number.isFinite(startedAtMs)) return '';
-
- const totalSeconds = Math.max(0, Math.floor((nowMs - startedAtMs) / 1000));
- const hours = Math.floor(totalSeconds / 3600);
- const minutes = Math.floor((totalSeconds % 3600) / 60);
- const seconds = totalSeconds % 60;
-
- if (hours > 0) return `${hours}h ${minutes}m`;
- return `${minutes}:${seconds.toString().padStart(2, '0')}`;
-}
-
-export const InCallPanel: Component<InCallPanelProps> = (props) => {
- const panel = useInCallPanel({
- channelId: props.channelId,
- onLeaveCall: props.onLeaveCall,
- onJoinCall: props.onJoinCall,
- });
-
- async function handleLeave() {
- try {
- await panel.controls.leaveCall();
- } catch (error) {
- console.error('Failed to leave call from panel', error);
- }
- }
- const channelsCtx = useChannelsContext();
- const [nowMs, setNowMs] = createSignal(Date.now());
- const durationTimer = globalThis.setInterval(
- () => setNowMs(Date.now()),
- 1000
- );
- onCleanup(() => globalThis.clearInterval(durationTimer));
-
- const slim = createMemo((): boolean => {
- const v = props.isSlim;
- return typeof v === 'function' ? v() : v;
- });
-
- const onCallPage = createMemo(() => panel.callCtx.isCallPage());
-
- // Hide the pulse in the slim sidebar unless we're on the active call page,
- // so the icon-only strip doesn't read as a distracting live indicator.
- const showHeaderPulse = () => !slim() || onCallPage();
-
- const orderedMembers = createMemo(() => [
- ...panel.visibleMembers(),
- ...panel.overflowMembers(),
- ]);
-
- const stripStackEach = createMemo((): InCallStripImage[] => {
- if (!panel.isActive()) return [];
- const out: InCallStripImage[] = [];
- for (const member of orderedMembers()) {
- if (member.kind === 'local') {
- const id = profilePictureIdForMember(panel, member);
- if (id) {
- out.push({ userId: id, stripMemberKind: 'local' });
- } else {
- out.push({
- userId: IN_CALL_LOCAL_STRIP_PENDING_ID,
- stripMemberKind: 'local',
- stripLocalPending: true,
- });
- }
- continue;
- }
- const id = profilePictureIdForMember(panel, member);
- if (!id) continue;
- const name = member.participant.name?.trim();
- out.push({
- userId: id,
- stripMemberKind: 'remote',
- ...(name ? { tooltip: name } : {}),
- });
- }
- return out;
- });
-
- const controlsVariant = createMemo(
- (): CallControlsVariant => (slim() ? 'panel-small' : 'panel')
- );
-
- const showExpandToFullCall = createMemo(() => !onCallPage());
- const activeChannelId = createMemo(() => panel.callCtx.activeChannelId());
- const activeCallQuery = useActiveCallQuery(() => activeChannelId() ?? '');
- const activeChannelName = createMemo(() => {
- const id = activeChannelId();
- if (!id) return 'In call';
- const channel = channelsCtx.channelsById()[id];
- return channel?.name ? `#${channel.name}` : 'In call';
- });
- const activeChannelLetter = createMemo(() => {
- const id = activeChannelId();
- if (!id) return '?';
- const name = channelsCtx.channelsById()[id]?.name ?? '';
- return name[0]?.toUpperCase() ?? '?';
- });
- const memberCount = createMemo(() => orderedMembers().length);
- const callDuration = createMemo(() =>
- formatDuration(activeCallQuery.data?.createdAt, nowMs())
- );
- const slimHeaderTooltip = createMemo(() => {
- const duration = callDuration();
- const count = memberCount();
- const participants = `${count} participant${count === 1 ? '' : 's'}`;
- return [activeChannelName(), duration, participants]
- .filter(Boolean)
- .join(' - ');
- });
-
- return (
- <Show when={() => panel.isActive()}>
- <section
- data-in-call-panel
- aria-label="In call"
- class="relative isolate rounded-lg border border-ink-muted/[0.08] bg-ink-muted/[0.025] divide-y divide-ink-muted/[0.08]"
- >
- {/* Header — soup notification vocabulary: muted label, accent pulse,
- share affordance is a single icon button (no chunky toggle switch).
- Active = subtle accent-tinted bg. */}
- <div
- class={cn(
- 'flex items-center min-w-0 w-full px-3 h-8',
- slim() ? 'justify-center' : 'justify-between'
- )}
- >
- <div class="flex min-w-0 shrink-0 items-center gap-2">
- <Show
- when={!slim()}
- fallback={
- <Tooltip label={slimHeaderTooltip()} placement="right">
- <button
- type="button"
- class="relative flex items-center justify-center shrink-0 size-5 rounded-full"
- aria-label={slimHeaderTooltip()}
- onClick={() => {
- const id = panel.callCtx.activeChannelId();
- if (id) void openChannelCallTab(id);
- }}
- >
- <Avatar size="sm" class="bg-transparent text-ink-muted">
- <Avatar.Fallback class="font-semibold">
- {activeChannelLetter()}
- </Avatar.Fallback>
- </Avatar>
- <span class="absolute -top-0.5 -right-0.5 size-1.5 bg-success rounded-full ring-surface ring-2 animate-pulse" />
- </button>
- </Tooltip>
- }
- >
- <Show when={showHeaderPulse()}>
- <span class="size-1.5 shrink-0 rounded-full bg-success animate-pulse" />
- </Show>
- <span class="text-xs font-medium text-ink truncate">
- {activeChannelName()}
- </span>
- </Show>
- </div>
-
- <div class="flex items-center gap-0.5 shrink-0">
- <Show when={showExpandToFullCall() && !slim()}>
- <button
- type="button"
- class="inline-flex items-center justify-center size-6 rounded transition-colors text-ink-muted/70 hover:text-ink hover:bg-ink-muted/[0.06]"
- title="Open full call view"
- aria-label="Open full call view"
- onClick={() => {
- const id = panel.callCtx.activeChannelId();
- if (id) void openChannelCallTab(id);
- }}
- >
- <ArrowsOut class="size-3.5" />
- </button>
- </Show>
- </div>
- </div>
-
- {/* Avatars */}
- <div
- class={cn(
- 'px-3 py-2.5',
- slim() && 'flex flex-col items-center gap-2 py-1'
- )}
- >
- <div
- class={cn(
- 'flex flex-row items-center leading-none min-w-0 w-full',
- slim() ? 'justify-center' : 'justify-between'
- )}
- data-in-call-panel-avatars
- >
- <Show
- when={!slim()}
- fallback={<InCallParticipantsListPopover panel={panel} />}
- >
- <StackedAvatarsRow<InCallStripImage>
- class="w-full min-w-0"
- distribute="fill"
- each={stripStackEach}
- max={6}
- size={IN_CALL_STRIP_IMAGE_SIZE}
- defaultEmptyUserPlaceholder
- overflowChipClass="bg-ink-muted/10"
- overflowTooltipContent={(close) => (
- <Surface depth={3} class="min-w-48 max-w-72">
- <InCallRosterListSection
- panel={panel}
- members={orderedMembers()}
- onClose={() => close()}
- allowOpenDm={false}
- />
- </Surface>
- )}
- >
- {(image) => (
- <InCallStripAvatarImage
- image={image}
- trackCall={() => panel.callCtx.trackVersion()}
- />
- )}
- </StackedAvatarsRow>
- </Show>
- </div>
- </div>
-
- {/* Controls */}
- <div class="flex justify-center px-1 py-1">
- <CallControls
- variant={controlsVariant()}
- when={props.showCallControls}
- onLeave={handleLeave}
- />
- </div>
-
- <Show when={slim()}>
- <div class="flex items-center justify-center px-1 py-1">
- <button
- class="flex items-center justify-center size-5 shrink-0 rounded-md transition-colors text-failure hover:bg-failure/10"
- onClick={handleLeave}
- aria-label="Leave call"
- type="button"
- >
- <PhoneDisconnect class="size-4" />
- </button>
- </div>
- </Show>
- </section>
- </Show>
- );
-};
diff --git a/apps/web/src/features/channel/Call/InCallPanel/InCallParticipantAvatar.tsx b/apps/web/src/features/channel/Call/InCallPanel/InCallParticipantAvatar.tsx
deleted file mode 100644
index 49fedb72b1..0000000000
--- a/apps/web/src/features/channel/Call/InCallPanel/InCallParticipantAvatar.tsx
+++ /dev/null
@@ -1,41 +0,0 @@
-import type { UserIconProps } from '@core/component/UserIcon';
-import { UserIcon } from '@core/component/UserIcon';
-import { tryMacroId } from '@core/user';
-import { Show } from 'solid-js';
-import { InCallAvatarPlaceholderShell } from './InCallAvatarPlaceholder';
-import { profilePictureIdForMember } from './profile-picture-id-for-member';
-import type { InCallPanelMember, UseInCallPanelResult } from './types';
-
-/**
- * Renders `UserIcon` once LiveKit identity is available; until then shows the
- * generic silhouette. `ProfilePicture` inside `UserIcon` handles letter vs photo.
- */
-export function InCallParticipantAvatar(props: {
- panel: UseInCallPanelResult;
- member: InCallPanelMember;
- size?: UserIconProps['size'];
-}) {
- const rawIdentity = () =>
- profilePictureIdForMember(props.panel, props.member);
-
- const size = () => props.size ?? 'md';
-
- const userIconId = () => {
- const raw = rawIdentity();
- return raw ? tryMacroId(raw.trim()) : undefined;
- };
-
- return (
- <Show
- when={userIconId()}
- keyed
- fallback={
- <InCallAvatarPlaceholderShell size={size()} variant="placeholder" />
- }
- >
- {(id) => (
- <UserIcon id={id} size={size()} suppressClick showTooltip={false} />
- )}
- </Show>
- );
-}
diff --git a/apps/web/src/features/channel/Call/InCallPanel/InCallParticipantsListPopover.tsx b/apps/web/src/features/channel/Call/InCallPanel/InCallParticipantsListPopover.tsx
deleted file mode 100644
index 328c149106..0000000000
--- a/apps/web/src/features/channel/Call/InCallPanel/InCallParticipantsListPopover.tsx
+++ /dev/null
@@ -1,182 +0,0 @@
-import { useSplitLayout } from '@components/app/split-layout/layout';
-import { toast } from '@core/component/Toast/Toast';
-import { getDisplayName, tryMacroId } from '@core/user';
-import { Popover } from '@kobalte/core/popover';
-import UsersThree from '@phosphor/users-three.svg';
-import { useGetOrCreateDirectMessageMutation } from '@queries/channel/get-or-create-dm';
-import { cn, Surface } from '@ui';
-import { createMemo, createSignal, For, Show } from 'solid-js';
-import { InCallParticipantAvatar } from './InCallParticipantAvatar';
-import { profilePictureIdForMember } from './profile-picture-id-for-member';
-import type { InCallPanelMember, UseInCallPanelResult } from './types';
-
-export function InCallRosterListSection(props: {
- panel: UseInCallPanelResult;
- members: InCallPanelMember[];
- onClose: () => void;
- allowOpenDm?: boolean;
-}) {
- return (
- <>
- <div class="rounded-t-md border-b border-edge px-2 py-2.5 text-xs font-medium text-accent">
- In this call
- </div>
- <div class="max-h-64 overflow-y-auto p-1">
- <Show
- when={props.members.length > 0}
- fallback={<div class="p-2 text-sm text-ink-muted">Connecting…</div>}
- >
- <For each={props.members}>
- {(member) => (
- <InCallParticipantNameRow
- panel={props.panel}
- member={member}
- onClose={props.onClose}
- allowOpenDm={props.allowOpenDm}
- />
- )}
- </For>
- </Show>
- </div>
- </>
- );
-}
-
-export function InCallParticipantNameRow(props: {
- panel: UseInCallPanelResult;
- member: InCallPanelMember;
- onClose: () => void;
- /** When false, the row is display-only (no DM on click). Default true. */
- allowOpenDm?: boolean;
-}) {
- const { openWithSplit } = useSplitLayout();
- const getOrCreateDmMutation = useGetOrCreateDirectMessageMutation({
- onError: () => toast.failure('Could not open direct message'),
- });
-
- const label = createMemo(() => {
- props.panel.callCtx.trackVersion();
- const r = profilePictureIdForMember(props.panel, props.member);
- const displayName =
- (props.member.kind === 'remote'
- ? props.member.participant.name?.trim()
- : undefined) || getDisplayName(tryMacroId(r ?? ''));
- return (
- displayName ||
- r ||
- (props.member.kind === 'local' ? 'You' : 'Participant')
- );
- });
-
- const isRemote = () => props.member.kind === 'remote';
- const allowDm = () => props.allowOpenDm !== false;
- const isInteractive = () =>
- isRemote() &&
- allowDm() &&
- props.member.kind === 'remote' &&
- !!tryMacroId(props.member.participant.identity);
-
- const openDm = (event: MouseEvent | KeyboardEvent) => {
- if (props.member.kind !== 'remote') return;
- const { identity } = props.member.participant;
- if (!identity.startsWith('macro|') || !identity.slice(6).includes('@'))
- return;
- getOrCreateDmMutation.mutate(
- { recipient_id: identity },
- {
- onSuccess: ({ channel_id }) => {
- props.onClose();
- openWithSplit(
- { type: 'channel', id: channel_id },
- { activate: true, preferNewSplit: event.shiftKey }
- );
- },
- }
- );
- };
-
- return (
- <div
- role={isInteractive() ? 'button' : undefined}
- tabIndex={isInteractive() ? 0 : undefined}
- onClick={isInteractive() ? openDm : undefined}
- onKeyDown={
- isInteractive() ? (e) => e.key === 'Enter' && void openDm(e) : undefined
- }
- class={cn(
- 'flex min-w-0 items-center gap-2 rounded-xs p-1',
- isInteractive() ? 'hover:bg-hover' : 'cursor-default'
- )}
- >
- <InCallParticipantAvatar
- panel={props.panel}
- member={props.member}
- size="sm"
- />
- <span class="truncate text-sm text-ink">{label()}</span>
- <Show when={props.member.kind === 'local'}>
- <span class="ml-auto text-xs text-ink-muted shrink-0">You</span>
- </Show>
- </div>
- );
-}
-
-export type InCallParticipantsListPopoverProps = {
- panel: UseInCallPanelResult;
- class?: string;
-};
-
-/**
- * Slim in-call panel only: compact trigger opens the full roster (`InCallRosterListSection`).
- * Parent should render only when the panel is in slim layout.
- */
-export function InCallParticipantsListPopover(
- props: InCallParticipantsListPopoverProps
-) {
- const [open, setOpen] = createSignal(false);
-
- const members = createMemo(() => [
- ...props.panel.visibleMembers(),
- ...props.panel.overflowMembers(),
- ]);
-
- return (
- <Popover
- open={open()}
- onOpenChange={setOpen}
- placement="right-start"
- gutter={8}
- overflowPadding={8}
- >
- <Popover.Trigger
- as="button"
- type="button"
- class={cn(
- 'inline-flex items-center justify-center rounded-md bg-transparent p-0.5 transition-colors text-ink-muted hover:text-ink hover:bg-ink-muted/[0.06]',
- props.class
- )}
- aria-haspopup="dialog"
- aria-expanded={open()}
- aria-label="Everyone in call"
- >
- <UsersThree class="block size-4" />
- </Popover.Trigger>
-
- <Popover.Portal>
- <Popover.Content class="z-modal">
- <Surface
- depth={3}
- hideBorder
- class="min-w-48 max-w-72 rounded-xl glass bg-menu-glass"
- >
- <InCallRosterListSection
- panel={props.panel}
- members={members()}
- onClose={() => setOpen(false)}
- />
- </Surface>
- </Popover.Content>
- </Popover.Portal>
- </Popover>
- );
-}
diff --git a/apps/web/src/features/channel/Call/InCallPanel/InCallStripAvatarImage.tsx b/apps/web/src/features/channel/Call/InCallPanel/InCallStripAvatarImage.tsx
deleted file mode 100644
index 89393c8e25..0000000000
--- a/apps/web/src/features/channel/Call/InCallPanel/InCallStripAvatarImage.tsx
+++ /dev/null
@@ -1,79 +0,0 @@
-import {
- type StackedAvatarInput,
- StackedAvatarsDefaultEmptyPlaceholder,
- type StackedAvatarsSize,
- stackedAvatarInnerClass,
-} from '@core/component/StackedAvatarsRow';
-import { UserIcon } from '@core/component/UserIcon';
-import { getDisplayName, tryMacroId } from '@core/user';
-import { Tooltip } from '@ui';
-import { type Component, Show } from 'solid-js';
-
-/** Matches {@link UserIcon} `lg` (`size-10`) for the in-call strip. */
-export const IN_CALL_STRIP_IMAGE_SIZE = 'lg' satisfies StackedAvatarsSize;
-
-/** Stable id for the local slot before `room().localParticipant.identity` is available. */
-export const IN_CALL_LOCAL_STRIP_PENDING_ID = '__in_call_local_pending__';
-
-export type InCallStripImage = StackedAvatarInput & {
- stripMemberKind: 'local' | 'remote';
- /** Local participant: show ring placeholder until LiveKit identity is ready for `UserIcon`. */
- stripLocalPending?: boolean;
-};
-
-export const InCallStripAvatarImage: Component<{
- image: InCallStripImage;
- trackCall?: () => unknown;
-}> = (props) => {
- const displayName = () =>
- getDisplayName(
- props.image.stripLocalPending ? undefined : tryMacroId(props.image.userId)
- );
-
- const nameLabel = () => {
- props.trackCall?.();
- if (props.image.stripLocalPending) return 'You';
- const fromProfile = displayName()?.trim();
- if (fromProfile) return fromProfile;
- const liveKit = props.image.tooltip?.trim();
- if (liveKit) return liveKit;
- return (
- props.image.userId?.split('|').at(1)?.split('@')[0] ||
- (props.image.stripMemberKind === 'remote' ? 'Participant' : 'You')
- );
- };
-
- return (
- <Tooltip label={nameLabel()}>
- <Show
- when={props.image.stripLocalPending}
- fallback={
- <div class={stackedAvatarInnerClass(IN_CALL_STRIP_IMAGE_SIZE)}>
- <Show
- when={tryMacroId(props.image.userId)}
- fallback={
- <div class="flex size-full items-center justify-center rounded-full bg-ink-extra-muted text-sm text-surface">
- {nameLabel().charAt(0).toUpperCase()}
- </div>
- }
- >
- {(id) => (
- <UserIcon
- id={id()}
- isDeleted={false}
- size="fill"
- showTooltip={false}
- suppressClick
- />
- )}
- </Show>
- </div>
- }
- >
- <StackedAvatarsDefaultEmptyPlaceholder
- size={IN_CALL_STRIP_IMAGE_SIZE}
- />
- </Show>
- </Tooltip>
- );
-};
diff --git a/apps/web/src/features/channel/Call/InCallPanel/in-call-panel-debug.ts b/apps/web/src/features/channel/Call/InCallPanel/in-call-panel-debug.ts
deleted file mode 100644
index cf9bdf825a..0000000000
--- a/apps/web/src/features/channel/Call/InCallPanel/in-call-panel-debug.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import type { RemoteParticipant } from 'livekit-client';
-import type { InCallPanelMember } from './types';
-
-const QUERY_KEY = 'in_call_debug_extra';
-/** Upper bound so absurd query values do not freeze the tab in dev. */
-const MAX_EXTRAS = 500;
-
-/**
- * Dev-only: append N fake remotes to the in-call roster for layout testing.
- * Add e.g. `?in_call_debug_extra=8` to the page URL (integer 1–500, clamped). No-op in prod builds.
- */
-export function readInCallPanelDebugExtraRemoteCount(): number {
- if (!import.meta.env.DEV) return 0;
- if (typeof window === 'undefined') return 0;
- const raw = new URLSearchParams(window.location.search).get(QUERY_KEY);
- if (raw == null || raw === '') return 0;
- const n = Number.parseInt(raw, 10);
- if (!Number.isFinite(n) || n < 1) return 0;
- return Math.min(n, MAX_EXTRAS);
-}
-
-export function debugInCallExtraRemoteMembers(
- count: number
-): InCallPanelMember[] {
- return Array.from({ length: count }, (_, i) => {
- const participant = {
- sid: `debug-mock-${i}`,
- identity: `debug-mock-participant-${i}`,
- isAgent: false,
- } as RemoteParticipant;
- return { kind: 'remote' as const, participant };
- });
-}
diff --git a/apps/web/src/features/channel/Call/InCallPanel/index.ts b/apps/web/src/features/channel/Call/InCallPanel/index.ts
deleted file mode 100644
index 09dbd2df85..0000000000
--- a/apps/web/src/features/channel/Call/InCallPanel/index.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-export { InCallPanel } from './InCallPanelView';
-export type { InCallParticipantsListPopoverProps } from './InCallParticipantsListPopover';
-export { InCallParticipantsListPopover } from './InCallParticipantsListPopover';
-export {
- buildOrderedInCallMembers,
- buildVisibleAvatarSlots,
- IN_CALL_PANEL_VISIBLE_AVATAR_COUNT,
- splitInCallMembersForAvatars,
-} from './members';
-export type {
- InCallPanelControls,
- InCallPanelMember,
- InCallPanelProps,
- InCallVisibleAvatarSlot,
- UseInCallPanelOptions,
- UseInCallPanelResult,
-} from './types';
-export { useInCallPanel } from './use-in-call-panel';
diff --git a/apps/web/src/features/channel/Call/InCallPanel/members.ts b/apps/web/src/features/channel/Call/InCallPanel/members.ts
deleted file mode 100644
index 7d6004ce79..0000000000
--- a/apps/web/src/features/channel/Call/InCallPanel/members.ts
+++ /dev/null
@@ -1,52 +0,0 @@
-import type { RemoteParticipant, Room } from 'livekit-client';
-import type { InCallPanelMember, InCallVisibleAvatarSlot } from './types';
-
-/** How many participant avatars show inline before the rest go in a dropdown. */
-export const IN_CALL_PANEL_VISIBLE_AVATAR_COUNT = 3;
-
-/** Non-slim panel: when there are more than this many people, show this many inline avatars plus the roster trigger. */
-export const IN_CALL_PANEL_CROWDED_MEMBER_THRESHOLD = 5;
-export const IN_CALL_PANEL_VISIBLE_AVATAR_COUNT_CROWDED = 4;
-
-/**
- * Ordered list: local participant first, then non-agent remotes.
- * Empty when there is no room yet (e.g. still connecting).
- */
-export function buildOrderedInCallMembers(
- room: Room | null,
- remoteParticipants: Map<string, RemoteParticipant>
-): InCallPanelMember[] {
- if (!room) return [];
- const out: InCallPanelMember[] = [{ kind: 'local' }];
- for (const p of remoteParticipants.values()) {
- if (!p.isAgent) out.push({ kind: 'remote', participant: p });
- }
- return out;
-}
-
-export function splitInCallMembersForAvatars(
- members: InCallPanelMember[],
- visibleCount: number
-): { visible: InCallPanelMember[]; overflow: InCallPanelMember[] } {
- return {
- visible: members.slice(0, visibleCount),
- overflow: members.slice(visibleCount),
- };
-}
-
-export function buildVisibleAvatarSlots(
- panelActive: boolean,
- members: InCallPanelMember[],
- visibleCount: number
-): InCallVisibleAvatarSlot[] {
- if (!panelActive) return [];
- if (members.length === 0) {
- return [{ type: 'placeholder', key: 'connecting' }];
- }
- const slice = members.slice(0, visibleCount);
- return slice.map((member) => ({
- type: 'member',
- member,
- key: member.kind === 'local' ? 'local' : member.participant.sid,
- }));
-}
diff --git a/apps/web/src/features/channel/Call/InCallPanel/profile-picture-id-for-member.ts b/apps/web/src/features/channel/Call/InCallPanel/profile-picture-id-for-member.ts
deleted file mode 100644
index d35ea38eee..0000000000
--- a/apps/web/src/features/channel/Call/InCallPanel/profile-picture-id-for-member.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { tryMacroId } from '@core/user';
-import type { InCallPanelMember, UseInCallPanelResult } from './types';
-
-export function profilePictureIdForMember(
- panel: UseInCallPanelResult,
- member: InCallPanelMember
-): string | undefined {
- // LiveKit mutates participant fields on stable object refs — `room()` alone
- // does not invalidate. Re-read when connection or participant/track state changes.
- panel.callCtx.connectionState();
- panel.callCtx.trackVersion();
-
- if (member.kind === 'local') {
- const identity = panel.callCtx.room()?.localParticipant.identity;
- if (!identity) return undefined;
- return tryMacroId(identity) ?? identity;
- }
- return tryMacroId(member.participant.identity) ?? member.participant.identity;
-}
diff --git a/apps/web/src/features/channel/Call/InCallPanel/types.ts b/apps/web/src/features/channel/Call/InCallPanel/types.ts
deleted file mode 100644
index 62d4fbc303..0000000000
--- a/apps/web/src/features/channel/Call/InCallPanel/types.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-import type { RemoteParticipant } from 'livekit-client';
-import type { Accessor } from 'solid-js';
-import type { CallState } from '../CallContext';
-
-export type InCallPanelMember =
- | { kind: 'local' }
- | { kind: 'remote'; participant: RemoteParticipant };
-
-export type InCallVisibleAvatarSlot =
- | { type: 'member'; member: InCallPanelMember; key: string }
- | { type: 'placeholder'; key: string };
-
-export type InCallPanelControls = {
- toggleAudio: () => Promise<void>;
- toggleVideo: () => Promise<void>;
- toggleScreenShare: () => Promise<void>;
- leaveCall: () => Promise<void>;
- switchAudioInput: CallState['switchAudioInput'];
- switchAudioOutput: CallState['switchAudioOutput'];
- switchVideoInput: CallState['switchVideoInput'];
-};
-
-export type UseInCallPanelOptions = {
- /**
- * When set, `isActive` is true only if the active call is for this channel.
- * Omit to treat any active call as active (sidebar-global).
- */
- channelId?: Accessor<string | undefined>;
- /** Same role as `useCall` `onLeave` (e.g. switch tab back to Messages). */
- onLeaveCall?: () => void;
- onJoinCall?: () => void;
-};
-
-export type UseInCallPanelResult = {
- /** Whether the panel should render (in a call, and optional channel filter). */
- isActive: () => boolean;
- /** Members shown as inline avatars. */
- visibleMembers: Accessor<InCallPanelMember[]>;
- /** One placeholder while connecting; otherwise up to visible cap members (no padding). */
- visibleAvatarSlots: Accessor<InCallVisibleAvatarSlot[]>;
- /** Members listed in the overflow dropdown. */
- overflowMembers: Accessor<InCallPanelMember[]>;
- isConnecting: CallState['isConnecting'];
- /** LiveKit + device state (read in your DOM). */
- callCtx: CallState;
- /** Join / leave orchestration for this channel. */
- controls: InCallPanelControls;
-};
-
-export type InCallPanelProps = {
- /** Plain boolean or accessor so sidebar width updates stay tracked in Solid. */
- isSlim: boolean | Accessor<boolean>;
- channelId?: Accessor<string | undefined>;
- onLeaveCall?: () => void;
- onJoinCall?: () => void;
- class?: string;
- /**
- * When false, the in-panel mic / camera / screen / leave row is hidden.
- * Omitted defaults to visible. Use an accessor to toggle reactively.
- */
- showCallControls?: boolean | Accessor<boolean>;
-};
diff --git a/apps/web/src/features/channel/Call/InCallPanel/use-in-call-panel.ts b/apps/web/src/features/channel/Call/InCallPanel/use-in-call-panel.ts
deleted file mode 100644
index 369414724e..0000000000
--- a/apps/web/src/features/channel/Call/InCallPanel/use-in-call-panel.ts
+++ /dev/null
@@ -1,84 +0,0 @@
-import { createMemo } from 'solid-js';
-import { useCallContext } from '../CallContext';
-import { useCall } from '../use-call';
-import {
- debugInCallExtraRemoteMembers,
- readInCallPanelDebugExtraRemoteCount,
-} from './in-call-panel-debug';
-import {
- buildOrderedInCallMembers,
- buildVisibleAvatarSlots,
- IN_CALL_PANEL_VISIBLE_AVATAR_COUNT,
- splitInCallMembersForAvatars,
-} from './members';
-import type { UseInCallPanelOptions, UseInCallPanelResult } from './types';
-
-/**
- * Headless model for the in-call sidebar strip: participant split + the same
- * control surface as `CallOverlay` (mic / cam / screen / leave + device switches).
- *
- * Dev: `?in_call_debug_extra=8` appends fake remotes for crowded-roster UI (see `inCallPanelDebug.ts`;
- * values are clamped to a max in that module).
- */
-export function useInCallPanel(
- options?: UseInCallPanelOptions
-): UseInCallPanelResult {
- const callCtx = useCallContext();
-
- const resolvedChannelId = () =>
- options?.channelId?.() ?? callCtx.activeChannelId() ?? '';
-
- const call = useCall(resolvedChannelId, {
- onJoin: options?.onJoinCall,
- onLeave: options?.onLeaveCall,
- });
-
- const members = createMemo(() => {
- const real = buildOrderedInCallMembers(
- callCtx.room(),
- callCtx.remoteParticipants()
- );
- const extra = readInCallPanelDebugExtraRemoteCount();
- if (extra === 0) return real;
- return [...real, ...debugInCallExtraRemoteMembers(extra)];
- });
-
- const avatarSplit = createMemo(() =>
- splitInCallMembersForAvatars(members(), IN_CALL_PANEL_VISIBLE_AVATAR_COUNT)
- );
-
- const isActive = () => {
- if (!callCtx.isInCall()) return false;
- if (options?.channelId === undefined) return true;
- return callCtx.activeChannelId() === options.channelId();
- };
-
- const avatarSlotsRow = createMemo(() =>
- buildVisibleAvatarSlots(
- isActive(),
- members(),
- IN_CALL_PANEL_VISIBLE_AVATAR_COUNT
- )
- );
-
- const controls = {
- toggleAudio: () => callCtx.toggleAudio(),
- toggleVideo: () => callCtx.toggleVideo(),
- toggleScreenShare: () => callCtx.toggleScreenShare(),
- leaveCall: () => call.leaveCall(),
- switchAudioInput: (deviceId: string) => callCtx.switchAudioInput(deviceId),
- switchAudioOutput: (deviceId: string) =>
- callCtx.switchAudioOutput(deviceId),
- switchVideoInput: (deviceId: string) => callCtx.switchVideoInput(deviceId),
- };
-
- return {
- isActive,
- visibleMembers: () => avatarSplit().visible,
- visibleAvatarSlots: () => avatarSlotsRow(),
- overflowMembers: () => avatarSplit().overflow,
- isConnecting: callCtx.isConnecting,
- callCtx,
- controls,
- };
-}
diff --git a/apps/web/src/features/channel/sidebar/channels-recent-widget.tsx b/apps/web/src/features/channel/sidebar/channels-recent-widget.tsx
deleted file mode 100644
index f10eb76452..0000000000
--- a/apps/web/src/features/channel/sidebar/channels-recent-widget.tsx
+++ /dev/null
@@ -1,620 +0,0 @@
-import { makeMuteAction } from '@app/features/next-soup/actions';
-import {
- compileToAst,
- defineQueryFilters,
- queryStateFrom,
-} from '@app/features/next-soup/filters/filter-store';
-import { globalSplitManager } from '@app/signal/splitLayout';
-import { navigateToChannelMessage } from '@block-channel/utils/link';
-import { ChannelMutedIndicator } from '@channel/components/ChannelMutedIndicator';
-import { ReadonlyThread } from '@channel/StandaloneThread';
-import {
- CollapsibleSidebarSection,
- type CollapsibleSidebarSectionItem,
-} from '@components/app/app-sidebar/collapsible-sidebar-section';
-import type { SidebarState } from '@components/app/app-sidebar/sidebar';
-import {
- useGlobalBlockOrchestrator,
- useGlobalNotificationSource,
-} from '@components/app/GlobalAppState';
-import { useSplitLayout } from '@components/app/split-layout/layout';
-import {
- ContextMenuContent,
- MenuGroup,
- MenuItem,
- MenuSeparator,
-} from '@core/component/ContextMenu';
-import { isTouchDevice } from '@core/mobile/isTouchDevice';
-import { compareDateDesc } from '@core/util/date';
-import { type ChannelEntity, EntityRowIcon, isChannelEntity } from '@entity';
-import { ContextMenu } from '@kobalte/core/context-menu';
-import { Tooltip as KobalteTooltip } from '@kobalte/core/tooltip';
-import { openNotification } from '@notifications';
-import {
- isChannelNotification,
- notificationIsRead,
-} from '@notifications/notification-helpers';
-import { getChannelNotificationParams } from '@notifications/notification-navigation';
-import type { UnifiedNotification } from '@notifications/types';
-import { useSoupAstItemsQuery } from '@queries/soup/items';
-import { Key } from '@solid-primitives/keyed';
-import { makePersisted } from '@solid-primitives/storage';
-import { cn, NavRow, Surface, ToggleSwitch, Tooltip } from '@ui';
-import {
- createEffect,
- createMemo,
- createSignal,
- For,
- type JSX,
- onCleanup,
- type ParentProps,
- Show,
-} from 'solid-js';
-
-/** Rows the channel list shows before it scrolls internally. */
-const VISIBLE_CHANNEL_COUNT = 12;
-/**
- * How long the user must be done scrolling the list before a new channel
- * message snaps it back to the top.
- */
-const SCROLL_IDLE_SNAP_MS = 5000;
-/** Icon rows shown in the slim rail (unread channels only). */
-const SLIM_MAX = 4;
-const RECENT_CHANNELS_LIMIT = 100;
-const RECENT_CHANNELS_STALE_MS = 5 * 60 * 1000;
-
-/** A channel from the recent-channels query plus its unread notifications. */
-interface RecentChannel {
- entity: ChannelEntity;
- /** Unread channel notifications, newest first. */
- unread: UnifiedNotification[];
-}
-
-function unreadCountLabel(count: number): string {
- return count > 99 ? '99+' : String(count);
-}
-
-/**
- * Open a channel like the soup list would: an unread channel opens at its
- * newest unread message, a read one opens at the latest message.
- */
-function useOpenChannel() {
- const layout = useSplitLayout();
- return (channel: RecentChannel, newSplit: boolean) => {
- const manager = globalSplitManager();
- if (!manager) return;
- const notification = channel.unread[0];
- if (notification) {
- openNotification(notification, manager, newSplit);
- return;
- }
- layout.openWithSplit(
- { type: 'channel', id: channel.entity.id },
- { preferNewSplit: newSplit, referredFrom: 'sidebar' }
- );
- };
-}
-
-const HOVER_PREVIEW_COUNT = 3;
-
-// Unique thread roots (a reply previews its whole thread), newest first.
-function getPreviewThreadRoots(notifications: UnifiedNotification[]): string[] {
- const roots: string[] = [];
- const seen = new Set<string>();
- for (const notification of notifications) {
- const { messageId, threadId } = getChannelNotificationParams(notification);
- const rootId = threadId ?? messageId;
- if (!rootId || seen.has(rootId)) continue;
- seen.add(rootId);
- roots.push(rootId);
- }
- return roots;
-}
-
-function ChannelHoverPreview(props: { channel: RecentChannel }) {
- const orchestrator = useGlobalBlockOrchestrator();
- const roots = () => getPreviewThreadRoots(props.channel.unread);
- // Show the latest few threads oldest → newest, like the channel reads.
- const visible = () => roots().slice(0, HOVER_PREVIEW_COUNT).reverse();
- const hiddenCount = () => roots().length - visible().length;
-
- return (
- <div class="w-90 min-h-12 max-h-96 overflow-y-auto overscroll-contain flex flex-col py-1">
- <Show when={hiddenCount() > 0}>
- <span class="px-3 py-1 text-xs text-ink-extra-muted">
- +{hiddenCount()} earlier
- </span>
- </Show>
- <For each={visible()}>
- {(rootMessageId) => (
- <ReadonlyThread
- channelId={props.channel.entity.id}
- messageId={rootMessageId}
- onClickMessage={(clickedMessageId, e) => {
- e.stopPropagation();
- const isReply = clickedMessageId !== rootMessageId;
- navigateToChannelMessage(
- orchestrator,
- props.channel.entity.id,
- clickedMessageId,
- isReply ? rootMessageId : undefined
- );
- }}
- />
- )}
- </For>
- </div>
- );
-}
-
-function UnreadHoverCard(
- props: ParentProps<{
- channel: RecentChannel;
- disabled?: boolean;
- onOpenChange?: (open: boolean) => void;
- }>
-) {
- const [hovered, setHovered] = createSignal(false);
- const open = () => hovered() && !props.disabled;
-
- createEffect(() => props.onOpenChange?.(open()));
-
- return (
- <Show when={!isTouchDevice()} fallback={props.children}>
- <KobalteTooltip
- open={open()}
- onOpenChange={setHovered}
- placement="right"
- overflowPadding={16}
- fitViewport={true}
- closeDelay={250}
- openDelay={1000}
- flip={true}
- gutter={4}
- >
- <KobalteTooltip.Trigger
- class="inline-flex items-center w-full"
- as="div"
- >
- {props.children}
- </KobalteTooltip.Trigger>
- <KobalteTooltip.Portal>
- <KobalteTooltip.Content class="z-tool-tip max-w-[calc(100vw-32px)] menu-open-animation">
- <Surface
- depth={3}
- hideBorder
- class="shadow-menu ring ring-edge rounded-xl"
- >
- <ChannelHoverPreview channel={props.channel} />
- </Surface>
- </KobalteTooltip.Content>
- </KobalteTooltip.Portal>
- </KobalteTooltip>
- </Show>
- );
-}
-
-function ChannelRow(props: {
- channel: RecentChannel;
- isSlim?: boolean;
- onFloatingOpenChange?: (open: boolean) => void;
-}) {
- const notificationSource = useGlobalNotificationSource();
- const muteAction = makeMuteAction({
- notificationSource: () => notificationSource,
- });
- const openChannel = useOpenChannel();
-
- const entity = () => props.channel.entity;
- const isUnread = () => props.channel.unread.length > 0;
- const unreadCount = () => props.channel.unread.length;
- const isMuted = () => muteAction.isMuted(entity());
- const isSlim = () => props.isSlim ?? false;
-
- const canOpenInNewSplit = () =>
- globalSplitManager()?.canAppendSplit() ?? false;
-
- const openInCurrentSplit = () => openChannel(props.channel, false);
-
- const openInNewSplit = () => {
- if (!canOpenInNewSplit()) return;
- openChannel(props.channel, true);
- };
-
- const markAllAsRead = () => {
- void notificationSource.bulkMarkAsRead(props.channel.unread);
- };
-
- const ButtonContent = () => (
- <NavRow
- class="justify-start w-full h-7"
- draggable={false}
- onMouseDown={(e) => {
- if (e.button !== 0) return;
- e.preventDefault();
- openChannel(props.channel, e.shiftKey);
- }}
- >
- <div class="relative flex items-center justify-center shrink-0 size-5">
- <div class="size-3.5">
- <EntityRowIcon entity={entity()} suppressClick showTooltip={false} />
- </div>
- <Show when={isSlim() && isUnread()}>
- <span class="absolute -top-1.5 -right-1.5 min-w-3.5 h-3.5 px-0.5 flex items-center justify-center text-[9px] leading-none font-medium bg-accent text-surface rounded-full ring-surface ring-2">
- {unreadCountLabel(unreadCount())}
- </span>
- </Show>
- </div>
-
- <Show when={!isSlim()}>
- <span class="text-sm font-medium truncate flex-1 text-start">
- {entity().name}
- </span>
- <ChannelMutedIndicator muted={isMuted()} class="size-3.5" />
- </Show>
- <Show when={!isSlim() && isUnread()}>
- <span class="ml-auto shrink-0 min-w-5 h-5 px-1.5 flex items-center justify-center text-xs font-medium bg-ink/6 text-ink-muted rounded-md">
- {unreadCountLabel(unreadCount())}
- </span>
- </Show>
- </NavRow>
- );
-
- const [contextMenuOpen, setContextMenuOpen] = createSignal(false);
- const [hoverCardOpen, setHoverCardOpen] = createSignal(false);
-
- createEffect(() => {
- props.onFloatingOpenChange?.(contextMenuOpen() || hoverCardOpen());
- });
-
- return (
- <ContextMenu onOpenChange={setContextMenuOpen}>
- <ContextMenu.Trigger
- class={cn(isSlim() ? 'flex justify-center' : 'w-full')}
- >
- <Show
- when={!isSlim()}
- fallback={
- <Tooltip label={entity().name} placement="right">
- <ButtonContent />
- </Tooltip>
- }
- >
- <UnreadHoverCard
- channel={props.channel}
- disabled={contextMenuOpen() || !isUnread()}
- onOpenChange={setHoverCardOpen}
- >
- <ButtonContent />
- </UnreadHoverCard>
- </Show>
- </ContextMenu.Trigger>
-
- <ContextMenu.Portal>
- <ContextMenuContent class="text-xs text-ink-muted">
- <MenuGroup>
- <MenuItem
- text="Open in new split"
- onClick={openInNewSplit}
- disabled={!canOpenInNewSplit()}
- />
- <MenuItem
- text="Open in current split"
- onClick={openInCurrentSplit}
- />
- </MenuGroup>
- <Show when={isUnread()}>
- <MenuSeparator />
- <MenuGroup>
- <MenuItem text="Mark as read" onClick={markAllAsRead} />
- </MenuGroup>
- </Show>
- <Show when={muteAction.canExecute(entity())}>
- <MenuSeparator />
- <MenuGroup>
- <MenuItem
- text={isMuted() ? 'Unmute notifications' : 'Mute notifications'}
- onClick={() => void muteAction.execute([entity()])}
- />
- </MenuGroup>
- </Show>
- </ContextMenuContent>
- </ContextMenu.Portal>
- </ContextMenu>
- );
-}
-
-export const ChannelsRecentWidget = (props: {
- sidebarState: SidebarState;
- /** Rows visible before the list scrolls. */
- maxVisible?: number;
- onSectionOpenChange?: () => void;
- onDropdownOpenChange?: (open: boolean) => void;
- headerWrapper?: (header: JSX.Element) => JSX.Element;
-}) => {
- const notificationSource = useGlobalNotificationSource();
- const [unreadOnly, setUnreadOnly] = makePersisted(createSignal(false), {
- name: 'sidebar-recent-channels-unread-only',
- });
-
- const channelsQuery = useSoupAstItemsQuery(
- () => ({
- params: { limit: RECENT_CHANNELS_LIMIT, sort_method: 'updated_at' },
- body: compileToAst(
- queryStateFrom(
- defineQueryFilters({
- include: { channelImportance: true, channelIsParticipant: [true] },
- })
- )
- ),
- }),
- () => ({ staleTime: RECENT_CHANNELS_STALE_MS })
- );
-
- const unreadByChannel = createMemo(() => {
- const map = new Map<string, UnifiedNotification[]>();
- for (const notification of notificationSource.notifications()) {
- if (notification.entity_type !== 'channel') continue;
- if (notificationIsRead(notification)) continue;
- const list = map.get(notification.entity_id);
- if (list) list.push(notification);
- else map.set(notification.entity_id, [notification]);
- }
- // `unread[0]` must be the newest notification (it aims open-at-unread and
- // the hover previews); don't rely on the source list's ordering.
- for (const list of map.values()) {
- list.sort((a, b) => compareDateDesc(a.created_at, b.created_at));
- }
- return map;
- });
-
- // A channel can carry unread notifications while being older than the
- // newest-RECENT_CHANNELS_LIMIT window the main query returns. Fetch those
- // stragglers by id so an unread channel always makes the list.
- const missingUnreadChannelIds = createMemo(() => {
- const entities = channelsQuery.data?.entities;
- if (!entities) return [];
- const listed = new Set(
- entities.filter(isChannelEntity).map((entity) => entity.id)
- );
- // Sorted so the derived query key is stable across notification reorders.
- return [...unreadByChannel().keys()].filter((id) => !listed.has(id)).sort();
- });
-
- const missingUnreadChannelsQuery = useSoupAstItemsQuery(
- () => ({
- // Sized to the id list, not RECENT_CHANNELS_LIMIT: this query must
- // return every exact-id match, and a fixed limit would silently drop
- // the oldest ones past it. (The server's [20, 500] clamp covers only
- // the merged page; the channel SQL takes this limit verbatim, safe
- // here because the exact-id filter runs before LIMIT.)
- params: {
- limit: missingUnreadChannelIds().length,
- sort_method: 'updated_at',
- },
- body: compileToAst(
- queryStateFrom(
- defineQueryFilters({
- include: {
- channelId: missingUnreadChannelIds(),
- channelImportance: true,
- channelIsParticipant: [true],
- },
- })
- )
- ),
- }),
- () => ({
- enabled: missingUnreadChannelIds().length > 0,
- staleTime: RECENT_CHANNELS_STALE_MS,
- })
- );
-
- const recentChannels = createMemo<RecentChannel[]>(() => {
- const unread = unreadByChannel();
- // Only ids still missing may merge in: placeholder rows from a previous id
- // set must not duplicate a listed channel or resurrect a since-read one.
- const missing = new Set(missingUnreadChannelIds());
- const channels = [
- ...(channelsQuery.data?.entities ?? []).filter(isChannelEntity),
- ...(missingUnreadChannelsQuery.data?.entities ?? [])
- .filter(isChannelEntity)
- .filter((entity) => missing.has(entity.id)),
- ].map((entity) => ({ entity, unread: unread.get(entity.id) ?? [] }));
- // Same ordering as the channels soup view…
- channels.sort((a, b) =>
- compareDateDesc(
- a.entity.sortTs ?? a.entity.updatedAt,
- b.entity.sortTs ?? b.entity.updatedAt
- )
- );
- // …but with unread channels sorted to the top.
- return [
- ...channels.filter((channel) => channel.unread.length > 0),
- ...channels.filter((channel) => channel.unread.length === 0),
- ];
- });
- const visibleChannels = createMemo(() =>
- unreadOnly()
- ? recentChannels().filter((channel) => channel.unread.length > 0)
- : recentChannels()
- );
- const showAllCaughtUp = () =>
- unreadOnly() &&
- recentChannels().length > 0 &&
- visibleChannels().length === 0;
-
- const maxVisible = () => props.maxVisible ?? VISIBLE_CHANNEL_COUNT;
- // The list shows `maxVisible` rows (h-7 rows, gap-0.5) and scrolls inside
- // itself to reveal the rest.
- const listMaxHeight = () =>
- `calc(${maxVisible()} * 1.75rem + ${Math.max(0, maxVisible() - 1)} * 0.125rem)`;
-
- // The slim rail keeps its "unread at a glance" role: unread channels only.
- const slimChannels = () =>
- recentChannels().filter((channel) => channel.unread.length > 0);
- const slimVisible = () => slimChannels().slice(0, SLIM_MAX);
- const slimOverflow = () => Math.max(0, slimChannels().length - SLIM_MAX);
-
- const isSlim = () => props.sidebarState === 'slim';
-
- let channelListRef: HTMLDivElement | undefined;
- let lastUserScrollAt = 0;
- let suppressNextScrollEvent = false;
-
- const [hasOverflowTop, setHasOverflowTop] = createSignal(false);
- const [hasOverflowBottom, setHasOverflowBottom] = createSignal(false);
- let listScrollFrame: number | undefined;
-
- const updateListScrollShadows = () => {
- const el = channelListRef;
- if (!el) return;
- const maxScrollTop = el.scrollHeight - el.clientHeight;
- setHasOverflowTop(el.scrollTop > 1);
- setHasOverflowBottom(maxScrollTop - el.scrollTop > 1);
- };
-
- const scheduleListScrollUpdate = () => {
- if (listScrollFrame !== undefined) cancelAnimationFrame(listScrollFrame);
- listScrollFrame = requestAnimationFrame(() => {
- listScrollFrame = undefined;
- updateListScrollShadows();
- });
- };
-
- // Overflow can change without a scroll event (channels load in, rows are
- // removed, the visible-row cap changes), so re-check when those change too.
- createEffect(() => {
- visibleChannels();
- maxVisible();
- scheduleListScrollUpdate();
- });
-
- onCleanup(() => {
- if (listScrollFrame !== undefined) cancelAnimationFrame(listScrollFrame);
- });
-
- const snapToTopIfIdle = () => {
- const el = channelListRef;
- if (!el || el.scrollTop === 0) return;
- if (Date.now() - lastUserScrollAt < SCROLL_IDLE_SNAP_MS) return;
- // The programmatic scroll fires a scroll event too; don't let it count
- // as user scrolling.
- suppressNextScrollEvent = true;
- el.scrollTop = 0;
- };
-
- const unsubscribe = notificationSource.subscribe((notification) => {
- if (!isChannelNotification(notification)) return;
- snapToTopIfIdle();
- });
- onCleanup(unsubscribe);
-
- const sectionItems = createMemo<CollapsibleSidebarSectionItem[]>(() => [
- {
- id: 'channels-list',
- visible: () => (
- <div class="relative">
- <div
- ref={channelListRef}
- class="flex flex-col gap-0.5 overflow-y-auto overscroll-none"
- style={{ 'max-height': listMaxHeight() }}
- onScroll={() => {
- updateListScrollShadows();
- if (suppressNextScrollEvent) {
- suppressNextScrollEvent = false;
- return;
- }
- lastUserScrollAt = Date.now();
- }}
- >
- <Key each={visibleChannels()} by={(channel) => channel.entity.id}>
- {(channel) => (
- <ChannelRow
- channel={channel()}
- onFloatingOpenChange={props.onDropdownOpenChange}
- />
- )}
- </Key>
- <Show when={showAllCaughtUp()}>
- <div class="flex h-7 w-full items-center gap-2 px-2 py-1 text-sm font-medium text-ink-extra-muted/60">
- <span class="truncate">All caught up</span>
- </div>
- </Show>
- </div>
- <div
- class={cn(
- 'pointer-events-none absolute inset-x-0 top-0 h-3 transition-opacity bg-gradient-to-b from-surface to-transparent',
- hasOverflowTop() ? 'opacity-100' : 'opacity-0'
- )}
- />
- <div
- class={cn(
- 'pointer-events-none absolute inset-x-0 bottom-0 h-3 transition-opacity bg-gradient-to-t from-surface to-transparent',
- hasOverflowBottom() ? 'opacity-100' : 'opacity-0'
- )}
- />
- </div>
- ),
- dropdown: () => null,
- },
- ]);
-
- return (
- <Show
- when={!isSlim()}
- fallback={
- <Show when={slimVisible().length > 0}>
- <section class="w-full py-1.5 flex flex-col items-start gap-0.5">
- <Key each={slimVisible()} by={(channel) => channel.entity.id}>
- {(channel) => <ChannelRow channel={channel()} isSlim />}
- </Key>
- <Show when={slimOverflow() > 0}>
- <span class="w-full text-center text-xxs text-ink-muted mt-1">
- +{slimOverflow()}
- </span>
- </Show>
- </section>
- </Show>
- }
- >
- <Show when={recentChannels().length > 0}>
- <CollapsibleSidebarSection
- label="Latest"
- persistKey="recent-channels"
- items={sectionItems()}
- headerWrapper={props.headerWrapper}
- headerMenu={(open) => (
- <Show when={open}>
- <Tooltip
- label="Toggle unread filter"
- placement="top"
- class="pointer-events-none rounded-full opacity-0 transition-opacity duration-100 group-hover/sidebar-section:pointer-events-auto group-hover/sidebar-section:opacity-100"
- >
- <div
- onMouseDown={(event) => event.stopPropagation()}
- onClick={(event) => event.stopPropagation()}
- >
- <ToggleSwitch
- checked={unreadOnly()}
- onChange={setUnreadOnly}
- size="xs"
- label={
- <span class="text-[11px] font-medium leading-none text-ink-extra-muted/60">
- Unread
- </span>
- }
- labelClass="flex items-center"
- controlClass="bg-ink-extra-muted/25 data-checked:bg-accent"
- class="flex-row-reverse gap-1 rounded-full px-1.5 py-1"
- />
- </div>
- </Tooltip>
- </Show>
- )}
- onOpenChange={() => props.onSectionOpenChange?.()}
- />
- </Show>
- </Show>
- );
-};
diff --git a/apps/web/src/features/channels-view/route.tsx b/apps/web/src/features/channels-view/route.tsx
index 3b1592ae7d..4d63091cd6 100644
--- a/apps/web/src/features/channels-view/route.tsx
+++ b/apps/web/src/features/channels-view/route.tsx
@@ -6,33 +6,16 @@ import {
import { URL_PARAMS as CHANNEL_URL_PARAMS } from '@block-channel/constants';
import type { SplitContent } from '@components/app/split-layout/layoutManager';
import {
- NewAppView,
+ AppView,
RedirectSplit,
withAuth,
} from '@components/app/split-layout/split-router/app-route-shell';
import { uuidRouteReference } from '@components/app/split-layout/split-router/mention-links';
-import { lazy, Show } from 'solid-js';
+import { Show } from 'solid-js';
import { z } from 'zod';
-import { getViewPreset } from '../next-soup/sidebar/soup-filter-presets';
import { channelsSearch } from './channels-route';
import { ChannelDetailRouteView, ChannelsView } from './channels-view';
-const SoupView = lazy(async () => ({
- default: (await import('../next-soup/soup-view/soup-view')).SoupView,
-}));
-
-function LegacyChannelsView() {
- const preset = getViewPreset('channels');
- return (
- <SoupView
- viewName="Channels"
- initialFilters={preset?.filters}
- initialClientFilters={preset?.clientFilters}
- initialGroupBy={preset?.groupBy}
- />
- );
-}
-
function ChannelsLegacyRouteView() {
const params = useParams<{ channelId?: string }>();
const [search] = createSearchParams(channelsSearch);
@@ -44,7 +27,7 @@ function ChannelsLegacyRouteView() {
};
return (
- <Show when={params.channelId} fallback={<LegacyChannelsView />}>
+ <Show when={params.channelId}>
{(channelId) => <RedirectSplit to={legacyChannel(channelId())} />}
</Show>
);
@@ -55,15 +38,14 @@ export const ChannelsRouteView = withAuth(() => {
const detailRequested = () => typeof params.channelId === 'string';
return (
- <NewAppView
+ <AppView
id="channels"
detailDesktopOnly
detailRequested={detailRequested}
detailFallback={<ChannelsLegacyRouteView />}
- fallback={<LegacyChannelsView />}
>
<ChannelsView />
- </NewAppView>
+ </AppView>
);
});
diff --git a/apps/web/src/features/drive-view/route.tsx b/apps/web/src/features/drive-view/route.tsx
index 4e8f18d124..d88219cdfb 100644
--- a/apps/web/src/features/drive-view/route.tsx
+++ b/apps/web/src/features/drive-view/route.tsx
@@ -4,7 +4,6 @@ import {
defineRoute,
routeParams,
type SplitRouterEntry,
- useParams,
useRouteParams,
} from '@app/lib/split-router';
import { callDetailSearch } from '@block-call/call-route';
@@ -15,18 +14,12 @@ import { URL_PARAMS as PDF_URL_PARAMS } from '@block-pdf/constants';
import { pdfDetailSearch } from '@block-pdf/pdf-route';
import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
import {
- NewAppView,
+ AppView,
withAuth,
} from '@components/app/split-layout/split-router/app-route-shell';
import { uuidRouteReference } from '@components/app/split-layout/split-router/mention-links';
-import { useUserContext } from '@core/context/user';
import { lazy } from 'solid-js';
import { z } from 'zod';
-import { queryStateFrom } from '../next-soup/filters/filter-store';
-import type { SetPredicatesInput } from '../next-soup/filters/filter-store/predicates-store';
-import { mergeQuery } from '../next-soup/filters/filter-store/query-store';
-import type { Query } from '../next-soup/filters/filter-store/types';
-import { getViewPreset } from '../next-soup/sidebar/soup-filter-presets';
import { DriveDetailView } from './components/DriveDetailView';
import { DriveView, type DriveViewProps } from './drive-view';
import { driveDetailTrailSchema } from './primitives/drive-detail-trail';
@@ -35,72 +28,22 @@ import {
driveDocumentBlockType,
} from './primitives/drive-route-schema';
-const SoupView = lazy(async () => ({
- default: (await import('../next-soup/soup-view/soup-view')).SoupView,
-}));
const DriveCallDetail = lazy(async () => ({
default: (await import('./views/DriveCallDetail')).DriveCallDetail,
}));
-type DriveRouteViewProps = DriveViewProps & {
- initialFilters?: Query;
- initialClientFilters?: SetPredicatesInput<string>;
-};
-
export const DriveRouteView = withAuth(() => {
const panel = useSplitPanelOrThrow();
- const params = useParams<{ callId?: string }>();
- const props = (): DriveRouteViewProps => {
+ const props = (): DriveViewProps => {
const content = panel.handle.content();
return content.type === 'component'
- ? ((content.params ?? {}) as DriveRouteViewProps)
+ ? ((content.params ?? {}) as DriveViewProps)
: {};
};
- const user = useUserContext();
- const preset = getViewPreset('documents', undefined, {
- userId: user.userId(),
- isTeamAdmin: false,
- });
- const initialFilters = () => {
- const requested = props().initialFilters;
- return preset?.filters && requested
- ? mergeQuery(queryStateFrom(preset.filters), requested)
- : (requested ?? preset?.filters);
- };
- const initialClientFilters = () =>
- preset?.clientFilters && props().initialClientFilters
- ? {
- and: [
- ...new Set([
- ...(preset.clientFilters.and ?? []),
- ...(props().initialClientFilters?.and ?? []),
- ]),
- ],
- or: [
- ...new Set([
- ...(preset.clientFilters.or ?? []),
- ...(props().initialClientFilters?.or ?? []),
- ]),
- ],
- }
- : (props().initialClientFilters ?? preset?.clientFilters);
return (
- <NewAppView
- id="documents"
- composableOnTouch
- fallback={
- <SoupView
- viewName="Files"
- initialFilters={initialFilters()}
- initialClientFilters={initialClientFilters()}
- initialGroupBy={preset?.groupBy}
- />
- }
- detailRequested={() => !!params.callId}
- alwaysRenderDetail
- >
+ <AppView id="documents">
<DriveView initialFacets={props().initialFacets} />
- </NewAppView>
+ </AppView>
);
});
diff --git a/apps/web/src/features/email-view/email-view-context.test.tsx b/apps/web/src/features/email-view/email-view-context.test.tsx
index 9ef8059e23..93118456c7 100644
--- a/apps/web/src/features/email-view/email-view-context.test.tsx
+++ b/apps/web/src/features/email-view/email-view-context.test.tsx
@@ -18,9 +18,6 @@ vi.mock('@app/components/list', () => ({
listOwnedSlotName: (name: string) => name,
}));
vi.mock('@app/components/view-shell', () => ({}));
-vi.mock('@app/features/next-soup/soup-view/inbox-filter-controllers', () => ({
- registerInboxFilterSplit: () => () => {},
-}));
vi.mock(
'@app/features/soup',
async () => import('../soup/filters/facets/selection')
diff --git a/apps/web/src/features/email-view/email-view-context.tsx b/apps/web/src/features/email-view/email-view-context.tsx
index 759db0a03f..6f4ef80e87 100644
--- a/apps/web/src/features/email-view/email-view-context.tsx
+++ b/apps/web/src/features/email-view/email-view-context.tsx
@@ -7,7 +7,6 @@ import {
} from '@app/components/list';
import { setSidebarSectionCollapsed } from '@app/components/view-shell';
import { useMobileSearchText } from '@app/features/command/mobile/use-mobile-search-text';
-import { registerInboxFilterSplit } from '@app/features/next-soup/soup-view/inbox-filter-controllers';
import { normalizeFacetSelection } from '@app/features/soup';
import { registerListNavigationSource } from '@app/features/soup/collection/list-navigation-source';
import { makePersistedState } from '@app/lib/persistence';
@@ -366,17 +365,6 @@ export const [EmailViewProvider, useEmailView] = createAssertedContextProvider<
'collapsedSidebarSectionIds',
setSidebarSectionCollapsed(id, open)
);
-
- // The classic sidebar's nested account rows scope the mail list by split id
- // (see `SidebarMailLink`); registering keeps them driving this view too, and
- // flushes a selection queued while navigating here.
- onCleanup(
- registerInboxFilterSplit(panel.handle.id, {
- inboxFilter: () => state.inboxIds,
- setInboxFilter: setInboxIds,
- })
- );
-
return {
state,
setState,
diff --git a/apps/web/src/features/email-view/route.tsx b/apps/web/src/features/email-view/route.tsx
index f30ba9cf21..2d699342a1 100644
--- a/apps/web/src/features/email-view/route.tsx
+++ b/apps/web/src/features/email-view/route.tsx
@@ -5,35 +5,18 @@ import {
} from '@app/lib/split-router';
import type { SplitContent } from '@components/app/split-layout/layoutManager';
import {
- NewAppView,
+ AppView,
RedirectSplit,
withAuth,
} from '@components/app/split-layout/split-router/app-route-shell';
import { uuidRouteReference } from '@components/app/split-layout/split-router/mention-links';
-import { lazy, Show } from 'solid-js';
+import { Show } from 'solid-js';
import { z } from 'zod';
import { URL_PARAMS as EMAIL_URL_PARAMS } from '../email-thread/core/location';
-import { getViewPreset } from '../next-soup/sidebar/soup-filter-presets';
import { EmailDetailRouteView } from './components/EmailDetailView';
import { emailDetailSearch } from './email-route';
import { EmailView } from './email-view';
-const SoupView = lazy(async () => ({
- default: (await import('../next-soup/soup-view/soup-view')).SoupView,
-}));
-
-function LegacyMailView() {
- const preset = getViewPreset('mail');
- return (
- <SoupView
- viewName="Email"
- initialFilters={preset?.filters}
- initialClientFilters={preset?.clientFilters}
- initialGroupBy={preset?.groupBy}
- />
- );
-}
-
function MailLegacyRouteView() {
const params = useParams<{ threadId?: string }>();
const [search] = createSearchParams(emailDetailSearch);
@@ -44,7 +27,7 @@ function MailLegacyRouteView() {
};
return (
- <Show when={params.threadId} fallback={<LegacyMailView />}>
+ <Show when={params.threadId}>
{(threadId) => <RedirectSplit to={legacyThread(threadId())} />}
</Show>
);
@@ -55,15 +38,14 @@ export const MailRouteView = withAuth(() => {
const detailRequested = () => typeof params.threadId === 'string';
return (
- <NewAppView
+ <AppView
id="mail"
detailDesktopOnly
detailRequested={detailRequested}
detailFallback={<MailLegacyRouteView />}
- fallback={<LegacyMailView />}
>
<EmailView />
- </NewAppView>
+ </AppView>
);
});
diff --git a/apps/web/src/features/favorites/sidebar/favorites-section.tsx b/apps/web/src/features/favorites/sidebar/favorites-section.tsx
deleted file mode 100644
index 701852cdf3..0000000000
--- a/apps/web/src/features/favorites/sidebar/favorites-section.tsx
+++ /dev/null
@@ -1,516 +0,0 @@
-import { FavoriteIcon } from '@app/features/favorites/FavoriteIcon';
-import { makeMuteAction } from '@app/features/next-soup/actions';
-import { globalSplitManager } from '@app/signal/splitLayout';
-import {
- favoriteIconType,
- favoriteSplitContent,
- useFavoriteDisplayName,
- useFavoriteDmRecipientId,
-} from '@app/util/favorites';
-import { navigateToChannelMessage } from '@block-channel/utils/link';
-import { ChannelMutedIndicator } from '@channel/components/ChannelMutedIndicator';
-import { ReadonlyThread } from '@channel/StandaloneThread';
-import type { SidebarState } from '@components/app/app-sidebar/sidebar';
-import {
- useGlobalBlockOrchestrator,
- useGlobalNotificationSource,
-} from '@components/app/GlobalAppState';
-import { useSplitLayout } from '@components/app/split-layout/layout';
-import {
- MenuGroup,
- MenuItem,
- MenuSeparator,
-} from '@core/component/ContextMenu';
-import type { EntityIconSelector } from '@core/component/EntityIcon';
-import { toast } from '@core/component/Toast/Toast';
-import {
- enableGraphqlSoup,
- isFeatureEnabled,
-} from '@core/constant/featureFlags';
-import { isTouchDevice } from '@core/mobile/isTouchDevice';
-import type { EntityData } from '@entity';
-import { Tooltip as KobalteTooltip } from '@kobalte/core/tooltip';
-import { isChannelNotification } from '@notifications/notification-helpers';
-import { getChannelNotificationParams } from '@notifications/notification-navigation';
-import type { UnifiedNotification } from '@notifications/types';
-import CaretDownIcon from '@phosphor/caret-down.svg';
-import {
- favoriteEntityKey,
- useFavoritesData,
- useReorderFavoritesMutation,
-} from '@queries/favorites/favorites';
-import type { Favorite } from '@service-storage/generated/schemas/favorite';
-import { makePersisted } from '@solid-primitives/storage';
-import {
- createSortable,
- SortableProvider,
- useDragDropContext,
-} from '@thisbeyond/solid-dnd';
-import { cn, NavRow, Surface } from '@ui';
-import {
- type Accessor,
- createEffect,
- createMemo,
- createSignal,
- For,
- type ParentProps,
- Show,
-} from 'solid-js';
-import { FavoriteContextMenu } from '../FavoriteContextMenu';
-
-/**
- * Drag data carried by favorite row sortables. Distinct from `EntityDragData`
- * (`dragType: 'entity'`) so entity drop consumers ignore favorite drags; the
- * global `ItemDragOverlay` branches on it to render its chip.
- */
-export type FavoriteDragData = {
- dragType: 'favorite';
- iconType: EntityIconSelector;
- name: string;
- /** Other participant of a DM channel favorite; the drag overlay shows
- * their avatar instead of the entity icon. */
- dmRecipientId?: string;
- /** Read by the `pointerWithin` collision detector to skip collapsed rows. */
- isDropTargetDisabled: () => boolean;
-};
-
-const HOVER_PREVIEW_COUNT = 3;
-
-function getPreviewThreadRoots(notifications: UnifiedNotification[]): string[] {
- const roots: string[] = [];
- const seen = new Set<string>();
- for (const notification of notifications) {
- const { messageId, threadId } = getChannelNotificationParams(notification);
- const rootId = threadId ?? messageId;
- if (!rootId || seen.has(rootId)) continue;
- seen.add(rootId);
- roots.push(rootId);
- }
- return roots;
-}
-
-function FavoriteChannelHoverPreview(props: {
- channelId: string;
- notifications: UnifiedNotification[];
-}) {
- const orchestrator = useGlobalBlockOrchestrator();
- const roots = () => getPreviewThreadRoots(props.notifications);
- const visible = () => roots().slice(0, HOVER_PREVIEW_COUNT).reverse();
- const hiddenCount = () => roots().length - visible().length;
-
- return (
- <div class="w-90 min-h-12 max-h-96 overflow-y-auto overscroll-contain flex flex-col py-1">
- <Show when={hiddenCount() > 0}>
- <span class="px-3 py-1 text-xs text-ink-extra-muted">
- +{hiddenCount()} earlier
- </span>
- </Show>
- <For each={visible()}>
- {(rootMessageId) => (
- <ReadonlyThread
- channelId={props.channelId}
- messageId={rootMessageId}
- onClickMessage={(clickedMessageId, e) => {
- e.stopPropagation();
- const isReply = clickedMessageId !== rootMessageId;
- navigateToChannelMessage(
- orchestrator,
- props.channelId,
- clickedMessageId,
- isReply ? rootMessageId : undefined
- );
- }}
- />
- )}
- </For>
- </div>
- );
-}
-
-function FavoriteChannelHoverCard(
- props: ParentProps<{
- channelId: string;
- notifications: UnifiedNotification[];
- disabled?: boolean;
- onOpenChange?: (open: boolean) => void;
- }>
-) {
- const [hovered, setHovered] = createSignal(false);
- const open = () => hovered() && !props.disabled;
-
- createEffect(() => props.onOpenChange?.(open()));
-
- return (
- <Show when={!isTouchDevice()} fallback={props.children}>
- <KobalteTooltip
- open={open()}
- onOpenChange={setHovered}
- placement="right"
- overflowPadding={16}
- fitViewport={true}
- closeDelay={250}
- openDelay={1000}
- flip={true}
- gutter={4}
- >
- <KobalteTooltip.Trigger
- class="inline-flex items-center w-full"
- as="div"
- >
- {props.children}
- </KobalteTooltip.Trigger>
- <KobalteTooltip.Portal>
- <KobalteTooltip.Content class="z-tool-tip max-w-[calc(100vw-32px)] menu-open-animation">
- <Surface depth={3}>
- <FavoriteChannelHoverPreview
- channelId={props.channelId}
- notifications={props.notifications}
- />
- </Surface>
- </KobalteTooltip.Content>
- </KobalteTooltip.Portal>
- </KobalteTooltip>
- </Show>
- );
-}
-
-/**
- * Linear-style favorites for the expanded sidebar: a collapsible "Favorites"
- * list of the user's favorited entities. Rows navigate like other sidebar rows
- * and are drag-reorderable. Hidden entirely in slim mode and when the user has
- * no favorites.
- */
-export const FavoritesSection = (props: {
- sidebarState: SidebarState;
- onContextMenuOpenChange?: (open: boolean) => void;
-}) => {
- // TODO(dev-rb/notifications): Fetch favorite entities through Soup with
- // their notification edges instead of hydrating them from the REST list.
- // Non-suspending accessor: a pending or failed favorites query must not
- // suspend or crash the sidebar; the section just stays hidden until loaded.
- const favoritesData = useFavoritesData();
- const notificationSource = useGlobalNotificationSource();
-
- const favorites = () => favoritesData()?.favorites ?? [];
- const unreadNotificationsByChannel = createMemo(() => {
- // TODO(dev-rb/notifications): Restore favorite notification badges,
- // previews, and actions from notifications attached to favorite Soup items.
- if (isFeatureEnabled(enableGraphqlSoup)) {
- return new Map<string, UnifiedNotification[]>();
- }
-
- const notificationsByChannel = new Map<string, UnifiedNotification[]>();
- for (const notification of notificationSource.notifications()) {
- if (
- !isChannelNotification(notification) ||
- notification.state !== 'unseen'
- ) {
- continue;
- }
- const notifications = notificationsByChannel.get(notification.entity_id);
- if (notifications) {
- notifications.push(notification);
- } else {
- notificationsByChannel.set(notification.entity_id, [notification]);
- }
- }
- return notificationsByChannel;
- });
-
- return (
- <Show when={props.sidebarState === 'expanded' && favorites().length > 0}>
- <div class="w-full shrink-0">
- <FavoritesGroup
- label="Favorites"
- favorites={favorites()}
- persistKey="sidebar-favorites-expanded"
- onContextMenuOpenChange={props.onContextMenuOpenChange}
- unreadNotificationsByChannel={unreadNotificationsByChannel}
- />
- </div>
- </Show>
- );
-};
-
-const FavoritesGroup = (props: {
- label: string;
- favorites: Favorite[];
- persistKey: string;
- onContextMenuOpenChange?: (open: boolean) => void;
- unreadNotificationsByChannel: Accessor<
- ReadonlyMap<string, UnifiedNotification[]>
- >;
-}) => {
- const [expanded, setExpanded] = makePersisted(createSignal(true), {
- name: props.persistKey,
- });
- const reorderMutation = useReorderFavoritesMutation();
-
- // Rows are keyed by what they point at; favorites have no surrogate id.
- const keys = createMemo(() =>
- props.favorites.map((favorite) =>
- favoriteEntityKey(favorite.entityType, favorite.entityId)
- )
- );
- const notificationsForFavorite = (favorite: Favorite) => () =>
- favorite.entityType === 'channel'
- ? (props.unreadNotificationsByChannel().get(favorite.entityId) ?? [])
- : [];
-
- // The sidebar lives inside the app-wide DragDropProvider (ItemDndProvider);
- // register on its events rather than mounting a nested provider.
- const [, dndActions] = useDragDropContext() ?? [];
-
- dndActions?.onDragEnd(({ draggable, droppable }) => {
- const dragData = draggable.data;
- if (dragData?.dragType !== 'favorite') return;
- // Dropping outside the list leaves the order unchanged.
- if (!droppable) return;
- const dropData = droppable.data;
- if (dropData?.dragType !== 'favorite') return;
- const current = keys();
- const fromIndex = current.indexOf(String(draggable.id));
- const toIndex = current.indexOf(String(droppable.id));
- if (fromIndex < 0 || toIndex < 0 || fromIndex === toIndex) return;
- const ordered = props.favorites.slice();
- ordered.splice(toIndex, 0, ...ordered.splice(fromIndex, 1));
- reorderMutation.mutate({
- favorites: ordered.map((favorite) => ({
- entityType: favorite.entityType,
- entityId: favorite.entityId,
- })),
- });
- });
-
- return (
- <section class="w-full flex flex-col">
- <header>
- <button
- type="button"
- class="group/section flex h-7 w-full items-center justify-start gap-1 rounded-md px-2 text-left text-[13px] font-medium text-ink-extra-muted/60 transition-colors hover:bg-ink/3 hover:text-ink-muted"
- aria-expanded={expanded()}
- onClick={() => setExpanded(!expanded())}
- >
- <span class="min-w-0 truncate">{props.label}</span>
- <CaretDownIcon
- class={cn(
- 'size-3 shrink-0 transition-transform duration-[120ms] ease-in-out',
- !expanded() && '-rotate-90'
- )}
- />
- </button>
- </header>
-
- <div
- class="grid w-full transition-[grid-template-rows] duration-200 ease-out"
- style={{ 'grid-template-rows': expanded() ? '1fr' : '0fr' }}
- >
- <ul class="min-h-0 overflow-hidden flex flex-col gap-0.5">
- <SortableProvider ids={keys()}>
- <For each={props.favorites}>
- {(favorite) => (
- <li
- class={cn(
- 'w-full transition-[opacity,transform] duration-200 ease-out',
- expanded()
- ? 'opacity-100 translate-y-0'
- : 'opacity-0 -translate-y-2'
- )}
- >
- <FavoriteRow
- favorite={favorite}
- disabled={!expanded()}
- onContextMenuOpenChange={props.onContextMenuOpenChange}
- notifications={notificationsForFavorite(favorite)}
- />
- </li>
- )}
- </For>
- </SortableProvider>
- </ul>
- </div>
- </section>
- );
-};
-
-const FavoriteRow = (props: {
- favorite: Favorite;
- disabled: boolean;
- onContextMenuOpenChange?: (open: boolean) => void;
- notifications: Accessor<UnifiedNotification[]>;
-}) => {
- const layout = useSplitLayout();
- const notificationSource = useGlobalNotificationSource();
- const muteAction = makeMuteAction({
- notificationSource: () => notificationSource,
- });
- // Favorites already store the canonical notification type (`email_thread`),
- // which the mute mapping accepts as-is.
- const favoriteAsEntity = () =>
- ({
- type: props.favorite.entityType,
- id: props.favorite.entityId,
- }) as EntityData;
- const [dndState] = useDragDropContext() ?? [];
-
- const displayName = useFavoriteDisplayName(props.favorite);
- const dmRecipientId = useFavoriteDmRecipientId(props.favorite);
-
- // `For` keys rows by favorite identity, so the favorite (and drag data
- // derived from it) is stable for the row's lifetime.
- //
- // `isDropTargetDisabled` is read by the app's `pointerWithin` collision
- // detector (see ItemDragAndDrop). A collapsed group still renders its rows
- // (clipped to 0 height for the expand/collapse animation), so without this
- // their stale layout rects would capture drops. Gating on `disabled` keeps
- // collapsed rows out of collision detection entirely.
- //
- // `name` and `dmRecipientId` are getters so the drag overlay chip reads
- // the row's live values (names resolve asynchronously through the preview
- // cache, DM recipients through the channels list).
- const sortable = createSortable(
- favoriteEntityKey(props.favorite.entityType, props.favorite.entityId),
- {
- dragType: 'favorite',
- iconType: favoriteIconType(props.favorite),
- get name() {
- return displayName();
- },
- get dmRecipientId() {
- return dmRecipientId();
- },
- isDropTargetDisabled: () => props.disabled,
- } satisfies FavoriteDragData
- );
-
- const content = () => favoriteSplitContent(props.favorite);
-
- const isActive = () => {
- const active = globalSplitManager()?.activeSplit()?.content();
- return (
- !!active &&
- active.type !== 'component' &&
- active.id === props.favorite.entityId
- );
- };
-
- const openFavorite = (preferNewSplit: boolean) => {
- const result = layout.openWithSplit(content(), {
- referredFrom: 'sidebar',
- activate: true,
- preferNewSplit,
- allowDuplicate: props.favorite.entityType === 'foreign_entity',
- });
- if (result.status === 'reused' && result.owner !== result.sourceOwner) {
- toast.alert('Content already open');
- }
- const split = result.split;
- globalSplitManager()?.returnFocus();
- return split;
- };
-
- const open = (e: MouseEvent) => openFavorite(e.shiftKey);
- const markAllAsRead = () => {
- void notificationSource.bulkMarkAsRead(props.notifications());
- };
- const markAllAsDone = () => {
- void notificationSource.bulkMarkAsDone(props.notifications());
- };
-
- const isUnreadChannelFavorite = () =>
- props.favorite.entityType === 'channel' && props.notifications().length > 0;
- const [contextMenuOpen, setContextMenuOpen] = createSignal(false);
- const [hoverPreviewOpen, setHoverPreviewOpen] = createSignal(false);
-
- createEffect(() => {
- props.onContextMenuOpenChange?.(contextMenuOpen() || hoverPreviewOpen());
- });
-
- const row = (
- <NavRow
- draggable={false}
- disabled={props.disabled}
- data-sidebar-favorite={favoriteEntityKey(
- props.favorite.entityType,
- props.favorite.entityId
- )}
- data-active={isActive() ? '' : undefined}
- active={isActive()}
- class="h-7"
- fullWidth
- onClick={open}
- >
- <div class="size-5 shrink-0 flex items-center justify-center">
- <FavoriteIcon
- favorite={props.favorite}
- class={dmRecipientId() ? 'size-[18px]' : 'size-3.5'}
- />
- </div>
- <span class="min-w-0 truncate">{displayName()}</span>
- <ChannelMutedIndicator
- muted={muteAction.isMuted(favoriteAsEntity())}
- class="size-3.5"
- />
- <Show when={props.notifications().length > 0}>
- <span class="ml-auto shrink-0 min-w-5 h-5 px-1.5 flex items-center justify-center text-xs font-medium bg-ink/6 text-ink-muted rounded-md">
- {props.notifications().length}
- </span>
- </Show>
- </NavRow>
- );
-
- return (
- <div
- ref={sortable}
- class={cn(
- 'w-full',
- // Smoothly shift rows out of the way while a drag is live; snap
- // (no transition) when it ends so the settled order doesn't animate
- // twice.
- !!dndState?.active.draggable && 'transition-transform',
- sortable.isActiveDraggable && 'opacity-40'
- )}
- >
- <FavoriteContextMenu
- favorite={props.favorite}
- triggerClass="h-7"
- onOpenChange={setContextMenuOpen}
- additionalActions={
- <>
- <Show when={props.notifications().length > 0}>
- <MenuSeparator />
- <MenuGroup>
- <MenuItem text="Mark all as read" onClick={markAllAsRead} />
- <MenuItem text="Mark all as done" onClick={markAllAsDone} />
- </MenuGroup>
- </Show>
- <Show when={muteAction.canExecute(favoriteAsEntity())}>
- <MenuSeparator />
- <MenuGroup>
- <MenuItem
- text={
- muteAction.isMuted(favoriteAsEntity())
- ? 'Unmute notifications'
- : 'Mute notifications'
- }
- onClick={() => void muteAction.execute([favoriteAsEntity()])}
- />
- </MenuGroup>
- </Show>
- </>
- }
- >
- <Show when={isUnreadChannelFavorite()} fallback={row}>
- <FavoriteChannelHoverCard
- channelId={props.favorite.entityId}
- notifications={props.notifications()}
- disabled={contextMenuOpen()}
- onOpenChange={setHoverPreviewOpen}
- >
- {row}
- </FavoriteChannelHoverCard>
- </Show>
- </FavoriteContextMenu>
- </div>
- );
-};
diff --git a/apps/web/src/features/getting-started/sidebar-visibility.test.ts b/apps/web/src/features/getting-started/sidebar-visibility.test.ts
deleted file mode 100644
index 342241ee9f..0000000000
--- a/apps/web/src/features/getting-started/sidebar-visibility.test.ts
+++ /dev/null
@@ -1,74 +0,0 @@
-import { createRoot } from 'solid-js';
-import { afterEach, describe, expect, it, vi } from 'vitest';
-import {
- createGettingStartedSidebarVisibility,
- type GettingStartedSidebarStore,
- localStorageGettingStartedSidebarStore,
-} from './sidebar-visibility';
-
-vi.mock('@core/context/user', () => ({
- useUserId: () => () => 'user-1',
-}));
-
-describe('localStorageGettingStartedSidebarStore', () => {
- afterEach(() => {
- localStorage.clear();
- });
-
- it('loads null when the user never removed the link', async () => {
- await expect(
- localStorageGettingStartedSidebarStore.load('user-1')
- ).resolves.toBeNull();
- });
-
- it('round-trips the hidden flag', async () => {
- await localStorageGettingStartedSidebarStore.save('user-1', true);
- await expect(
- localStorageGettingStartedSidebarStore.load('user-1')
- ).resolves.toBe(true);
- await localStorageGettingStartedSidebarStore.save('user-1', false);
- await expect(
- localStorageGettingStartedSidebarStore.load('user-1')
- ).resolves.toBe(false);
- });
-});
-
-describe('createGettingStartedSidebarVisibility', () => {
- const withVisibility = (store: GettingStartedSidebarStore) =>
- createRoot((dispose) => ({
- visibility: createGettingStartedSidebarVisibility(store),
- dispose,
- }));
-
- it('starts visible and flips once a stored hidden flag loads', async () => {
- const { visibility, dispose } = withVisibility({
- load: () => Promise.resolve(true),
- save: () => Promise.resolve(),
- });
- expect(visibility.hidden()).toBe(false);
- await vi.waitFor(() => expect(visibility.hidden()).toBe(true));
- dispose();
- });
-
- it('stays visible when nothing is stored', async () => {
- const { visibility, dispose } = withVisibility({
- load: () => Promise.resolve(null),
- save: () => Promise.resolve(),
- });
- await new Promise((resolve) => setTimeout(resolve));
- expect(visibility.hidden()).toBe(false);
- dispose();
- });
-
- it('hide applies optimistically before the load resolves and persists', () => {
- const save = vi.fn(() => Promise.resolve());
- const { visibility, dispose } = withVisibility({
- load: () => new Promise<never>(() => {}),
- save,
- });
- visibility.hide();
- expect(visibility.hidden()).toBe(true);
- expect(save).toHaveBeenCalledWith('user-1', true);
- dispose();
- });
-});
diff --git a/apps/web/src/features/getting-started/sidebar-visibility.ts b/apps/web/src/features/getting-started/sidebar-visibility.ts
deleted file mode 100644
index 3e178fc381..0000000000
--- a/apps/web/src/features/getting-started/sidebar-visibility.ts
+++ /dev/null
@@ -1,64 +0,0 @@
-import { useUserId } from '@core/context/user';
-import { createUserScopedStorage } from '@core/util/userScopedStorage';
-import { createResource, createSignal } from 'solid-js';
-
-/**
- * Persistence seam for the "Getting started" sidebar link's removed flag.
- * Async so a backend-backed implementation can slot in without touching
- * consumers (mirrors `GettingStartedStore`); the default is user-scoped
- * localStorage.
- */
-export interface GettingStartedSidebarStore {
- /** The stored flag, or `null` when the user never removed the link. */
- load(userId: string): Promise<boolean | null>;
- save(userId: string, hidden: boolean): Promise<void>;
-}
-
-const storage = createUserScopedStorage('macro:getting-started-sidebar-hidden');
-
-export const localStorageGettingStartedSidebarStore: GettingStartedSidebarStore =
- {
- load(userId) {
- const raw = storage.read(userId);
- return Promise.resolve(raw === null ? null : raw === 'true');
- },
- save(userId, hidden) {
- storage.write(userId, String(hidden));
- return Promise.resolve();
- },
- };
-
-/**
- * User-scoped, reactive visibility of the "Getting started" sidebar link.
- * Starts visible and flips once the persisted flag loads; `hide` applies
- * optimistically and persists behind the store seam.
- */
-export function createGettingStartedSidebarVisibility(
- store: GettingStartedSidebarStore = localStorageGettingStartedSidebarStore
-) {
- const userId = useUserId();
- const [storedHidden] = createResource(userId, async (id) => ({
- userId: id,
- hidden: (await store.load(id)) ?? false,
- }));
- const [optimisticallyHiddenUserId, setOptimisticallyHiddenUserId] =
- createSignal<string>();
-
- const hidden = () => {
- const id = userId();
- if (!id) return false;
- if (optimisticallyHiddenUserId() === id) return true;
-
- const stored = storedHidden.latest;
- return stored?.userId === id && stored.hidden;
- };
-
- const hide = () => {
- const id = userId();
- if (!id || hidden()) return;
- setOptimisticallyHiddenUserId(id);
- void store.save(id, true);
- };
-
- return { hidden, hide };
-}
diff --git a/apps/web/src/features/home/home-view.tsx b/apps/web/src/features/home/home-view.tsx
index fe58a01763..e2fef6894c 100644
--- a/apps/web/src/features/home/home-view.tsx
+++ b/apps/web/src/features/home/home-view.tsx
@@ -92,7 +92,7 @@ function HomeViewRoot() {
else closePreview();
};
- // The touch nav item and legacy touch view both call this "Notifications".
+ // The touch nav item calls this "Notifications".
onMount(() =>
panel.handle.setDisplayName(isTouchDevice() ? 'Notifications' : 'Home')
);
diff --git a/apps/web/src/features/home/route.tsx b/apps/web/src/features/home/route.tsx
index a7549ff269..0159501345 100644
--- a/apps/web/src/features/home/route.tsx
+++ b/apps/web/src/features/home/route.tsx
@@ -20,15 +20,13 @@ import { URL_PARAMS as CHANNEL_URL_PARAMS } from '@block-channel/constants';
import { URL_PARAMS as MARKDOWN_URL_PARAMS } from '@block-md/constants';
import { URL_PARAMS as PDF_URL_PARAMS } from '@block-pdf/constants';
import {
- NewAppView,
+ AppView,
RedirectSplit,
withAuth,
} from '@components/app/split-layout/split-router/app-route-shell';
import { uuidRouteReference } from '@components/app/split-layout/split-router/mention-links';
-import { isTouchDevice } from '@core/mobile/isTouchDevice';
-import { lazy, Show } from 'solid-js';
+import { Show } from 'solid-js';
import { URL_PARAMS as EMAIL_URL_PARAMS } from '../email-thread/core/location';
-import { getViewPreset } from '../next-soup/sidebar/soup-filter-presets';
import { HomeEntityDetailRouteView } from './components/HomeEntityDetailRouteView';
import {
homeCalendarLegacyTarget,
@@ -47,10 +45,6 @@ import {
HomeView,
} from './home-view';
-const SoupView = lazy(async () => ({
- default: (await import('../next-soup/soup-view/soup-view')).SoupView,
-}));
-
type HomeDetailParams = Partial<HomePreviewRouteParams> & {
channelId?: string;
documentType?: string;
@@ -58,19 +52,6 @@ type HomeDetailParams = Partial<HomePreviewRouteParams> & {
period?: CalendarPeriodView;
};
-function LegacyHomeView() {
- const preset = getViewPreset('home');
- return (
- <SoupView
- viewName={isTouchDevice() ? 'Notifications' : 'Home'}
- initialFilters={preset?.filters}
- initialClientFilters={preset?.clientFilters}
- initialGroupBy={preset?.groupBy}
- disableLocalSearch
- />
- );
-}
-
function HomeLegacyRouteView() {
const params = useParams<HomeDetailParams>();
const [channelSearch] = createSearchParams(channelsSearch);
@@ -88,7 +69,7 @@ function HomeLegacyRouteView() {
};
return (
- <Show when={legacyTarget()} fallback={<LegacyHomeView />}>
+ <Show when={legacyTarget()}>
{(target) => <RedirectSplit to={target()} />}
</Show>
);
@@ -101,16 +82,14 @@ export const HomeRouteView = withAuth(() => {
typeof params.period === 'string';
return (
- <NewAppView
+ <AppView
id="home"
- composableOnTouch
detailDesktopOnly
detailRequested={detailRequested}
detailFallback={<HomeLegacyRouteView />}
- fallback={<LegacyHomeView />}
>
<HomeView />
- </NewAppView>
+ </AppView>
);
});
diff --git a/apps/web/src/features/next-soup/soup-view/documents-filter-controllers.ts b/apps/web/src/features/next-soup/soup-view/documents-filter-controllers.ts
deleted file mode 100644
index d8290f6ed6..0000000000
--- a/apps/web/src/features/next-soup/soup-view/documents-filter-controllers.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import type { SplitId } from '@components/app/split-layout/layoutManager';
-
-type DocumentsFilterController = {
- toggleMarkdownFilter: () => void;
-};
-
-const registry = new Map<SplitId, DocumentsFilterController>();
-
-export function registerDocumentsFilterSplit(
- splitId: SplitId,
- controller: DocumentsFilterController
-): () => void {
- registry.set(splitId, controller);
- return () => {
- if (registry.get(splitId) === controller) registry.delete(splitId);
- };
-}
-
-export function getDocumentsFilterSplit(
- splitId: SplitId
-): DocumentsFilterController | undefined {
- return registry.get(splitId);
-}
diff --git a/apps/web/src/features/next-soup/soup-view/inbox-filter-controllers.ts b/apps/web/src/features/next-soup/soup-view/inbox-filter-controllers.ts
index e722120473..19db60193a 100644
--- a/apps/web/src/features/next-soup/soup-view/inbox-filter-controllers.ts
+++ b/apps/web/src/features/next-soup/soup-view/inbox-filter-controllers.ts
@@ -1,64 +1,2 @@
-import type { SplitId } from '@components/app/split-layout/layoutManager';
-import { type Accessor, createSignal } from 'solid-js';
-
-type InboxFilterController = {
- /** `undefined` = all inboxes; otherwise the selected email link ids. */
- inboxFilter: Accessor<string[] | undefined>;
- setInboxFilter: (ids: string[] | undefined) => void;
-};
-
-/**
- * Entry-state key the mail view persists its inbox filter under. Exposed so
- * out-of-tree consumers (the sidebar) can read the filter a mail history
- * entry captured on nav-away — e.g. while an email block is open on top.
- */
+/** Entry-state key the mail view persists its inbox filter under. */
export const INBOX_FILTER_ENTRY_KEY = 'soup.inboxFilter';
-
-// Signal-of-Map (with equals: false) so consumers outside the split tree —
-// the sidebar's nested account rows — re-render on register/unregister.
-const [controllers, setControllers] = createSignal(
- new Map<SplitId, InboxFilterController>(),
- { equals: false }
-);
-const pendingFilterBySplit = new Map<SplitId, string[] | undefined>();
-
-export function registerInboxFilterSplit(
- splitId: SplitId,
- controller: InboxFilterController
-): () => void {
- setControllers((map) => map.set(splitId, controller));
- if (pendingFilterBySplit.has(splitId)) {
- controller.setInboxFilter(pendingFilterBySplit.get(splitId));
- pendingFilterBySplit.delete(splitId);
- }
- return () => {
- setControllers((map) => {
- if (map.get(splitId) === controller) map.delete(splitId);
- return map;
- });
- };
-}
-
-/** Reactive: tracks registration changes and re-evaluates for callers. */
-export function getInboxFilterSplit(
- splitId: SplitId
-): InboxFilterController | undefined {
- return controllers().get(splitId);
-}
-
-/**
- * Set the inbox filter for the given split. If the split's mail view is
- * already mounted, apply immediately; otherwise queue the value and apply it
- * once the view registers (e.g. right after a sidebar navigation).
- */
-export function requestInboxFilter(
- splitId: SplitId,
- ids: string[] | undefined
-) {
- const controller = controllers().get(splitId);
- if (controller) {
- controller.setInboxFilter(ids);
- return;
- }
- pendingFilterBySplit.set(splitId, ids);
-}
diff --git a/apps/web/src/features/next-soup/soup-view/soup-view-context.tsx b/apps/web/src/features/next-soup/soup-view/soup-view-context.tsx
index 3a77446db1..1dcb344581 100644
--- a/apps/web/src/features/next-soup/soup-view/soup-view-context.tsx
+++ b/apps/web/src/features/next-soup/soup-view/soup-view-context.tsx
@@ -37,10 +37,7 @@ import {
type TagFilter,
} from '@app/features/next-soup/soup-view/filters-bar/tag-filter-state';
import { dateBucket } from '@app/features/next-soup/soup-view/group-by-date';
-import {
- INBOX_FILTER_ENTRY_KEY,
- registerInboxFilterSplit,
-} from '@app/features/next-soup/soup-view/inbox-filter-controllers';
+import { INBOX_FILTER_ENTRY_KEY } from '@app/features/next-soup/soup-view/inbox-filter-controllers';
import { SORT_CONFIGS } from '@app/features/next-soup/soup-view/sort-options';
import { useSoupFilterPersistence } from '@app/features/next-soup/use-soup-filter-persistence';
import { deduplicateEntities } from '@app/features/next-soup/utils';
@@ -527,23 +524,6 @@ export const SoupViewContextProvider: FlowComponent<
name: soupViewPersistenceKey('soup-view-inbox-filter'),
}
);
-
- // Expose the mail view's inbox filter to consumers outside the split tree
- // (the sidebar's nested account rows read and set it by split id). The
- // provider outlives content swaps within a split, so track the live content
- // reactively and (un)register as the mail list becomes / stops being the
- // shown view — registering also flushes any filter the sidebar queued while
- // navigating here, so a sidebar inbox selection takes on the first click.
- createEffect(() => {
- const content = panel.handle.content();
- if (content.type === 'component' && content.id === 'mail') {
- const dispose = registerInboxFilterSplit(panel.handle.id, {
- inboxFilter,
- setInboxFilter,
- });
- onCleanup(dispose);
- }
- });
const [activeTab, setActiveTab] = useEntryState<string | undefined>(
'soup.tab',
{ default: initialTab }
diff --git a/apps/web/src/features/next-soup/soup-view/soup-view.tsx b/apps/web/src/features/next-soup/soup-view/soup-view.tsx
index 171ecfd251..93a3516925 100644
--- a/apps/web/src/features/next-soup/soup-view/soup-view.tsx
+++ b/apps/web/src/features/next-soup/soup-view/soup-view.tsx
@@ -10,13 +10,11 @@ import type {
GroupHeaderProps,
SoupRow,
} from '@app/features/next-soup/create-soup-state';
-import { buildDocumentTypeQuery } from '@app/features/next-soup/filters/configs/document-type-query';
import type { Query } from '@app/features/next-soup/filters/filter-store';
import type { SetPredicatesInput } from '@app/features/next-soup/filters/filter-store/predicates-store';
import { VIEW_TAB_PRESETS } from '@app/features/next-soup/sidebar/soup-filter-presets';
import { useSoup } from '@app/features/next-soup/soup-context';
import { DateGroupHeader } from '@app/features/next-soup/soup-view/date-group-header';
-import { registerDocumentsFilterSplit } from '@app/features/next-soup/soup-view/documents-filter-controllers';
import {
EmptyState,
shouldShowLoadError,
@@ -122,7 +120,6 @@ import {
Match,
on,
onCleanup,
- onMount,
Show,
Suspense,
Switch,
@@ -417,34 +414,6 @@ export const SoupView = (props: SoupViewProps) => {
});
});
- onMount(() => {
- if (contentId !== 'documents') return;
-
- const markdownQuery = buildDocumentTypeQuery(['doc-markdown']);
- if (!markdownQuery) return;
-
- const dispose = registerDocumentsFilterSplit(panel.handle.id, {
- toggleMarkdownFilter: () => {
- if (soup.predicates.isActive('doc-markdown')) {
- soupView.queryFilters.remove(markdownQuery);
- soup.predicates.set(({ andIds, orIds }) => ({
- and: andIds,
- or: orIds.filter((id) => id !== 'doc-markdown'),
- }));
- return;
- }
-
- soupView.queryFilters.add(markdownQuery);
- soup.predicates.set(({ andIds, orIds }) => ({
- and: andIds,
- or: [...new Set([...orIds, 'doc-markdown'])],
- }));
- },
- });
-
- onCleanup(dispose);
- });
-
createEffect(() => {
panel.handle.setDisplayName(props.viewName);
});
diff --git a/apps/web/src/features/tasks-view/route.test.tsx b/apps/web/src/features/tasks-view/route.test.tsx
index eba63c7522..dbbdd335d0 100644
--- a/apps/web/src/features/tasks-view/route.test.tsx
+++ b/apps/web/src/features/tasks-view/route.test.tsx
@@ -23,14 +23,10 @@ vi.mock('@app/lib/analytics/posthog', () => ({
vi.mock('@components/app/side-panel', () => ({ SidePanel: {} }));
vi.mock('@components/app/split-layout/split-router/app-route-shell', () => ({
withAuth: (value: unknown) => value,
- NewAppView: () => null,
+ AppView: () => null,
RedirectSplit: () => null,
}));
vi.mock('@core/component/LoadingBlock', () => ({ LoadingBlock: () => null }));
-vi.mock('@core/context/user', () => ({ useUserContext: () => ({}) }));
-vi.mock('../next-soup/sidebar/soup-filter-presets', () => ({
- getViewPreset: () => undefined,
-}));
vi.mock('./components/TasksDetailView', () => ({
TasksDetailView: () => null,
TasksDetailRouteView: () => null,
diff --git a/apps/web/src/features/tasks-view/route.tsx b/apps/web/src/features/tasks-view/route.tsx
index b163ba63d7..205bb3d871 100644
--- a/apps/web/src/features/tasks-view/route.tsx
+++ b/apps/web/src/features/tasks-view/route.tsx
@@ -16,48 +16,26 @@ import {
import { URL_PARAMS as MARKDOWN_URL_PARAMS } from '@block-md/constants';
import { SidePanel } from '@components/app/side-panel';
import {
- NewAppView,
+ AppView,
RedirectSplit,
withAuth,
} from '@components/app/split-layout/split-router/app-route-shell';
import { uuidRouteReference } from '@components/app/split-layout/split-router/mention-links';
import { LoadingBlock } from '@core/component/LoadingBlock';
import { enableProjects } from '@core/constant/featureFlags';
-import { useUserContext } from '@core/context/user';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
-import { lazy, onMount, Show } from 'solid-js';
+import { onMount, Show } from 'solid-js';
import { z } from 'zod';
-import { getViewPreset } from '../next-soup/sidebar/soup-filter-presets';
import {
TasksDetailRouteView,
TasksDetailView,
} from './components/TasksDetailView';
import { TasksView } from './tasks-view';
-const SoupView = lazy(async () => ({
- default: (await import('../next-soup/soup-view/soup-view')).SoupView,
-}));
-
-function LegacyTasksView() {
- const user = useUserContext();
- const preset = getViewPreset('tasks', undefined, {
- userId: user.userId(),
- isTeamAdmin: false,
- });
- return (
- <SoupView
- viewName="Tasks"
- initialFilters={preset?.filters}
- initialClientFilters={preset?.clientFilters}
- initialGroupBy={preset?.groupBy}
- />
- );
-}
-
function TasksLegacyRouteView() {
const params = useParams<{ taskId?: string; projectId?: string }>();
return (
- <Show when={params.taskId} fallback={<LegacyTasksView />}>
+ <Show when={params.taskId}>
{(taskId) => <RedirectSplit to={{ type: 'task', id: taskId() }} />}
</Show>
);
@@ -66,18 +44,16 @@ function TasksLegacyRouteView() {
export const TasksRouteView = withAuth(() => {
const params = useParams<{ taskId?: string; projectId?: string }>();
return (
- <NewAppView
+ <AppView
id="tasks"
- composableOnTouch
detailDesktopOnly
detailRequested={() =>
typeof params.taskId === 'string' && !params.projectId
}
detailFallback={<TasksLegacyRouteView />}
- fallback={<LegacyTasksView />}
>
<TasksView />
- </NewAppView>
+ </AppView>
);
});
diff --git a/apps/web/src/lib/core/component/StackedAvatarsRow.tsx b/apps/web/src/lib/core/component/StackedAvatarsRow.tsx
deleted file mode 100644
index 7f99f9d379..0000000000
--- a/apps/web/src/lib/core/component/StackedAvatarsRow.tsx
+++ /dev/null
@@ -1,395 +0,0 @@
-import User from '@phosphor-icons/core/regular/user.svg?component-solid';
-import { cn, Tooltip } from '@ui';
-import {
- type Accessor,
- createEffect,
- createMemo,
- createSignal,
- For,
- type JSX,
- onCleanup,
- Show,
-} from 'solid-js';
-import { HoverCard } from './HoverCard';
-import type { UserIconProps } from './UserIcon';
-
-/** Same keys as {@link UserIconProps} `size` (aligned ring + overlap + overflow chip). */
-export type StackedAvatarsSize = NonNullable<UserIconProps['size']>;
-
-/** `distribute="fill"`: face + chip footprint in px (matches Tailwind `size-*` at default rem). */
-const AVATAR_DIAMETER_PX: Record<StackedAvatarsSize, number> = {
- sm: 16,
- md: 24,
- lg: 40,
- fill: 24,
-};
-
-/** Horizontal row shell: stacking context (`isolate`). */
-const STACKED_AVATARS_ROW_CLASS =
- 'flex items-center h-full shrink-0 w-fit isolate leading-none min-w-0';
-
-type StackedAvatarsOverflowContext<T = unknown> = {
- overflowItems: T[];
- overflowCount: number;
-};
-
-/**
- * Ring, overlap, and +N chip track {@link UserIcon} `sizeClasses().container` widths.
- * `fill` uses the md footprint (intrinsic fill still needs a sized parent for `UserIcon`).
- */
-const STACK_STYLE: Record<
- StackedAvatarsSize,
- {
- overlap: string;
- overflowChip: string;
- overflowChipText: string;
- inner: string;
- /** Muted empty-slot user icon (same scale as in-call avatar placeholder shells). */
- defaultEmptyIcon: string;
- }
-> = {
- sm: {
- overlap: '-mr-1.5',
- overflowChip:
- 'size-4 shrink-0 rounded-full border-2 border-surface bg-surface flex flex-col items-center justify-center',
- overflowChipText:
- 'text-[8px] font-semibold tabular-nums leading-none text-ink',
- inner:
- 'bg-surface size-4 rounded-full p-[1px] border-2 border-surface box-border',
- defaultEmptyIcon: 'w-2 h-2',
- },
- md: {
- overlap: '-mr-2',
- overflowChip:
- 'size-6 shrink-0 rounded-full border-2 border-surface bg-surface flex flex-col items-center justify-center',
- overflowChipText:
- 'text-[10px] font-semibold tabular-nums leading-none text-ink',
- inner:
- 'bg-surface size-6 rounded-full p-[2px] border-2 border-surface box-border',
- defaultEmptyIcon: 'w-3 h-3',
- },
- lg: {
- overlap: '-mr-4',
- overflowChip:
- 'size-10 shrink-0 rounded-full border-2 border-surface bg-surface flex flex-col items-center justify-center',
- overflowChipText:
- 'text-sm font-semibold tabular-nums leading-none text-ink',
- inner:
- 'bg-surface size-10 rounded-full p-[2px] border-2 border-surface box-border',
- defaultEmptyIcon: 'w-5 h-5',
- },
- fill: {
- overlap: '-mr-2',
- overflowChip:
- 'size-6 shrink-0 rounded-full border-2 border-surface bg-surface flex flex-col items-center justify-center',
- overflowChipText:
- 'text-[10px] font-semibold tabular-nums leading-none text-ink',
- inner:
- 'bg-surface size-6 rounded-full p-[2px] border-2 border-surface box-border',
- defaultEmptyIcon: 'w-3 h-3',
- },
-};
-
-/** Inner ring around `UserIcon` (no overlap margin — the row applies overlap on a wrapper). */
-export function stackedAvatarInnerClass(size: StackedAvatarsSize = 'sm') {
- return STACK_STYLE[size].inner;
-}
-
-/** Default +N chip shell (no text); pair with {@link stackedAvatarOverflowChipTextClass}. */
-function stackedAvatarOverflowChipClass(size: StackedAvatarsSize = 'sm') {
- return STACK_STYLE[size].overflowChip;
-}
-
-function stackedAvatarOverflowChipTextClass(size: StackedAvatarsSize = 'sm') {
- return STACK_STYLE[size].overflowChipText;
-}
-
-/**
- * Muted user-in-ring placeholder: same outer ring as stacked faces
- * ({@link stackedAvatarInnerClass}); icon scales with `size`.
- */
-export function StackedAvatarsDefaultEmptyPlaceholder(props: {
- size?: StackedAvatarsSize;
-}) {
- const s = () => props.size ?? 'md';
- return (
- <div class={stackedAvatarInnerClass(s())}>
- <div class="flex size-full min-h-0 min-w-0 items-center justify-center overflow-hidden rounded-full bg-ink-extra-muted text-surface leading-none">
- <User
- class={cn(STACK_STYLE[s()].defaultEmptyIcon, 'block shrink-0')}
- aria-hidden
- />
- </div>
- </div>
- );
-}
-
-export type StackedAvatarInput = {
- userId: string;
- tooltip?: string;
- onPress?: () => void;
- ariaLabel?: string;
-};
-
-function OverflowTooltip(props: {
- chip: JSX.Element;
- render: (close: () => void) => JSX.Element;
-}) {
- const [open, setOpen] = createSignal(false);
- return (
- <HoverCard
- open={open()}
- onOpenChange={setOpen}
- triggerAs="div"
- trigger={props.chip}
- content={props.render(() => setOpen(false))}
- />
- );
-}
-
-type StackedAvatarsRowProps<T = unknown> = {
- each: Accessor<T[]>;
- max: number | Accessor<number>;
- size?: StackedAvatarsSize;
- /** Shown when `each()` is empty (e.g. connecting); if truthy, overrides `defaultEmptyUserPlaceholder`. */
- placeholder?: Accessor<JSX.Element | undefined | null | false>;
- /** When the list is empty and `placeholder` is unset or falsy, show the built-in muted user ring at `size`. */
- defaultEmptyUserPlaceholder?: boolean;
- /** Face slot; use `UserIcon` with `showTooltip={false}` if you add your own `Tooltip`. */
- children: (item: T, index: number) => JSX.Element;
- /** Plain tooltip on the +N chip when not using `overflowTooltipContent`. */
- overflowTooltip?:
- | string
- | ((ctx: StackedAvatarsOverflowContext<T>) => string | undefined);
- overflowTooltipContent?: (
- close: () => void,
- ctx: StackedAvatarsOverflowContext<T>
- ) => JSX.Element;
- overflowWrap?: (
- ctx: StackedAvatarsOverflowContext<T> & { chip: JSX.Element }
- ) => JSX.Element;
- renderOverflow?: (ctx: StackedAvatarsOverflowContext<T>) => JSX.Element;
- overflowChipClass?: string;
- overflowChipLabelClass?: string;
- class?: string;
- /**
- * `fill`: when `each().length >= max`, ResizeObserver + per-gap `margin-right` so the strip
- * spans the row (below that count, behaves like `pack`). `pack`: fixed overlap from `size`.
- */
- distribute?: 'pack' | 'fill';
-};
-
-function maxValue(max: number | Accessor<number>) {
- return typeof max === 'function' ? max() : max;
-}
-
-function defaultOverflowChip(
- size: StackedAvatarsSize,
- overflowCount: number,
- chipClass?: string,
- labelClass?: string
-): JSX.Element {
- return (
- <div
- class={cn(stackedAvatarOverflowChipClass(size), chipClass)}
- data-ui="stacked-avatars-overflow-chip"
- >
- <span
- class={cn(stackedAvatarOverflowChipTextClass(size), labelClass)}
- >{`+${overflowCount}`}</span>
- </div>
- );
-}
-
-export function StackedAvatarsRow<T = unknown>(
- props: StackedAvatarsRowProps<T>
-) {
- const size = () => props.size ?? 'sm';
-
- const distributeFill = () => props.distribute === 'fill';
-
- const [rowEl, setRowEl] = createSignal<HTMLDivElement | null>(null);
- const [rowWidth, setRowWidth] = createSignal(0);
-
- const all = createMemo(() => props.each());
-
- const maxed = () => {
- const m = maxValue(props.max);
- if (!Number.isFinite(m) || m < 0) return 0;
- return m;
- };
-
- /** `distribute="fill"` only affects layout at or above the `max` slot cap. */
- const useFillWidthLayout = createMemo(
- () => distributeFill() && all().length >= maxed()
- );
-
- createEffect(() => {
- const el = rowEl();
- if (!useFillWidthLayout() || !el) return;
- const ro = new ResizeObserver(() => {
- setRowWidth(el.clientWidth);
- });
- ro.observe(el);
- setRowWidth(el.clientWidth);
- onCleanup(() => ro.disconnect());
- });
-
- const visible = createMemo(() => all().slice(0, maxed()));
-
- const overflow = createMemo(() => all().slice(maxed()));
-
- const overflowCount = createMemo(() => overflow().length);
-
- const overflowCtx = createMemo(
- (): StackedAvatarsOverflowContext<T> => ({
- overflowItems: overflow(),
- overflowCount: overflowCount(),
- })
- );
-
- const plainOverflowTooltip = createMemo(() => {
- const ctx = overflowCtx();
- const ot = props.overflowTooltip;
- if (typeof ot === 'string') return ot;
- if (typeof ot === 'function') return ot(ctx) ?? '';
- return `${ctx.overflowCount} more`;
- });
-
- const overlap = () => STACK_STYLE[size()].overlap;
-
- /**
- * Per-gap `margin-right` between consecutive stack slots so the row fills `rowWidth`
- * (negative = overlap, positive = gap).
- */
- const fillStepMarginPx = createMemo(() => {
- if (!useFillWidthLayout()) return null;
-
- const rowWidthPx = rowWidth();
- const visibleFaces = visible();
- const overflowFaceCount = overflowCount();
- const slotCount = visibleFaces.length + (overflowFaceCount > 0 ? 1 : 0);
- const faceDiameterPx = AVATAR_DIAMETER_PX[size()];
-
- if (slotCount < 2 || rowWidthPx < 1) return null;
-
- const gapCount = slotCount - 1;
- let marginRightPerGapPx =
- (rowWidthPx - slotCount * faceDiameterPx) / gapCount;
- const minMarginRightPx = -(faceDiameterPx - 6);
- const maxMarginRightPx = Math.max(24, Math.round(faceDiameterPx * 0.45));
- marginRightPerGapPx = Math.max(
- minMarginRightPx,
- Math.min(maxMarginRightPx, marginRightPerGapPx)
- );
-
- return marginRightPerGapPx;
- });
-
- const faceWrapperClass = (lastNoOverflowChip: boolean) =>
- cn(
- 'relative shrink-0',
- !(useFillWidthLayout() && fillStepMarginPx() !== null) && overlap(),
- !(useFillWidthLayout() && fillStepMarginPx() !== null) &&
- lastNoOverflowChip &&
- 'mr-0!'
- );
-
- const faceWrapperStyle = (
- index: number,
- lastNoOverflowChip: boolean
- ): JSX.CSSProperties | undefined => {
- const stackingStyle: JSX.CSSProperties = {
- 'z-index': String(10 + index),
- };
- if (!useFillWidthLayout()) return stackingStyle;
- const marginRightPerGapPx = fillStepMarginPx();
- if (marginRightPerGapPx === null) return stackingStyle;
- const lastVisibleIndex = visible().length - 1;
- let slotMarginRightPx = marginRightPerGapPx;
- if (lastNoOverflowChip) slotMarginRightPx = 0;
- else if (index === lastVisibleIndex && overflowCount() === 0) {
- slotMarginRightPx = 0;
- }
- return { ...stackingStyle, 'margin-right': `${slotMarginRightPx}px` };
- };
-
- const placeholderEl = createMemo(() => {
- if (all().length > 0) return undefined;
- const custom = props.placeholder?.();
- if (custom) return custom;
- if (props.defaultEmptyUserPlaceholder) {
- return <StackedAvatarsDefaultEmptyPlaceholder size={size()} />;
- }
- return undefined;
- });
-
- const overflowSlot = () => {
- if (overflowCount() === 0) return null;
-
- const ctx = overflowCtx();
- const overflowSlotZIndex = String(10 + visible().length);
- const faceShell = (inner: JSX.Element) => (
- <div class="relative shrink-0" style={{ 'z-index': overflowSlotZIndex }}>
- {inner}
- </div>
- );
-
- if (props.renderOverflow) {
- return faceShell(props.renderOverflow(ctx));
- }
-
- const chip = defaultOverflowChip(
- size(),
- ctx.overflowCount,
- props.overflowChipClass,
- props.overflowChipLabelClass
- );
-
- if (props.overflowWrap) {
- return faceShell(props.overflowWrap({ ...ctx, chip }));
- }
-
- if (props.overflowTooltipContent) {
- return faceShell(
- <OverflowTooltip
- chip={chip}
- render={(close) => props.overflowTooltipContent!(close, ctx)}
- />
- );
- }
-
- return faceShell(<Tooltip label={plainOverflowTooltip()}>{chip}</Tooltip>);
- };
-
- return (
- <div
- ref={setRowEl}
- class={cn(STACKED_AVATARS_ROW_CLASS, props.class)}
- data-ui="stacked-avatars-row"
- >
- <Show when={all().length === 0}>
- <Show when={placeholderEl()}>
- <div class="relative mr-0 shrink-0">{placeholderEl()}</div>
- </Show>
- </Show>
- <Show when={all().length > 0}>
- <For each={visible()}>
- {(item, index) => {
- const lastNoOverflowChip =
- index() === visible().length - 1 && overflowCount() === 0;
- return (
- <div
- class={faceWrapperClass(lastNoOverflowChip)}
- style={faceWrapperStyle(index(), lastNoOverflowChip)}
- >
- {props.children(item, index())}
- </div>
- );
- }}
- </For>
- <Show when={overflowCount() > 0}>{overflowSlot()}</Show>
- </Show>
- </div>
- );
-}
diff --git a/apps/web/src/lib/core/constant/featureFlags.ts b/apps/web/src/lib/core/constant/featureFlags.ts
index 2b975486d8..3c3bd6905b 100644
--- a/apps/web/src/lib/core/constant/featureFlags.ts
+++ b/apps/web/src/lib/core/constant/featureFlags.ts
@@ -105,18 +105,6 @@ export function isFeatureEnabled(flag: Flag): boolean {
return flag.enabled;
}
-/**
- * Switches Inbox, Tasks, and Channels from the current SoupView implementations
- * to the new composable view implementations. On everywhere without waiting
- * for PostHog: a late PostHog answer swaps the app shell after first paint.
- * Override locally with VITE_ENABLE_NEW_APP_VIEWS=false.
- */
-export const enableNewAppViews = defineFlag({
- key: 'enable-new-app-views',
- env: 'ENABLE_NEW_APP_VIEWS',
- default: true,
-});
-
/**
* This constant reflects whether the app is running in production mode with prod backend environment
*
@@ -537,12 +525,6 @@ export function isAutoUpdateUiEnabled(): boolean {
return !isFeatureEnabled(disableAutoUpdateUi);
}
-export const enableNewPricing = defineFlag({
- key: 'enable-new-pricing',
- env: 'ENABLE_NEW_PRICING',
- default: onInDev,
-});
-
// Bot management in Settings, channels, and the command menu. Override locally
// with VITE_BOT_MANAGEMENT.
export const botManagement = defineFlag({
diff --git a/apps/web/src/lib/core/constant/settingsTabsConfig.tsx b/apps/web/src/lib/core/constant/settingsTabsConfig.tsx
index 990e902139..2d19b1af6e 100644
--- a/apps/web/src/lib/core/constant/settingsTabsConfig.tsx
+++ b/apps/web/src/lib/core/constant/settingsTabsConfig.tsx
@@ -84,9 +84,6 @@ export const SETTINGS_TAB_GROUPS: SettingsTabGroup[] = [
},
];
-/** Flattened view of {@link SETTINGS_TAB_GROUPS} for direct tab lookups. */
-const SETTINGS_TAB_ITEMS = SETTINGS_TAB_GROUPS.flatMap((group) => group.items);
-
/**
* URL slugs for each settings tab, used to build the settings page path
* (`/settings/<slug>`, and the `settings/<slug>` pair when docked in a split).
@@ -138,18 +135,6 @@ export const settingsSlugToTab = (
): SettingsTab | undefined =>
slug ? SETTINGS_SLUG_TO_TAB.get(slug) : undefined;
-/**
- * Look up a single tab's presentation (label + icon). Lets consumers that
- * surface individual tabs (e.g. the sidebar's quick links) reuse the config's
- * label/icon instead of hardcoding their own.
- */
-export const getSettingsTabItem = (
- tab: SettingsTab
-): SettingsTabItem | undefined =>
- tab === 'Harness'
- ? { tab: 'Harness', label: 'Agents', icon: AgentIcon }
- : SETTINGS_TAB_ITEMS.find((item) => item.tab === tab);
-
/**
* Returns a predicate gating which settings tabs are available given feature
* flags and platform. This is the single gate that the settings panel and the
diff --git a/apps/web/src/lib/core/tests/featureFlags.test.ts b/apps/web/src/lib/core/tests/featureFlags.test.ts
index c19ae6d514..64fc2d4b33 100644
--- a/apps/web/src/lib/core/tests/featureFlags.test.ts
+++ b/apps/web/src/lib/core/tests/featureFlags.test.ts
@@ -1,47 +1,4 @@
-import { afterEach, describe, expect, it, vi } from 'vitest';
-
-const remoteFlag = vi.hoisted(() => vi.fn());
-vi.mock('@app/lib/analytics', () => ({
- analytics: { posthog: { isFeatureEnabled: remoteFlag } },
-}));
-
-afterEach(() => {
- vi.unstubAllEnvs();
- vi.resetModules();
- remoteFlag.mockReset();
-});
-
-describe('new app views rollout', () => {
- it('enables production without waiting for PostHog', async () => {
- vi.stubEnv('MODE', 'production');
- vi.stubEnv('VITE_ENABLE_NEW_APP_VIEWS', '');
- vi.resetModules();
- const { enableNewAppViews, isFeatureEnabled } = await import(
- '../constant/featureFlags'
- );
- remoteFlag.mockReturnValue(undefined);
- expect(isFeatureEnabled(enableNewAppViews)).toBe(true);
- expect(remoteFlag).not.toHaveBeenCalled();
- });
-
- it('lets the env override disable the flag', async () => {
- vi.stubEnv('MODE', 'production');
- vi.stubEnv('VITE_ENABLE_NEW_APP_VIEWS', 'false');
- vi.resetModules();
- const { enableNewAppViews, isFeatureEnabled } = await import(
- '../constant/featureFlags'
- );
- expect(isFeatureEnabled(enableNewAppViews)).toBe(false);
- });
-
- it('enables local development by default', async () => {
- vi.stubEnv('MODE', 'development');
- vi.stubEnv('VITE_ENABLE_NEW_APP_VIEWS', '');
- vi.resetModules();
- const { enableNewAppViews } = await import('../constant/featureFlags');
- expect(enableNewAppViews.override).toBe(true);
- });
-});
+import { describe, expect, it } from 'vitest';
import { resolveFeatureFlag } from '../constant/featureFlags';
diff --git a/apps/web/src/lib/queries/favorites/favorites.ts b/apps/web/src/lib/queries/favorites/favorites.ts
index 51c1c8d0eb..55b474aace 100644
--- a/apps/web/src/lib/queries/favorites/favorites.ts
+++ b/apps/web/src/lib/queries/favorites/favorites.ts
@@ -69,7 +69,7 @@ export function favoriteEntityType(
}
}
-export function favoriteEntityKey(
+function favoriteEntityKey(
entityType: FavoriteEntityType,
entityId: string
): string {
diff --git a/apps/web/tests/native/runner.ts b/apps/web/tests/native/runner.ts
index c88fc3b35c..19f82868f6 100644
--- a/apps/web/tests/native/runner.ts
+++ b/apps/web/tests/native/runner.ts
@@ -143,7 +143,6 @@ try {
LOCAL_JWT: 'fixture-only',
VITE_ENABLE_GRAPHQL_SOUP: 'true',
VITE_ENABLE_GRAPHQL_BACKFILL: 'true',
- VITE_ENABLE_NEW_APP_VIEWS: 'true',
VITE_ENABLE_SNIPPETS: 'true',
VITE_ENABLE_AUTO_UPDATE_UI: 'false',
}
diff --git a/docs/AGENT_GUIDE/navigation.md b/docs/AGENT_GUIDE/navigation.md
index 38b1ee84dc..b9fcb092ce 100644
--- a/docs/AGENT_GUIDE/navigation.md
+++ b/docs/AGENT_GUIDE/navigation.md
@@ -141,9 +141,9 @@ their child routes and history independently; returning to a list does not
activate another pane. Opening a resource already displayed in another pane
activates its owner through router claim arbitration, preserves the owner's route,
and applies compatible search targets to that pane. The compatibility preview
-guard can instead reject a conflicting embedded preview. On touch, or
-when the new-app-view flag cannot render the detail, Home, Email, Tasks, and
-Channels detail URLs fall back to the existing full-block surface. Legacy email
+guard can instead reject a conflicting embedded preview. On touch, Home, Email,
+Tasks, and Channels detail URLs fall back to the existing full-block surface.
+Legacy email
and channel message targets are normalized into per-pane search by ingress
middleware, including external/history navigation; explicit namespaced values win.
Unavailable documents retain their error/retry UI rather than navigating away.
@@ -221,23 +221,21 @@ stay centered and the preview body fills the remaining height below the divider.
## Sidebar (a11y names are load-bearing)
-- Top: buttons `Search` and `Create`. Clicking sidebar `Search` opens a menu
+The outer sidebar is an icon rail; labels appear in tooltips.
+
+- Top: buttons `Create` and `Search`. Clicking `Search` opens a menu
with `Command Menu` (⌘K on Mac / Ctrl+K elsewhere) and `Search everything`
(`/`). Choose the first to open commands, or the second to open and focus
global search. Hold Shift while selecting `Search everything` to open it in a
new split, including when Search is already active. This left-click menu shares
- its surface and item styling with the sidebar right-click menus, in both the
- compact rail and expanded sidebar.
-- Nav: `Go to Home`, `Go to Getting Started`, `Go to Recent`, `Go to Activity`.
-- Workspace: `Go to Email`, `Go to Channels`, `Go to Calls`, `Go to Files`, `Go to Tasks`,
- `Go to Calendar`, `Go to Agents`, `Go to Customers`.
-- Then `Favorites` (pinned items) and `Latest` (recent channels/DMs with an `Unread` switch).
-- Bottom: button named after the user's email — menu with `Command menu (Ctrl K)`,
- `Settings (Ctrl ;)`, `Log out`.
-
-With the new app views enabled, the outer sidebar is an icon rail. Start a new AI
-chat from the Agents workspace; the rail has no separate new-chat-in-a-new-split
-button. Its tooltips
+ its surface and item styling with the sidebar right-click menus.
+- Nav: `Home`, `Drive`, `Email`, `Chat`, `Tasks`, `Calendar`, `Agents`,
+ `Customers`. Calendar and Customers appear only when their features are enabled.
+- Bottom: button named after the user (their name, or email when unset) — menu
+ with `Command menu (Ctrl K)`, `Settings (Ctrl ;)`, `Log out`.
+
+Start a new AI chat from the Agents workspace; the rail has no separate
+new-chat-in-a-new-split button. Its tooltips
use the standard 400 ms hover delay and 300 ms grace period between items. Home,
Email, and Chat show a small accent dot when the loaded data contains an unread
item. Home uses Signal; Email uses Important across all linked inboxes.
@@ -320,8 +318,7 @@ uploading or moving anything.
## Favorites
-Use an entity's command/context menu to add or remove it from Favorites; drag rows
-within the expanded sidebar's Favorites section to reorder them. Documents, chats,
+Use an entity's command/context menu to add or remove it from Favorites. Documents, chats,
projects, email threads, channels, calls, CRM companies, and CRM contacts support
toggling. Individual channel messages are not favoritable.
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index 68626caf29..f7f87ba381 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -101,11 +101,9 @@ it does not imply deletion. Only explicit `GraphqlCacheDeletion` events remove r
## Home (desktop) / Notifications (mobile) — `/app/home`
-Every form factor waits for new-app-views flag readiness before choosing the
-new view or its legacy fallback. With the flag enabled, touch devices render
-the new Inbox as **Notifications**: a floating Signal/Noise pill strip with a
-leading filter drawer (Status and Type), pull-to-refresh, and swipe-left to
-mark done. On touch, Signal is a pure notification feed — the viewer's own
+Touch devices render the Inbox as **Notifications**: a floating Signal/Noise
+pill strip with a leading filter drawer (Status and Type), pull-to-refresh,
+and swipe-left to mark done. On touch, Signal is a pure notification feed — the viewer's own
touched-by-me recents are not merged in; that merge is desktop Home's Signal
only, so sent mail and AI chats without notifications appear only on desktop.
@@ -262,13 +260,10 @@ an older reminder stays in its older section after the event's metadata syncs;
opening its details should show the expected occurrence. A newer reminder or your
own later activity can move the row forward, but a calendar sync alone should not.
-On mobile, this route always renders the original Notifications soup view,
-regardless of the new-app-views flag. The dock and search scope use the bell icon
-and **Notifications** label; Home is desktop-only. Notifications uses the existing
-Inbox presets, Signal/Noise tabs, notification cards, read/type filters, swipe
-actions, and pull-to-refresh, without Home's merged own-activity feed or chat
-starting pane. Opening a row navigates to its entity. On iOS, rows fade underneath
-the filters and status bar using the shared top edge gradient.
+On mobile, the dock and search scope use the bell icon and **Notifications**
+label; Home is desktop-only. Notifications has no merged own-activity feed or
+chat starting pane. Opening a row navigates to its entity. On iOS, rows fade
+underneath the filters and status bar using the shared top edge gradient.
Notifications have three lifecycle states: `unseen`, `seen`, and `done`. Active means
unseen or seen. Viewing must not reopen a done notification; undoing done (`Ctrl+Z`
@@ -723,8 +718,8 @@ just client-side row filtering. Cached inserts enforce the same rule before a
refetch, including expanded groups and inactive cached Shared queries. Until
viewer identity is available, document inserts into Shared are rejected.
-With `enable-new-app-views` enabled, Files opens **Drive** using the
-same shell as Tasks, on desktop and touch devices alike.
+Files opens **Drive** using the same shell as Tasks, on desktop and touch
+devices alike.
On touch devices (phones and tablets), the Drive header is a scrollable pill
strip — **Recent**, **My Files**, **Shared with me**, and **Folders** — with a