@remit/web-client 0.0.328 → 0.0.330

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/dist/src/components/calendar/CalendarEventEditor.d.ts +6 -0
  2. package/dist/src/components/calendar/CalendarEventEditor.js +371 -0
  3. package/dist/src/components/calendar/CalendarEventPopup.d.ts +10 -0
  4. package/dist/src/components/calendar/CalendarEventPopup.js +198 -0
  5. package/dist/src/components/calendar/CalendarLoadFailed.d.ts +8 -0
  6. package/dist/src/components/calendar/CalendarLoadFailed.js +11 -0
  7. package/dist/src/components/calendar/CalendarNavPane.d.ts +11 -0
  8. package/dist/src/components/calendar/CalendarNavPane.js +50 -0
  9. package/dist/src/components/calendar/CalendarQuickCreate.d.ts +22 -0
  10. package/dist/src/components/calendar/CalendarQuickCreate.js +204 -0
  11. package/dist/src/components/calendar/CalendarScreen.d.ts +11 -0
  12. package/dist/src/components/calendar/CalendarScreen.js +184 -0
  13. package/dist/src/components/calendar/CalendarSession.d.ts +24 -0
  14. package/dist/src/components/calendar/CalendarSession.js +12 -0
  15. package/dist/src/components/calendar/CalendarTaskPopup.d.ts +4 -0
  16. package/dist/src/components/calendar/CalendarTaskPopup.js +95 -0
  17. package/dist/src/components/calendar/CalendarWaiting.d.ts +3 -3
  18. package/dist/src/components/calendar/CalendarWaiting.js +5 -10
  19. package/dist/src/components/calendar/ChangeCalendarSuggestion.js +39 -5
  20. package/dist/src/components/calendar/EventMoves.d.ts +17 -0
  21. package/dist/src/components/calendar/EventMoves.js +103 -0
  22. package/dist/src/components/calendar/calendar-story-fixtures.js +8 -2
  23. package/dist/src/components/calendar/calendar-story-server.d.ts +2 -5
  24. package/dist/src/components/calendar/calendar-story-server.js +5 -6
  25. package/dist/src/components/compose/ComposeForm.js +1 -1
  26. package/dist/src/components/layout/AppFrame.d.ts +11 -0
  27. package/dist/src/components/layout/AppFrame.js +16 -0
  28. package/dist/src/components/mail/BulkRunProvider.js +1 -1
  29. package/dist/src/components/mail/MailSidebarAdapter.js +1 -1
  30. package/dist/src/components/mail/MessageActionMenu.js +1 -1
  31. package/dist/src/components/mail/MessageList.js +1 -1
  32. package/dist/src/components/mail/OutboxPane.js +1 -1
  33. package/dist/src/components/mail/ThreadListInteraction.js +1 -1
  34. package/dist/src/components/settings/CalendarDefaultSenderCard.d.ts +2 -0
  35. package/dist/src/components/settings/CalendarDefaultSenderCard.js +16 -0
  36. package/dist/src/components/ui/ErrorBannerProvider.d.ts +0 -23
  37. package/dist/src/components/ui/ErrorBannerProvider.js +3 -39
  38. package/dist/src/components/ui/SignedOutOverlay.d.ts +6 -0
  39. package/dist/src/components/ui/SignedOutOverlay.js +29 -0
  40. package/dist/src/components/ui/error-banner-context.d.ts +23 -0
  41. package/dist/src/components/ui/error-banner-context.js +38 -0
  42. package/dist/src/hooks/calendar/draft-session.d.ts +78 -0
  43. package/dist/src/hooks/calendar/draft-session.js +110 -0
  44. package/dist/src/hooks/calendar/draft.d.ts +8 -2
  45. package/dist/src/hooks/calendar/draft.js +17 -4
  46. package/dist/src/hooks/calendar/index.d.ts +6 -3
  47. package/dist/src/hooks/calendar/index.js +5 -2
  48. package/dist/src/hooks/calendar/instance.d.ts +2 -1
  49. package/dist/src/hooks/calendar/instance.js +14 -1
  50. package/dist/src/hooks/calendar/useCalendarJump.d.ts +0 -2
  51. package/dist/src/hooks/calendar/useCalendarJump.js +3 -5
  52. package/dist/src/hooks/calendar/useCalendarScheduling.d.ts +33 -0
  53. package/dist/src/hooks/calendar/useCalendarScheduling.js +118 -0
  54. package/dist/src/hooks/calendar/useCalendarTasks.d.ts +53 -0
  55. package/dist/src/hooks/calendar/useCalendarTasks.js +105 -0
  56. package/dist/src/hooks/calendar/useCalendarWrites.d.ts +18 -2
  57. package/dist/src/hooks/calendar/useCalendarWrites.js +19 -6
  58. package/dist/src/hooks/calendar/useCalendars.d.ts +3 -0
  59. package/dist/src/hooks/calendar/useCalendars.js +13 -5
  60. package/dist/src/hooks/calendar/useDraftSession.d.ts +32 -0
  61. package/dist/src/hooks/calendar/useDraftSession.js +106 -0
  62. package/dist/src/hooks/calendar/useMoveEvent.d.ts +4 -0
  63. package/dist/src/hooks/calendar/useMoveEvent.js +62 -0
  64. package/dist/src/hooks/use-system-update.js +3 -5
  65. package/dist/src/hooks/useApplyLabel.js +1 -1
  66. package/dist/src/hooks/useCalendarData.d.ts +9 -2
  67. package/dist/src/hooks/useCalendarData.js +22 -5
  68. package/dist/src/hooks/useCalendarSidePane.d.ts +14 -0
  69. package/dist/src/hooks/useCalendarSidePane.js +30 -0
  70. package/dist/src/hooks/useComposeLanguages.js +1 -1
  71. package/dist/src/hooks/useDeleteMessages.js +1 -1
  72. package/dist/src/hooks/useEmptyTrash.js +1 -1
  73. package/dist/src/hooks/useEscalatedActions.js +1 -1
  74. package/dist/src/hooks/useFilters.d.ts +1 -1
  75. package/dist/src/hooks/useLabels.d.ts +1 -1
  76. package/dist/src/hooks/useMarkAsRead.js +1 -1
  77. package/dist/src/hooks/useMoveMessages.js +1 -1
  78. package/dist/src/hooks/useRefreshControl.js +4 -8
  79. package/dist/src/hooks/useReportSpam.js +1 -1
  80. package/dist/src/hooks/useSignature.js +1 -1
  81. package/dist/src/hooks/useStaleAccountSync.js +4 -4
  82. package/dist/src/hooks/useStarredThreads.d.ts +1 -1
  83. package/dist/src/hooks/useToggleStar.js +1 -1
  84. package/dist/src/hooks/useToggleTrusted.js +1 -1
  85. package/dist/src/hooks/useTriggerSync.d.ts +1 -1
  86. package/dist/src/hooks/useUpdateAddressFlags.js +1 -1
  87. package/dist/src/hooks/useWarningsAttention.js +1 -3
  88. package/dist/src/lib/calendar-route.d.ts +6 -0
  89. package/dist/src/lib/calendar-route.js +14 -0
  90. package/dist/src/lib/calendar-side-pane-pref.d.ts +14 -0
  91. package/dist/src/lib/calendar-side-pane-pref.js +27 -0
  92. package/dist/src/lib/error-classifier.d.ts +5 -30
  93. package/dist/src/lib/error-classifier.js +7 -10
  94. package/dist/src/lib/escalate.d.ts +6 -0
  95. package/dist/src/lib/escalate.js +16 -0
  96. package/dist/src/lib/intelligence-pref.js +3 -2
  97. package/dist/src/lib/new-event-range.d.ts +26 -0
  98. package/dist/src/lib/new-event-range.js +69 -0
  99. package/dist/src/lib/query-error-handler.d.ts +2 -6
  100. package/dist/src/lib/query-error-handler.js +5 -14
  101. package/dist/src/lib/signed-out.d.ts +13 -0
  102. package/dist/src/lib/signed-out.js +28 -0
  103. package/dist/src/routeTree.gen.d.ts +98 -19
  104. package/dist/src/routeTree.gen.js +32 -1
  105. package/dist/src/routes/__root.js +8 -2
  106. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/$recurrenceId/edit.d.ts +5 -0
  107. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/$recurrenceId/edit.js +11 -0
  108. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/$recurrenceId/index.d.ts +5 -0
  109. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/$recurrenceId/index.js +12 -0
  110. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/$recurrenceId.d.ts +1 -1
  111. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/$recurrenceId.js +4 -13
  112. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/edit.d.ts +5 -0
  113. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/edit.js +14 -0
  114. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/index.d.ts +1 -1
  115. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/index.js +4 -4
  116. package/dist/src/routes/calendar/$view.$date/$calendarObjectId.d.ts +1 -1
  117. package/dist/src/routes/calendar/$view.$date/index.d.ts +1 -6
  118. package/dist/src/routes/calendar/$view.$date/index.js +3 -10
  119. package/dist/src/routes/calendar/$view.$date/new.d.ts +6 -2
  120. package/dist/src/routes/calendar/$view.$date/new.js +8 -13
  121. package/dist/src/routes/calendar/$view.$date/suggestion.$suggestionId.d.ts +1 -1
  122. package/dist/src/routes/calendar/$view.$date/suggestion.$suggestionId.js +2 -2
  123. package/dist/src/routes/calendar/$view.$date/task.$calendarTaskId.d.ts +5 -0
  124. package/dist/src/routes/calendar/$view.$date/task.$calendarTaskId.js +16 -0
  125. package/dist/src/routes/calendar/$view.$date.d.ts +1 -1
  126. package/dist/src/routes/calendar/$view.$date.js +14 -50
  127. package/dist/src/routes/calendar/index.d.ts +1 -1
  128. package/dist/src/routes/calendar/index.js +2 -1
  129. package/dist/src/routes/calendar.d.ts +4 -9
  130. package/dist/src/routes/calendar.js +10 -35
  131. package/dist/src/routes/mail/index.d.ts +1 -1
  132. package/dist/src/routes/mail/index.js +7 -2
  133. package/dist/src/routes/mail.js +6 -5
  134. package/dist/src/routes/settings/calendars.js +2 -1
  135. package/dist/src/routing/app-switch.d.ts +11 -0
  136. package/dist/src/routing/app-switch.js +35 -0
  137. package/dist/src/routing/calendar.d.ts +45 -4
  138. package/dist/src/routing/calendar.js +135 -13
  139. package/dist/src/routing/fragment.d.ts +1 -1
  140. package/dist/src/routing/fragment.js +6 -1
  141. package/dist/src/routing/index.d.ts +2 -1
  142. package/dist/src/routing/index.js +2 -1
  143. package/package.json +2 -2
  144. package/dist/src/components/calendar/CalendarComposePane.d.ts +0 -49
  145. package/dist/src/components/calendar/CalendarComposePane.js +0 -8
  146. package/dist/src/components/calendar/CalendarComposeSeed.d.ts +0 -7
  147. package/dist/src/components/calendar/CalendarComposeSeed.js +0 -19
  148. package/dist/src/components/calendar/CalendarEventPane.d.ts +0 -48
  149. package/dist/src/components/calendar/CalendarEventPane.js +0 -48
  150. package/dist/src/components/calendar/CalendarShell.d.ts +0 -43
  151. package/dist/src/components/calendar/CalendarShell.js +0 -35
  152. package/dist/src/components/calendar/CalendarViewPlaceholder.d.ts +0 -1
  153. package/dist/src/components/calendar/CalendarViewPlaceholder.js +0 -5
  154. package/dist/src/components/calendar/CalendarWorkspace.d.ts +0 -49
  155. package/dist/src/components/calendar/CalendarWorkspace.js +0 -65
  156. package/dist/src/components/calendar/OpenCalendarEvent.d.ts +0 -20
  157. package/dist/src/components/calendar/OpenCalendarEvent.js +0 -169
  158. package/dist/src/components/calendar/WriteCalendarEvent.d.ts +0 -13
  159. package/dist/src/components/calendar/WriteCalendarEvent.js +0 -59
