@remit/ui 0.0.45 → 0.0.46

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.45",
3
+ "version": "0.0.46",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src"
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  CheckCircle2,
3
+ Clock,
3
4
  CloudOff,
4
5
  Download,
5
6
  ExternalLink,
@@ -152,6 +153,39 @@ export function SelfUpdateSection({
152
153
  </SectionRow>
153
154
  );
154
155
 
156
+ case "neverChecked":
157
+ return (
158
+ <SectionRow>
159
+ <div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
160
+ <div className="flex min-w-0 items-start gap-2">
161
+ <Clock
162
+ className="mt-0.5 size-4 shrink-0 text-fg-subtle"
163
+ aria-hidden
164
+ />
165
+ <p className="text-sm text-fg-muted">
166
+ No update check has run yet. Remit checks for updates on its
167
+ own in the background.
168
+ {state.lastCheckedAt !== undefined && (
169
+ <span className="text-fg-subtle">
170
+ {" "}
171
+ Last checked{" "}
172
+ {formatRelativeCheck(state.lastCheckedAt, now)}.
173
+ </span>
174
+ )}
175
+ </p>
176
+ </div>
177
+ <Button
178
+ variant="secondary"
179
+ size="sm"
180
+ className="shrink-0"
181
+ onClick={handleCheck}
182
+ >
183
+ Check now
184
+ </Button>
185
+ </div>
186
+ </SectionRow>
187
+ );
188
+
155
189
  case "checkFailed":
156
190
  return (
157
191
  <SectionRow>
@@ -165,6 +165,25 @@ describe("SelfUpdateSection", () => {
165
165
  assert.doesNotMatch(html, /disabled=/);
166
166
  });
167
167
 
168
+ it("states a never-checked instance without a spinner or an alert", () => {
169
+ // The version is the literal the backend emits before any check has run —
170
+ // no state file, so no authoritative version yet.
171
+ const html = section({ status: "neverChecked", version: "unknown" });
172
+ assert.match(html, /No update check has run yet/);
173
+ assert.match(html, /Check now/);
174
+ assert.doesNotMatch(html, /animate-spin/);
175
+ assert.doesNotMatch(html, /role="alert"/);
176
+ });
177
+
178
+ it("shows the last-checked time on a never-checked state when one is known", () => {
179
+ const html = section({
180
+ status: "neverChecked",
181
+ version: "unknown",
182
+ lastCheckedAt: NOW - 3_600_000,
183
+ });
184
+ assert.match(html, /Last checked/);
185
+ });
186
+
168
187
  it("renders a failed rollback verbatim and never claims a version is running", () => {
169
188
  const html = section({
170
189
  status: "rollbackFailed",
@@ -52,6 +52,16 @@ export const Checking: Story = {
52
52
  args: withState({ status: "checking", version: CURRENT }),
53
53
  };
54
54
 
55
+ /**
56
+ * A fresh, configured instance before its first automatic check has landed. The
57
+ * honest resting state, not a spinner: it says a check has not run and that Remit
58
+ * checks on its own, and offers a manual check. This is what every install shows
59
+ * until the updater writes its first result.
60
+ */
61
+ export const NeverChecked: Story = {
62
+ args: withState({ status: "neverChecked", version: "unknown" }),
63
+ };
64
+
55
65
  /**
56
66
  * An update exists. It is stated — version, date, one line of what changes, a
57
67
  * link to the full notes — and then it waits. Nothing here follows the user
@@ -28,6 +28,12 @@ export type UpdateRunId = string;
28
28
  export type SelfUpdateState =
29
29
  | { status: "upToDate"; version: string; checkedAt: number }
30
30
  | { status: "checking"; version: string }
31
+ /**
32
+ * A configured instance whose first automatic check has not landed yet. It is
33
+ * its own resting state, never a spinner: the updater checks on a cadence, and
34
+ * this is the honest account of the gap before the first result arrives.
35
+ */
36
+ | { status: "neverChecked"; version: string; lastCheckedAt?: number }
31
37
  | {
32
38
  status: "checkFailed";
33
39
  version: string;