@remit/ui 0.0.166 → 0.0.167

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/ui",
3
- "version": "0.0.166",
3
+ "version": "0.0.167",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src"
@@ -0,0 +1,36 @@
1
+ import { Banner } from "./banner.js";
2
+
3
+ /** Which of the two composers is looking at a source it cannot quote. */
4
+ export type ComposeQuoteMode = "reply" | "forward";
5
+
6
+ /**
7
+ * The source has no text or html part — it is attachments and nothing else.
8
+ *
9
+ * A forward of one has nothing of the original to carry: the composer sends a
10
+ * text body and an html body, and no attachments, so the message would arrive
11
+ * holding only what the sender typed. Send refuses with these words. A reply
12
+ * still carries the answer and the thread it belongs to, so it goes out and
13
+ * these words say the original is not quoted in it. See #1030.
14
+ */
15
+ export const NO_QUOTABLE_BODY_FORWARD_MESSAGE =
16
+ "This message is attachments only, and attachments aren't forwarded — a forward would arrive with nothing of the original in it.";
17
+
18
+ export const NO_QUOTABLE_BODY_REPLY_MESSAGE =
19
+ "This message is attachments only, so there's nothing to quote and your reply goes out without the original.";
20
+
21
+ export const composeQuoteMissingMessage = (mode: ComposeQuoteMode): string =>
22
+ mode === "forward"
23
+ ? NO_QUOTABLE_BODY_FORWARD_MESSAGE
24
+ : NO_QUOTABLE_BODY_REPLY_MESSAGE;
25
+
26
+ export interface ComposeQuoteMissingBannerProps {
27
+ mode: ComposeQuoteMode;
28
+ }
29
+
30
+ export const ComposeQuoteMissingBanner = ({
31
+ mode,
32
+ }: ComposeQuoteMissingBannerProps) => (
33
+ <Banner tone="warning" data-testid="compose-quote-missing">
34
+ <span>{composeQuoteMissingMessage(mode)}</span>
35
+ </Banner>
36
+ );
@@ -82,6 +82,16 @@ export function SelfUpdateSection({
82
82
  onCheck();
83
83
  };
84
84
 
85
+ // The pane renders one state at a time, and an undismissed run outcome wins
86
+ // over any check in flight — so a check pressed from the success row would
87
+ // leave the screen unchanged and surface its verdict, right or wrong, only
88
+ // once the banner was dismissed. Retiring the outcome is what makes the
89
+ // press visible, and pressing it is the acknowledgement that retires it.
90
+ const handleCheckAfterResult = () => {
91
+ onDismissResult();
92
+ handleCheck();
93
+ };
94
+
85
95
  const handleInstall = () => {
86
96
  if (
87
97
  !installable &&
@@ -281,23 +291,48 @@ export function SelfUpdateSection({
281
291
 
282
292
  case "succeeded":
283
293
  return (
284
- <Banner tone="success" onDismiss={onDismissResult}>
285
- <div className="space-y-1">
286
- <p className="font-semibold">Updated to Remit {state.version}.</p>
287
- <p>
288
- You were on {state.previousVersion}.{" "}
289
- <a
290
- href={state.releaseNotesUrl}
291
- target="_blank"
292
- rel="noopener noreferrer"
293
- className="underline"
294
+ <>
295
+ <Banner tone="success" onDismiss={onDismissResult}>
296
+ <div className="space-y-1">
297
+ <p className="font-semibold">
298
+ Updated to Remit {state.version}.
299
+ </p>
300
+ <p>
301
+ You were on {state.previousVersion}.{" "}
302
+ <a
303
+ href={state.releaseNotesUrl}
304
+ target="_blank"
305
+ rel="noopener noreferrer"
306
+ className="underline"
307
+ >
308
+ See what changed
309
+ </a>
310
+ .
311
+ </p>
312
+ </div>
313
+ </Banner>
314
+ <SectionRow>
315
+ <div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
316
+ <div className="flex min-w-0 items-center gap-2">
317
+ <CheckCircle2
318
+ className="size-4 shrink-0 text-positive"
319
+ aria-hidden
320
+ />
321
+ <p className="text-sm text-fg">
322
+ Remit {state.version} is running.
323
+ </p>
324
+ </div>
325
+ <Button
326
+ variant="secondary"
327
+ size="sm"
328
+ className="shrink-0"
329
+ onClick={handleCheckAfterResult}
294
330
  >
295
- See what changed
296
- </a>
297
- .
298
- </p>
299
- </div>
300
- </Banner>
331
+ Check for updates
332
+ </Button>
333
+ </div>
334
+ </SectionRow>
335
+ </>
301
336
  );
302
337
 
303
338
  case "rolledBack":
@@ -204,6 +204,20 @@ describe("SelfUpdateSection", () => {
204
204
  assert.doesNotMatch(html, /running 0\.9\.3 again/);
205
205
  });
206
206
 
207
+ it("keeps the pane's control reachable while the success banner is up", () => {
208
+ const html = section({
209
+ status: "succeeded",
210
+ runId: demoRunId,
211
+ version: "0.9.4",
212
+ previousVersion: CURRENT,
213
+ releaseNotesUrl: demoRelease.releaseNotesUrl,
214
+ });
215
+ assert.match(html, /Updated to Remit 0\.9\.4/);
216
+ assert.match(html, /0\.9\.4 is running/);
217
+ assert.match(html, /Check for updates/);
218
+ assert.doesNotMatch(html, /disabled=/);
219
+ });
220
+
207
221
  it("renders an abandoned run as a no-op that changed nothing", () => {
208
222
  const html = section({
209
223
  status: "abandoned",
package/src/index.ts CHANGED
@@ -258,6 +258,14 @@ export {
258
258
  ComposeLanguageSetting,
259
259
  type ComposeLanguageSettingProps,
260
260
  } from "./components/compose-language-setting.js";
261
+ export {
262
+ ComposeQuoteMissingBanner,
263
+ type ComposeQuoteMissingBannerProps,
264
+ type ComposeQuoteMode,
265
+ composeQuoteMissingMessage,
266
+ NO_QUOTABLE_BODY_FORWARD_MESSAGE,
267
+ NO_QUOTABLE_BODY_REPLY_MESSAGE,
268
+ } from "./components/compose-quote-missing-banner.js";
261
269
  export {
262
270
  ComposeSmtpMissingBanner,
263
271
  type ComposeSmtpMissingBannerProps,