@@ -1,20 +1,19 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createFileRoute, Navigate, Outlet, redirect, } from "@tanstack/react-router";
3
- import { useCallback, useState } from "react";
4
- import { AgendaView } from "../../components/calendar/AgendaView";
5
- import { CalendarComposeSeedProvider } from "../../components/calendar/CalendarComposeSeed";
6
- import { CalendarShell } from "../../components/calendar/CalendarShell";
7
- import { CalendarWorkspace } from "../../components/calendar/CalendarWorkspace";
8
- import { PendingSuggestions } from "../../components/calendar/PendingSuggestions";
9
- import { calendarInstanceId, deviceTimeZone } from "../../hooks/calendar";
10
- import { useCalendarData } from "../../hooks/useCalendarData";
2
+ // biome-ignore lint/style/useFilenamingConvention: TanStack Router convention
3
+ /**
4
+ * /calendar/{view}/{date} — the calendar screen, at one zoom, on one day.
5
+ *
6
+ * Both are path segments: the zooms are mutually exclusive surfaces (R5), and
7
+ * the day is where the screen opened (R4). An unreadable segment is rewritten
8
+ * rather than refused, keeping the half that was readable.
9
+ */
10
+ import { createFileRoute, Outlet, redirect } from "@tanstack/react-router";
11
+ import { CalendarScreen } from "../../components/calendar/CalendarScreen";
11
12
  import { useLayoutTier } from "../../hooks/useLayoutTier";
