@remit/web-client 0.0.346 → 0.0.348

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 (108) hide show
  1. package/dist/src/components/mail/BriefPane.js +3 -3
  2. package/dist/src/components/mail/CheckAgainProvider.d.ts +30 -0
  3. package/dist/src/components/mail/CheckAgainProvider.js +194 -0
  4. package/dist/src/components/mail/{FlaggedList.d.ts → CollectionList.d.ts} +7 -3
  5. package/dist/src/components/mail/{FlaggedList.js → CollectionList.js} +29 -24
  6. package/dist/src/components/mail/CollectionPane.d.ts +32 -0
  7. package/dist/src/components/mail/{FlaggedPane.js → CollectionPane.js} +35 -33
  8. package/dist/src/components/mail/ConversationView.d.ts +7 -8
  9. package/dist/src/components/mail/ConversationView.js +4 -4
  10. package/dist/src/components/mail/DailyBrief.js +6 -4
  11. package/dist/src/components/mail/IntelligencePane.d.ts +2 -2
  12. package/dist/src/components/mail/IntelligencePane.js +33 -4
  13. package/dist/src/components/mail/MailSidebarAdapter.js +29 -7
  14. package/dist/src/components/mail/MailboxPane.js +10 -12
  15. package/dist/src/components/mail/MessageActionMenu.d.ts +3 -1
  16. package/dist/src/components/mail/MessageActionMenu.js +3 -3
  17. package/dist/src/components/mail/MessageCard.js +9 -1
  18. package/dist/src/components/mail/MessageList.js +11 -2
  19. package/dist/src/components/mail/MessageListItem.d.ts +4 -2
  20. package/dist/src/components/mail/MessageListItem.js +4 -6
  21. package/dist/src/components/mail/SpamBannerSlot.d.ts +10 -0
  22. package/dist/src/components/mail/SpamBannerSlot.js +56 -0
  23. package/dist/src/components/mail/SwipeableMessageRow.d.ts +3 -2
  24. package/dist/src/components/mail/SwipeableMessageRow.js +6 -6
  25. package/dist/src/components/mail/ThreadListInteraction.d.ts +2 -0
  26. package/dist/src/components/mail/ThreadListInteraction.js +12 -2
  27. package/dist/src/components/settings/classification/FailureBanner.js +3 -4
  28. package/dist/src/components/settings/spam/SpamSettingsPanel.d.ts +6 -0
  29. package/dist/src/components/settings/spam/SpamSettingsPanel.js +176 -0
  30. package/dist/src/hooks/{useStarredThreads.d.ts → useCollectionThreads.d.ts} +10 -8
  31. package/dist/src/hooks/{useStarredThreads.js → useCollectionThreads.js} +16 -14
  32. package/dist/src/hooks/useCurrentMailboxName.d.ts +1 -0
  33. package/dist/src/hooks/useCurrentMailboxName.js +6 -1
  34. package/dist/src/hooks/useIntelligenceData.d.ts +2 -4
  35. package/dist/src/hooks/useIntelligenceData.js +1 -127
  36. package/dist/src/hooks/useJunkMailboxIds.d.ts +2 -0
  37. package/dist/src/hooks/useJunkMailboxIds.js +17 -0
  38. package/dist/src/hooks/useLabels.d.ts +10 -9
  39. package/dist/src/hooks/useLabels.js +25 -6
  40. package/dist/src/lib/brief.d.ts +1 -1
  41. package/dist/src/lib/brief.js +3 -3
  42. package/dist/src/lib/check-again.d.ts +33 -0
  43. package/dist/src/lib/check-again.js +66 -0
  44. package/dist/src/lib/{flagged-criteria.d.ts → collection-criteria.d.ts} +18 -6
  45. package/dist/src/lib/{flagged-criteria.js → collection-criteria.js} +4 -3
  46. package/dist/src/lib/conversation-target.d.ts +3 -2
  47. package/dist/src/lib/label-folders.d.ts +6 -0
  48. package/dist/src/lib/label-folders.js +10 -0
  49. package/dist/src/lib/mail-route.d.ts +10 -5
  50. package/dist/src/lib/mail-route.js +9 -1
  51. package/dist/src/lib/mail-search.d.ts +11 -0
  52. package/dist/src/lib/mail-search.js +4 -0
  53. package/dist/src/lib/search-scope.d.ts +2 -2
  54. package/dist/src/lib/search-scope.js +4 -4
  55. package/dist/src/lib/search-tokens.d.ts +1 -1
  56. package/dist/src/lib/search-tokens.js +2 -2
  57. package/dist/src/lib/spam-overview.d.ts +23 -0
  58. package/dist/src/lib/spam-overview.js +44 -0
  59. package/dist/src/lib/spam.d.ts +32 -0
  60. package/dist/src/lib/spam.js +38 -0
  61. package/dist/src/lib/thread-search-tokens.js +3 -1
  62. package/dist/src/routeTree.gen.d.ts +312 -5
  63. package/dist/src/routeTree.gen.js +72 -0
  64. package/dist/src/routes/__root.js +2 -1
  65. package/dist/src/routes/mail/flagged/$threadId/$messageId.js +2 -2
  66. package/dist/src/routes/mail/flagged/$threadId/index.js +2 -2
  67. package/dist/src/routes/mail/flagged/index.js +2 -2
  68. package/dist/src/routes/mail/flagged.js +3 -2
  69. package/dist/src/routes/mail/label/$labelId/$threadId/$messageId/$mode.{-$outboxMessageId}.d.ts +18 -0
  70. package/dist/src/routes/mail/label/$labelId/$threadId/$messageId/$mode.{-$outboxMessageId}.js +8 -0
  71. package/dist/src/routes/mail/label/$labelId/$threadId/$messageId.d.ts +15 -0
  72. package/dist/src/routes/mail/label/$labelId/$threadId/$messageId.js +14 -0
  73. package/dist/src/routes/mail/label/$labelId/$threadId/index.d.ts +15 -0
  74. package/dist/src/routes/mail/label/$labelId/$threadId/index.js +9 -0
  75. package/dist/src/routes/mail/label/$labelId/$threadId.d.ts +15 -0
  76. package/dist/src/routes/mail/label/$labelId/$threadId.js +8 -0
  77. package/dist/src/routes/mail/label/$labelId/compose.{-$outboxMessageId}.d.ts +15 -0
  78. package/dist/src/routes/mail/label/$labelId/compose.{-$outboxMessageId}.js +10 -0
  79. package/dist/src/routes/mail/label/$labelId/index.d.ts +15 -0
  80. package/dist/src/routes/mail/label/$labelId/index.js +9 -0
  81. package/dist/src/routes/mail/label/$labelId.d.ts +15 -0
  82. package/dist/src/routes/mail/label/$labelId.js +30 -0
  83. package/dist/src/routes/mail/label/index.d.ts +29 -0
  84. package/dist/src/routes/mail/label/index.js +18 -0
  85. package/dist/src/routes/settings/filters.d.ts +6 -2
  86. package/dist/src/routes/settings/filters.js +10 -3
  87. package/dist/src/routes/settings/senders.d.ts +14 -2
  88. package/dist/src/routes/settings/senders.js +32 -15
  89. package/dist/src/routes/settings/spam.d.ts +1 -0
  90. package/dist/src/routes/settings/spam.js +15 -0
  91. package/dist/src/routes/settings.js +6 -1
  92. package/dist/src/routing/browsed-list.d.ts +1 -1
  93. package/dist/src/routing/browsed-list.js +15 -4
  94. package/dist/src/routing/compose.js +10 -6
  95. package/dist/src/routing/index.d.ts +1 -1
  96. package/dist/src/routing/index.js +1 -1
  97. package/dist/src/routing/nav-selection.d.ts +5 -0
  98. package/dist/src/routing/nav-selection.js +15 -0
  99. package/dist/src/routing/open-thread.js +23 -3
  100. package/dist/src/routing/reply.js +28 -11
  101. package/dist/src/routing/search-mirror.d.ts +5 -0
  102. package/dist/src/routing/search-mirror.js +20 -2
  103. package/dist/src/routing/spam-link.d.ts +3 -0
  104. package/dist/src/routing/spam-link.js +12 -0
  105. package/package.json +2 -2
  106. package/dist/src/components/mail/AuthenticityBanner.d.ts +0 -14
  107. package/dist/src/components/mail/AuthenticityBanner.js +0 -18
  108. package/dist/src/components/mail/FlaggedPane.d.ts +0 -29
