Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(calendar): calendar view with proper route (#6876)
dev-rb5cd9dc294d79
diff --git a/apps/web/src/components/app/PreviewPanel.test.tsx b/apps/web/src/components/app/PreviewPanel.test.tsxindex 93741be450..d54ff0b6dd 100644--- a/apps/web/src/components/app/PreviewPanel.test.tsx+++ b/apps/web/src/components/app/PreviewPanel.test.tsx@@ -20,8 +20,8 @@ const mocks = vi.hoisted(() => ({vi.mock('@app/features/next-soup/utils', () => ({getChannelEntityTarget: () => ({ kind: 'latest' }),navigateChannelEntityToTarget: mocks.navigateChannel,- navigateCalendarEntityToTarget: mocks.navigateCalendar,- calendarBlockParamsForEntity: vi.fn(),+ navigateCalendarPreviewToTarget: mocks.navigateCalendar,+ calendarViewTargetForEntity: vi.fn(),reminderSplitTarget: vi.fn(),}));vi.mock('@block-calendar/types', () => ({ CALENDAR_BLOCK_ID: 'calendar' }));diff --git a/apps/web/src/components/app/PreviewPanel.tsx b/apps/web/src/components/app/PreviewPanel.tsxindex 114c9e9ebc..a1b763e5e2 100644--- a/apps/web/src/components/app/PreviewPanel.tsx+++ b/apps/web/src/components/app/PreviewPanel.tsx@@ -1,5 +1,5 @@import {- navigateCalendarEntityToTarget,+ navigateCalendarPreviewToTarget,navigateChannelEntityToTarget,} from '@app/features/next-soup/utils';import { useHotkeyDOMScope } from '@core/hotkey/hotkeys';@@ -118,7 +118,7 @@ function PreviewPanelContent() {void navigateChannelEntityToTarget(entity, props.orchestrator);} else if (entity.type === 'calendar_event') {- void navigateCalendarEntityToTarget(entity, props.orchestrator);+ void navigateCalendarPreviewToTarget(entity, props.orchestrator);}}));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.tsxindex 1dc77d6a52..5347e1b196 100644--- a/apps/web/src/components/app/app-sidebar/calendar-sidebar-preview.tsx+++ b/apps/web/src/components/app/app-sidebar/calendar-sidebar-preview.tsx@@ -1,8 +1,3 @@-import { useOpenEventComposer } from '@app/features/block-calendar/components/use-open-event-composer';-import {- CALENDAR_BLOCK_ID,- type CalendarBlockProps,-} from '@app/features/block-calendar/types';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';@@ -18,8 +13,9 @@ import {formatCalendarTime,getDefaultCalendarTimeFormat,} from '@app/features/calendar/utils/time-format';-import { globalSplitManager } from '@app/signal/splitLayout';-import { useSplitLayout } from '@components/app/split-layout/layout';+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';@@ -217,7 +213,6 @@ function PreviewContent(props: { dropdownMount?: HTMLElement }) {const [timeFormat, setTimeFormat] = createSignal<CalendarTimeFormat>(getDefaultCalendarTimeFormat());- const layout = useSplitLayout();const openEventComposer = useOpenEventComposer();const { sourceById, sources } = useCalendarSources();const isSourceVisible = (sourceId: string) =>@@ -247,31 +242,15 @@ function PreviewContent(props: { dropdownMount?: HTMLElement }) {setSelectedEventId(undefined);}};- const openEventInCalendar = async (event: CalendarEvent) => {- const params: CalendarBlockProps = {- eventId: event.eventId,- occurrenceKey: event.occurrenceKey,- range: range(),- };- const manager = globalSplitManager();- const existing = manager?.getSplitByContent('calendar', CALENDAR_BLOCK_ID);- if (existing) {- existing.activate();- } else {- layout.openWithSplit(- { type: 'calendar', id: CALENDAR_BLOCK_ID, params },- {- allowDuplicate: false,- mergeHistory: false,- referredFrom: 'sidebar',- }- );- }-- const calendarHandle = await manager- ?.getOrchestrator()- .getBlockHandle(CALENDAR_BLOCK_ID, 'calendar');- await calendarHandle?.goToLocationFromParams(params);+ const openEventInCalendar = (event: CalendarEvent) => {+ openCalendarView(+ {+ eventId: event.eventId,+ occurrenceKey: event.occurrenceKey,+ range: range(),+ },+ { referredFrom: 'sidebar' }+ );};return (diff --git a/apps/web/src/components/app/app-sidebar/sidebar.tsx b/apps/web/src/components/app/app-sidebar/sidebar.tsxindex 5c275707e5..8cd3f5c770 100644--- a/apps/web/src/components/app/app-sidebar/sidebar.tsx+++ b/apps/web/src/components/app/app-sidebar/sidebar.tsx@@ -3,6 +3,8 @@ 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 { CommandState } from '@app/features/command';import { SidebarCreateMenu } from '@app/features/command/sidebar/sidebar-create-menu';@@ -26,7 +28,6 @@ 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 { CALENDAR_BLOCK_ID } from '@block-calendar/types';import { useCallContextOptional } from '@channel/Call/CallContext';import { InCallPanel } from '@channel/Call/InCallPanel';import {@@ -253,7 +254,7 @@ const SIDEBAR_LINKS = [{id: 'calendar',label: 'Calendar',- href: '/calendar',+ href: calendarPath('timeGridWeek'),icon: getIconConfig('calendar').icon,hotkey: 'r',hotkeyToken: TOKENS.sidebar.goTo.calendar,@@ -310,9 +311,11 @@ export function sidebarContent(viewId: SidebarItem['id'],params?: SidebarItem['params']): SplitContent {- return viewId === 'calendar'- ? { type: 'calendar', id: CALENDAR_BLOCK_ID }- : { type: 'component', id: viewId, params };+ return {+ type: 'component',+ id: viewId === 'calendar' ? CALENDAR_VIEW_ID : viewId,+ params,+ };}/**diff --git a/apps/web/src/components/app/mobile/MobilePageActionRow.test.tsx b/apps/web/src/components/app/mobile/MobilePageActionRow.test.tsxindex 6341b9e1f0..fb0d9cc143 100644--- a/apps/web/src/components/app/mobile/MobilePageActionRow.test.tsx+++ b/apps/web/src/components/app/mobile/MobilePageActionRow.test.tsx@@ -40,9 +40,12 @@ vi.mock('@app/features/command/Launcher', () => ({keyDownHandler: () => mocks.createItem(label),})),}));-vi.mock('@block-calendar/components/use-open-event-composer', () => ({- useOpenEventComposer: () => mocks.openEvent,-}));+vi.mock(+ '@app/features/calendar-view/components/use-open-event-composer',+ () => ({+ useOpenEventComposer: () => mocks.openEvent,+ })+);vi.mock('@app/features/calendar/hooks/use-calendar-ui-flag', () => ({useCalendarUiFlag: () => () => true,}));diff --git a/apps/web/src/components/app/mobile/MobilePageCreateButton.test.tsx b/apps/web/src/components/app/mobile/MobilePageCreateButton.test.tsxindex ac5cece088..df6e3d156c 100644--- a/apps/web/src/components/app/mobile/MobilePageCreateButton.test.tsx+++ b/apps/web/src/components/app/mobile/MobilePageCreateButton.test.tsx@@ -25,9 +25,12 @@ vi.mock('@app/features/command/Launcher', () => ({vi.mock('@app/features/calendar/hooks/use-calendar-ui-flag', () => ({useCalendarUiFlag: () => sources.calendar,}));-vi.mock('@block-calendar/components/use-open-event-composer', () => ({- useOpenEventComposer: () => sources.openEvent,-}));+vi.mock(+ '@app/features/calendar-view/components/use-open-event-composer',+ () => ({+ useOpenEventComposer: () => sources.openEvent,+ })+);vi.mock('@app/features/companies/CreateCompanyModal', () => ({openCreateCompanyModal: sources.openCompany,}));diff --git a/apps/web/src/components/app/mobile/MobilePageCreateButton.tsx b/apps/web/src/components/app/mobile/MobilePageCreateButton.tsxindex 65b41f5df4..edf6ae1134 100644--- a/apps/web/src/components/app/mobile/MobilePageCreateButton.tsx+++ b/apps/web/src/components/app/mobile/MobilePageCreateButton.tsx@@ -1,10 +1,10 @@import { useCalendarUiFlag } from '@app/features/calendar/hooks/use-calendar-ui-flag';+import { useOpenEventComposer } from '@app/features/calendar-view/components/use-open-event-composer';import {setCreateMenuOpen,useCreateMenuBlocks,} from '@app/features/command/Launcher';import { openCreateCompanyModal } from '@app/features/companies/CreateCompanyModal';-import { useOpenEventComposer } from '@block-calendar/components/use-open-event-composer';import { hapticImpact } from '@core/mobile/haptics';import { virtualKeyboardVisible } from '@core/mobile/virtualKeyboard';import CalendarIcon from '@phosphor/calendar-blank.svg';diff --git a/apps/web/src/components/app/mobile/use-mobile-nav.ts b/apps/web/src/components/app/mobile/use-mobile-nav.tsindex 74ad1c115e..c3c1e686a1 100644--- a/apps/web/src/components/app/mobile/use-mobile-nav.ts+++ b/apps/web/src/components/app/mobile/use-mobile-nav.ts@@ -1,6 +1,6 @@import type { ListView } from '@app/constants/list-views';+import { CALENDAR_VIEW_ID } from '@app/features/calendar-view/types';import { globalSplitManager } from '@app/signal/splitLayout';-import { CALENDAR_BLOCK_ID } from '@block-calendar/types';import { useSettingsState } from '@core/constant/SettingsState';import { type Accessor, createMemo } from 'solid-js';import { useSplitLayout } from '../split-layout/layout';@@ -14,9 +14,10 @@ import { isMobileNavViewId, type MobileNavViewId } from './mobile-nav-views';export type MobileDockNavId = ListView | 'calendar' | 'settings';function mobileNavContent(id: Exclude<MobileDockNavId, 'settings'>) {- return id === 'calendar'- ? ({ type: 'calendar', id: CALENDAR_BLOCK_ID } as const)- : ({ type: 'component', id } as const);+ return {+ type: 'component' as const,+ id: id === 'calendar' ? CALENDAR_VIEW_ID : id,+ };}/** The mobile navigation view represented by the foreground split content. */@@ -26,9 +27,6 @@ export function useForegroundMobileView(): Accessor<return createMemo(() => {const content = globalSplitManager()?.activeSplit()?.content();if (!content) return undefined;- if (content.type === 'calendar') {- return content.id === CALENDAR_BLOCK_ID ? 'calendar' : undefined;- }if (content.type !== 'component') return undefined;return isMobileNavViewId(content.id) ? content.id : undefined;});@@ -50,8 +48,7 @@ export function useMobileNavNavigate(): (id: MobileDockNavId) => void {return;}const fgContent = globalSplitManager()?.activeSplit()?.content();- const isOnNavView =- fgContent?.type === 'component' || fgContent?.type === 'calendar';+ const isOnNavView = fgContent?.type === 'component';openWithSplit(mobileNavContent(id), { mergeHistory: isOnNavView });};}diff --git a/apps/web/src/components/app/previewTarget.ts b/apps/web/src/components/app/previewTarget.tsindex 601834e4b7..dfeefb37c7 100644--- a/apps/web/src/components/app/previewTarget.ts+++ b/apps/web/src/components/app/previewTarget.ts@@ -1,7 +1,7 @@import {type CalendarPreviewSelection,type ChannelPreviewSelection,- calendarBlockParamsForEntity,+ calendarViewTargetForEntity,getChannelEntityTarget,type ReminderPreviewSelection,reminderSplitTarget,@@ -124,7 +124,7 @@ export function previewBlockTarget(blockType: 'calendar',blockId: CALENDAR_BLOCK_ID,aliasContext: undefined,- params: untrack(() => calendarBlockParamsForEntity(calendarEvent)),+ params: untrack(() => calendarViewTargetForEntity(calendarEvent)),})).with({ type: 'reminder' }, (reminder) => {const reminderTarget = reminderSplitTarget(reminder);diff --git a/apps/web/src/components/app/sidebar-next/nav-items.ts b/apps/web/src/components/app/sidebar-next/nav-items.tsindex 0cd03c1bf2..fba71e5d1c 100644--- a/apps/web/src/components/app/sidebar-next/nav-items.ts+++ b/apps/web/src/components/app/sidebar-next/nav-items.ts@@ -1,4 +1,5 @@import { LIST_VIEW_PATHS } from '@app/constants/list-views';+import { calendarPath } from '@app/features/calendar-view/calendar-url';import type { SidebarItem } from '@components/app/app-sidebar/sidebar';import { TOKENS } from '@core/hotkey/tokens';import BuildingsIcon from '@phosphor/buildings.svg';@@ -92,7 +93,7 @@ const SIDEBAR_NEXT_NAV_ITEMS = [{id: 'calendar',label: 'Calendar',- href: '/calendar',+ href: calendarPath('timeGridWeek'),icon: CalendarBlankIcon,iconActive: CalendarBlankFillIcon,hotkey: 'r',diff --git a/apps/web/src/components/app/split-layout/componentRegistry.tsx b/apps/web/src/components/app/split-layout/componentRegistry.tsxindex 1343c022c5..721aa32023 100644--- a/apps/web/src/components/app/split-layout/componentRegistry.tsx+++ b/apps/web/src/components/app/split-layout/componentRegistry.tsx@@ -4,6 +4,7 @@ import { AgentsRouteView } from '@app/features/agents-view/route';import { useSpreadsheetAccess } from '@app/features/block-spreadsheet/primitives/use-spreadsheet-access';import type { EventEditorInitialValues } from '@app/features/calendar/components/composer/event-form-model';import type { CalendarEvent } from '@app/features/calendar/types';+import { CalendarRouteView } from '@app/features/calendar-view/route';import { ChannelsRouteView } from '@app/features/channels-view/route';import { CompaniesRouteView } from '@app/features/companies/route';import { DriveRouteView } from '@app/features/drive-view/route';@@ -134,6 +135,7 @@ registerComponent('agents', () => <AgentsRouteView />);registerComponent('mail', () => <MailRouteView />);registerComponent('documents', () => <DriveRouteView />);registerComponent('tasks', () => <TasksRouteView />);+registerComponent('calendar', () => <CalendarRouteView />);registerComponent('channels', () => <ChannelsRouteView />);registerComponent('calls', () => <CallsRouteView />);registerComponent('companies', () => <CompaniesRouteView />);diff --git a/apps/web/src/components/app/split-layout/components/SplitHeader.tsx b/apps/web/src/components/app/split-layout/components/SplitHeader.tsxindex a1a6a44539..e38f8e1131 100644--- a/apps/web/src/components/app/split-layout/components/SplitHeader.tsx+++ b/apps/web/src/components/app/split-layout/components/SplitHeader.tsx@@ -1,11 +1,11 @@import { ViewBreadcrumbs } from '@app/components/view-shell';import { isListViewID, LIST_VIEW_ID } from '@app/constants/list-views';+import { CALENDAR_VIEW_ID } from '@app/features/calendar-view/types';import { driveLocationLabel } from '@app/features/drive-view/core/location-label';import type { DriveState } from '@app/features/drive-view/core/types';import { useSoup } from '@app/features/next-soup/soup-context';import { openEntityInSplitFromUnifiedList } from '@app/features/next-soup/utils';import { useSplitRouter } from '@app/lib/split-router';-import { CALENDAR_BLOCK_ID } from '@block-calendar/types';import { useGlobalNotificationSource } from '@components/app/GlobalAppState';import { useSidebarCollapse } from '@components/app/sidebarVisibility';import { type BlockName, NonDocumentBlockTypes } from '@core/block';@@ -90,8 +90,8 @@ function getEntitySplitContent(data: EntityDragEvent['draggable']['data']):.with({ type: P.union('foreign', 'reminder') }, () => undefined)// The full calendar opening path supplies the event range to focus..with({ type: 'calendar_event' }, () => ({- type: 'calendar',- id: CALENDAR_BLOCK_ID,+ type: 'component',+ id: CALENDAR_VIEW_ID,})).with({ type: 'crm_company' }, (entity) => ({type: 'company',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.tsindex 50afcbeca8..53181ec264 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@@ -1,3 +1,10 @@+import { getPreferredCalendarPeriodView } from '@app/features/calendar/calendar-preferences';+import {+ CALENDAR_ROUTE_ID,+ CALENDAR_SEARCH_NAMESPACE,+ calendarPath,+} from '@app/features/calendar-view/calendar-url';+import { CALENDAR_VIEW_ID } from '@app/features/calendar-view/types';import { CHANNEL_DETAIL_SEARCH_NAMESPACE } from '@app/features/channels-view/channels-route';import {driveDocumentFromContent,@@ -50,6 +57,9 @@ export function createAppSplitRouterMiddleware(options: {return redirect('/inbox');if (id === 'documents') return redirect('/drive');if (id === 'settings') return redirect('/settings');+ if (id === CALENDAR_VIEW_ID) {+ return redirect(calendarPath(getPreferredCalendarPeriodView()));+ }if (appSplitRoutes.definitions.some((route) => route.id === `view-${id}`)) {@@ -59,6 +69,9 @@ export function createAppSplitRouterMiddleware(options: {const content = type && id ? decodeLegacyPair(type, id) : undefined;if (!content) return;+ if (content.type === 'component' && content.id === CALENDAR_VIEW_ID) {+ return redirect(calendarPath(getPreferredCalendarPeriodView()));+ }const flag = options.newAppViews();const canRenderDetail =!flag.loading && flag.enabled && !options.isTouchDevice();@@ -94,6 +107,9 @@ export function createAppSplitRouterMiddleware(options: {[CHANNEL_URL_PARAMS.message, 'messageId'],[CHANNEL_URL_PARAMS.thread, 'threadId'],];+ } else if (leafId === CALENDAR_ROUTE_ID) {+ namespace = CALENDAR_SEARCH_NAMESPACE;+ fields = [['eventId', 'eventId']];} else {return;}diff --git a/apps/web/src/components/app/split-layout/split-router/app-routes.ts b/apps/web/src/components/app/split-layout/split-router/app-routes.tsindex 5d8c12da33..1ff10cb1cb 100644--- a/apps/web/src/components/app/split-layout/split-router/app-routes.ts+++ b/apps/web/src/components/app/split-layout/split-router/app-routes.ts@@ -5,6 +5,7 @@ import {agentsViewRoute,codersRoute,} from '@app/features/agents-view/route';+import { calendarSplitRoute } from '@app/features/calendar-view/route';import { channelsSplitRoute } from '@app/features/channels-view/route';import { companiesRoute } from '@app/features/companies/route';import { driveSplitRoute } from '@app/features/drive-view/route';@@ -40,6 +41,7 @@ export const appSplitRoutes = defineRoutes({agentsViewRoute,emailSplitRoute,tasksSplitRoute,+ calendarSplitRoute,channelsSplitRoute,callsRoute,companiesRoute,diff --git a/apps/web/src/components/app/split-layout/split-router/legacy-route.ts b/apps/web/src/components/app/split-layout/split-router/legacy-route.tsindex c519358fbb..02a0022fe4 100644--- a/apps/web/src/components/app/split-layout/split-router/legacy-route.ts+++ b/apps/web/src/components/app/split-layout/split-router/legacy-route.ts@@ -2,6 +2,13 @@ import {agentsRouteFromSegments,agentsRouteSegments,} from '@app/features/agents-view/core/route';+import { getPreferredCalendarPeriodView } from '@app/features/calendar/calendar-preferences';+import {+ CALENDAR_ROUTE_ID,+ CALENDAR_SEARCH_NAMESPACE,+ calendarSearchCodec,+} from '@app/features/calendar-view/calendar-url';+import { CALENDAR_VIEW_ID } from '@app/features/calendar-view/types';import type { DriveLocation } from '@app/features/drive-view/core/types';import type { DriveDocumentRoute } from '@app/features/drive-view/primitives/drive-route';import { URL_PARAMS as EMAIL_URL_PARAMS } from '@app/features/email-thread/core/location';@@ -22,6 +29,7 @@ import {} from '@app/lib/split-router/routes';import { parseSearchState } from '@app/lib/split-router/search';import { isRecord } from '@app/lib/split-router/utils';+import { CALENDAR_BLOCK_ID } from '@block-calendar/types';import { URL_PARAMS as CHANNEL_URL_PARAMS } from '@block-channel/constants';import type { BlockAlias, BlockName } from '@core/block';import { isBlockAlias, resolveBlockAlias } from '@core/constant/allBlocks';@@ -41,6 +49,10 @@ export function decodeLegacyPair(return { type: 'component', id: 'settings' };}+ if (type === 'calendar' && id === CALENDAR_BLOCK_ID) {+ return { type: 'component', id: CALENDAR_VIEW_ID };+ }+if (type === 'component') {// Retired Preview Pair placeholders must never reach the view registry.return {@@ -196,6 +208,29 @@ export function splitLocationFromContent(routes: SplitRoutesManifest,content: SplitContent): SplitLocation {+ if (+ (content.type === 'component' && content.id === CALENDAR_VIEW_ID) ||+ (content.type === 'calendar' && content.id === CALENDAR_BLOCK_ID)+ ) {+ const rawEventId = isRecord(content.params)+ ? (content.params as Record<string, unknown>).eventId+ : undefined;+ const eventId =+ typeof rawEventId === 'string' && rawEventId.length > 0 ? rawEventId : '';+ const search = calendarSearchCodec.serialize({ eventId });+ return {+ route: {+ matches: [+ {+ id: CALENDAR_ROUTE_ID,+ params: { period: getPreferredCalendarPeriodView() },+ },+ ],+ },+ ...(search ? { search: { [CALENDAR_SEARCH_NAMESPACE]: search } } : {}),+ };+ }+if (content.type === 'component' && content.id === 'documents') {return { route: { matches: [{ id: 'drive', params: {} }] } };}diff --git a/apps/web/src/components/app/split-layout/tests/app-route-isolation.test.ts b/apps/web/src/components/app/split-layout/tests/app-route-isolation.test.tsindex 6f3ce02eb4..23294ffbde 100644--- a/apps/web/src/components/app/split-layout/tests/app-route-isolation.test.ts+++ b/apps/web/src/components/app/split-layout/tests/app-route-isolation.test.ts@@ -22,6 +22,9 @@ vi.mock('@app/features/activity/views/my-activity-view', () => {vi.mock('@app/features/agents-view/views/AgentsView', () => {throw new Error('Route declarations must not eagerly load agent views');});+vi.mock('@app/features/calendar-view/calendar-view', () => {+ throw new Error('Route declarations must not eagerly load Calendar views');+});vi.mock('@app/features/channels-view/channels-view', () => {throw new Error('Route declarations must not eagerly load channel views');});@@ -67,6 +70,7 @@ describe('application route import isolation', () => {['tasks'],['settings', 'account'],['drive', 'md', 'doc'],+ ['calendar', 'week'],['channels', 'channel-id'],]) {expect(decodeRoute(routes, path)).toBeDefined();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.tsindex 769df6c73f..db474ed76f 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@@ -1,4 +1,5 @@import { agentsRouteId } from '@app/features/agents-view/core/route';+import { CALENDAR_PREFERENCES_KEY } from '@app/features/calendar/calendar-preferences';import { driveDestination } from '@app/features/drive-view/drive-route-navigation';import { driveSplitRoute } from '@app/features/drive-view/route';import {@@ -894,6 +895,68 @@ describe('layoutManager', () => {dispose();});+ it('renders Calendar as a route-backed component and restores URL state', async () => {+ const { manager, location, router, dispose } = ingressRouter(+ '/calendar/week?eventId=event-1'+ );+ await router.settled();+ const split = manager.splits()[0];+ const mount = split.mount;+ expect(split.content).toMatchObject({+ type: 'component',+ id: 'calendar',+ });+ expect(mount.kind).toBe('component');+ expect(router.route(split.id)?.matches).toEqual([+ { id: 'view-calendar', params: { period: 'timeGridWeek' } },+ ]);+ expect(router.search(split.id, 'calendar')).toEqual({+ eventId: ['event-1'],+ });+ expect(location.read().pathname).toBe('/calendar/week');+ expect(new URLSearchParams(location.read().search).get('eventId')).toBe(+ 'event-1'+ );+ expect(+ new URLSearchParams(location.read().search).get('s0.calendar.eventId')+ ).toBe('event-1');++ location.set('/calendar/day?s0.calendar.eventId=event-2');+ await router.settled();+ expect(manager.splits()[0].mount).toBe(mount);+ expect(router.route(split.id)?.matches).toEqual([+ { id: 'view-calendar', params: { period: 'timeGridDay' } },+ ]);+ expect(router.search(split.id, 'calendar')).toEqual({+ eventId: ['event-2'],+ });+ router.dispose();+ dispose();+ });++ it('upgrades the legacy Calendar block URL to the preferred period route', async () => {+ localStorage.setItem(+ CALENDAR_PREFERENCES_KEY,+ JSON.stringify({ periodView: 'dayGridMonth' })+ );+ const { manager, location, router, dispose } = ingressRouter(+ '/calendar/view?eventId=legacy-event'+ );+ await router.settled();+ const split = manager.splits()[0];+ expect(split.content).toMatchObject({+ type: 'component',+ id: 'calendar',+ });+ expect(location.read().pathname).toBe('/calendar/month');+ expect(router.search(split.id, 'calendar')).toEqual({+ eventId: ['legacy-event'],+ });+ localStorage.removeItem(CALENDAR_PREFERENCES_KEY);+ router.dispose();+ dispose();+ });+it('normalizes legacy search per detail pane without overriding canonical values', async () => {const { manager, location, router, dispose } = ingressRouter('/mail/one/~/channels/c1/~/mail/two/~/mail' +diff --git a/apps/web/src/features/block-calendar/CalendarBlockAdapter.tsx b/apps/web/src/features/block-calendar/CalendarBlockAdapter.tsxindex eb616d533b..51bf89d1b8 100644--- a/apps/web/src/features/block-calendar/CalendarBlockAdapter.tsx+++ b/apps/web/src/features/block-calendar/CalendarBlockAdapter.tsx@@ -1,6 +1,10 @@import { CalendarViewContextProvider } from '@app/features/calendar/components/CalendarViewContext';import { useCalendarUiFlag } from '@app/features/calendar/hooks/use-calendar-ui-flag';import { isCalendarRangeSupported } from '@app/features/calendar/utils/calendar-supported-range';+import { CalendarFocusContextProvider } from '@app/features/calendar-view/calendar-focus-target';+import { resolveCalendarTarget } from '@app/features/calendar-view/calendar-target';+import { createCalendarTargetAim } from '@app/features/calendar-view/calendar-target-request';+import { Workspace } from '@app/features/calendar-view/components/Workspace';import { useAnalytics } from '@app/lib/analytics/analytics-context';import { usePosthog } from '@app/lib/analytics/posthog';import { globalSplitManager } from '@app/signal/splitLayout';@@ -12,10 +16,6 @@ import { blockHandleSignal } from '@core/signal/load';import { useCalendarOccurrencesQuery } from '@queries/calendar/occurrences';import { useSearchParams } from '@solidjs/router';import { createMemo, onMount, Show } from 'solid-js';-import { CalendarFocusContextProvider } from './calendar-focus-target';-import { resolveCalendarBlockTarget } from './calendar-target';-import { createCalendarTargetAim } from './calendar-target-request';-import { Workspace } from './components/Workspace';import type { CalendarBlockProps } from './types';function CalendarBlockDisabledRedirect() {@@ -26,7 +26,7 @@ function CalendarBlockDisabledRedirect() {return null;}-/** Bridges the singleton block lifecycle and navigation API to CalendarView. */+/** Compatibility host for inline previews that still mount a Calendar block. */function CalendarBlockAdapter(props: CalendarBlockProps) {const calendarUiEnabled = useCalendarUiFlag();const posthog = usePosthog();@@ -92,10 +92,7 @@ function CalendarBlockAdapter(props: CalendarBlockProps) {) {return undefined;}- return resolveCalendarBlockTarget(- occurrencesQuery.data?.items ?? [],- request- );+ return resolveCalendarTarget(occurrencesQuery.data?.items ?? [], request);});onMount(() => {diff --git a/apps/web/src/features/block-calendar/open-calendar-event.ts b/apps/web/src/features/block-calendar/open-calendar-event.tsdeleted file mode 100644index a46e37d7dc..0000000000--- a/apps/web/src/features/block-calendar/open-calendar-event.ts+++ /dev/null@@ -1,82 +0,0 @@-import { globalSplitManager } from '@app/signal/splitLayout';-import {- enableCalendarUi,- isFeatureEnabled,-} from '@core/constant/featureFlags';-import {- type CalendarBlockEventTime,- createCalendarBlockRange,-} from './calendar-range';-import { CALENDAR_BLOCK_ID, type CalendarBlockProps } from './types';--export type CalendarEventOpenTarget = {- /** The viewer's own event entity to focus. */- eventId: string;- /** Instance to focus, for recurring events. */- occurrenceKey?: string;- /** Instance timing used to build the locator range. */- time?: CalendarBlockEventTime;- openInNewSplit?: boolean;-};--/**- * Timed occurrence keys are the instance's RFC 3339 start and all-day keys- * its YYYY-MM-DD start date, so a key alone can anchor the locator range- * when no richer timing is at hand.- */-export function eventTimeFromOccurrenceKey(- occurrenceKey: string-): CalendarBlockEventTime | undefined {- if (/^\d{4}-\d{2}-\d{2}$/.test(occurrenceKey)) {- return { kind: 'allDay', startDate: occurrenceKey };- }- const startsAt = new Date(occurrenceKey);- if (!Number.isFinite(startsAt.getTime())) return undefined;- return { kind: 'timed', startsAt: occurrenceKey };-}--/**- * Open the singleton calendar block focused on one event occurrence,- * mirroring how soup rows and notifications retarget the calendar. Repeat- * opens re-aim the already-open split instead of stacking another calendar.- */-export async function openCalendarEventSplit(target: CalendarEventOpenTarget) {- if (!isFeatureEnabled(enableCalendarUi)) return;- const splitManager = globalSplitManager();- if (!splitManager) return;-- const time =- target.time ??- (target.occurrenceKey- ? eventTimeFromOccurrenceKey(target.occurrenceKey)- : undefined);- const params: CalendarBlockProps = {- eventId: target.eventId,- occurrenceKey: target.occurrenceKey,- range: time ? createCalendarBlockRange(time) : undefined,- };-- const existing = splitManager.getSplitByContent(- 'calendar',- CALENDAR_BLOCK_ID- );- if (existing) {- existing.activate();- } else {- splitManager.openWithSplit(- { type: 'calendar', id: CALENDAR_BLOCK_ID, params },- {- activate: true,- referredFrom: null,- preferNewSplit: target.openInNewSplit,- }- );- }-- const orchestrator = splitManager.getOrchestrator();- const handle = await orchestrator.getBlockHandle(- CALENDAR_BLOCK_ID,- 'calendar'- );- await handle?.goToLocationFromParams(params);-}diff --git a/apps/web/src/features/block-calendar/types.ts b/apps/web/src/features/block-calendar/types.tsindex 350459e772..426b593673 100644--- a/apps/web/src/features/block-calendar/types.ts+++ b/apps/web/src/features/block-calendar/types.ts@@ -1,23 +1,7 @@-import type { CalendarOccurrenceQueryRange } from '@queries/calendar/occurrences';+import type { CalendarViewTarget } from '@app/features/calendar-view/types';-/** Stable identity used by the singleton calendar block. */+/** Stable identity retained for legacy Calendar block entries and previews. */export const CALENDAR_BLOCK_ID = 'view';-/** Optional navigation parameters accepted by the singleton calendar block. */-export interface CalendarBlockProps {- /** Canonical event to focus after loading `range`. */- eventId?: string;- /** Exact half-open occurrence API range used to locate `eventId`. */- range?: CalendarOccurrenceQueryRange;- /** Stable occurrence key, when the target is a recurring event instance. */- occurrenceKey?: string;-}--/** A validated request to locate and focus one event occurrence. */-export interface CalendarBlockTargetRequest {- eventId: string;- range: CalendarOccurrenceQueryRange;- occurrenceKey?: string;- requestId: number;- requestedAt: number;-}+/** Compatibility params accepted by the retired Calendar block adapter. */+export interface CalendarBlockProps extends CalendarViewTarget {}diff --git a/apps/web/src/features/block-calendar/calendar-focus-target.ts b/apps/web/src/features/calendar-view/calendar-focus-target.tssimilarity index 100%rename from apps/web/src/features/block-calendar/calendar-focus-target.tsrename to apps/web/src/features/calendar-view/calendar-focus-target.tsdiff --git a/apps/web/src/features/calendar-view/calendar-navigation.test.ts b/apps/web/src/features/calendar-view/calendar-navigation.test.tsnew file mode 100644index 0000000000..3786edb6ee--- /dev/null+++ b/apps/web/src/features/calendar-view/calendar-navigation.test.ts@@ -0,0 +1,93 @@+import type {+ SplitHandle,+ SplitManager,+} from '@components/app/split-layout/layoutManager';+import { describe, expect, it, vi } from 'vitest';+import { calendarViewContent, openCalendarView } from './calendar-navigation';++describe('Calendar view navigation', () => {+ it('builds route-backed component content', () => {+ expect(+ calendarViewContent({+ period: 'dayGridMonth',+ eventId: 'event-1',+ occurrenceKey: 'instance-1',+ })+ ).toMatchObject({+ type: 'component',+ id: 'calendar',+ params: {+ eventId: 'event-1',+ occurrenceKey: 'instance-1',+ focusRequestId: expect.any(Number),+ },+ entryMetadata: {+ route: {+ matches: [+ {+ id: 'view-calendar',+ params: { period: 'dayGridMonth' },+ },+ ],+ },+ search: { calendar: { eventId: ['event-1'] } },+ },+ });+ });++ it('retargets an existing Calendar component without a block handle', () => {+ const replace = vi.fn();+ const activate = vi.fn();+ const existing = { replace, activate } as unknown as SplitHandle;+ const manager = {+ getSplitByContent: vi.fn(() => existing),+ openWithSplit: vi.fn(),+ } as unknown as SplitManager;++ openCalendarView(+ { period: 'timeGridDay', eventId: 'event-2' },+ { manager }+ );++ expect(manager.getSplitByContent).toHaveBeenCalledWith(+ 'component',+ 'calendar'+ );+ expect(replace).toHaveBeenCalledWith({+ next: expect.objectContaining({+ type: 'component',+ id: 'calendar',+ entryMetadata: expect.objectContaining({+ search: { calendar: { eventId: ['event-2'] } },+ }),+ }),+ mergeHistory: true,+ referredFrom: undefined,+ });+ expect(activate).toHaveBeenCalledOnce();+ expect(manager.openWithSplit).not.toHaveBeenCalled();+ });++ it('opens the Calendar route when no instance exists', () => {+ const manager = {+ getSplitByContent: vi.fn(),+ openWithSplit: vi.fn(),+ } as unknown as SplitManager;++ openCalendarView(+ { period: 'timeGridWeek', eventId: 'event-3' },+ { manager, openInNewSplit: true, referredFrom: 'sidebar' }+ );++ expect(manager.openWithSplit).toHaveBeenCalledWith(+ expect.objectContaining({ type: 'component', id: 'calendar' }),+ {+ activate: true,+ referredFrom: 'sidebar',+ preferNewSplit: true,+ handle: undefined,+ mergeHistory: undefined,+ }+ );+ });+});diff --git a/apps/web/src/features/calendar-view/calendar-navigation.ts b/apps/web/src/features/calendar-view/calendar-navigation.tsnew file mode 100644index 0000000000..73805db789--- /dev/null+++ b/apps/web/src/features/calendar-view/calendar-navigation.ts@@ -0,0 +1,88 @@+import { getPreferredCalendarPeriodView } from '@app/features/calendar/calendar-preferences';+import type { CalendarPeriodView } from '@app/features/calendar/types';+import { globalSplitManager } from '@app/signal/splitLayout';+import type {+ ReferredFrom,+ SplitContent,+ SplitHandle,+ SplitManager,+} from '@components/app/split-layout/layoutManager';+import {+ CALENDAR_ROUTE_ID,+ CALENDAR_SEARCH_NAMESPACE,+ calendarSearchCodec,+} from './calendar-url';+import { CALENDAR_VIEW_ID, type CalendarViewTarget } from './types';++let nextFocusRequestId = 1;++export type CalendarRouteTarget = CalendarViewTarget & {+ period?: CalendarPeriodView;+};++/** Route-backed split content for opening or retargeting the Calendar view. */+export function calendarViewContent(+ target: CalendarRouteTarget = {}+): SplitContent {+ const period = target.period ?? getPreferredCalendarPeriodView();+ const eventId =+ typeof target.eventId === 'string' && target.eventId.length > 0+ ? target.eventId+ : undefined;+ const search = calendarSearchCodec.serialize({ eventId: eventId ?? '' });+ const params: CalendarViewTarget | undefined = eventId+ ? {+ eventId,+ occurrenceKey: target.occurrenceKey,+ range: target.range,+ focusRequestId: nextFocusRequestId++,+ }+ : undefined;++ return {+ type: 'component',+ id: CALENDAR_VIEW_ID,+ ...(params ? { params: { ...params } } : {}),+ entryMetadata: {+ route: {+ matches: [{ id: CALENDAR_ROUTE_ID, params: { period } }],+ },+ ...(search ? { search: { [CALENDAR_SEARCH_NAMESPACE]: search } } : {}),+ },+ };+}++/** Open the singleton Calendar route, or retarget its existing split. */+export function openCalendarView(+ target: CalendarRouteTarget = {},+ options: {+ manager?: SplitManager;+ handle?: SplitHandle;+ openInNewSplit?: boolean;+ mergeHistory?: boolean;+ referredFrom?: ReferredFrom;+ } = {}+): void {+ const manager = options.manager ?? globalSplitManager();+ if (!manager) return;++ const content = calendarViewContent(target);+ const existing = manager.getSplitByContent('component', CALENDAR_VIEW_ID);+ if (existing) {+ existing.replace({+ next: content,+ mergeHistory: options.mergeHistory ?? true,+ referredFrom: options.referredFrom,+ });+ existing.activate();+ return;+ }++ manager.openWithSplit(content, {+ activate: true,+ referredFrom: options.referredFrom ?? null,+ preferNewSplit: options.openInNewSplit,+ handle: options.handle,+ mergeHistory: options.mergeHistory,+ });+}diff --git a/apps/web/src/features/block-calendar/calendar-range.ts b/apps/web/src/features/calendar-view/calendar-range.tssimilarity index 94%rename from apps/web/src/features/block-calendar/calendar-range.tsrename to apps/web/src/features/calendar-view/calendar-range.tsindex 8fc468212f..2a781d35a1 100644--- a/apps/web/src/features/block-calendar/calendar-range.ts+++ b/apps/web/src/features/calendar-view/calendar-range.ts@@ -5,7 +5,7 @@ import {} from '@queries/calendar/occurrences';/** Event timing fields available to calendar navigation call sites. */-export type CalendarBlockEventTime =+export type CalendarEventTime =| { kind: 'timed'; startsAt: string; endsAt?: string }| { kind: 'allDay'; startDate: string; endDate?: string };@@ -20,8 +20,8 @@ function nextLocalDay(date: Date) {* expanded to local-day boundaries so both UTC and date-only API boundaries* remain non-empty and can also match all-day projections.*/-export function createCalendarBlockRange(- time: CalendarBlockEventTime+export function createCalendarRange(+ time: CalendarEventTime): CalendarOccurrenceQueryRange | undefined {if (time.kind === 'allDay') {const start = parseLocalDate(time.startDate);@@ -59,7 +59,7 @@ export function createCalendarBlockRange(}/** Whether a runtime value is a complete, non-empty occurrence query range. */-export function isCalendarBlockRange(+export function isCalendarRange(value: unknown): value is CalendarOccurrenceQueryRange {if (!value || typeof value !== 'object') return false;diff --git a/apps/web/src/features/block-calendar/calendar-target-request.test.ts b/apps/web/src/features/calendar-view/calendar-target-request.test.tssimilarity index 93%rename from apps/web/src/features/block-calendar/calendar-target-request.test.tsrename to apps/web/src/features/calendar-view/calendar-target-request.test.tsindex 63d1d68b6b..30d5217a43 100644--- a/apps/web/src/features/block-calendar/calendar-target-request.test.ts+++ b/apps/web/src/features/calendar-view/calendar-target-request.test.ts@@ -4,7 +4,7 @@ import {type CalendarTargetAim,createCalendarTargetAim,} from './calendar-target-request';-import type { CalendarBlockProps, CalendarBlockTargetRequest } from './types';+import type { CalendarFocusRequest, CalendarViewTarget } from './types';const RANGE = {start: '2026-08-17T04:00:00.000Z',@@ -20,7 +20,7 @@ const NEXT_WEEK_RANGE = {endDate: '2026-08-25',};-const standup: CalendarBlockProps = {+const standup: CalendarViewTarget = {eventId: 'event-1',occurrenceKey: '2026-08-17T14:00:00+00:00',range: RANGE,@@ -72,9 +72,9 @@ describe('createCalendarTargetAim', () => {it('resolves params without a range through the preview', async () => {const resolveFromPreview = vi.fn(async (- _params: CalendarBlockProps,+ _params: CalendarViewTarget,requestId: number- ): Promise<CalendarBlockTargetRequest> => ({+ ): Promise<CalendarFocusRequest> => ({eventId: 'viewer-copy',range: RANGE,occurrenceKey: '2026-08-17T14:00:00+00:00',@@ -116,9 +116,9 @@ describe('createCalendarTargetAim', () => {let releaseStalePreview: (() => void) | undefined;const resolveFromPreview = vi.fn(async (- _params: CalendarBlockProps,+ _params: CalendarViewTarget,requestId: number- ): Promise<CalendarBlockTargetRequest> => {+ ): Promise<CalendarFocusRequest> => {await new Promise<void>((resolve) => {releaseStalePreview = resolve;});diff --git a/apps/web/src/features/block-calendar/calendar-target-request.ts b/apps/web/src/features/calendar-view/calendar-target-request.tssimilarity index 80%rename from apps/web/src/features/block-calendar/calendar-target-request.tsrename to apps/web/src/features/calendar-view/calendar-target-request.tsindex 1eae1a8066..fded9b1f49 100644--- a/apps/web/src/features/block-calendar/calendar-target-request.ts+++ b/apps/web/src/features/calendar-view/calendar-target-request.ts@@ -1,21 +1,21 @@import { fetchCalendarMentionPreview } from '@queries/calendar/mention-preview';import { type Accessor, createSignal } from 'solid-js';import {- type CalendarBlockEventTime,- createCalendarBlockRange,- isCalendarBlockRange,+ type CalendarEventTime,+ createCalendarRange,+ isCalendarRange,} from './calendar-range';-import type { CalendarBlockProps, CalendarBlockTargetRequest } from './types';+import type { CalendarFocusRequest, CalendarViewTarget } from './types';/** Builds a request straight from params that already carry a locator range. */export function targetRequestFromParams(- params: CalendarBlockProps,+ params: CalendarViewTarget,requestId: number-): CalendarBlockTargetRequest | undefined {+): CalendarFocusRequest | undefined {if (typeof params.eventId !== 'string' ||params.eventId.length === 0 ||- !isCalendarBlockRange(params.range)+ !isCalendarRange(params.range)) {return undefined;}@@ -39,9 +39,9 @@ export function targetRequestFromParams(* meeting to the viewer's own copy.*/export async function resolveTargetRequestFromPreview(- params: CalendarBlockProps,+ params: CalendarViewTarget,requestId: number-): Promise<CalendarBlockTargetRequest | undefined> {+): Promise<CalendarFocusRequest | undefined> {if (typeof params.eventId !== 'string' || params.eventId.length === 0) {return undefined;}@@ -53,7 +53,7 @@ export async function resolveTargetRequestFromPreview().catch(() => null);if (!event) return undefined;- const time: CalendarBlockEventTime =+ const time: CalendarEventTime =event.time.kind === 'timed'? {kind: 'timed',@@ -65,7 +65,7 @@ export async function resolveTargetRequestFromPreview(startDate: event.time.startDate,endDate: event.time.endDate,};- const range = createCalendarBlockRange(time);+ const range = createCalendarRange(time);if (!range) return undefined;return {@@ -79,8 +79,8 @@ export async function resolveTargetRequestFromPreview(/** The occurrence the block is currently aimed at, and how to re-aim it. */export interface CalendarTargetAim {- target: Accessor<CalendarBlockTargetRequest | undefined>;- aimAt: (params: CalendarBlockProps) => void;+ target: Accessor<CalendarFocusRequest | undefined>;+ aimAt: (params: CalendarViewTarget) => void;}/**@@ -93,19 +93,19 @@ export interface CalendarTargetAim {* the click with no effect at all beyond activating the split.*/export function createCalendarTargetAim(options: {- initial: CalendarBlockProps;+ initial: CalendarViewTarget;resolveFromPreview?: (- params: CalendarBlockProps,+ params: CalendarViewTarget,requestId: number- ) => Promise<CalendarBlockTargetRequest | undefined>;+ ) => Promise<CalendarFocusRequest | undefined>;}): CalendarTargetAim {const resolveFromPreview =options.resolveFromPreview ?? resolveTargetRequestFromPreview;let nextRequestId = 1;let latestRequestId = 0;- const [target, setTarget] = createSignal<- CalendarBlockTargetRequest | undefined- >(targetRequestFromParams(options.initial, nextRequestId++));+ const [target, setTarget] = createSignal<CalendarFocusRequest | undefined>(+ targetRequestFromParams(options.initial, nextRequestId++)+ );// Preview resolution is async, so a stale answer must never clobber a// target the user has since re-aimed or cleared. The latest answer always@@ -114,13 +114,13 @@ export function createCalendarTargetAim(options: {// for the focus effect to land on.const applyResolvedTarget = (requestId: number,- resolved: CalendarBlockTargetRequest | undefined+ resolved: CalendarFocusRequest | undefined) => {if (requestId < latestRequestId) return;setTarget(resolved);};- const aimAt = (params: CalendarBlockProps) => {+ const aimAt = (params: CalendarViewTarget) => {const requestId = nextRequestId++;latestRequestId = requestId;const direct = targetRequestFromParams(params, requestId);diff --git a/apps/web/src/features/block-calendar/calendar-target.ts b/apps/web/src/features/calendar-view/calendar-target.tssimilarity index 84%rename from apps/web/src/features/block-calendar/calendar-target.tsrename to apps/web/src/features/calendar-view/calendar-target.tsindex 2705ecfd5b..71736d13af 100644--- a/apps/web/src/features/block-calendar/calendar-target.ts+++ b/apps/web/src/features/calendar-view/calendar-target.ts@@ -1,7 +1,7 @@import { parseLocalDate } from '@app/features/calendar/utils/calendar-date';import type { CalendarOccurrenceItem } from '@service-storage/generated/schemas/calendarOccurrenceItem';import type { CalendarFocusTarget } from './calendar-focus-target';-import type { CalendarBlockTargetRequest } from './types';+import type { CalendarFocusRequest } from './types';function occurrenceDate(item: CalendarOccurrenceItem): Date | undefined {const time = item.occurrence.time;@@ -13,12 +13,12 @@ function occurrenceDate(item: CalendarOccurrenceItem): Date | undefined {}/**- * Resolves a block request to one occurrence. Without an occurrence key the+ * Resolves a navigation request to one occurrence. Without an occurrence key the* supplied range must contain exactly one instance of the canonical event.*/-export function resolveCalendarBlockTarget(+export function resolveCalendarTarget(items: CalendarOccurrenceItem[],- request: CalendarBlockTargetRequest+ request: CalendarFocusRequest): CalendarFocusTarget | undefined {const matches = items.filter((item) =>diff --git a/apps/web/src/features/calendar-view/calendar-url.ts b/apps/web/src/features/calendar-view/calendar-url.tsnew file mode 100644index 0000000000..e889c77e2a--- /dev/null+++ b/apps/web/src/features/calendar-view/calendar-url.ts@@ -0,0 +1,42 @@+import type { CalendarPeriodView } from '@app/features/calendar/types';+import { createSearchParamsCodec } from '@app/lib/split-router';+import { z } from 'zod';++export const CALENDAR_ROUTE_ID = 'view-calendar';+export const CALENDAR_SEARCH_NAMESPACE = 'calendar';++const CALENDAR_PERIOD_PATHS = {+ dayGridMonth: 'month',+ timeGridWeek: 'week',+ timeGridDay: 'day',+} as const satisfies Record<CalendarPeriodView, string>;++export const calendarPeriodParams = z.object({+ period: z+ .enum(['month', 'week', 'day'])+ .transform((period): CalendarPeriodView => {+ if (period === 'month') return 'dayGridMonth';+ if (period === 'day') return 'timeGridDay';+ return 'timeGridWeek';+ }),+});++export function calendarPeriodPath(period: CalendarPeriodView): string {+ return CALENDAR_PERIOD_PATHS[period];+}++export function calendarPath(period: CalendarPeriodView): string {+ return `/calendar/${calendarPeriodPath(period)}`;+}++export function calendarFocusedEventSearchKey(splitIndex = 0): string {+ return `s${splitIndex}.${CALENDAR_SEARCH_NAMESPACE}.eventId`;+}++export const calendarSearch = {+ namespace: CALENDAR_SEARCH_NAMESPACE,+ schema: z.object({ eventId: z.string() }),+ defaults: { eventId: '' },+};++export const calendarSearchCodec = createSearchParamsCodec(calendarSearch);diff --git a/apps/web/src/features/calendar-view/calendar-view.tsx b/apps/web/src/features/calendar-view/calendar-view.tsxnew file mode 100644index 0000000000..7ae042776e--- /dev/null+++ b/apps/web/src/features/calendar-view/calendar-view.tsx@@ -0,0 +1,149 @@+import { CalendarViewContextProvider } from '@app/features/calendar/components/CalendarViewContext';+import { useCalendarUiFlag } from '@app/features/calendar/hooks/use-calendar-ui-flag';+import type { CalendarPeriodView } from '@app/features/calendar/types';+import { isCalendarRangeSupported } from '@app/features/calendar/utils/calendar-supported-range';+import { useAnalytics } from '@app/lib/analytics/analytics-context';+import { usePosthog } from '@app/lib/analytics/posthog';+import {+ createSearchParams,+ useNavigate,+ useParams,+} from '@app/lib/split-router';+import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';+import { LoadingBlock } from '@core/component/LoadingBlock';+import { useUserId } from '@core/context/user';+import { useCalendarOccurrencesQuery } from '@queries/calendar/occurrences';+import { createEffect, createMemo, on, onMount, Show } from 'solid-js';+import { CalendarFocusContextProvider } from './calendar-focus-target';+import { resolveCalendarTarget } from './calendar-target';+import { createCalendarTargetAim } from './calendar-target-request';+import { calendarPath, calendarSearch } from './calendar-url';+import { Workspace } from './components/Workspace';+import { CALENDAR_VIEW_ID, type CalendarViewTarget } from './types';++function CalendarDisabledRedirect() {+ const panel = useSplitPanelOrThrow();+ onMount(() => {+ panel.handle.replace({ next: { type: 'component', id: 'inbox' } });+ });+ return null;+}++function nonEmpty(value: unknown): string | undefined {+ return typeof value === 'string' && value.length > 0 ? value : undefined;+}++/** Route-backed Calendar application view. */+export function CalendarView() {+ const calendarUiEnabled = useCalendarUiFlag();+ const posthog = usePosthog();+ const userId = useUserId();+ const analytics = useAnalytics();+ const panel = useSplitPanelOrThrow();+ const navigate = useNavigate();+ const routeParams = useParams<{ period: CalendarPeriodView }>();+ const [search, setSearch] = createSearchParams(calendarSearch);+ const routeEventId = () => nonEmpty(search.eventId);+ const contentTarget = createMemo<CalendarViewTarget>(() => {+ const content = panel.handle.content();+ if (content.type !== 'component' || content.id !== CALENDAR_VIEW_ID) {+ return {};+ }+ return (content.params ?? {}) as CalendarViewTarget;+ });+ const initialContentTarget = contentTarget();+ const initialAim: CalendarViewTarget = nonEmpty(initialContentTarget.eventId)+ ? initialContentTarget+ : { eventId: routeEventId() };+ const aim = createCalendarTargetAim({ initial: initialAim });+ const targetRequest = aim.target;+ let initializedTargetSync = false;+ let locallyWrittenEventId: string | null = null;++ createEffect(+ on(+ [routeEventId, () => contentTarget().focusRequestId],+ ([eventId, focusRequestId], previous) => {+ if (!initializedTargetSync) {+ initializedTargetSync = true;+ return;+ }+ const previousFocusRequestId = previous?.[1];+ if (+ focusRequestId !== undefined &&+ focusRequestId !== previousFocusRequestId+ ) {+ aim.aimAt(contentTarget());+ return;+ }+ if (eventId === previous?.[0]) return;+ if (locallyWrittenEventId === (eventId ?? '')) {+ locallyWrittenEventId = null;+ return;+ }+ aim.aimAt(eventId ? { eventId } : {});+ }+ )+ );++ const occurrencesQuery = useCalendarOccurrencesQuery(+ () => ({ userId: userId(), range: targetRequest()?.range }),+ () => {+ const request = targetRequest();+ return {+ enabled:+ request !== undefined && isCalendarRangeSupported(request.range),+ refetchOnWindowFocus: false,+ };+ }+ );+ const focusTarget = createMemo(() => {+ const request = targetRequest();+ if (+ !request ||+ occurrencesQuery.isLoading ||+ occurrencesQuery.isPlaceholderData+ ) {+ return undefined;+ }+ return resolveCalendarTarget(occurrencesQuery.data?.items ?? [], request);+ });++ const setFocusedEventId = (eventId: string | undefined) => {+ const next = eventId ?? '';+ if (search.eventId === next) return;+ locallyWrittenEventId = next;+ setSearch({ eventId: next }, { history: 'replace' });+ };+ const setPeriodView = (period: CalendarPeriodView) => {+ if (routeParams.period === period) return;+ navigate(calendarPath(period));+ };++ onMount(() => {+ analytics.pageView('calendar');+ analytics.track('open_view', { viewId: 'calendar' });+ });++ return (+ <Show+ when={calendarUiEnabled()}+ fallback={+ <Show when={posthog.flagsLoaded()} fallback={<LoadingBlock />}>+ <CalendarDisabledRedirect />+ </Show>+ }+ >+ <CalendarFocusContextProvider target={focusTarget}>+ <CalendarViewContextProvider+ periodView={routeParams.period}+ focusedEventId={routeEventId()}+ onPeriodViewChange={setPeriodView}+ onFocusedEventIdChange={setFocusedEventId}+ >+ <Workspace />+ </CalendarViewContextProvider>+ </CalendarFocusContextProvider>+ </Show>+ );+}diff --git a/apps/web/src/features/block-calendar/components/CalendarSearch.tsx b/apps/web/src/features/calendar-view/components/CalendarSearch.tsxsimilarity index 98%rename from apps/web/src/features/block-calendar/components/CalendarSearch.tsxrename to apps/web/src/features/calendar-view/components/CalendarSearch.tsxindex e38eda4b59..be5299c28a 100644--- a/apps/web/src/features/block-calendar/components/CalendarSearch.tsx+++ b/apps/web/src/features/calendar-view/components/CalendarSearch.tsx@@ -27,7 +27,7 @@ import {onMount,Show,} from 'solid-js';-import { createCalendarBlockRange } from '../calendar-range';+import { createCalendarRange } from '../calendar-range';import {eventTimeFromOccurrenceKey,openCalendarEventSplit,@@ -185,7 +185,7 @@ function CalendarEventPreviewContent(props: {/*** Keyword search over the caller's calendar events, opened from the calendar- * header. Selecting a result re-aims the singleton calendar block at that+ * header. Selecting a result re-aims the singleton Calendar view at that* occurrence, the same navigation an event mention or soup row performs.*/export function CalendarSearch() {@@ -267,7 +267,7 @@ function CalendarSearchControl() {const time = event.occurrenceKey? eventTimeFromOccurrenceKey(event.occurrenceKey): event.time;- const range = time ? createCalendarBlockRange(time) : undefined;+ const range = time ? createCalendarRange(time) : undefined;if (range && isCalendarRangeSupported(range)) {setOpen(false);diff --git a/apps/web/src/features/block-calendar/components/EventRsvpScopeDialog.tsx b/apps/web/src/features/calendar-view/components/EventRsvpScopeDialog.tsxsimilarity index 100%rename from apps/web/src/features/block-calendar/components/EventRsvpScopeDialog.tsxrename to apps/web/src/features/calendar-view/components/EventRsvpScopeDialog.tsxdiff --git a/apps/web/src/features/block-calendar/components/EventRsvpSection.test.tsx b/apps/web/src/features/calendar-view/components/EventRsvpSection.test.tsxsimilarity index 100%rename from apps/web/src/features/block-calendar/components/EventRsvpSection.test.tsxrename to apps/web/src/features/calendar-view/components/EventRsvpSection.test.tsxdiff --git a/apps/web/src/features/block-calendar/components/EventRsvpSection.tsx b/apps/web/src/features/calendar-view/components/EventRsvpSection.tsxsimilarity index 100%rename from apps/web/src/features/block-calendar/components/EventRsvpSection.tsxrename to apps/web/src/features/calendar-view/components/EventRsvpSection.tsxdiff --git a/apps/web/src/features/block-calendar/components/Header.tsx b/apps/web/src/features/calendar-view/components/Header.tsxsimilarity index 98%rename from apps/web/src/features/block-calendar/components/Header.tsxrename to apps/web/src/features/calendar-view/components/Header.tsxindex 8f4c99dde1..f01dc50ed6 100644--- a/apps/web/src/features/block-calendar/components/Header.tsx+++ b/apps/web/src/features/calendar-view/components/Header.tsx@@ -9,6 +9,7 @@ import { MonthDrawer } from '@app/features/calendar/components/MonthDrawer';import { PeriodSelector } from '@app/features/calendar/components/PeriodSelector';import { useCalendarHotkeys } from '@app/features/calendar/hooks/use-calendar-hotkeys';import { calendarPeriodLabel } from '@app/features/calendar/utils/calendar-label';+import { useOpenEventComposer } from '@app/features/calendar-view/components/use-open-event-composer';import { useSidePanel } from '@components/app/side-panel/SidePanel';import { HeaderIsland } from '@components/app/split-layout/components/HeaderIsland';import {@@ -26,7 +27,6 @@ import { Button } from '@ui';import { usePager } from '@ui/components/Pager';import { createMemo, createSignal, onCleanup, Show } from 'solid-js';import { CalendarSearch } from './CalendarSearch';-import { useOpenEventComposer } from './use-open-event-composer';const formatMonthTitle = new Intl.DateTimeFormat(undefined, {month: 'long',diff --git a/apps/web/src/features/block-calendar/components/Page.tsx b/apps/web/src/features/calendar-view/components/Page.tsxsimilarity index 99%rename from apps/web/src/features/block-calendar/components/Page.tsxrename to apps/web/src/features/calendar-view/components/Page.tsxindex 3182e6d921..c8bcb13c0d 100644--- a/apps/web/src/features/block-calendar/components/Page.tsx+++ b/apps/web/src/features/calendar-view/components/Page.tsx@@ -29,6 +29,7 @@ import {scrollEventChipIntoView,timeGridScroller,} from '@app/features/calendar/utils/time-grid-scroller';+import { useOpenEventComposer } from '@app/features/calendar-view/components/use-open-event-composer';import { toast } from '@core/component/Toast/Toast';import { ScrollIndicators } from '@core/component/VerticalScrollIndicators';import { isMobile } from '@core/mobile/isMobile';@@ -56,7 +57,6 @@ import {calendarFocusTargetId,useCalendarFocus,} from '../calendar-focus-target';-import { useOpenEventComposer } from './use-open-event-composer';interface CalendarScrollTarget {scrollElement: HTMLElement;diff --git a/apps/web/src/features/block-calendar/components/SelectedEventDetails.tsx b/apps/web/src/features/calendar-view/components/SelectedEventDetails.tsxsimilarity index 97%rename from apps/web/src/features/block-calendar/components/SelectedEventDetails.tsxrename to apps/web/src/features/calendar-view/components/SelectedEventDetails.tsxindex 431905a317..953c6896d1 100644--- a/apps/web/src/features/block-calendar/components/SelectedEventDetails.tsx+++ b/apps/web/src/features/calendar-view/components/SelectedEventDetails.tsx@@ -12,6 +12,11 @@ import {eventEmailRecipients,guestEmails,} from '@app/features/calendar/utils/guest-emails';+import { EventRsvpSection } from '@app/features/calendar-view/components/EventRsvpSection';+import { useOpenEventComposer } from '@app/features/calendar-view/components/use-open-event-composer';+import { useOpenEventEmail } from '@app/features/calendar-view/components/use-open-event-email';+import { copyCalendarEventMention } from '@app/features/calendar-view/copy-event-mention';+import { copyGuestEmails } from '@app/features/calendar-view/copy-guest-emails';import { MobileDrawer } from '@components/app/mobile/MobileDrawer';import { toast } from '@core/component/Toast/Toast';import { isMobile } from '@core/mobile/isMobile';@@ -36,11 +41,6 @@ import {useImperativeDialog,} from '@ui';import { type Accessor, createMemo, createSignal, For, Show } from 'solid-js';-import { copyCalendarEventMention } from '../copy-event-mention';-import { copyGuestEmails } from '../copy-guest-emails';-import { EventRsvpSection } from './EventRsvpSection';-import { useOpenEventComposer } from './use-open-event-composer';-import { useOpenEventEmail } from './use-open-event-email';interface SelectedEventDetailsProps {anchor: Accessor<HTMLElement | undefined>;diff --git a/apps/web/src/features/block-calendar/components/SetupStatus.tsx b/apps/web/src/features/calendar-view/components/SetupStatus.tsxsimilarity index 100%rename from apps/web/src/features/block-calendar/components/SetupStatus.tsxrename to apps/web/src/features/calendar-view/components/SetupStatus.tsxdiff --git a/apps/web/src/features/block-calendar/components/SidePanelSections.tsx b/apps/web/src/features/calendar-view/components/SidePanelSections.tsxsimilarity index 100%rename from apps/web/src/features/block-calendar/components/SidePanelSections.tsxrename to apps/web/src/features/calendar-view/components/SidePanelSections.tsxdiff --git a/apps/web/src/features/block-calendar/components/Workspace.tsx b/apps/web/src/features/calendar-view/components/Workspace.tsxsimilarity index 100%rename from apps/web/src/features/block-calendar/components/Workspace.tsxrename to apps/web/src/features/calendar-view/components/Workspace.tsxdiff --git a/apps/web/src/features/block-calendar/components/use-open-event-composer.ts b/apps/web/src/features/calendar-view/components/use-open-event-composer.tssimilarity index 100%rename from apps/web/src/features/block-calendar/components/use-open-event-composer.tsrename to apps/web/src/features/calendar-view/components/use-open-event-composer.tsdiff --git a/apps/web/src/features/block-calendar/components/use-open-event-email.ts b/apps/web/src/features/calendar-view/components/use-open-event-email.tssimilarity index 100%rename from apps/web/src/features/block-calendar/components/use-open-event-email.tsrename to apps/web/src/features/calendar-view/components/use-open-event-email.tsdiff --git a/apps/web/src/features/block-calendar/copy-event-mention.test.ts b/apps/web/src/features/calendar-view/copy-event-mention.test.tssimilarity index 91%rename from apps/web/src/features/block-calendar/copy-event-mention.test.tsrename to apps/web/src/features/calendar-view/copy-event-mention.test.tsindex 7baa3554ad..2bae8cea5f 100644--- a/apps/web/src/features/block-calendar/copy-event-mention.test.ts+++ b/apps/web/src/features/calendar-view/copy-event-mention.test.ts@@ -62,10 +62,8 @@ describe('copyCalendarEventMentionTarget', () => {});const plain = written()?.['text/plain'] ?? '';- expect(plain).toContain('/app/calendar/');- expect(plain).toContain('eventId=event-1');- expect(plain).toContain(- `occurrenceKey=${encodeURIComponent('2026-08-21T18:00:00+00:00')}`- );+ expect(plain).toMatch(/\/app\/calendar\/(month|week|day)\?/);+ expect(plain).toContain('s0.calendar.eventId=event-1');+ expect(plain).not.toContain('occurrenceKey');});});diff --git a/apps/web/src/features/block-calendar/copy-event-mention.ts b/apps/web/src/features/calendar-view/copy-event-mention.tssimilarity index 85%rename from apps/web/src/features/block-calendar/copy-event-mention.tsrename to apps/web/src/features/calendar-view/copy-event-mention.tsindex 4baaee0431..da2680f2c7 100644--- a/apps/web/src/features/block-calendar/copy-event-mention.ts+++ b/apps/web/src/features/calendar-view/copy-event-mention.ts@@ -1,7 +1,11 @@+import { getPreferredCalendarPeriodView } from '@app/features/calendar/calendar-preferences';import type { CalendarEvent } from '@app/features/calendar/types';+import {+ calendarFocusedEventSearchKey,+ calendarPath,+} from '@app/features/calendar-view/calendar-url';import { toast } from '@core/component/Toast/Toast';import { writeClipboardData } from '@core/util/dataTransfer';-import { CALENDAR_BLOCK_ID } from './types';/** What a copied event needs to come back as a mention or a deep link. */export type CalendarMentionTarget = {@@ -38,7 +42,7 @@ function mentionHtml(target: CalendarMentionTarget): string {}/**- * Deep link to one event on the singleton calendar block, using the same+ * Deep link to one event on the singleton Calendar view, using the same* host convention as the copy-link actions elsewhere in the app.*/export function calendarEventDeepLink(target: {@@ -50,10 +54,10 @@ export function calendarEventDeepLink(target: {hostname = 'dev.macro.com';}const params = new URLSearchParams({- eventId: target.eventId,- ...(target.occurrenceKey ? { occurrenceKey: target.occurrenceKey } : {}),+ [calendarFocusedEventSearchKey()]: target.eventId,});- return `https://${hostname}/app/calendar/${CALENDAR_BLOCK_ID}?${params.toString()}`;+ const path = calendarPath(getPreferredCalendarPeriodView());+ return `https://${hostname}/app${path}?${params.toString()}`;}/**diff --git a/apps/web/src/features/block-calendar/copy-guest-emails.test.ts b/apps/web/src/features/calendar-view/copy-guest-emails.test.tssimilarity index 100%rename from apps/web/src/features/block-calendar/copy-guest-emails.test.tsrename to apps/web/src/features/calendar-view/copy-guest-emails.test.tsdiff --git a/apps/web/src/features/block-calendar/copy-guest-emails.ts b/apps/web/src/features/calendar-view/copy-guest-emails.tssimilarity index 100%rename from apps/web/src/features/block-calendar/copy-guest-emails.tsrename to apps/web/src/features/calendar-view/copy-guest-emails.tsdiff --git a/apps/web/src/features/calendar-view/open-calendar-event.ts b/apps/web/src/features/calendar-view/open-calendar-event.tsnew file mode 100644index 0000000000..5f950cf5d5--- /dev/null+++ b/apps/web/src/features/calendar-view/open-calendar-event.ts@@ -0,0 +1,51 @@+import {+ enableCalendarUi,+ isFeatureEnabled,+} from '@core/constant/featureFlags';+import { openCalendarView } from './calendar-navigation';+import { type CalendarEventTime, createCalendarRange } from './calendar-range';++export type CalendarEventOpenTarget = {+ /** The viewer's own event entity to focus. */+ eventId: string;+ /** Instance to focus, for recurring events. */+ occurrenceKey?: string;+ /** Instance timing used to build the locator range. */+ time?: CalendarEventTime;+ openInNewSplit?: boolean;+};++/**+ * Timed occurrence keys are the instance's RFC 3339 start and all-day keys+ * its YYYY-MM-DD start date, so a key alone can anchor the locator range+ * when no richer timing is at hand.+ */+export function eventTimeFromOccurrenceKey(+ occurrenceKey: string+): CalendarEventTime | undefined {+ if (/^\d{4}-\d{2}-\d{2}$/.test(occurrenceKey)) {+ return { kind: 'allDay', startDate: occurrenceKey };+ }+ const startsAt = new Date(occurrenceKey);+ if (!Number.isFinite(startsAt.getTime())) return undefined;+ return { kind: 'timed', startsAt: occurrenceKey };+}++/** Open or retarget the singleton Calendar application view. */+export async function openCalendarEventSplit(target: CalendarEventOpenTarget) {+ if (!isFeatureEnabled(enableCalendarUi)) return;+ const time =+ target.time ??+ (target.occurrenceKey+ ? eventTimeFromOccurrenceKey(target.occurrenceKey)+ : undefined);++ openCalendarView(+ {+ eventId: target.eventId,+ occurrenceKey: target.occurrenceKey,+ range: time ? createCalendarRange(time) : undefined,+ },+ { openInNewSplit: target.openInNewSplit }+ );+}diff --git a/apps/web/src/features/calendar-view/route.test.ts b/apps/web/src/features/calendar-view/route.test.tsnew file mode 100644index 0000000000..f1440dda50--- /dev/null+++ b/apps/web/src/features/calendar-view/route.test.ts@@ -0,0 +1,49 @@+import {+ createRoutesManifest,+ decodeRoute,+ encodeRoute,+ getRouteClaim,+ getRouteSearchNamespaces,+ routeParams,+} from '@app/lib/split-router';+import { describe, expect, it } from 'vitest';+import { CALENDAR_SEARCH_NAMESPACE, calendarSearchCodec } from './calendar-url';+import { calendarSplitRoute } from './route';++const routes = createRoutesManifest({ definitions: [calendarSplitRoute] });++describe('Calendar split route', () => {+ it.each([+ ['month', 'dayGridMonth'],+ ['week', 'timeGridWeek'],+ ['day', 'timeGridDay'],+ ] as const)('round-trips the %s period', (pathPeriod, period) => {+ const entry = decodeRoute(routes, ['calendar', pathPeriod]);+ expect(entry).toBeDefined();+ expect(routeParams(entry?.location.route)).toEqual({ period });+ expect(encodeRoute(routes, entry!)).toEqual(['calendar', pathPeriod]);+ expect(getRouteSearchNamespaces(routes, entry!.location.route)).toEqual(+ new Set([CALENDAR_SEARCH_NAMESPACE])+ );+ expect(getRouteClaim(routes, entry!.location.route)).toEqual({+ namespace: 'component',+ id: 'calendar',+ });+ });++ it('rejects missing and unknown periods', () => {+ expect(decodeRoute(routes, ['calendar'])).toBeUndefined();+ expect(decodeRoute(routes, ['calendar', 'agenda'])).toBeUndefined();+ });++ it('serializes only a non-empty focused event id', () => {+ expect(calendarSearchCodec.serialize({ eventId: '' })).toBeUndefined();+ expect(calendarSearchCodec.serialize({ eventId: 'event-1' })).toEqual({+ eventId: ['event-1'],+ });+ expect(calendarSearchCodec.parse({ eventId: ['event-1'] })).toEqual({+ value: { eventId: 'event-1' },+ valid: true,+ });+ });+});diff --git a/apps/web/src/features/calendar-view/route.tsx b/apps/web/src/features/calendar-view/route.tsxnew file mode 100644index 0000000000..67831dce67--- /dev/null+++ b/apps/web/src/features/calendar-view/route.tsx@@ -0,0 +1,29 @@+import { defineRoute } from '@app/lib/split-router';+import { withAuth } from '@components/app/split-layout/split-router/app-route-shell';+import { lazy } from 'solid-js';+import {+ CALENDAR_ROUTE_ID,+ CALENDAR_SEARCH_NAMESPACE,+ calendarPeriodParams,+ calendarPeriodPath,+} from './calendar-url';+import { CALENDAR_VIEW_ID } from './types';++const CalendarView = lazy(async () => ({+ default: (await import('./calendar-view')).CalendarView,+}));++export const CalendarRouteView = withAuth(() => <CalendarView />);++export const calendarSplitRoute = defineRoute({+ id: CALENDAR_ROUTE_ID,+ path: 'calendar/:period',+ params: calendarPeriodParams,+ serializeParams: ({ period }) => ({+ period: calendarPeriodPath(period),+ }),+ search: [CALENDAR_SEARCH_NAMESPACE],+ externalSearch: ['eventId'],+ component: CalendarRouteView,+ claim: () => ({ namespace: 'component', id: CALENDAR_VIEW_ID }),+});diff --git a/apps/web/src/features/calendar-view/types.ts b/apps/web/src/features/calendar-view/types.tsnew file mode 100644index 0000000000..98603c240f--- /dev/null+++ b/apps/web/src/features/calendar-view/types.ts@@ -0,0 +1,25 @@+import type { CalendarOccurrenceQueryRange } from '@queries/calendar/occurrences';++/** Stable identity used by the Calendar application view. */+export const CALENDAR_VIEW_ID = 'calendar';++/** Optional navigation target carried by an in-app Calendar route entry. */+export interface CalendarViewTarget {+ /** Canonical event to focus. */+ eventId?: string;+ /** Exact half-open occurrence API range used to locate `eventId`. */+ range?: CalendarOccurrenceQueryRange;+ /** Stable occurrence key, when the target is a recurring event instance. */+ occurrenceKey?: string;+ /** Monotonic token that makes repeated navigation to one event observable. */+ focusRequestId?: number;+}++/** A validated request to locate and focus one event occurrence. */+export interface CalendarFocusRequest {+ eventId: string;+ range: CalendarOccurrenceQueryRange;+ occurrenceKey?: string;+ requestId: number;+ requestedAt: number;+}diff --git a/apps/web/src/features/calendar/availability/settings.ts b/apps/web/src/features/calendar/availability/settings.tsindex 63fbab136b..1de9301f71 100644--- a/apps/web/src/features/calendar/availability/settings.ts+++ b/apps/web/src/features/calendar/availability/settings.ts@@ -7,7 +7,7 @@import { makePersisted } from '@solid-primitives/storage';import { createSignal } from 'solid-js';-import { CALENDAR_PREFERENCES_KEY } from '../components/CalendarViewContext';+import { CALENDAR_PREFERENCES_KEY } from '../calendar-preferences';import type { CalendarTimeFormat } from '../types';import { getDefaultCalendarTimeFormat } from '../utils/time-format';import {@@ -81,7 +81,7 @@ export function useAvailabilitySettings() {/*** The calendar's persisted 12/24-hour preference, readable outside the- * calendar block (the email composer has no CalendarViewContext). Read at+ * Calendar view (the email composer has no CalendarViewContext). Read at* copy time, so a preference change applies to the next copy.*/export function getPersistedCalendarTimeFormat(): CalendarTimeFormat {diff --git a/apps/web/src/features/calendar/calendar-preferences.ts b/apps/web/src/features/calendar/calendar-preferences.tsnew file mode 100644index 0000000000..d90147348d--- /dev/null+++ b/apps/web/src/features/calendar/calendar-preferences.ts@@ -0,0 +1,28 @@+import { isMobile } from '@core/mobile/isMobile';+import type { CalendarPeriodView } from './types';++/** Storage key shared by the calendar view and consumers of its preferences. */+export const CALENDAR_PREFERENCES_KEY = 'macro:pref:calendar:settings';++function isCalendarPeriodView(value: unknown): value is CalendarPeriodView {+ return (+ value === 'dayGridMonth' ||+ value === 'timeGridWeek' ||+ value === 'timeGridDay'+ );+}++/** The period a navigation without explicit route state should open. */+export function getPreferredCalendarPeriodView(): CalendarPeriodView {+ try {+ const raw = localStorage.getItem(CALENDAR_PREFERENCES_KEY);+ if (raw) {+ const periodView = (JSON.parse(raw) as { periodView?: unknown })+ .periodView;+ if (isCalendarPeriodView(periodView)) return periodView;+ }+ } catch {+ // Unreadable storage falls through to the device default.+ }+ return isMobile() ? 'timeGridDay' : 'timeGridWeek';+}diff --git a/apps/web/src/features/calendar/components/CalendarPagerContext.tsx b/apps/web/src/features/calendar/components/CalendarPagerContext.tsxindex b3c4eec354..2991a16a9f 100644--- a/apps/web/src/features/calendar/components/CalendarPagerContext.tsx+++ b/apps/web/src/features/calendar/components/CalendarPagerContext.tsx@@ -282,6 +282,18 @@ function createCalendarPagerContext(props: CalendarPagerContextProps) {synchronizeBuffers();};+ // Browser history and direct URL navigation can change the route period+ // without going through `changeView`. Keep the mounted pager in sync without+ // emitting another route update or clearing an event that remains focused.+ createEffect(() => {+ const view = props.initialView;+ const api = activePage()?.api();+ if (!api || api.view.type === view) return;+ pager.cancel();+ api.changeView(view);+ synchronizeBuffers();+ });+return {pager,pageOrder,diff --git a/apps/web/src/features/calendar/components/CalendarViewContext.tsx b/apps/web/src/features/calendar/components/CalendarViewContext.tsxindex ba2a696ce3..1611fa7b2d 100644--- a/apps/web/src/features/calendar/components/CalendarViewContext.tsx+++ b/apps/web/src/features/calendar/components/CalendarViewContext.tsx@@ -1,8 +1,18 @@import { createAssertedContextProvider } from '@core/context/createContext';-import { isMobile } from '@core/mobile/isMobile';import { makePersisted } from '@solid-primitives/storage';-import { batch, createMemo, createSignal } from 'solid-js';+import {+ batch,+ createEffect,+ createMemo,+ createSignal,+ on,+ type ParentProps,+} from 'solid-js';import { createStore } from 'solid-js/store';+import {+ CALENDAR_PREFERENCES_KEY,+ getPreferredCalendarPeriodView,+} from '../calendar-preferences';import { useCalendarSources } from '../hooks/use-calendar-sources';import {type CalendarEvent,@@ -28,25 +38,33 @@ interface CalendarPreferences {timeFormat: CalendarTimeFormat;}-/** Storage key for calendar display preferences (also read at copy time by- * the availability feature, which runs outside this context). */-export const CALENDAR_PREFERENCES_KEY = 'macro:pref:calendar:settings';+type CalendarViewContextProps = ParentProps<{+ periodView?: CalendarPeriodView;+ focusedEventId?: string;+ onPeriodViewChange?: (periodView: CalendarPeriodView) => void;+ onFocusedEventIdChange?: (eventId: string | undefined) => void;+}>;-function createCalendarEventSelection() {+function createCalendarEventSelection(+ onFocusedEventIdChange?: (eventId: string | undefined) => void+) {const [event, setEvent] = createSignal<CalendarEvent>();const [anchor, setAnchor] = createSignal<HTMLElement>();- const close = () => {+ const close = (notify = true) => {+ const hadSelection = event() !== undefined || anchor() !== undefined;batch(() => {setEvent(undefined);setAnchor(undefined);});+ if (notify && hadSelection) onFocusedEventIdChange?.(undefined);};const select = (nextEvent: CalendarEvent, nextAnchor: HTMLElement) => {batch(() => {setEvent(() => nextEvent);setAnchor(nextAnchor);});+ onFocusedEventIdChange?.(nextEvent.eventId);};const refresh = (nextEvent: CalendarEvent) => {if (event()?.id === nextEvent.id) setEvent(nextEvent);@@ -56,89 +74,118 @@ function createCalendarEventSelection() {}export const [CalendarViewContextProvider, useCalendarView] =- createAssertedContextProvider('CalendarViewContext', () => {- const defaultPreferences: CalendarPreferences = {- periodView: isMobile() ? 'timeGridDay' : 'timeGridWeek',- hiddenSourceIds: [],- showWeekends: true,- weekStartsOn: 0,- timeFormat: getDefaultCalendarTimeFormat(),- };- const [preferences, setPreferences] = makePersisted(- createStore<CalendarPreferences>(defaultPreferences),- {- name: CALENDAR_PREFERENCES_KEY,- deserialize: (value) => ({- ...defaultPreferences,- ...(JSON.parse(value) as Partial<CalendarPreferences>),- }),- }- );- const { sources, sourceById } = useCalendarSources();- // Sources default to visible, so calendars discovered after a- // preference was saved (or events whose calendar is still loading)- // never silently disappear.- const hiddenSourceIds = createMemo(- () => new Set(preferences.hiddenSourceIds)- );- const isSourceVisible = (sourceId: string) =>- !hiddenSourceIds().has(sourceId);+ createAssertedContextProvider(+ 'CalendarViewContext',+ (props: CalendarViewContextProps) => {+ const defaultPreferences: CalendarPreferences = {+ periodView: getPreferredCalendarPeriodView(),+ hiddenSourceIds: [],+ showWeekends: true,+ weekStartsOn: 0,+ timeFormat: getDefaultCalendarTimeFormat(),+ };+ const [preferences, setPreferences] = makePersisted(+ createStore<CalendarPreferences>(defaultPreferences),+ {+ name: CALENDAR_PREFERENCES_KEY,+ deserialize: (value) => ({+ ...defaultPreferences,+ ...(JSON.parse(value) as Partial<CalendarPreferences>),+ }),+ }+ );+ const { sources, sourceById } = useCalendarSources();+ // Sources default to visible, so calendars discovered after a+ // preference was saved (or events whose calendar is still loading)+ // never silently disappear.+ const hiddenSourceIds = createMemo(+ () => new Set(preferences.hiddenSourceIds)+ );+ const isSourceVisible = (sourceId: string) =>+ !hiddenSourceIds().has(sourceId);- const selection = createCalendarEventSelection();- const displaySettings: CalendarDisplaySettings = {- get periodView() {- return preferences.periodView;- },- get showWeekends() {- return preferences.showWeekends;- },- get weekStartsOn() {- return preferences.weekStartsOn;- },- get timeFormat() {- return preferences.timeFormat;- },- };+ const selection = createCalendarEventSelection(+ props.onFocusedEventIdChange+ );+ createEffect(() => {+ const periodView = props.periodView;+ if (periodView && preferences.periodView !== periodView) {+ setPreferences('periodView', periodView);+ }+ });+ createEffect(+ on(+ () => props.focusedEventId,+ (focusedEventId, previousEventId) => {+ const selectedEvent = selection.event();+ if (+ previousEventId !== undefined &&+ focusedEventId !== previousEventId &&+ selectedEvent &&+ selectedEvent.eventId !== focusedEventId+ ) {+ selection.close(false);+ }+ }+ )+ );+ const displaySettings: CalendarDisplaySettings = {+ get periodView() {+ return props.periodView ?? preferences.periodView;+ },+ get showWeekends() {+ return preferences.showWeekends;+ },+ get weekStartsOn() {+ return preferences.weekStartsOn;+ },+ get timeFormat() {+ return preferences.timeFormat;+ },+ };- const closeEventDetails = selection.close;+ const closeEventDetails = () => selection.close();- const setSourceVisibility = (sourceId: string, visible: boolean) => {- setPreferences('hiddenSourceIds', (current) =>- visible- ? current.filter((id) => id !== sourceId)- : current.includes(sourceId)- ? current- : [...current, sourceId]- );+ const setSourceVisibility = (sourceId: string, visible: boolean) => {+ setPreferences('hiddenSourceIds', (current) =>+ visible+ ? current.filter((id) => id !== sourceId)+ : current.includes(sourceId)+ ? current+ : [...current, sourceId]+ );- const selected = selection.event();- if (- !visible &&- selected &&- !isCalendarEventVisible(selected, isSourceVisible)- ) {- closeEventDetails();- }- };+ const selected = selection.event();+ if (+ !visible &&+ selected &&+ !isCalendarEventVisible(selected, isSourceVisible)+ ) {+ closeEventDetails();+ }+ };- return {- displaySettings,- sources,- sourceById,- isSourceVisible,- setSourceVisibility,- selectedEvent: selection.event,- selectedEventAnchor: selection.anchor,- setPeriodView: (periodView: CalendarPeriodView) =>- setPreferences('periodView', periodView),- setShowWeekends: (showWeekends: boolean) =>- setPreferences('showWeekends', showWeekends),- setWeekStartsOn: (weekStartsOn: CalendarWeekStart) =>- setPreferences('weekStartsOn', weekStartsOn),- setTimeFormat: (timeFormat: CalendarTimeFormat) =>- setPreferences('timeFormat', timeFormat),- closeEventDetails,- selectEvent: selection.select,- refreshSelectedEvent: selection.refresh,- };- });+ return {+ displaySettings,+ sources,+ sourceById,+ isSourceVisible,+ setSourceVisibility,+ selectedEvent: selection.event,+ selectedEventAnchor: selection.anchor,+ setPeriodView: (periodView: CalendarPeriodView) => {+ setPreferences('periodView', periodView);+ props.onPeriodViewChange?.(periodView);+ },+ setShowWeekends: (showWeekends: boolean) =>+ setPreferences('showWeekends', showWeekends),+ setWeekStartsOn: (weekStartsOn: CalendarWeekStart) =>+ setPreferences('weekStartsOn', weekStartsOn),+ setTimeFormat: (timeFormat: CalendarTimeFormat) =>+ setPreferences('timeFormat', timeFormat),+ closeEventDetails,+ selectEvent: selection.select,+ refreshSelectedEvent: selection.refresh,+ };+ }+ );diff --git a/apps/web/src/features/entity/extractors-notification/notification-copy-link.ts b/apps/web/src/features/entity/extractors-notification/notification-copy-link.tsindex cc88407f86..c55a382138 100644--- a/apps/web/src/features/entity/extractors-notification/notification-copy-link.ts+++ b/apps/web/src/features/entity/extractors-notification/notification-copy-link.ts@@ -1,4 +1,4 @@-import { copyCalendarEventMentionTarget } from '@block-calendar/copy-event-mention';+import { copyCalendarEventMentionTarget } from '@app/features/calendar-view/copy-event-mention';import { toast } from '@core/component/Toast/Toast';import { buildSimpleEntityUrl } from '@core/util/url';import {diff --git a/apps/web/src/features/inbox-view/inbox-route.ts b/apps/web/src/features/inbox-view/inbox-route.tsindex ca61d05ce4..06dda12986 100644--- a/apps/web/src/features/inbox-view/inbox-route.ts+++ b/apps/web/src/features/inbox-view/inbox-route.ts@@ -1,7 +1,9 @@+import { calendarViewContent } from '@app/features/calendar-view/calendar-navigation';import { createSearchParamsCodec } from '@app/lib/split-router';import { CALENDAR_BLOCK_ID } from '@block-calendar/types';import { URL_PARAMS as CHANNEL_URL_PARAMS } from '@block-channel/constants';import type { PreviewPanelSelection } from '@components/app/previewTarget';+import type { SplitContent } from '@components/app/split-layout/layoutManager';import type { BlockName } from '@core/block';import { fileTypeToResolvedBlockName } from '@core/constant/allBlocks';import { USE_MACRO_PR_SUMMARY_BLOCK } from '@core/constant/featureFlags';@@ -326,11 +328,7 @@ export function inboxPreviewSelection(export function inboxPreviewLegacyTarget(params: InboxPreviewRouteParams,search: InboxPreviewSearchParams-): {- type: BlockName | 'task' | 'snippet' | 'skill';- id: string;- params?: Record<string, unknown>;-} {+): SplitContent {const documentSubType =search.selectionType === 'document'? search.subType@@ -367,17 +365,11 @@ export function inboxPreviewLegacyTarget(endDate: search.endDate,}: undefined;- return {- type: 'calendar',- id: CALENDAR_BLOCK_ID,- params: {- ...(search.eventId ? { eventId: search.eventId } : {}),- ...(search.occurrenceKey- ? { occurrenceKey: search.occurrenceKey }- : {}),- ...(range ? { range } : {}),- },- };+ return calendarViewContent({+ eventId: search.eventId || undefined,+ occurrenceKey: search.occurrenceKey || undefined,+ range,+ });}return { type: params.blockType, id: params.previewId };}diff --git a/apps/web/src/features/next-soup/actions/make-copy-link-action.ts b/apps/web/src/features/next-soup/actions/make-copy-link-action.tsindex 0d9488979b..ffcadf681d 100644--- a/apps/web/src/features/next-soup/actions/make-copy-link-action.ts+++ b/apps/web/src/features/next-soup/actions/make-copy-link-action.ts@@ -1,4 +1,4 @@-import { copyCalendarEventMentionTarget } from '@block-calendar/copy-event-mention';+import { copyCalendarEventMentionTarget } from '@app/features/calendar-view/copy-event-mention';import { getChannelParams } from '@block-channel/utils/link';import { toast } from '@core/component/Toast/Toast';import { fileTypeToBlockName } from '@core/constant/allBlocks';diff --git a/apps/web/src/features/next-soup/utils.test.ts b/apps/web/src/features/next-soup/utils.test.tsindex 3879e040b6..92eaa4ee52 100644--- a/apps/web/src/features/next-soup/utils.test.ts+++ b/apps/web/src/features/next-soup/utils.test.ts@@ -343,14 +343,11 @@ describe('mark-done orchestration', () => {});});-describe('calendar block navigation', () => {- it('opens and targets the singleton calendar block', async () => {+describe('calendar view navigation', () => {+ it('opens and targets the singleton Calendar route', async () => {const openWithSplit = vi.fn(() => ({ status: 'unavailable' }));- const goToLocationFromParams = vi.fn();- const getBlockHandle = vi.fn(async () => ({ goToLocationFromParams }));setGlobalSplitManager({activeSplit: vi.fn(),- getOrchestrator: vi.fn(() => ({ getBlockHandle })),getSplitByContent: vi.fn(),findOpenView: vi.fn(),openWithSplit,@@ -378,8 +375,8 @@ describe('calendar block navigation', () => {expect(openWithSplit).toHaveBeenCalledWith(expect.objectContaining({- type: 'calendar',- id: 'view',+ type: 'component',+ id: 'calendar',params: expect.objectContaining({eventId: 'event-1',occurrenceKey: 'instance-1',@@ -388,13 +385,19 @@ describe('calendar block navigation', () => {endDate: '2026-01-28',}),}),+ entryMetadata: expect.objectContaining({+ route: {+ matches: [+ expect.objectContaining({+ id: 'view-calendar',+ }),+ ],+ },+ search: { calendar: { eventId: ['event-1'] } },+ }),}),expect.any(Object));- expect(getBlockHandle).toHaveBeenCalledWith('view', 'calendar');- expect(goToLocationFromParams).toHaveBeenCalledWith(- expect.objectContaining({ eventId: 'event-1' })- );});});diff --git a/apps/web/src/features/next-soup/utils.ts b/apps/web/src/features/next-soup/utils.tsindex 768f0e1257..6333f7ddd6 100644--- a/apps/web/src/features/next-soup/utils.ts+++ b/apps/web/src/features/next-soup/utils.ts@@ -1,4 +1,15 @@import { isListViewID } from '@app/constants/list-views';+import { getPreferredCalendarPeriodView } from '@app/features/calendar/calendar-preferences';+import { openCalendarView } from '@app/features/calendar-view/calendar-navigation';+import { createCalendarRange } from '@app/features/calendar-view/calendar-range';+import {+ calendarFocusedEventSearchKey,+ calendarPath,+} from '@app/features/calendar-view/calendar-url';+import {+ CALENDAR_VIEW_ID,+ type CalendarViewTarget,+} from '@app/features/calendar-view/types';import { driveDocumentFromContent } from '@app/features/drive-view/primitives/drive-route';import { URL_PARAMS as EMAIL_PARAMS } from '@app/features/email-thread/core/location';import { withListNavigationSource } from '@app/features/soup/collection/list-navigation-source';@@ -8,11 +19,7 @@ import {scopeChannelNotificationsForEntity,} from '@app/features/soup/entity-notifications';import { globalSplitManager } from '@app/signal/splitLayout';-import { createCalendarBlockRange } from '@block-calendar/calendar-range';-import {- CALENDAR_BLOCK_ID,- type CalendarBlockProps,-} from '@block-calendar/types';+import { CALENDAR_BLOCK_ID } from '@block-calendar/types';import { URL_PARAMS as CALL_PARAMS } from '@block-call/constants';import { URL_PARAMS as CHANNEL_PARAMS } from '@block-channel/constants';import {@@ -254,7 +261,7 @@ export const openEntityInNewTab = ({// Build URL for the entitylet entityPath: string;if (entity.type === 'calendar_event') {- entityPath = `/app/calendar/${CALENDAR_BLOCK_ID}`;+ entityPath = `/app${calendarPath(getPreferredCalendarPeriodView())}`;} else if (entity.type === 'document') {const { fileType, subType } = entity;const blockName = fileTypeToBlockName(subType?.type ?? fileType);@@ -271,7 +278,15 @@ export const openEntityInNewTab = ({// Add location params if presentlet entityUrl = new URL(entityPath, window.location.origin);- if (entity.type === 'channel_message' || entity.type === 'channel_thread') {+ if (entity.type === 'calendar_event') {+ entityUrl.searchParams.set(+ calendarFocusedEventSearchKey(),+ calendarViewTargetForEntity(entity).eventId ?? entity.id+ );+ } else if (+ entity.type === 'channel_message' ||+ entity.type === 'channel_thread'+ ) {entityUrl.searchParams.set(CHANNEL_PARAMS.message, entity.messageId);if (entity.threadId) {entityUrl.searchParams.set(CHANNEL_PARAMS.thread, entity.threadId);@@ -531,8 +546,8 @@ export type CalendarPreviewSelection = WithNotification<Pick<CalendarEventEntity, 'id' | 'type' | 'time' | 'occurrenceKey'>>;-/** Retargets the singleton Calendar block to a calendar event row. */-export async function navigateCalendarEntityToTarget(+/** Retargets a legacy calendar preview block to a calendar event row. */+export async function navigateCalendarPreviewToTarget(entity: CalendarPreviewSelection,blockOrchestrator: BlockOrchestrator): Promise<void> {@@ -541,7 +556,7 @@ export async function navigateCalendarEntityToTarget('calendar');await calendarHandle?.goToLocationFromParams(- calendarBlockParamsForEntity(entity)+ calendarViewTargetForEntity(entity));}@@ -612,35 +627,20 @@ export const openEntityInSplitFromUnifiedList = async (}if (entity.type === 'foreign') return;- const blockOrchestrator = splitManager.getOrchestrator();-- // Calendar is a singleton block. Event opens retarget that one instance- // with a locator range, including repeat clicks on an already-open split.if (entity.type === 'calendar_event') {if (!isFeatureEnabled(enableCalendarUi)) return;- const params = calendarBlockParamsForEntity(entity);- const existing = splitManager.getSplitByContent(- 'calendar',- CALENDAR_BLOCK_ID- );- if (existing) {- existing.activate();- } else {- splitManager.openWithSplit(- { type: 'calendar', id: CALENDAR_BLOCK_ID, params },- {- activate: true,- referredFrom: null,- preferNewSplit: openInNewSplit,- handle: splitHandle,- mergeHistory,- }- );- }- await navigateCalendarEntityToTarget(entity, blockOrchestrator);+ openCalendarView(calendarViewTargetForEntity(entity), {+ manager: splitManager,+ handle: splitHandle,+ openInNewSplit,+ mergeHistory,+ referredFrom: options.referredFrom,+ });return;}+ const blockOrchestrator = splitManager.getOrchestrator();+if (entity.type === 'channel' && entity.unreadNotifications !== undefined) {try {entity = await hydrateChannelNotificationSelection(@@ -807,14 +807,14 @@ export function calendarEventLinkTarget(entity: CalendarPreviewSelection): {eventId: string;occurrenceKey?: string;} {- const { eventId, occurrenceKey } = calendarBlockParamsForEntity(entity);+ const { eventId, occurrenceKey } = calendarViewTargetForEntity(entity);return { eventId: eventId ?? entity.id, occurrenceKey };}-/** Build singleton calendar block parameters for an event row's occurrence. */-export function calendarBlockParamsForEntity(+/** Build a Calendar view focus target for an event row's occurrence. */+export function calendarViewTargetForEntity(entity: CalendarPreviewSelection-): CalendarBlockProps {+): CalendarViewTarget {const notifications = isWithNotification(entity)? (entity.notifications?.() ?? []): [];@@ -838,7 +838,7 @@ export function calendarBlockParamsForEntity(// A reminder names a precise instance, so it wins; otherwise fall back to// whatever resolved the row (search supplies one, soup does not).occurrenceKey: content?.occurrenceKey ?? entity.occurrenceKey,- range: time ? createCalendarBlockRange(time) : undefined,+ range: time ? createCalendarRange(time) : undefined,};}@@ -906,10 +906,10 @@ function getEntitySplitContent(entity: EntityData) {id: `reminder-view~${entity.id}`,};})- // Calendar events open the singleton calendar block; the open path- // branches before reaching here, so this only serves duplicate checks.+ // Calendar events open the singleton Calendar application view; the open+ // path branches before reaching here, so this only serves duplicate checks..with({ type: 'calendar_event' }, () => {- return { type: 'calendar' as const, id: CALENDAR_BLOCK_ID };+ return { type: 'component' as const, id: CALENDAR_VIEW_ID };}).otherwise((entity) => {return { type: entity.type, id: entity.id };diff --git a/apps/web/src/features/notifications/notification-navigation.ts b/apps/web/src/features/notifications/notification-navigation.tsindex 4fe6d56bd9..bf1c6adeac 100644--- a/apps/web/src/features/notifications/notification-navigation.ts+++ b/apps/web/src/features/notifications/notification-navigation.ts@@ -1,5 +1,5 @@-import { createCalendarBlockRange } from '@block-calendar/calendar-range';-import { CALENDAR_BLOCK_ID } from '@block-calendar/types';+import { openCalendarView } from '@app/features/calendar-view/calendar-navigation';+import { createCalendarRange } from '@app/features/calendar-view/calendar-range';import {getChannelParams,navigateToChannelMessage,@@ -403,16 +403,19 @@ function getSupportedHandler(: content.startDate? { kind: 'allDay' as const, startDate: content.startDate }: undefined;- const range = time ? createCalendarBlockRange(time) : undefined;- openSplitIfNotOpen(lm, 'calendar', CALENDAR_BLOCK_ID, {- newSplit,- sourceHandle,- params: {+ const range = time ? createCalendarRange(time) : undefined;+ openCalendarView(+ {eventId: content.eventId,occurrenceKey: content.occurrenceKey,range,},- });+ {+ manager: lm,+ handle: sourceHandle,+ openInNewSplit: newSplit,+ }+ );};}).with('inbox_reauth_required', () => null)diff --git a/apps/web/src/features/notifications/tests/channel-notification-navigation.test.ts b/apps/web/src/features/notifications/tests/channel-notification-navigation.test.tsindex 7a736d77e4..45088f6bef 100644--- a/apps/web/src/features/notifications/tests/channel-notification-navigation.test.ts+++ b/apps/web/src/features/notifications/tests/channel-notification-navigation.test.ts@@ -16,8 +16,11 @@ vi.mock('@core/constant/settingsTabsConfig', () => ({settingsTabToSlug: (tab: string) => tab,}));vi.mock('@core/component/Toast/Toast', () => ({ toast: { alert: vi.fn() } }));-vi.mock('@block-calendar/calendar-range', () => ({- createCalendarBlockRange: vi.fn(),+vi.mock('@app/features/calendar-view/calendar-range', () => ({+ createCalendarRange: vi.fn(),+}));+vi.mock('@app/features/calendar-view/calendar-navigation', () => ({+ openCalendarView: vi.fn(),}));vi.mock('@core/constant/allBlocks', () => ({isBlockAlias: () => false,diff --git a/apps/web/src/features/notifications/tests/spreadsheet-comment-navigation.test.ts b/apps/web/src/features/notifications/tests/spreadsheet-comment-navigation.test.tsindex 6712d6e4f9..550a08f00e 100644--- a/apps/web/src/features/notifications/tests/spreadsheet-comment-navigation.test.ts+++ b/apps/web/src/features/notifications/tests/spreadsheet-comment-navigation.test.ts@@ -18,8 +18,11 @@ import type { SplitManager } from '@components/app/split-layout/layoutManager';import { expect, it, vi } from 'vitest';import type { UnifiedNotification } from '../types';-vi.mock('@block-calendar/calendar-range', () => ({- createCalendarBlockRange: vi.fn(),+vi.mock('@app/features/calendar-view/calendar-range', () => ({+ createCalendarRange: vi.fn(),+}));+vi.mock('@app/features/calendar-view/calendar-navigation', () => ({+ openCalendarView: vi.fn(),}));vi.mock('@block-channel/utils/link', () => ({getChannelParams: vi.fn(),diff --git a/apps/web/src/lib/core/component/AI/component/tool/CalendarTools.tsx b/apps/web/src/lib/core/component/AI/component/tool/CalendarTools.tsxindex 8a435dac08..bdc16cf42e 100644--- a/apps/web/src/lib/core/component/AI/component/tool/CalendarTools.tsx+++ b/apps/web/src/lib/core/component/AI/component/tool/CalendarTools.tsx@@ -1,4 +1,4 @@-import type { CalendarBlockEventTime } from '@block-calendar/calendar-range';+import type { CalendarEventTime } from '@app/features/calendar-view/calendar-range';import CalendarBlank from '@phosphor-icons/core/regular/calendar-blank.svg';import CalendarDots from '@phosphor-icons/core/regular/calendar-dots.svg';import CalendarPlus from '@phosphor-icons/core/regular/calendar-plus.svg';@@ -124,7 +124,7 @@ function CalendarMutationCard(props: {/** Instance the call targeted, for occurrence-scoped mutations. */occurrenceKey?: string;/** Locator timing to use instead of the returned event's own. */- openTime?: CalendarBlockEventTime;+ openTime?: CalendarEventTime;renderContext: Parameters<typeof BaseTool>[0]['renderContext'];status?: string;title?: string;diff --git a/apps/web/src/lib/core/component/AI/component/tool/calendar/open-tool-event.test.ts b/apps/web/src/lib/core/component/AI/component/tool/calendar/open-tool-event.test.tsindex 9206be00f4..a8da380a22 100644--- a/apps/web/src/lib/core/component/AI/component/tool/calendar/open-tool-event.test.ts+++ b/apps/web/src/lib/core/component/AI/component/tool/calendar/open-tool-event.test.ts@@ -7,7 +7,7 @@ import {const openCalendarEventSplit = vi.hoisted(() => vi.fn());-vi.mock('@block-calendar/open-calendar-event', () => ({+vi.mock('@app/features/calendar-view/open-calendar-event', () => ({openCalendarEventSplit,}));diff --git a/apps/web/src/lib/core/component/AI/component/tool/calendar/open-tool-event.ts b/apps/web/src/lib/core/component/AI/component/tool/calendar/open-tool-event.tsindex e107ae9caf..eff3204b26 100644--- a/apps/web/src/lib/core/component/AI/component/tool/calendar/open-tool-event.ts+++ b/apps/web/src/lib/core/component/AI/component/tool/calendar/open-tool-event.ts@@ -1,5 +1,5 @@-import type { CalendarBlockEventTime } from '@block-calendar/calendar-range';-import { openCalendarEventSplit } from '@block-calendar/open-calendar-event';+import type { CalendarEventTime } from '@app/features/calendar-view/calendar-range';+import { openCalendarEventSplit } from '@app/features/calendar-view/open-calendar-event';import type { NamedTool } from '@service-cognition/generated/tools/tool';/** The event shape the create and update calendar tools return. */@@ -16,10 +16,10 @@ type OpenToolCalendarEventOptions = {* call returns the refreshed series, whose start is the master's rather* than the occurrence's.*/- time?: CalendarBlockEventTime;+ time?: CalendarEventTime;};-function eventTime(event: ToolCalendarEvent): CalendarBlockEventTime {+function eventTime(event: ToolCalendarEvent): CalendarEventTime {return event.isAllDay? { kind: 'allDay', startDate: event.start, endDate: event.end }: { kind: 'timed', startsAt: event.start, endsAt: event.end };@@ -28,7 +28,7 @@ function eventTime(event: ToolCalendarEvent): CalendarBlockEventTime {/** Time fields of a tool time input, as calendar navigation expects them. */export function toolInputOpenTime(time: NonNullable<NamedTool<'UpdateCalendarEvent', 'call'>['data']['time']>-): CalendarBlockEventTime {+): CalendarEventTime {return time.kind === 'allDay'? { kind: 'allDay', startDate: time.startDate, endDate: time.endDate }: { kind: 'timed', startsAt: time.startsAt, endsAt: time.endsAt };diff --git a/apps/web/src/lib/core/component/DocumentPreview.tsx b/apps/web/src/lib/core/component/DocumentPreview.tsxindex 2a18a27d28..f459c3a04f 100644--- a/apps/web/src/lib/core/component/DocumentPreview.tsx+++ b/apps/web/src/lib/core/component/DocumentPreview.tsx@@ -1,12 +1,12 @@import { parseLocalDate } from '@app/features/calendar/utils/calendar-date';-import { openChatWithAgent } from '@app/features/chat/ChatWithAgentButton';-import { globalSplitManager } from '@app/signal/splitLayout';import {type CalendarMentionTarget,copyCalendarEventMentionTarget,-} from '@block-calendar/copy-event-mention';-import { openCalendarEventSplit } from '@block-calendar/open-calendar-event';-import { CALENDAR_BLOCK_ID } from '@block-calendar/types';+} from '@app/features/calendar-view/copy-event-mention';+import { openCalendarEventSplit } from '@app/features/calendar-view/open-calendar-event';+import { CALENDAR_VIEW_ID } from '@app/features/calendar-view/types';+import { openChatWithAgent } from '@app/features/chat/ChatWithAgentButton';+import { globalSplitManager } from '@app/signal/splitLayout';import { URL_PARAMS as URL_PARAMS_CANVAS } from '@block-canvas/constants';import { URL_PARAMS as CHANNEL_PARAMS } from '@block-channel/constants';import { URL_PARAMS as URL_PARAMS_MD } from '@block-md/constants';@@ -503,8 +503,8 @@ export function DocumentPreviewContent(props: DocumentPreviewContentProps) {props.collapseInfo?.handleCollapse();};- // The calendar is a singleton block: a mentioned event opens it aimed at- // the viewer's own copy of the meeting rather than a per-id split.+ // Calendar is a singleton application view: a mentioned event opens it aimed+ // at the viewer's own copy of the meeting rather than a per-id split.const calendarOpenTarget = () => {const i = item();if (isCalendarEventPreviewItem(i)) {@@ -515,9 +515,8 @@ export function DocumentPreviewContent(props: DocumentPreviewContentProps) {};}// Preview not (yet) accessible — e.g. the recent-mention fallback for a- // just-created event. Still route through the singleton opener with the- // mentioned id; a generic `{type:'calendar', id:<event-id>}` split would- // be rejected by the calendar block's load.+ // just-created event. Still route through the singleton Calendar opener+ // with the mentioned id so it resolves through the event preview API.if (targetBlockType() === 'calendar') {return {eventId: props.documentInfo.id,@@ -636,7 +635,7 @@ export function DocumentPreviewContent(props: DocumentPreviewContentProps) {const splitManager = globalSplitManager();if (!splitManager) return false;if (calendarOpenTarget()) {- return !!splitManager.getSplitByContent('calendar', CALENDAR_BLOCK_ID);+ return !!splitManager.getSplitByContent('component', CALENDAR_VIEW_ID);}return !!splitManager.getSplitByContent(targetBlockType(),diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsxindex 33ffd0e36d..b45fefa45a 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsx+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsx@@ -1,5 +1,5 @@import { parseLocalDate } from '@app/features/calendar/utils/calendar-date';-import { openCalendarEventSplit } from '@block-calendar/open-calendar-event';+import { openCalendarEventSplit } from '@app/features/calendar-view/open-calendar-event';import { URL_PARAMS as CHANNEL_PARAMS } from '@block-channel/constants';import {type BlockAlias,diff --git a/docs/AGENT_GUIDE/navigation.md b/docs/AGENT_GUIDE/navigation.mdindex 9a78b6e3b3..a123483fc3 100644--- a/docs/AGENT_GUIDE/navigation.md+++ b/docs/AGENT_GUIDE/navigation.md@@ -29,7 +29,7 @@| `/app/companies` | Customers (CRM; needs a team) || `/app/activity` | Activity heatmap + feed || `/app/home` | Assistant (AI-first landing) |-| `/app/calendar/view` | Calendar |+| `/app/calendar/<month-or-week-or-day>` | Calendar; the focused event uses `sN.calendar.eventId` || `/app/<document-type>/<uuid>` | Legacy document URL (including `md`, `pdf`, `canvas`, `spreadsheet`, and the other Drive document types); redirects to `/app/drive/<document-type>/<uuid>` || `/app/documents`, `/app/files` | Legacy Files views; redirect to `/app/drive` || `/app/chat/<uuid>` | A standalone AI chat |diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.mdindex 487ec1998b..3dab80ab34 100644--- a/docs/AGENT_GUIDE/surfaces.md+++ b/docs/AGENT_GUIDE/surfaces.md@@ -583,10 +583,12 @@ title and navigation goes through the hamburger overlay. Location, search,filters, expanded folders, list focus, and scroll position are restored whenreturning from an opened file.-## Calendar — `/app/calendar/view`+## Calendar — `/app/calendar/<month-or-week-or-day>`-Calendars default to Day on phones and Week on desktop. The selected view is-remembered locally on each device.+The path selects the Month, Week, or Day period, and choosing another period updates+that path. Calendar navigation defaults to Day on phones and Week on desktop; the most+recent choice is remembered locally for navigation that does not specify a period. An+opened event is reflected in the pane-owned `sN.calendar.eventId` search parameter.Calendar event creation and editing open in a bottom sheet on touch devices,with scrollable content above the keyboard. Desktop retains the centered dialog.