Skip to content

armgit / macro

Public Imported from GitHub
0

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

fix(scheduling): preserve native navigation on booking pages (#8263)

Jacob Beckermanbc08ee4120e4
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.md
index c355c5122f..2c73cee9ee 100644
--- a/apps/web/AGENTS.md
+++ b/apps/web/AGENTS.md
@@ -98,6 +98,7 @@ ownership. Cancel, logout, and the ten-minute timeout retire pending callbacks.
- Preserve focused chrome editors during deferred split insertion/removal autofocus; explicit return-focus commands may still focus the pane.
- Reconcile global focus when focused DOM subtrees are removed; iOS can omit blur events, otherwise floating creation actions stay hidden after search or editor teardown.
- Mount the floating mobile AI composer only on the Agents view; other views keep their New action or their own reply/comment composer.
+- Keep native booking exit navigation in the route shell, outside page loading boundaries, and use the router so the native hash route stays intact.
- All API/network calls live in service-clients.
- Keep desktop Gmail and Outlook inbox consent in the system browser with a
`macro:///inbox-link-callback` return; webview origins are not desktop callbacks.
diff --git a/apps/web/src/routes/public-booking-shell.test.tsx b/apps/web/src/routes/public-booking-shell.test.tsx
new file mode 100644
index 0000000000..4557b21267
--- /dev/null
+++ b/apps/web/src/routes/public-booking-shell.test.tsx
@@ -0,0 +1,112 @@
+import { HashRouter, Route } from '@solidjs/router';
+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import { createResource, Suspense } from 'solid-js';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { PublicBookingShell } from './public-booking-shell';
+
+const platform = vi.hoisted(() => ({ native: true }));
+vi.mock('@core/mobile/isNativeMobilePlatform', () => ({
+ isNativeMobilePlatform: () => platform.native,
+}));
+
+beforeEach(() => {
+ platform.native = true;
+ vi.stubGlobal('scrollTo', vi.fn());
+ window.history.replaceState(null, '', '/app/#/app/book/team');
+});
+
+afterEach(() => {
+ cleanup();
+ vi.unstubAllGlobals();
+});
+
+describe('native booking navigation', () => {
+ it.each([
+ ['/book/team', 'Choose an event'],
+ ['/book/team/meeting', 'This booking page is unavailable.'],
+ ['/booking/booking-id#private-token', 'Loading booking…'],
+ ['/booking/booking-id#private-token', 'You’re booked'],
+ ])(
+ 'returns from %s to the app without reloading (%s)',
+ async (path, text) => {
+ window.history.replaceState(null, '', `/app/#/app${path}`);
+ const historyLength = window.history.length;
+ render(() => (
+ <HashRouter base="/app">
+ <Route path="/" component={() => <h1>Macro home</h1>} />
+ <Route
+ path={['/book/*path', '/booking/:id']}
+ component={() => (
+ <PublicBookingShell>
+ <p>{text}</p>
+ </PublicBookingShell>
+ )}
+ />
+ </HashRouter>
+ ));
+
+ expect(screen.getByText(text)).toBeTruthy();
+ fireEvent.click(screen.getByRole('button', { name: 'Back to Macro' }));
+
+ expect(
+ await screen.findByRole('heading', { name: 'Macro home' })
+ ).toBeTruthy();
+ expect(window.location.pathname).toBe('/app/');
+ expect(window.location.hash).toBe('#/app');
+ expect(window.history.length).toBe(historyLength);
+ }
+ );
+
+ it('keeps the exit available while the booking content is suspended', async () => {
+ function PendingPage() {
+ const [page] = createResource(() => new Promise<string>(() => {}));
+ return <p>{page()}</p>;
+ }
+ render(() => (
+ <HashRouter base="/app">
+ <Route path="/" component={() => <h1>Macro home</h1>} />
+ <Route
+ path="/book/*path"
+ component={() => (
+ <PublicBookingShell>
+ <Suspense fallback={<p>Loading booking page…</p>}>
+ <PendingPage />
+ </Suspense>
+ </PublicBookingShell>
+ )}
+ />
+ </HashRouter>
+ ));
+
+ expect(screen.getByText('Loading booking page…')).toBeTruthy();
+ fireEvent.click(screen.getByRole('button', { name: 'Back to Macro' }));
+ expect(
+ await screen.findByRole('heading', { name: 'Macro home' })
+ ).toBeTruthy();
+ });
+
+ it.each(['browser', 'embedded'])(
+ 'omits native chrome for %s pages',
+ (surface) => {
+ platform.native = surface !== 'browser';
+ if (surface === 'embedded') vi.stubGlobal('parent', {});
+ render(() => (
+ <HashRouter base="/app">
+ <Route
+ path="/book/*path"
+ component={() => (
+ <PublicBookingShell>
+ <p>Choose an event</p>
+ </PublicBookingShell>
+ )}
+ />
+ </HashRouter>
+ ));
+
+ expect(screen.getByText('Choose an event')).toBeTruthy();
+ expect(
+ screen.queryByRole('button', { name: 'Back to Macro' })
+ ).toBeNull();
+ }
+ );
+});
diff --git a/apps/web/src/routes/public-booking-shell.tsx b/apps/web/src/routes/public-booking-shell.tsx
new file mode 100644
index 0000000000..f4edb69372
--- /dev/null
+++ b/apps/web/src/routes/public-booking-shell.tsx
@@ -0,0 +1,31 @@
+import { hapticImpact } from '@core/mobile/haptics';
+import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';
+import ArrowLeftIcon from '@phosphor/arrow-left.svg';
+import { useNavigate } from '@solidjs/router';
+import { Button } from '@ui';
+import { type ParentProps, Show } from 'solid-js';
+
+/** Native webviews have no browser chrome, including on unavailable pages. */
+export function PublicBookingShell(props: ParentProps) {
+ const navigate = useNavigate();
+ const showBack = () => isNativeMobilePlatform() && window.parent === window;
+
+ return (
+ <div class="min-h-0 flex-1 overflow-y-auto bg-page text-ink">
+ <Show when={showBack()}>
+ <header class="sticky top-0 z-10 flex bg-panel/95 px-2 pb-2 pt-[calc(var(--safe-top,0px)+0.5rem)] backdrop-blur-sm">
+ <Button
+ variant="ghost"
+ size="icon-md"
+ label="Back to Macro"
+ onPointerDown={() => hapticImpact('light')}
+ onClick={() => navigate('/', { replace: true })}
+ >
+ <ArrowLeftIcon />
+ </Button>
+ </header>
+ </Show>
+ {props.children}
+ </div>
+ );
+}
diff --git a/apps/web/src/routes/shells.tsx b/apps/web/src/routes/shells.tsx
index 3a4dbee48a..8edc4ef1b8 100644
--- a/apps/web/src/routes/shells.tsx
+++ b/apps/web/src/routes/shells.tsx
@@ -6,6 +6,7 @@ import { useIsAuthenticated } from '@core/auth';
import { ImperativeDialogHost } from '@ui';
import { type JSX, onCleanup, onMount, type ParentProps, Show } from 'solid-js';
import { LIKELY_NEXT_VIEWS } from './lazy-route-views';
+import { PublicBookingShell } from './public-booking-shell';
/** Takes over from index.html's boot shell once this shell has drawn. */
function useDismissBootShell() {
@@ -33,12 +34,14 @@ function FocusedPage(props: ParentProps) {
);
}
-/** Booking links: a scrolling page on the page background, without app chrome. */
+/** Booking links keep a native exit outside the lazy page/loading boundary. */
export function FocusedShell(): JSX.Element {
+ useDismissBootShell();
return (
- <FocusedPage>
+ <PublicBookingShell>
+ <ImperativeDialogHost />
<SplitRouter.Outlet />
- </FocusedPage>
+ </PublicBookingShell>
);
}
diff --git a/docs/agent-guide/calendar.md b/docs/agent-guide/calendar.md
index 7778e71706..d914837f0a 100644
--- a/docs/agent-guide/calendar.md
+++ b/docs/agent-guide/calendar.md
@@ -147,6 +147,11 @@ show progress; the event summary and selected time stay visible. Choose another
time preserves attendee input. All meetings returns to the profile chooser when
multiple events exist, but is disabled while a booking response is unresolved.
The private confirmation shows the meeting, date, timezone, location, and guest.
+In the native iOS and Android apps, standalone booking and receipt pages keep a
+sticky **Back to Macro** button below the device's top safe-area inset. It returns to
+the app through the router without reloading, including while the page is loading
+or unavailable. Browser pages and embedded booking dialogs omit this button.
+
Public URLs and booking behavior remain unchanged. The website can frame the
booking page and receipt without duplicate Macro branding. A completed booking
notifies the same-origin parent page; other sites cannot frame these routes.