@@ -4,6 +4,7 @@ import { ErrorState, SettingsShell } from "@remit/ui";
4
4
  import { useQuery } from "@tanstack/react-query";
5
5
  import { createFileRoute, useNavigate } from "@tanstack/react-router";
6
6
  import { useCallback, useMemo, useState } from "react";
7
+ import { z } from "zod";
7
8
  import { FilterActionError } from "../../components/settings/FilterActionError";
8
9
  import { FilterEditorSurface } from "../../components/settings/FilterEditorSurface";
9
10
  import { FiltersList } from "../../components/settings/FiltersList";
@@ -17,11 +18,16 @@ import { buildMoveOptions, folderDelimiter } from "../../lib/move-options";
17
18
  import { filterRunStatus } from "../../lib/organize/filter-run";
18
19
  import { useOpenSettingsSection } from "../../routing/sections";
19
20
  import { useSettingsNavItems } from "../settings";
21
+ const filtersSearchSchema = z.object({
22
+ /** A filter to open on arrival, as the Spam check links to it. */
23
+ filterId: z.string().optional(),
24
+ });
20
25
  export const Route = createFileRoute("/settings/filters")({
21
26
  component: FiltersSettings,
27
+ validateSearch: filtersSearchSchema,
22
28
  });
23
29
  const filtersHelp = (_jsxs("div", { className: "space-y-3", children: [_jsxs("p", { children: ["Filters are the standing rules Organize creates. A", " ", _jsx("strong", { children: "Standing" }), " filter keeps working on new mail; a", " ", _jsx("strong", { children: "Temporary" }), " one stops on its own at the date you picked."] }), _jsx("p", { children: "An expired filter isn't deleted the instant it lapses \u2014 it stays here, marked Expired, so you can see what it did and when it stopped." }), _jsx("p", { children: "A filter that can't do its job turns itself off and says why, for example when its folder no longer exists. Turn it back on once that is fixed." })] }));
24
- export function AccountFilters({ account, }) {
30
+ export function AccountFilters({ account, openFilterId, }) {
25
31
  const accountId = account.accountId;
26
32
  const { filters, isPending, isError, error, refetch } = useFilterList(accountId);
27
33
  const { deleteFilter, deletingFilterId } = useDeleteFilter(accountId);
@@ -34,7 +40,7 @@ export function AccountFilters({ account, }) {
34
40
  startForFilter(filterId);
35
41
  }, [startForFilter]);
36
42
  const runStatus = filterRunStatus(run);
37
- const [editingFilterId, setEditingFilterId] = useState();
43
+ const [editingFilterId, setEditingFilterId] = useState(openFilterId);
38
44
  const { data: mailboxesData } = useQuery({
39
45
  ...mailboxOperationsListMailboxesOptions({ path: { accountId } }),
40
46
  staleTime: Infinity,
@@ -77,10 +83,11 @@ function FiltersSettings() {
77
83
  const navItems = useSettingsNavItems();
78
84
  const openSettingsSection = useOpenSettingsSection();
79
85
  const [helpOpen, setHelpOpen] = useState(true);
86
+ const openFilterId = Route.useSearch({ select: (search) => search.filterId });
80
87
  const { data: config, isPending, isError, error, refetch, } = useQuery(configOperationsGetConfigOptions());
81
88
  return (_jsx(SettingsShell, { items: navItems, activeId: "filters", title: "Filters", description: "Standing and temporary rules created by Organize, per account.", help: filtersHelp, helpOpen: helpOpen, onToggleHelp: () => setHelpOpen((v) => !v), onSelect: openSettingsSection, onBackToMail: () => void navigate({ to: "/mail" }), children: isPending ? (
82
89
  // biome-ignore lint/a11y/useAriaPropsSupportedByRole: aria-label on loading skeleton provides useful context for assistive tech
83
90
  _jsx("div", { className: "h-24 animate-pulse rounded-sm border border-line bg-surface", "aria-busy": "true", "aria-label": "Loading accounts" })) : isError ? (_jsx(ErrorState, { title: "Couldn't load accounts", error: error, onRetry: () => {
84
91
  refetch();
85
- } })) : config.accounts.length === 0 ? (_jsx("p", { className: "py-12 text-sm text-fg-muted", children: "No accounts configured." })) : (_jsx("div", { className: "space-y-8", children: config.accounts.map((account) => (_jsx(AccountFilters, { account: account }, account.accountId))) })) }));
92
+ } })) : config.accounts.length === 0 ? (_jsx("p", { className: "py-12 text-sm text-fg-muted", children: "No accounts configured." })) : (_jsx("div", { className: "space-y-8", children: config.accounts.map((account) => (_jsx(AccountFilters, { account: account, openFilterId: openFilterId }, account.accountId))) })) }));
86
93
  }
