@scalio-cloud/ui 0.45.0 → 0.46.0

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/README.md CHANGED
@@ -315,6 +315,8 @@ import { AuthLayout, AuthHeader, MicrosoftButton, AuthDivider, AuthMessage, Prof
315
315
  lang={lang} onLangChange={setLang} // top right
316
316
  theme={theme} onThemeChange={setTheme} // optional
317
317
  footer={<VersionTag version={v} />} // optional
318
+ // version: shown small bottom left in every app. Left out = read from /version.json (written by the
319
+ // frontend image), a string = that version, false = hidden.
318
320
  >
319
321
  <AuthHeader eyebrow="Zugang" title="Anmelden" subtitle="..." />
320
322
  <MicrosoftButton href="/api/auth/sso/login" lang={lang} disabled={!ssoReady} hint="..." />
package/auth.css CHANGED
@@ -53,6 +53,14 @@
53
53
  font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em;
54
54
  }
55
55
 
56
+ /* App version bottom left: on the dark brand panel from 1024px, on the page below. */
57
+ .scalio-auth { position: relative; }
58
+ .scalio-auth-version {
59
+ position: absolute; left: 1rem; bottom: 0.75rem; z-index: 1; pointer-events: none;
60
+ color: #71717a; font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 0.08em;
61
+ }
62
+ @media (min-width: 1024px) { .scalio-auth-version { left: 3rem; bottom: 1rem; } }
63
+
56
64
  .scalio-auth-main { position: relative; display: flex; flex-direction: column; min-width: 0; }
57
65
  .scalio-auth-top { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 1rem; min-height: 4.25rem; }
58
66
  .scalio-auth-body { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; padding: 0 1.5rem 2rem; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalio-cloud/ui",
3
- "version": "0.45.0",
3
+ "version": "0.46.0",
4
4
  "description": "Scalio Control Room design tokens, Tailwind preset, self-hosted fonts, the shared app header, sign-in layout, sidebar and page blocks",
5
5
  "license": "SEE LICENSE IN README.md",
6
6
  "private": false,
package/react/auth.js CHANGED
@@ -19,7 +19,44 @@ function BrandMark({ brand, className }) {
19
19
  );
20
20
  }
21
21
 
22
+ // "1.4.0" -> "v1.4.0"; dev builds ("dev-1a2b3c4") and other names stay as they are.
23
+ function formatVersion(v) {
24
+ const s = String(v || "").trim();
25
+ return /^\d/.test(s) ? `v${s}` : s;
26
+ }
27
+
28
+ // Reads the build of this frontend from /version.json ({version, commit, build_date}, written by every
29
+ // app's frontend image). Gives "" while loading or when the file is missing (local vite run).
30
+ function useAppVersion(given, url) {
31
+ const [v, setV] = React.useState(typeof given === "string" ? given : "");
32
+ React.useEffect(() => {
33
+ if (typeof given === "string") { setV(given); return undefined; }
34
+ if (given === false || typeof fetch !== "function") return undefined;
35
+ let alive = true;
36
+ fetch(url || "/version.json", { cache: "no-store" })
37
+ .then((r) => (r.ok ? r.json() : null))
38
+ .then((d) => { if (alive && d && d.version) setV(String(d.version)); })
39
+ .catch(() => {});
40
+ return () => { alive = false; };
41
+ }, [given, url]);
42
+ return v;
43
+ }
44
+
45
+ // Small version bottom left of the sign-in page. version: a string, false (hidden), or left out
46
+ // (read from /version.json).
47
+ function AppVersion({ version, url, lang, labels, className, testId }) {
48
+ const L = labelsFor(lang, labels);
49
+ const v = useAppVersion(version, url);
50
+ if (!v) return null;
51
+ return h(
52
+ "div",
53
+ { className: cx("scalio-auth-version", className), title: `${L.version} ${v}`, "data-testid": testId || "auth-version" },
54
+ formatVersion(v)
55
+ );
56
+ }
57
+
22
58
  // brand: { mark: "N", name: "Scalio Nexus", claim, eyebrow, features: [..], color }
59
+ // version: shown small bottom left; left out = read from /version.json, false = hidden.
23
60
  function AuthLayout(props) {
24
61
  const brand = props.brand || {};
25
62
  const L = labelsFor(props.lang, props.labels);
@@ -73,7 +110,8 @@ function AuthLayout(props) {
73
110
  )
74
111
  ),
75
112
  props.footer ? h("div", { className: "scalio-auth-footer", "aria-label": L.version }, props.footer) : null
76
- )
113
+ ),
114
+ h(AppVersion, { version: props.version, url: props.versionUrl, lang: props.lang, labels: props.labels })
77
115
  );
78
116
  }
79
117
 
@@ -155,4 +193,4 @@ function ProfileSection({ id, title, description, lang, labels, children, testId
155
193
  );
156
194
  }
157
195
 
158
- module.exports = { AuthLayout, AuthHeader, AuthDivider, AuthMessage, MicrosoftButton, MicrosoftLogo, ProfileSection, PROFILE_SECTIONS };
196
+ module.exports = { AuthLayout, AppVersion, formatVersion, AuthHeader, AuthDivider, AuthMessage, MicrosoftButton, MicrosoftLogo, ProfileSection, PROFILE_SECTIONS };