12
- import { readCalendarDensity, writeCalendarDensity, } from "../../lib/calendar-density";
13
- import { calendarSearchSchema, calendarViewMountsAgenda, canonicalCalendarParams, isoDate, } from "../../lib/calendar-route";
14
- import { useCalendarAddress, useCalendarNavigation, useIsWritingEvent, useOpenCalendarEvent, } from "../../routing";
13
+ import { calendarSearchSchema, canonicalCalendarParams, isoDate, } from "../../lib/calendar-route";
15
14
  export const Route = createFileRoute("/calendar/$view/$date")({
16
15
  validateSearch: calendarSearchSchema,
17
- beforeLoad: ({ params, search }) => {
16
+ beforeLoad: ({ params, search, location }) => {
18
17
  const canonical = canonicalCalendarParams(params, isoDate(new Date()));
19
18
  if (canonical.view === params.view && canonical.date === params.date)
20
19
  return;
@@ -22,48 +21,13 @@ export const Route = createFileRoute("/calendar/$view/$date")({
22
21
  to: "/calendar/$view/$date",
23
22
  params: canonical,
24
23
  search,
24
+ hash: location.hash,
25
25
  replace: true,
26
26
  });
27
27
  },
28
28
  component: CalendarViewLayout,
29
29
  });
30
30
  function CalendarViewLayout() {
31
- const { view, date } = useCalendarAddress();
32
31
  const isPhone = useLayoutTier() === "phone";
33
- if (isPhone && view === "year")
34
- return (_jsx(Navigate, { to: "/calendar/$view/$date", params: { view: "month", date }, search: true, replace: true }));
35
- return _jsx(CalendarView, { isPhone: isPhone });
36
- }
37
- function CalendarView({ isPhone }) {
38
- const { view, date, calendarIds } = useCalendarAddress();
39
- // The strip fetches the days it holds a week at a time and draws none of
40
- // this, so at that zoom the layout asks for nothing: the address rewrites on
41
- // every scroll, and each rewrite would otherwise fetch a week nobody renders
42
- // along with the two beside it.
43
- const drawsGrid = !calendarViewMountsAgenda(view);
44
- const { events, colorByCalendarId, isLoading, error, retry, instanceOf } = useCalendarData({ view, date, calendarIds, enabled: drawsGrid });
45
- const { goToView, goToToday, step, openEvent, openComposer, changeSuggestionFirst, zoomToDay, dayHref, } = useCalendarNavigation();
46
- const openedEvent = useOpenCalendarEvent();
47
- const isWriting = useIsWritingEvent();
48
- // Held in state rather than read back from storage each render: how much of
49
- // a day this device shows is not a fact about the calendar, so changing it
50
- // changes nothing about the address.
51
- const [density, setDensity] = useState(readCalendarDensity);
52
- const changeDensity = useCallback((next) => {
53
- writeCalendarDensity(next);
54
- setDensity(next);
55
- }, []);
56
- const [pick, setPick] = useState(undefined);
57
- const selectEvent = useCallback((eventId) => {
58
- const instance = instanceOf(eventId);
59
- openEvent(instance.calendarObjectId, instance.recurrenceId);
60
- }, [instanceOf, openEvent]);
61
- const pickSlot = useCallback((slot) => {
62
- setPick(slot);
63
- openComposer();
64
- }, [openComposer]);
65
- const workspace = (_jsx(CalendarWorkspace, { view: view, date: date, events: events, colorByCalendarId: colorByCalendarId, agenda: _jsx(AgendaView, { density: density, onPickSlot: pickSlot }), waiting: _jsx(PendingSuggestions, { onChangeFirst: changeSuggestionFirst }), isLoading: isLoading, error: error, onRetry: retry, density: density, selectedEventId: openedEvent
66
- ? calendarInstanceId(openedEvent.calendarObjectId, openedEvent.recurrenceId ?? "")
67
- : "", timeZone: deviceTimeZone(), now: new Date().toISOString(), onChangeView: goToView, onToday: goToToday, onStep: step, dayHref: dayHref, onZoomDay: zoomToDay, onChangeDensity: changeDensity, onSelectEvent: selectEvent, onPickSlot: pickSlot, touch: isPhone }));
68
- return (_jsx(CalendarComposeSeedProvider, { pick: pick, children: _jsx(CalendarShell, { workspace: workspace, reading: _jsx(Outlet, {}), hasOpenEvent: openedEvent !== undefined || isWriting }) }));
32
+ return _jsx(CalendarScreen, { isPhone: isPhone, detail: _jsx(Outlet, {}) });
69
33
  }
@@ -1,5 +1,5 @@
1
1
  export declare const Route: import("@tanstack/router-core").Route<import("@tanstack/react-router").Register, import("@tanstack/router-core").Route<import("@tanstack/react-router").Register, import("@tanstack/react-router").RootRoute<import("@tanstack/react-router").Register, undefined, import("../../router").RouterContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/calendar", "/calendar", "/calendar", "/calendar", undefined, import("@tanstack/router-core").ResolveParams<"/calendar">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, ({ context: { queryClient } }: import("@tanstack/router-core").LoaderFnContext<import("@tanstack/react-router").Register, import("@tanstack/react-router").RootRoute<import("@tanstack/react-router").Register, undefined, import("../../router").RouterContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/calendar", import("@tanstack/router-core").ResolveParams<"/calendar">, {}, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, unknown, undefined>) => void, unknown, unknown, unknown, unknown, undefined>, "/", "/calendar/", "/calendar/", "/calendar/", import("zod").ZodObject<{
2
2
  calendarId: import("zod").ZodOptional<import("zod").ZodPipe<import("zod").ZodPipe<import("zod").ZodUnknown, import("zod").ZodTransform<string[], unknown>>, import("zod").ZodTransform<string[] | undefined, string[]>>>;
3
- }, import("zod/v4/core").$strip>, import("@tanstack/router-core").ResolveParams<"/">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, ({ search }: import("@tanstack/router-core").BeforeLoadContextOptions<import("@tanstack/react-router").Register, import("@tanstack/router-core").Route<import("@tanstack/react-router").Register, import("@tanstack/react-router").RootRoute<import("@tanstack/react-router").Register, undefined, import("../../router").RouterContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/calendar", "/calendar", "/calendar", "/calendar", undefined, import("@tanstack/router-core").ResolveParams<"/calendar">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, ({ context: { queryClient } }: import("@tanstack/router-core").LoaderFnContext<import("@tanstack/react-router").Register, import("@tanstack/react-router").RootRoute<import("@tanstack/react-router").Register, undefined, import("../../router").RouterContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/calendar", import("@tanstack/router-core").ResolveParams<"/calendar">, {}, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, unknown, undefined>) => void, unknown, unknown, unknown, unknown, undefined>, import("zod").ZodObject<{
3
+ }, import("zod/v4/core").$strip>, import("@tanstack/router-core").ResolveParams<"/">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, ({ search, location }: import("@tanstack/router-core").BeforeLoadContextOptions<import("@tanstack/react-router").Register, import("@tanstack/router-core").Route<import("@tanstack/react-router").Register, import("@tanstack/react-router").RootRoute<import("@tanstack/react-router").Register, undefined, import("../../router").RouterContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/calendar", "/calendar", "/calendar", "/calendar", undefined, import("@tanstack/router-core").ResolveParams<"/calendar">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, ({ context: { queryClient } }: import("@tanstack/router-core").LoaderFnContext<import("@tanstack/react-router").Register, import("@tanstack/react-router").RootRoute<import("@tanstack/react-router").Register, undefined, import("../../router").RouterContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/calendar", import("@tanstack/router-core").ResolveParams<"/calendar">, {}, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, unknown, undefined>) => void, unknown, unknown, unknown, unknown, undefined>, import("zod").ZodObject<{
4
4
  calendarId: import("zod").ZodOptional<import("zod").ZodPipe<import("zod").ZodPipe<import("zod").ZodUnknown, import("zod").ZodTransform<string[], unknown>>, import("zod").ZodTransform<string[] | undefined, string[]>>>;
5
5
  }, import("zod/v4/core").$strip>, import("@tanstack/router-core").ResolveParams<"/">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, "/calendar/", unknown, undefined>) => never, {}, undefined, unknown, unknown, unknown, unknown, undefined>;