@@ -1,6 +1,18 @@
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>, "/settings", "/settings", "/settings", "/settings", undefined, import("@tanstack/router-core").ResolveParams<"/settings">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/senders", "/settings/senders", "/settings/senders", "/settings/senders", undefined, import("@tanstack/router-core").ResolveParams<"/senders">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>;
1
+ import { z } from "zod";
2
+ declare const SENDER_GROUPS: readonly ["vip", "muted", "blocked", "neverSpam"];
3
+ 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>, "/settings", "/settings", "/settings", "/settings", undefined, import("@tanstack/router-core").ResolveParams<"/settings">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/senders", "/settings/senders", "/settings/senders", "/settings/senders", z.ZodObject<{
4
+ group: z.ZodOptional<z.ZodEnum<{
5
+ blocked: "blocked";
6
+ vip: "vip";
7
+ muted: "muted";
8
+ neverSpam: "neverSpam";
9
+ }>>;
10
+ }, z.core.$strip>, import("@tanstack/router-core").ResolveParams<"/senders">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>;
11
+ type SenderGroup = (typeof SENDER_GROUPS)[number];
12
+ type SearchGroup = Exclude<SenderGroup, "vip">;
2
13
  export declare function SearchGroupPane({ group, query, onCount, }: {
3
- group: "muted" | "blocked";
14
+ group: SearchGroup;
4
15
  query: string;
5
16
  onCount?: (matched: number, total: number | null) => void;
6
17
  }): import("react").JSX.Element;
18
+ export {};
@@ -5,8 +5,9 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
5
5
  *
6
6
  * Backend gap (#427): there is no "list all addresses with flag X" endpoint.
7
7
  * VIP group: served from GET /me/vip-suggestions (suggested-to-promote list).
8
- * Muted / Blocked groups: users search by name/email to find flagged senders
9
- * via GET /addresses/search; results are filtered client-side on the flag.
8
+ * Muted / Blocked / Never in Spam groups: users search by name/email to find
9
+ * flagged senders via GET /addresses/search; results are filtered client-side
10
+ * on the flag, because the search takes no flag filter (spam spec gap 1).
10
11
  * The real flagged-address query endpoint is tracked as a backend issue.
11
12
  */
12
13
  import { addressDetailOperationsUpdateAddressMutation, addressOperationsSearchAddressesOptions, meOperationsListVipSuggestionsOptions, meOperationsListVipSuggestionsQueryKey, } from "@remit/api-http-client/@tanstack/react-query.gen.ts";
@@ -15,19 +16,32 @@ import { Search, Star, X } from "@remit/ui/icons";
15
16
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
16
17
  import { createFileRoute, useNavigate } from "@tanstack/react-router";
17
18
  import { useCallback, useEffect, useState } from "react";
19
+ import { z } from "zod";
18
20
  import { useDebouncedValue } from "../../hooks/useDebouncedValue";
19
21
  import { formatDate } from "../../lib/format";
20
22
  import { useOpenSettingsSection } from "../../routing/sections";
21
23
  import { useSettingsNavItems } from "../settings";
22
24
  import { sendersHelp } from "./-shared/help-copy";
25
+ const SENDER_GROUPS = ["vip", "muted", "blocked", "neverSpam"];
26
+ const sendersSearchSchema = z.object({
27
+ group: z.enum(SENDER_GROUPS).optional(),
28
+ });
23
29
  export const Route = createFileRoute("/settings/senders")({
24
30
  component: SendersSettings,
31
+ validateSearch: sendersSearchSchema,
25
32
  });
26
33
  const groupLabels = {
27
34
  vip: "VIPs",
28
35
  muted: "Muted",
29
- blocked: "Blocked",
36
+ blocked: "Blocked (reported)",
37
+ neverSpam: "Never in Spam",
38
+ };
39
+ const groupNouns = {
40
+ muted: "muted",
41
+ blocked: "blocked",
42
+ neverSpam: "never-in-spam",
30
43
  };
44
+ const flagOf = (address, group) => address.flags?.[group];
31
45
  /* ------------------------------------------------------------------ */
32
46
  /* VIP group: served from suggestions endpoint */
33
47
  /* ------------------------------------------------------------------ */
@@ -99,9 +113,7 @@ export function SearchGroupPane({ group, query, onCount, }) {
99
113
  queryClient.invalidateQueries({ queryKey: searchOptions.queryKey });
100
114
  },
101
115
  });
