@bygghammar/cms-platform 0.44.0 → 0.45.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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.45.0
4
+
5
+ - Version screen: added a live ticking "Current time" card showing the current date and time in UTC.
6
+
3
7
  ## 0.44.0
4
8
 
5
9
  - New `backoffice/routes/media-forms`: package-owned `MediaRoute`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bygghammar/cms-platform",
3
- "version": "0.44.0",
3
+ "version": "0.45.0",
4
4
  "description": "Shared CMS platform: blocks, block types, i18n core, UI primitives and design-token contract used by every Bygghammar/Voyara site.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -1,4 +1,5 @@
1
1
  import { Package } from "lucide-react";
2
+ import { useEffect, useState } from "react";
2
3
 
3
4
  /** Build metadata injected at compile time by the host. */
4
5
  export type PlatformBuildInfo = {
@@ -31,9 +32,25 @@ function fmt(value: string | null | undefined) {
31
32
  return d.toLocaleString("sv-SE", { timeZone: "UTC", hour12: false }) + " UTC";
32
33
  }
33
34
 
35
+ function formatUtc(date: Date) {
36
+ return date.toLocaleString("sv-SE", { timeZone: "UTC", hour12: false }) + " UTC";
37
+ }
38
+
39
+ /** Ticking current UTC time, started after hydration to stay SSR-safe. */
40
+ function useUtcClock() {
41
+ const [now, setNow] = useState<Date | null>(null);
42
+ useEffect(() => {
43
+ setNow(new Date());
44
+ const id = setInterval(() => setNow(new Date()), 1000);
45
+ return () => clearInterval(id);
46
+ }, []);
47
+ return now;
48
+ }
49
+
34
50
  /** Host-agnostic CMS & platform version screen. */
35
51
  export function VersionView({ deps }: { deps: VersionDeps }) {
36
52
  const { build, releases, loading, packageName = "@bygghammar/cms-platform" } = deps;
53
+ const now = useUtcClock();
37
54
 
38
55
  return (
39
56
  <div className="p-8 md:p-12 w-full max-w-4xl">
@@ -56,6 +73,7 @@ export function VersionView({ deps }: { deps: VersionDeps }) {
56
73
  { label: "Built at", value: fmt(build?.buildTime) },
57
74
  { label: "Platform package", value: build?.platformVersion ?? "—" },
58
75
  { label: "Declared range", value: build?.platformRange ?? "—" },
76
+ { label: "Current time", value: now ? formatUtc(now) : "—" },
59
77
  ].map((row) => (
60
78
  <div key={row.label} className="border border-ink/10 bg-white p-5">
61
79
  <dt className="text-[0.7rem] uppercase tracking-[0.22em] text-ink/50">