@@ -11,11 +11,12 @@ import { createFileRoute, redirect } from "@tanstack/react-router";
11
11
  import { calendarSearchSchema, DEFAULT_CALENDAR_VIEW, isoDate, } from "../../lib/calendar-route";
12
12
  export const Route = createFileRoute("/calendar/")({
13
13
  validateSearch: calendarSearchSchema,
14
- beforeLoad: ({ search }) => {
14
+ beforeLoad: ({ search, location }) => {
15
15
  throw redirect({
16
16
  to: "/calendar/$view/$date",
17
17
  params: { view: DEFAULT_CALENDAR_VIEW, date: isoDate(new Date()) },
18
18
  search,
19
+ hash: location.hash,
19
20
  replace: true,
20
21
  });
21
22
  },
@@ -1,14 +1,9 @@
1
1
  /**
2
- * /calendar — a sibling of /mail, sharing its nav and nothing else.
2
+ * /calendar — a screen of its own beside /mail, inside the same app frame.
3
3
  *
4
- * The layout owns what the whole calendar needs and no more: the account list
5
- * the sidebar is built from, and the nav slide-over the narrow tiers open. The
6
- * view below it decides what the panes hold.
7
- *
8
- * The fragment keeps the meaning it has in mail. The calendar has no
9
- * intelligence rail, so a reader arriving with `#intelligence` carries it
10
- * through and takes it back to their mail — nothing calendar-specific joins the
11
- * union, because none of the calendar's own chrome is a panel.
4
+ * The layout owns the first-run guard and nothing else: a reader with no
5
+ * account belongs in onboarding. The view below it draws the toolbar, the side
6
+ * pane and the grid.
12
7
  */
13
8
  import "../lib/client";
14
9
  export declare const Route: import("@tanstack/router-core").Route<import("@tanstack/react-router").Register, import("@tanstack/react-router").RootRoute<import("@tanstack/react-router").Register, undefined, import("../router").RouterContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/calendar", "/calendar", "/calendar", "/calendar", undefined, import("@tanstack/router-core").ResolveParams<"/calendar">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, ({ context: { queryClient } }: import("@tanstack/router-core").LoaderFnContext<import("@tanstack/react-router").Register, import("@tanstack/react-router").RootRoute<import("@tanstack/react-router").Register, undefined, import("../router").RouterContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/calendar", import("@tanstack/router-core").ResolveParams<"/calendar">, {}, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, unknown, undefined>) => void, unknown, unknown, unknown, unknown, undefined>;
@@ -1,25 +1,19 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  /**
3
- * /calendar — a sibling of /mail, sharing its nav and nothing else.
3
+ * /calendar — a screen of its own beside /mail, inside the same app frame.
4
4
  *
5
- * The layout owns what the whole calendar needs and no more: the account list
6
- * the sidebar is built from, and the nav slide-over the narrow tiers open. The
7
- * view below it decides what the panes hold.
8
- *
9
- * The fragment keeps the meaning it has in mail. The calendar has no
10
- * intelligence rail, so a reader arriving with `#intelligence` carries it
11
- * through and takes it back to their mail — nothing calendar-specific joins the
12
- * union, because none of the calendar's own chrome is a panel.
5
+ * The layout owns the first-run guard and nothing else: a reader with no
6
+ * account belongs in onboarding. The view below it draws the toolbar, the side
7
+ * pane and the grid.
13
8
  */
14
9
  import { configOperationsGetConfigOptions } from "@remit/api-http-client/@tanstack/react-query.gen.ts";
15
10
  import { ErrorState } from "@remit/ui";
16
11
  import { useQuery } from "@tanstack/react-query";
17
12
  import { createFileRoute, Outlet, useNavigate } from "@tanstack/react-router";
18
- import { useCallback, useEffect } from "react";
19
- import { CalendarShellProvider } from "../components/calendar/CalendarShell";
20
- import { MailNav } from "../components/mail/MailNav";
21
- import { isSinglePaneTier, useLayoutTier } from "../hooks/useLayoutTier";
22
- import { panelsWithOverlay, useOpenPanels, useSetOpenPanels } from "../routing";
13
+ import { useEffect } from "react";
14
+ import { AppFrame } from "../components/layout/AppFrame";
15
+ import { AppShellSkeleton } from "../components/layout/AppShellSkeleton";
16
+ import { useIsWritingEvent } from "../routing";
23
17
  import "../lib/client";
24
18
  export const Route = createFileRoute("/calendar")({
25
19
  loader: ({ context: { queryClient } }) => {
@@ -29,40 +23,21 @@ export const Route = createFileRoute("/calendar")({
29
23
  });
30
24
  function CalendarLayout() {
31
25
  const navigate = useNavigate();
32
- const isSinglePane = isSinglePaneTier(useLayoutTier());
33
- // Only the nav slide-over is the calendar's to open, and it is written as
34
- // the whole set so a pane the reader brought with them from mail survives
35
- // the visit rather than being dropped by the first tap on the hamburger.
36
- const openPanels = useOpenPanels();
37
- const setOpenPanels = useSetOpenPanels();
38
- const navOpen = openPanels.includes("nav");
39
- const showNav = useCallback((open) => {
40
- setOpenPanels(panelsWithOverlay(openPanels, open ? "nav" : undefined));
41
- }, [openPanels, setOpenPanels]);
26
+ const isWriting = useIsWritingEvent();
42
27
  const { data: config, isLoading, isError, error, refetch, } = useQuery({
43
28
  ...configOperationsGetConfigOptions(),
44
29
  staleTime: Infinity,
45
30
  });
46
- // The same first-run guard `/mail` carries: a reader with no account has no
47
- // calendar either, and the onboarding wizard is where they belong.
48
31
  const hasNoAccounts = Boolean(config && (config.accounts?.length ?? 0) === 0);
49
32
  useEffect(() => {
50
33
  if (!hasNoAccounts)
51
34
  return;
52
35
  navigate({ to: "/onboarding", replace: true });
53
36
  }, [hasNoAccounts, navigate]);
54
- const accounts = config?.accounts ?? [];
55
37
  if (isError) {
56
38
  return (_jsx("div", { className: "flex h-full items-center justify-center bg-canvas p-4", children: _jsx(ErrorState, { title: "Couldn't load your account", error: error, onRetry: () => {
57
39
  refetch();
58
40
  } }) }));
59
41
  }
60
- return (_jsx(CalendarShellProvider, { chrome: {
61
- isSinglePane,
62
- isLoading: isLoading || hasNoAccounts,
63
- nav: (_jsx(MailNav, { accounts: accounts, onMailboxSelect: () => showNav(false) })),
64
- navOpen,
65
- onOpenNav: () => showNav(true),
66
- onCloseNav: () => showNav(false),
67
- }, children: _jsx(Outlet, {}) }));
42
+ return (_jsx(AppFrame, { hideTabBar: isWriting, children: isLoading || hasNoAccounts ? _jsx(AppShellSkeleton, {}) : _jsx(Outlet, {}) }));
68
43
  }
@@ -12,7 +12,7 @@ export declare const Route: import("@tanstack/router-core").Route<import("@tanst
12
12
  wizardFrom: import("zod").ZodCatch<import("zod").ZodOptional<import("zod").ZodLiteral<"search">>>;
13
13
  }, import("zod/v4/core").$strip>, import("@tanstack/router-core").ResolveParams<"/mail">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, ({ context: { queryClient } }: import("@tanstack/router-core").LoaderFnContext<import("@tanstack/react-router").Register, import("@tanstack/react-router").RootRoute<import("@tanstack/react-router").Register, undefined, import("../../router").RouterContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/mail", import("@tanstack/router-core").ResolveParams<"/mail">, {}, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, unknown, undefined>) => void, unknown, unknown, unknown, unknown, undefined>, "/", "/mail/", "/mail/", "/mail/", import("zod").ZodObject<{
14
14
  q: import("zod").ZodOptional<import("zod").ZodString>;
15
- }, import("zod/v4/core").$strip>, import("@tanstack/router-core").ResolveParams<"/">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, ({ search }: import("@tanstack/router-core").BeforeLoadContextOptions<import("@tanstack/react-router").Register, import("@tanstack/router-core").Route<import("@tanstack/react-router").Register, import("@tanstack/react-router").RootRoute<import("@tanstack/react-router").Register, undefined, import("../../router").RouterContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/mail", "/mail", "/mail", "/mail", import("zod").ZodObject<{
15
+ }, import("zod/v4/core").$strip>, import("@tanstack/router-core").ResolveParams<"/">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, ({ search, location }: import("@tanstack/router-core").BeforeLoadContextOptions<import("@tanstack/react-router").Register, import("@tanstack/router-core").Route<import("@tanstack/react-router").Register, import("@tanstack/react-router").RootRoute<import("@tanstack/react-router").Register, undefined, import("../../router").RouterContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/mail", "/mail", "/mail", "/mail", import("zod").ZodObject<{
16
16
  q: import("zod").ZodOptional<import("zod").ZodString>;
17
17
  wizard: import("zod").ZodCatch<import("zod").ZodOptional<import("zod").ZodEnum<{
18
18
  name: "name";
@@ -7,7 +7,12 @@ import { createFileRoute, redirect } from "@tanstack/react-router";
7
7
  import { mailIndexSearchSchema } from "../../lib/mail-search";
8
8
  export const Route = createFileRoute("/mail/")({
9
9
  validateSearch: mailIndexSearchSchema,
10
- beforeLoad: ({ search }) => {
11
- throw redirect({ to: "/mail/brief", search, replace: true });
10
+ beforeLoad: ({ search, location }) => {
11
+ throw redirect({
12
+ to: "/mail/brief",
13
+ search,
14
+ hash: location.hash,
15
+ replace: true,
16
+ });
12
17
  },
13
18
  });
@@ -4,6 +4,7 @@ import { ErrorState, KeyboardShortcutsModal, useTriageKeyboard, } from "@remit/u
4
4
  import { useQuery } from "@tanstack/react-query";
5
5
  import { createFileRoute, Outlet, useNavigate, useRouterState, } from "@tanstack/react-router";
6
6
  import { useCallback, useEffect, useMemo } from "react";
7
+ import { AppFrame } from "../components/layout/AppFrame";
7
8
  import { ComposeFab } from "../components/layout/ComposeFab";
8
9
  import { MailShellProvider } from "../components/layout/MailShell";
9
10
  import { MailTopBar } from "../components/layout/MailTopBar";
@@ -171,9 +172,9 @@ function MailLayout() {
171
172
  onOpenNav: () => showOverlay("nav"),
172
173
  onCloseNav: () => showOverlay(undefined),
173
174
  };
174
- return (_jsx(MailContext.Provider, { value: mailContextValue, children: _jsxs(MailFreshnessProvider, { accountIds: accountIds, children: [isConfigError ? (_jsx("div", { className: "flex h-full items-center justify-center bg-canvas p-4", children: _jsx(ErrorState, { title: "Couldn't load your account", error: configError, onRetry: () => {
175
- refetchConfig();
176
- } }) })) : (
177
- // Each list route mounts its own shell around its own panes.
178
- _jsx(MailShellProvider, { chrome: shellChrome, children: _jsx(Outlet, {}) })), _jsx(KeyboardShortcutsModal, { isOpen: showShortcuts, onClose: () => showOverlay(undefined) })] }) }));
175
+ return (_jsx(MailContext.Provider, { value: mailContextValue, children: _jsxs(MailFreshnessProvider, { accountIds: accountIds, children: [_jsx(AppFrame, { children: isConfigError ? (_jsx("div", { className: "flex h-full items-center justify-center bg-canvas p-4", children: _jsx(ErrorState, { title: "Couldn't load your account", error: configError, onRetry: () => {
176
+ refetchConfig();
177
+ } }) })) : (
178
+ // Each list route mounts its own shell around its own panes.
179
+ _jsx(MailShellProvider, { chrome: shellChrome, children: _jsx(Outlet, {}) })) }), _jsx(KeyboardShortcutsModal, { isOpen: showShortcuts, onClose: () => showOverlay(undefined) })] }) }));
179
180
  }
@@ -3,6 +3,7 @@ import { SettingsShell } from "@remit/ui";
3
3
  import { createFileRoute, useNavigate } from "@tanstack/react-router";
4
4
  import { useState } from "react";
5
5
  import { CalendarCreateCard } from "../../components/settings/CalendarCreateCard";
6
+ import { CalendarDefaultSenderCard } from "../../components/settings/CalendarDefaultSenderCard";
6
7
  import { CalendarSettingsPanel } from "../../components/settings/CalendarSettingsPanel";
7
8
  import { CalendarSubscribeCard } from "../../components/settings/CalendarSubscribeCard";
8
9
  import { CalendarSubscriptionStatus } from "../../components/settings/CalendarSubscriptionStatus";
@@ -27,7 +28,7 @@ function CalendarsSettings() {
27
28
  void navigate({ to: path });
28
29
  }, onBackToMail: () => void navigate({ to: "/mail" }), children: isLoading ? (
29
30
  // biome-ignore lint/a11y/useAriaPropsSupportedByRole: aria-label on a loading skeleton is what assistive tech has to go on
30
- _jsx("div", { className: "h-24 animate-pulse rounded-sm border border-line bg-surface", "aria-busy": "true", "aria-label": "Loading calendars" })) : (_jsxs("div", { className: "space-y-4", children: [calendars.map((calendar) => {
31
+ _jsx("div", { className: "h-24 animate-pulse rounded-sm border border-line bg-surface", "aria-busy": "true", "aria-label": "Loading calendars" })) : (_jsxs("div", { className: "space-y-4", children: [_jsx(CalendarDefaultSenderCard, {}), calendars.map((calendar) => {
31
32
  const collection = collections.find((candidate) => candidate.calendarId === calendar.id);
32
33
  return (_jsx(CalendarSettingsPanel, { calendarId: calendar.id, calendarName: calendar.name, timezone: timeZoneByCalendarId[calendar.id] ?? "", subscription: collection?.source === "Subscribed" && (_jsx(CalendarSubscriptionStatus, { calendarName: collection.displayName, subscriptionUrl: collection.subscriptionUrl, enabled: collection.subscriptionEnabled, fetchedAt: collection.subscriptionFetchedAt, error: collection.subscriptionError, isBusy: subscriptions.togglingCalendarId === calendar.id, actionError: subscriptions.toggleFailure.calendarId === calendar.id
33
34
  ? subscriptions.toggleFailure.error
@@ -0,0 +1,11 @@
1
+ import type { AppId, AppSwitchItem } from "@remit/ui";
2
+ export interface AppSwitch {
3
+ items: AppSwitchItem[];
4
+ active: AppId;
5
+ switchTo: (id: AppId) => void;
6
+ }
7
+ /**
8
+ * Mail and calendar as two destinations. The panes the reader has up travel
9
+ * with them, the way a nav link carries them; overlays stay behind.
10
+ */
11
+ export declare function useAppSwitch(): AppSwitch;
@@ -0,0 +1,35 @@
1
+ import { useLocation, useNavigate, useRouter } from "@tanstack/react-router";
2
+ import { useCallback, useMemo } from "react";
3
+ import { useRetainOpenPanels } from "./fragment";
4
+ const appOfPath = (pathname) => pathname.startsWith("/calendar") ? "calendar" : "mail";
5
+ /**
6
+ * Mail and calendar as two destinations. The panes the reader has up travel
7
+ * with them, the way a nav link carries them; overlays stay behind.
8
+ */
9
+ export function useAppSwitch() {
10
+ const navigate = useNavigate();
11
+ const router = useRouter();
12
+ const retainPanels = useRetainOpenPanels();
13
+ const pathname = useLocation({ select: (location) => location.pathname });
14
+ const active = appOfPath(pathname);
15
+ const items = useMemo(() => [
16
+ {
17
+ id: "mail",
18
+ label: "Mail",
19
+ href: router.buildLocation({ to: "/mail", hash: retainPanels }).href,
20
+ },
21
+ {
22
+ id: "calendar",
23
+ label: "Calendar",
24
+ href: router.buildLocation({ to: "/calendar", hash: retainPanels })
25
+ .href,
26
+ },
27
+ ], [router, retainPanels]);
28
+ const switchTo = useCallback((id) => {
29
+ navigate({
30
+ to: id === "calendar" ? "/calendar" : "/mail",
31
+ hash: retainPanels,
32
+ });
33
+ }, [navigate, retainPanels]);
34
+ return { items, active, switchTo };
35
+ }
@@ -1,4 +1,10 @@
1
1
  import type { CalendarViewId } from "@remit/ui";
2
+ declare module "@tanstack/react-router" {
3
+ interface HistoryState {
4
+ /** This entry was opened from the calendar view, so Back returns to it. */
5
+ openedFromView?: boolean;
6
+ }
7
+ }
2
8
  /** Which zoom the calendar is at, on which day, over which calendars. */
3
9
  export interface CalendarAddress {
4
10
  view: CalendarViewId;
@@ -23,16 +29,27 @@ export interface OpenCalendarEvent {
23
29
  recurrenceId: string | undefined;
24
30
  }
25
31
  export declare function useOpenCalendarEvent(): OpenCalendarEvent | undefined;
32
+ /** The task the popup has open, if the address names one. */
33
+ export declare function useOpenCalendarTask(): string | undefined;
26
34
  /** Whether the composer is up, which is a route rather than a flag. */
27
35
  export declare function useChangingSuggestionId(): string | undefined;
36
+ /** The stored event the sidebar is editing, if the address has one open. */
37
+ export declare function useEditingEvent(): OpenCalendarEvent | undefined;
38
+ /** The range `/new` names in its query, unread until a sidebar reads it. */
39
+ export declare function useNewEventBounds(): {
40
+ start: string | undefined;
41
+ end: string | undefined;
42
+ } | undefined;
28
43
  export declare function useIsWritingEvent(): boolean;
29
44
  export interface CalendarNavigation {
30
45
  /** Change zoom, keeping the day on screen. */
31
46
  goToView: (view: CalendarViewId) => void;
32
- /** The previous or next screenful, measured in the view's own unit. */
33
- step: (direction: -1 | 1) => void;
34
47
  /** Home, from every view and every distance away. */
35
48
  goToToday: () => void;
49
+ /** The same view on another day. */
50
+ goToDate: (date: string) => void;
51
+ /** The calendars to draw; every one of them clears the query. */
52
+ setCalendarIds: (calendarIds: readonly string[]) => void;
36
53
  /**
37
54
  * The day the strip has scrolled to, written by `replace`. Scrolling is not
38
55
  * somewhere the reader went — Back belongs to the screen they arrived from,
@@ -47,8 +64,25 @@ export interface CalendarNavigation {
47
64
  * a resource that does not recur names only itself.
48
65
  */
49
66
  openEvent: (calendarObjectId: string, recurrenceId?: string) => void;
50
- closeEvent: () => void;
51
- openComposer: () => void;
67
+ /** A task in its popup, by its own segment. */
68
+ openTask: (calendarTaskId: string) => void;
69
+ /**
70
+ * Back to the view from an event popup or a sidebar: Back when the view is
71
+ * the entry before, else the view by replace.
72
+ */
73
+ closeToView: () => void;
74
+ /** The advanced sidebar on a new event over a range, as `start` and `end`. */
75
+ openNewEvent: (bounds: {
76
+ start: string;
77
+ end: string;
78
+ }) => void;
79
+ /** A new range for the open sidebar, by replace. */
80
+ setNewEventBounds: (bounds: {
81
+ start: string;
82
+ end: string;
83
+ }) => void;
84
+ /** The advanced sidebar on a stored event. */
85
+ openEditor: (calendarObjectId: string, recurrenceId?: string) => void;
52
86
  changeSuggestionFirst: (suggestionId: string, date: string) => void;
53
87
  }
54
88
  /**
@@ -67,3 +101,10 @@ export declare function useCalendarNavigation(): CalendarNavigation;
67
101
  */
68
102
  export declare function useOpenEventOnCalendar(): (date: string, calendarObjectId: string, recurrenceId: string) => void;
69
103
  export declare function useChangeSuggestionOnCalendar(): (date: string, suggestionId: string) => void;
104
+ /**
105
+ * Back answered by a layer that holds no address of its own: the phone's
106
+ * quick-create sheet, or an editor that asks before a touched draft goes.
107
+ * Only Back is caught, and only while `onBack` says it answered it; a
108
+ * navigation the app starts is never blocked.
109
+ */
110
+ export declare function useBackCloses(active: boolean, onBack: () => boolean): void;