102
- const items = (data?.items ?? []).filter((a) => group === "muted"
103
- ? (a.flags?.muted?.value ?? false)
104
- : (a.flags?.blocked?.value ?? false));
116
+ const items = (data?.items ?? []).filter((a) => flagOf(a, group)?.value ?? false);
105
117
  useEffect(() => {
106
118
  // Total flagged count is unknown (no list-all-flagged endpoint), so the
107
119
  // group rail shows the live matched-row count while a search is active.
@@ -109,7 +121,7 @@ export function SearchGroupPane({ group, query, onCount, }) {
109
121
  }, [onCount, enabled, items.length]);
110
122
  if (!enabled) {
111
123
  // Backend gap: no list-all-flagged endpoint; prompt user to search.
112
- return (_jsxs("div", { className: "px-row-inset py-5 text-sm text-fg-subtle space-y-2", children: [_jsxs("p", { children: ["Type 2+ characters to search ", groupLabels[group].toLowerCase(), " ", "senders by name or address."] }), _jsxs("p", { className: "text-2xs text-fg-subtle", children: ["Note: a dedicated flagged-address list endpoint is in the backlog. Press ", _jsx(Kbd, { children: "m" }), " on any message to mute its sender; ", _jsx(Kbd, { children: "b" }), " to block."] })] }));
124
+ return (_jsxs("div", { className: "px-row-inset py-5 text-sm text-fg-subtle space-y-2", children: [_jsxs("p", { children: ["Type 2+ characters to search ", groupNouns[group], " senders by name or address."] }), _jsxs("p", { className: "text-2xs text-fg-subtle", children: ["Note: a dedicated flagged-address list endpoint is in the backlog. Press ", _jsx(Kbd, { children: "m" }), " on any message to mute its sender; ", _jsx(Kbd, { children: "b" }), " to block."] })] }));
113
125
  }
114
126
  if (isPending) {
115
127
  return (_jsx("div", { className: "px-row-inset py-3 text-sm text-fg-subtle animate-pulse", children: "Searching\u2026" }));
@@ -118,16 +130,16 @@ export function SearchGroupPane({ group, query, onCount, }) {
118
130
  return (_jsx("div", { className: "px-row-inset py-3", children: _jsx(ErrorState, { variant: "inline", title: "Search failed", error: error }) }));
119
131
  }
120
132
  if (items.length === 0) {
121
- return (_jsxs("p", { className: "px-row-inset py-5 text-sm text-fg-subtle", children: ["No ", groupLabels[group].toLowerCase(), " senders matching \u201C", debouncedQ, "\u201D."] }));
133
+ return (_jsxs("p", { className: "px-row-inset py-5 text-sm text-fg-subtle", children: ["No ", groupNouns[group], " senders matching \u201C", debouncedQ, "\u201D."] }));
122
134
  }
123
135
  return (_jsx(_Fragment, { children: items.map((a) => {
124
- const flag = group === "muted" ? a.flags?.muted : a.flags?.blocked;
136
+ const flag = flagOf(a, group);
125
137
  // The search response carries no engagement counts, so the row's
126
138
  // info line is the flag provenance (when/why it was flagged)
127
139
  // rather than echoing the email already in the header.
128
140
  const meta = flag
129
141
  ? [
130
- `${group}`,
142
+ groupNouns[group],
131
143
  flag.setAt
132
144
  ? formatDate(flag.setAt, {
133
145
  month: "short",
@@ -138,7 +150,7 @@ export function SearchGroupPane({ group, query, onCount, }) {
138
150
  ]
139
151
  .filter(Boolean)
140
152
  .join(" ")
141
- : group;
153
+ : groupNouns[group];
142
154
  const isPendingRemove = removeMutation.isPending &&
143
155
  removeMutation.variables?.path.addressId === a.addressId;
144
156
  const isFailedRemove = removeMutation.isError && retryId === a.addressId;
@@ -150,7 +162,7 @@ export function SearchGroupPane({ group, query, onCount, }) {
150
162
  flags: { [group]: { value: false, setAt: Date.now() } },
151
163
  },
152
164
  });
153
- }, children: "Retry" })) : (_jsx(Button, { variant: "ghost", size: "sm", icon: _jsx(X, { className: "size-3.5" }), "aria-busy": isPendingRemove, "aria-label": `Remove ${group} flag`, onClick: () => {
165
+ }, children: "Retry" })) : (_jsx(Button, { variant: "ghost", size: "sm", icon: _jsx(X, { className: "size-3.5" }), "aria-busy": isPendingRemove, "aria-label": `Remove ${groupNouns[group]} flag`, onClick: () => {
154
166
  if (isPendingRemove)
155
167
  return;
156
168
  setRetryId(a.addressId);
@@ -170,14 +182,19 @@ function SendersSettings() {
170
182
  const navigate = useNavigate();
171
183
  const navItems = useSettingsNavItems();
172
184
  const openSettingsSection = useOpenSettingsSection();
173
- const [group, setGroup] = useState("vip");
185
+ const group = Route.useSearch({ select: (search) => search.group ?? "vip" });
186
+ const setGroup = (next) => void navigate({
187
+ to: "/settings/senders",
188
+ search: { group: next },
189
+ replace: true,
190
+ });
174
191
  const [query, setQuery] = useState("");
175
192
  const [helpOpen, setHelpOpen] = useState(true);
176
193
  // Per-group counts for the rail + footer. VIP total is the suggestions
177
194
  // list size; muted/blocked have no list endpoint, so their total is null
178
195
  // (the rail shows the live matched-row count instead of a stale total).
179
196
  const [matched, setMatched] = useState(0);
180
- const [groupCounts, setGroupCounts] = useState({ vip: 0, muted: null, blocked: null });
197
+ const [groupCounts, setGroupCounts] = useState({ vip: 0, muted: null, blocked: null, neverSpam: null });
181
198
  const handleVipCount = useCallback((m, total) => {
182
199
  setMatched(m);
183
200
  setGroupCounts((prev) => ({ ...prev, vip: total }));
@@ -190,7 +207,7 @@ function SendersSettings() {
190
207
  return (_jsx(SettingsShell, { items: navItems, activeId: "senders", title: "Senders & Rules", description: "Per-sender preferences \u2014 set with one key from any message, managed here.", flush: true, help: sendersHelp, helpOpen: helpOpen, onToggleHelp: () => setHelpOpen((v) => !v), onSelect: openSettingsSection, onBackToMail: () => void navigate({ to: "/mail" }), children: _jsxs("div", { className: "flex min-h-0 flex-1 flex-col lg:flex-row", children: [_jsx(SenderGroupSwitch, { active: group, onSelect: (g) => {
191
208
  setGroup(g);
192
209
  setQuery("");
193
- }, options: ["vip", "muted", "blocked"].map((g) => ({
210
+ }, options: SENDER_GROUPS.map((g) => ({
194
211
  id: g,
195
212
  label: groupLabels[g],
196
213
  count: groupCounts[g],
@@ -0,0 +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>, "/settings", "/settings", "/settings", "/settings", undefined, import("@tanstack/router-core").ResolveParams<"/settings">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/spam", "/settings/spam", "/settings/spam", "/settings/spam", undefined, import("@tanstack/router-core").ResolveParams<"/spam">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { SettingsShell } from "@remit/ui";
3
+ import { createFileRoute, useNavigate } from "@tanstack/react-router";
4
+ import { SpamSettingsPanel } from "../../components/settings/spam/SpamSettingsPanel";
5
+ import { useOpenSettingsSection } from "../../routing/sections";
6
+ import { useSettingsNavItems } from "../settings";
7
+ export const Route = createFileRoute("/settings/spam")({
8
+ component: SpamSettings,
9
+ });
10
+ function SpamSettings() {
11
+ const navigate = useNavigate();
12
+ const navItems = useSettingsNavItems();
13
+ const openSettingsSection = useOpenSettingsSection();
14
+ return (_jsx(SettingsShell, { items: navItems, activeId: "spam", title: "Spam & phishing", description: "What Remit flagged, and when it acts.", onSelect: openSettingsSection, onBackToMail: () => void navigate({ to: "/mail" }), children: _jsx(SpamSettingsPanel, {}) }));
15
+ }
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { CalendarDays, FolderTree, Funnel, Inbox, Palette, Sparkles, Tag, UserCog, Users, } from "@remit/ui/icons";
2
+ import { CalendarDays, FolderTree, Funnel, Inbox, Palette, ShieldAlert, Sparkles, Tag, UserCog, Users, } from "@remit/ui/icons";
3
3
  import { createFileRoute, Outlet } from "@tanstack/react-router";
4
4
  import { AdvancedNavIcon } from "../components/settings/AdvancedNavIcon";
5
5
  import { WarningsNavIcon } from "../components/settings/WarningsNavIcon";
@@ -35,6 +35,11 @@ export const SETTINGS_NAV_ITEMS = [
35
35
  label: "Mail classification",
36
36
  icon: _jsx(Sparkles, { className: "size-4" }),
37
37
  },
38
+ {
39
+ id: "spam",
40
+ label: "Spam & phishing",
41
+ icon: _jsx(ShieldAlert, { className: "size-4" }),
42
+ },
38
43
  {
39
44
  id: "calendars",
40
45
  label: "Calendars",
@@ -1,7 +1,7 @@
1
1
  import { type BrowsedList } from "../lib/mail-route";
2
2
  export type { BrowsedList };
3
3
  /**
4
- * The list the address is browsing, as the two values a navigation to it needs.
4
+ * The list the address is browsing, as the values a navigation to it needs.
5
5
  *
6
6
  * Every surface a list can open — compose, a reply, a conversation — reads the
7
7
  * same answer, so the four lists cannot disagree about which one is underneath.
@@ -3,7 +3,7 @@ import { useCallback, useMemo } from "react";
3
3
  import { locationOpensDetail, mailListRoute, } from "../lib/mail-route";
4
4
  import { useRetainOpenPanels } from "./fragment";
5
5
  /**
6
- * The list the address is browsing, as the two values a navigation to it needs.
6
+ * The list the address is browsing, as the values a navigation to it needs.
7
7
  *
8
8
  * Every surface a list can open — compose, a reply, a conversation — reads the
9
9
  * same answer, so the four lists cannot disagree about which one is underneath.
@@ -16,7 +16,9 @@ export function useBrowsedList() {
16
16
  });
17
17
  const mailbox = useParams({ from: "/mail/$mailboxId", shouldThrow: false });
18
18
  const mailboxId = mailbox?.mailboxId;
19
- return useMemo(() => ({ list, mailboxId }), [list, mailboxId]);
19
+ const label = useParams({ from: "/mail/label/$labelId", shouldThrow: false });
20
+ const labelId = label?.labelId;
21
+ return useMemo(() => ({ list, mailboxId, labelId }), [list, mailboxId, labelId]);
20
22
  }
21
23
  /**
22
24
  * Whether the address names something the list has open below it — a
@@ -40,7 +42,7 @@ export function useOpensDetail() {
40
42
  export function useNavigateToBrowsedList() {
41
43
  const navigate = useNavigate();
42
44
  const retainPanels = useRetainOpenPanels();
43
- const { list, mailboxId } = useBrowsedList();
45
+ const { list, mailboxId, labelId } = useBrowsedList();
44
46
  return useCallback(() => {
45
47
  const search = (prev) => prev;
46
48
  const hash = retainPanels;
@@ -56,6 +58,15 @@ export function useNavigateToBrowsedList() {
56
58
  navigate({ to: "/mail/$mailboxId", params: { mailboxId }, search, hash });
57
59
  return;
58
60
  }
61
+ if (list === "label" && labelId) {
62
+ navigate({
63
+ to: "/mail/label/$labelId",
64
+ params: { labelId },
65
+ search,
66
+ hash,
67
+ });
68
+ return;
69
+ }
59
70
  navigate({ to: "/mail/brief", search, hash });
60
- }, [navigate, retainPanels, list, mailboxId]);
71
+ }, [navigate, retainPanels, list, mailboxId, labelId]);
61
72
  }
@@ -1,7 +1,7 @@
1
1
  import { useNavigate, useParams } from "@tanstack/react-router";
2
2
  import { useCallback } from "react";
3
3
  import { withoutComposeSeed } from "../lib/mail-search";
4
- import { useBrowsedList, useNavigateToBrowsedList } from "./browsed-list";
4
+ import { useBrowsedList, useNavigateToBrowsedList, } from "./browsed-list";
5
5
  import { useRetainOpenPanels } from "./fragment";
6
6
  /**
7
7
  * The compose route under each list. The draft is an optional segment of the
@@ -12,6 +12,7 @@ const BRIEF_COMPOSE = "/mail/brief/compose/{-$outboxMessageId}";
12
12
  const FLAGGED_COMPOSE = "/mail/flagged/compose/{-$outboxMessageId}";
13
13
  const OUTBOX_COMPOSE = "/mail/outbox/compose/{-$outboxMessageId}";
14
14
  const MAILBOX_COMPOSE = "/mail/$mailboxId/compose/{-$outboxMessageId}";
15
+ const LABEL_COMPOSE = "/mail/label/$labelId/compose/{-$outboxMessageId}";
15
16
  /**
16
17
  * The compose match, if the address has one. Each `from` names a real route, so
17
18
  * a segment that does not exist fails to compile.
@@ -23,7 +24,8 @@ function useComposeParams() {
23
24
  const flagged = useParams({ from: FLAGGED_COMPOSE, shouldThrow: false });
24
25
  const outbox = useParams({ from: OUTBOX_COMPOSE, shouldThrow: false });
25
26
  const mailbox = useParams({ from: MAILBOX_COMPOSE, shouldThrow: false });
26
- return brief ?? flagged ?? outbox ?? mailbox;
27
+ const label = useParams({ from: LABEL_COMPOSE, shouldThrow: false });
28
+ return brief ?? flagged ?? outbox ?? mailbox ?? label;
27
29
  }
28
30
  /**
29
31
  * Whether the compose surface is showing.
@@ -57,13 +59,15 @@ export function useComposeDraftId() {
57
59
  * dead button this change deletes, and neither case has anything to report:
58
60
  * a message needs no folder to be written in.
59
61
  */
60
- function composeTarget(list, mailboxId, outboxMessageId) {
62
+ function composeTarget({ list, mailboxId, labelId }, outboxMessageId) {
61
63
  if (list === "flagged")
62
64
  return { to: FLAGGED_COMPOSE, params: { outboxMessageId } };
63
65
  if (list === "outbox")
64
66
  return { to: OUTBOX_COMPOSE, params: { outboxMessageId } };
65
67
  if (list === "mailbox" && mailboxId)
66
68
  return { to: MAILBOX_COMPOSE, params: { mailboxId, outboxMessageId } };
69
+ if (list === "label" && labelId)
70
+ return { to: LABEL_COMPOSE, params: { labelId, outboxMessageId } };
67
71
  return { to: BRIEF_COMPOSE, params: { outboxMessageId } };
68
72
  }
69
73
  /**
@@ -76,10 +80,10 @@ function composeTarget(list, mailboxId, outboxMessageId) {
76
80
  function useComposeNavigate() {
77
81
  const navigate = useNavigate();
78
82
  const retainPanels = useRetainOpenPanels();
79
- const { list, mailboxId } = useBrowsedList();
83
+ const browsed = useBrowsedList();
80
84
  return useCallback((outboxMessageId, options) => {
81
85
  navigate({
82
- ...composeTarget(list, mailboxId, outboxMessageId),
86
+ ...composeTarget(browsed, outboxMessageId),
83
87
  search: withoutComposeSeed,
84
88
  // Opening or closing the surface is going somewhere, so the panes the
85
89
  // reader keeps up travel and the overlays they were reading over do
@@ -89,7 +93,7 @@ function useComposeNavigate() {
89
93
  hash: options?.keepPanels ? true : retainPanels,
90
94
  replace: options?.replace ?? false,
91
95
  });
92
- }, [navigate, retainPanels, list, mailboxId]);
96
+ }, [navigate, retainPanels, browsed]);
93
97
  }
94
98
  /**
95
99
  * Start a new message.
@@ -4,7 +4,7 @@ export { type CalendarAddress, type CalendarNavigation, type OpenCalendarEvent,
4
4
  export { useAdoptComposeDraft, useCloseCompose, useComposeDraftId, useEditDraft, useIsComposing, useOpenCompose, } from "./compose";
5
5
  export { formatOpenPanels, isOverlayPanel, type OverlayPanel, overlayPanels, type PanelFragment, panelFragments, panelsWithOverlay, parseOpenPanels, retainOpenPanelsAtTier, useOpenPanels, useRetainOpenPanels, useSetOpenPanels, } from "./fragment";
6
6
  export { NavLink, type NavLinkProps } from "./nav-link";
7
- export { useSelectedNavId } from "./nav-selection";
7
+ export { labelIdOfNavId, labelNavId, useSelectedNavId, } from "./nav-selection";
8
8
  export { type OpenThreadOptions, type OpenThreadPath, type OpenThreadTarget, useCloseThread, useOpenThread, useOpenThreadPath, } from "./open-thread";
9
9
  export { useCloseOutboxDraft, useOpenOutboxDraft, useOutboxDraftId, } from "./outbox-draft";
10
10
  export { type ReplyAddress, type ReplyMode, type ReplySurface, type ReplyTarget, replyModes, replyToThread, useAdoptReplyDraft, useCloseReply, useIsReplying, useOpenReply, useReplySurface, } from "./reply";
@@ -4,7 +4,7 @@ export { useBackCloses, useCalendarAddress, useCalendarNavigation, useChangeSugg
4
4
  export { useAdoptComposeDraft, useCloseCompose, useComposeDraftId, useEditDraft, useIsComposing, useOpenCompose, } from "./compose";
5
5
  export { formatOpenPanels, isOverlayPanel, overlayPanels, panelFragments, panelsWithOverlay, parseOpenPanels, retainOpenPanelsAtTier, useOpenPanels, useRetainOpenPanels, useSetOpenPanels, } from "./fragment";
6
6
  export { NavLink } from "./nav-link";
7
- export { useSelectedNavId } from "./nav-selection";
7
+ export { labelIdOfNavId, labelNavId, useSelectedNavId, } from "./nav-selection";
8
8
  export { useCloseThread, useOpenThread, useOpenThreadPath, } from "./open-thread";
9
9
  export { useCloseOutboxDraft, useOpenOutboxDraft, useOutboxDraftId, } from "./outbox-draft";
10
10
  export { replyModes, replyToThread, useAdoptReplyDraft, useCloseReply, useIsReplying, useOpenReply, useReplySurface, } from "./reply";
@@ -1,9 +1,14 @@
1
+ /** The nav id of a label's entry. Mailbox ids are UUIDs, so the prefix never collides. */
2
+ export declare function labelNavId(labelId: string): string;
3
+ /** The label a nav id names, or `undefined` when it names something else. */
4
+ export declare function labelIdOfNavId(navId: string): string | undefined;
1
5
  /**
2
6
  * The nav entry the address selects, or `""` where none does.
3
7
  *
4
8
  * - `/settings/*` → "settings"
5
9
  * - `/calendar/*` → "calendar"
6
10
  * - `/mail/outbox`, `/mail/flagged`, `/mail/brief` → that list
11
+ * - `/mail/label/$labelId` → the label's nav id
7
12
  * - `/mail/$mailboxId` → the mailbox id, which is what the sidebar keys on
8
13
  *
9
14
  * Read off the pathname rather than the matches: the router commits the new
@@ -1,11 +1,23 @@
1
1
  import { useLocation, useParams } from "@tanstack/react-router";
2
2
  import { locationIsOnList } from "../lib/mail-route";
3
+ const LABEL_NAV_PREFIX = "label:";
4
+ /** The nav id of a label's entry. Mailbox ids are UUIDs, so the prefix never collides. */
5
+ export function labelNavId(labelId) {
6
+ return `${LABEL_NAV_PREFIX}${labelId}`;
7
+ }
8
+ /** The label a nav id names, or `undefined` when it names something else. */
9
+ export function labelIdOfNavId(navId) {
10
+ return navId.startsWith(LABEL_NAV_PREFIX)
11
+ ? navId.slice(LABEL_NAV_PREFIX.length)
12
+ : undefined;
13
+ }
3
14
  /**
4
15
  * The nav entry the address selects, or `""` where none does.
5
16
  *
6
17
  * - `/settings/*` → "settings"
7
18
  * - `/calendar/*` → "calendar"
8
19
  * - `/mail/outbox`, `/mail/flagged`, `/mail/brief` → that list
20
+ * - `/mail/label/$labelId` → the label's nav id
9
21
  * - `/mail/$mailboxId` → the mailbox id, which is what the sidebar keys on
10
22
  *
11
23
  * Read off the pathname rather than the matches: the router commits the new
@@ -15,6 +27,7 @@ import { locationIsOnList } from "../lib/mail-route";
15
27
  export function useSelectedNavId() {
16
28
  const { pathname } = useLocation();
17
29
  const mailbox = useParams({ from: "/mail/$mailboxId", shouldThrow: false });
30
+ const label = useParams({ from: "/mail/label/$labelId", shouldThrow: false });
18
31
  if (locationIsOnList(pathname, "/settings"))
19
32
  return "settings";
20
33
  if (locationIsOnList(pathname, "/calendar"))
@@ -25,5 +38,7 @@ export function useSelectedNavId() {
25
38
  return "flagged";
26
39
  if (locationIsOnList(pathname, "/mail/brief"))
27
40
  return "brief";
41
+ if (label?.labelId)
42
+ return labelNavId(label.labelId);
28
43
  return mailbox?.mailboxId ?? "";
29
44
  }
@@ -29,6 +29,14 @@ export function useOpenThreadPath() {
29
29
  from: "/mail/flagged/$threadId/$messageId",
30
30
  shouldThrow: false,
31
31
  });
32
+ const labelThread = useParams({
33
+ from: "/mail/label/$labelId/$threadId",
34
+ shouldThrow: false,
35
+ });
36
+ const labelMessage = useParams({
37
+ from: "/mail/label/$labelId/$threadId/$messageId",
38
+ shouldThrow: false,
39
+ });
32
40
  const mailboxThread = useParams({
33
41
  from: "/mail/$mailboxId/$threadId",
34
42
  shouldThrow: false,
@@ -37,9 +45,13 @@ export function useOpenThreadPath() {
37
45
  from: "/mail/$mailboxId/$threadId/$messageId",
38
46
  shouldThrow: false,
39
47
  });
40
- const threadId = briefThread?.threadId ?? flaggedThread?.threadId ?? mailboxThread?.threadId;
48
+ const threadId = briefThread?.threadId ??
49
+ flaggedThread?.threadId ??
50
+ labelThread?.threadId ??
51
+ mailboxThread?.threadId;
41
52
  const messageId = briefMessage?.messageId ??
42
53
  flaggedMessage?.messageId ??
54
+ labelMessage?.messageId ??
43
55
  mailboxMessage?.messageId;
44
56
  return useMemo(() => (threadId ? { threadId, messageId } : undefined), [threadId, messageId]);
45
57
  }
@@ -56,7 +68,7 @@ export function useOpenThreadPath() {
56
68
  export function useOpenThread() {
57
69
  const navigate = useNavigate();
58
70
  const retainPanels = useRetainOpenPanels();
59
- const { list, mailboxId: browsedMailboxId } = useBrowsedList();
71
+ const { list, mailboxId: browsedMailboxId, labelId } = useBrowsedList();
60
72
  return useCallback((target, options) => {
61
73
  const query = options?.query;
62
74
  const search = (prev) => query === undefined ? prev : { ...prev, q: query || undefined };
@@ -73,6 +85,14 @@ export function useOpenThread() {
73
85
  });
74
86
  return;
75
87
  }
88
+ if (list === "label" && labelId) {
89
+ navigate({
90
+ to: "/mail/label/$labelId/$threadId/$messageId",
91
+ params: { labelId, ...target },
92
+ ...rest,
93
+ });
94
+ return;
95
+ }
76
96
  const mailboxId = options?.mailboxId ?? browsedMailboxId;
77
97
  if (list === "mailbox" && mailboxId) {
78
98
  navigate({
@@ -87,7 +107,7 @@ export function useOpenThread() {
87
107
  params: target,
88
108
  ...rest,
89
109
  });
90
- }, [navigate, retainPanels, list, browsedMailboxId]);
110
+ }, [navigate, retainPanels, list, browsedMailboxId, labelId]);
91
111
  }
92
112
  /**
93
113
  * Close the conversation, landing back on the list it was opened from.
@@ -23,6 +23,7 @@ const replyModeSchema = z.enum(replyModes);
23
23
  const BRIEF_REPLY = "/mail/brief/$threadId/$messageId/$mode/{-$outboxMessageId}";
24
24
  const FLAGGED_REPLY = "/mail/flagged/$threadId/$messageId/$mode/{-$outboxMessageId}";
25
25
  const MAILBOX_REPLY = "/mail/$mailboxId/$threadId/$messageId/$mode/{-$outboxMessageId}";
26
+ const LABEL_REPLY = "/mail/label/$labelId/$threadId/$messageId/$mode/{-$outboxMessageId}";
26
27
  /**
27
28
  * The reply match, if the address has one. Each `from` names a real route, so a
28
29
  * segment that does not exist fails to compile.
@@ -33,13 +34,15 @@ function useReplyParams() {
33
34
  const brief = useParams({ from: BRIEF_REPLY, shouldThrow: false });
34
35
  const flagged = useParams({ from: FLAGGED_REPLY, shouldThrow: false });
35
36
  const mailbox = useParams({ from: MAILBOX_REPLY, shouldThrow: false });
36
- return brief ?? flagged ?? mailbox;
37
+ const label = useParams({ from: LABEL_REPLY, shouldThrow: false });
38
+ return brief ?? flagged ?? mailbox ?? label;
37
39
  }
38
40
  function useReplySeed() {
39
41
  const brief = useSearch({ from: BRIEF_REPLY, shouldThrow: false });
40
42
  const flagged = useSearch({ from: FLAGGED_REPLY, shouldThrow: false });
41
43
  const mailbox = useSearch({ from: MAILBOX_REPLY, shouldThrow: false });
42
- return (brief ?? flagged ?? mailbox)?.body;
44
+ const label = useSearch({ from: LABEL_REPLY, shouldThrow: false });
45
+ return (brief ?? flagged ?? mailbox ?? label)?.body;
43
46
  }
44
47
  const seededSearch = (seed) => (prev) => seed === undefined
45
48
  ? withoutComposeSeed(prev)
@@ -90,7 +93,7 @@ export function useIsReplying() {
90
93
  * exists and always mounts the conversation — so the frame before a folder id
91
94
  * resolves opens a composer rather than reporting that it cannot.
92
95
  */
93
- function replyTarget(list, mailboxId, target, outboxMessageId) {
96
+ function replyTarget({ list, mailboxId, labelId }, target, outboxMessageId) {
94
97
  if (list === "flagged")
95
98
  return { to: FLAGGED_REPLY, params: { ...target, outboxMessageId } };
96
99
  if (list === "mailbox" && mailboxId)
@@ -98,6 +101,11 @@ function replyTarget(list, mailboxId, target, outboxMessageId) {
98
101
  to: MAILBOX_REPLY,
99
102
  params: { ...target, mailboxId, outboxMessageId },
100
103
  };
104
+ if (list === "label" && labelId)
105
+ return {
106
+ to: LABEL_REPLY,
107
+ params: { ...target, labelId, outboxMessageId },
108
+ };
101
109
  return { to: BRIEF_REPLY, params: { ...target, outboxMessageId } };
102
110
  }
103
111
  /**
@@ -133,15 +141,15 @@ function inheritedDraft(open, target) {
133
141
  export function useOpenReply() {
134
142
  const navigate = useNavigate();
135
143
  const retainPanels = useRetainOpenPanels();
136
- const { list, mailboxId } = useBrowsedList();
144
+ const browsed = useBrowsedList();
137
145
  const open = useReplySurface();
138
146
  return useCallback((target, seed) => {
139
147
  navigate({
140
- ...replyTarget(list, mailboxId, target, seed === undefined ? inheritedDraft(open, target) : undefined),
148
+ ...replyTarget(browsed, target, seed === undefined ? inheritedDraft(open, target) : undefined),
141
149
  search: seededSearch(seed),
142
150
  hash: retainPanels,
143
151
  });
144
- }, [navigate, retainPanels, list, mailboxId, open]);
152
+ }, [navigate, retainPanels, browsed, open]);
145
153
  }
146
154
  /**
147
155
  * Answer the conversation a list has open, from the segments naming it.
@@ -175,13 +183,13 @@ export function replyToThread(openReply, threadId, messageId) {
175
183
  */
176
184
  export function useAdoptReplyDraft() {
177
185
  const navigate = useNavigate();
178
- const { list, mailboxId } = useBrowsedList();
186
+ const browsed = useBrowsedList();
179
187
  const surface = useReplySurface();
180
188
  return useCallback((outboxMessageId) => {
181
189
  if (surface?.kind !== "reply")
182
190
  return;
183
191
  navigate({
184
- ...replyTarget(list, mailboxId, {
192
+ ...replyTarget(browsed, {
185
193
  threadId: surface.threadId,
186
194
  messageId: surface.sourceMessageId,
187
195
  mode: surface.mode,
@@ -190,7 +198,7 @@ export function useAdoptReplyDraft() {
190
198
  hash: true,
191
199
  replace: true,
192
200
  });
193
- }, [navigate, list, mailboxId, surface]);
201
+ }, [navigate, browsed, surface]);
194
202
  }
195
203
  /**
196
204
  * Close the reply, landing back on the message it was answering.
@@ -202,7 +210,7 @@ export function useAdoptReplyDraft() {
202
210
  export function useCloseReply() {
203
211
  const navigate = useNavigate();
204
212
  const retainPanels = useRetainOpenPanels();
205
- const { list, mailboxId } = useBrowsedList();
213
+ const { list, mailboxId, labelId } = useBrowsedList();
206
214
  const params = useReplyParams();
207
215
  return useCallback(() => {
208
216
  if (!params)
@@ -228,11 +236,20 @@ export function useCloseReply() {
228
236
  });
229
237
  return;
230
238
  }
239
+ if (list === "label" && labelId) {
240
+ navigate({
241
+ to: "/mail/label/$labelId/$threadId/$messageId",
242
+ params: { ...message, labelId },
243
+ search,
244
+ hash,
245
+ });
246
+ return;
247
+ }
231
248
  navigate({
232
249
  to: "/mail/brief/$threadId/$messageId",
233
250
  params: message,
234
251
  search,
235
252
  hash,
236
253
  });
237
- }, [navigate, retainPanels, list, mailboxId, params]);
254
+ }, [navigate, retainPanels, list, mailboxId, labelId, params]);
238
255
  }