@realiizlabs/admin 0.15.5 → 0.15.7

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.
@@ -250,7 +250,7 @@ var OutIcon = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { ...ico, children: [
250
250
  /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16 17l5-5-5-5" }),
251
251
  /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M21 12H9" })
252
252
  ] });
253
- function AccountMenu({ user, role, theme, onTheme, signOutPath, accountHref, helpHref, siteUrl }) {
253
+ function AccountMenu({ user, role, theme, onTheme, signOutPath, accountHref, helpHref, siteUrl, version }) {
254
254
  const [open, setOpen] = react.useState(false);
255
255
  const wrap = react.useRef(null);
256
256
  react.useEffect(() => {
@@ -303,11 +303,15 @@ function AccountMenu({ user, role, theme, onTheme, signOutPath, accountHref, hel
303
303
  /* @__PURE__ */ jsxRuntime.jsx("form", { method: "post", action: signOutPath, className: "rz-menu__signout", children: /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "submit", role: "menuitem", className: "rz-menu__item", children: [
304
304
  /* @__PURE__ */ jsxRuntime.jsx(OutIcon, {}),
305
305
  "Sign out"
306
- ] }) })
306
+ ] }) }),
307
+ version && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rz-menu__version", children: [
308
+ "Studio ",
309
+ version
310
+ ] })
307
311
  ] })
308
312
  ] });
309
313
  }
310
- function TopBar({ siteName, productName, logoUrl, homeHref, siteUrl, user, role, theme, onTheme, signOutPath, accountHref, helpHref }) {
314
+ function TopBar({ siteName, productName, logoUrl, homeHref, siteUrl, user, role, theme, onTheme, signOutPath, accountHref, helpHref, version }) {
311
315
  return /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "rz-topbar", children: [
312
316
  /* @__PURE__ */ jsxRuntime.jsxs(
313
317
  "a",
@@ -328,7 +332,7 @@ function TopBar({ siteName, productName, logoUrl, homeHref, siteUrl, user, role,
328
332
  "Welcome back, ",
329
333
  firstNameOf(user)
330
334
  ] }),
331
- /* @__PURE__ */ jsxRuntime.jsx(AccountMenu, { user, role, theme, onTheme, signOutPath, accountHref, helpHref, siteUrl })
335
+ /* @__PURE__ */ jsxRuntime.jsx(AccountMenu, { user, role, theme, onTheme, signOutPath, accountHref, helpHref, siteUrl, version })
332
336
  ] })
333
337
  ] });
334
338
  }
@@ -409,6 +413,7 @@ var SHELL_CSS = `
409
413
  .rz-sidebar__collapse:hover { color: var(--text-primary); }
410
414
  .rz-sidebar__collapse svg { flex-shrink: 0; }
411
415
  .rz-sidebar--collapsed .rz-sidebar__collapse { justify-content: center; padding: .6rem 0; }
416
+ .rz-menu__version { padding: .45rem 1rem .55rem; border-top: 1px solid var(--separator); font-family: var(--rz-font-mono); font-size: .6875rem; letter-spacing: .04em; color: var(--text-muted); }
412
417
  .rz-sidebar__version { display: block; padding: 0 1rem .75rem; font-family: var(--rz-font-mono); font-size: .6875rem; letter-spacing: .04em; color: var(--text-muted); opacity: .8; white-space: nowrap; }
413
418
  .rz-sidebar--collapsed .rz-sidebar__version { padding: 0 0 .75rem; text-align: center; }
414
419
  .rz-main { flex: 1; min-width: 0; }
@@ -526,9 +531,9 @@ var SHELL_CSS = `
526
531
  flex-direction: row; align-items: stretch;
527
532
  border-right: 0; border-top: 1px solid var(--border); box-shadow: 0 -6px 16px rgba(14,23,38,.06);
528
533
  }
529
- .rz-sidebar__nav, .rz-sidebar__pinned { display: flex; flex: 1; padding: 0; overflow: visible; border-top: 0; }
530
- .rz-sidebar__pinned { flex: 0 0 auto; }
531
- .rz-sidebar__item { flex: 1; justify-content: center; padding: 0; min-width: 56px; border-radius: 0; }
534
+ /* Both nav groups dissolve into the bar so every icon gets an equal share of the width. */
535
+ .rz-sidebar__nav, .rz-sidebar__pinned { display: contents; }
536
+ .rz-sidebar__item { flex: 1 1 0; justify-content: center; padding: 0; min-width: 0; border-radius: 0; }
532
537
  .rz-sidebar__item svg { width: 22px; height: 22px; }
533
538
  .rz-sidebar__item--active { background: transparent; box-shadow: inset 0 2px 0 var(--signal); }
534
539
  /* Labels stay in the accessibility tree but not on screen. */
@@ -640,7 +645,8 @@ function AdminShell({
640
645
  onTheme: setTheme,
641
646
  signOutPath: signOutPath ?? `${basePath}/auth/signout`,
642
647
  accountHref: accountHref === null ? void 0 : accountHref ?? `${basePath}/account`,
643
- helpHref: helpHref === null ? void 0 : helpHref ?? `${basePath}/help`
648
+ helpHref: helpHref === null ? void 0 : helpHref ?? `${basePath}/help`,
649
+ version
644
650
  }
645
651
  ),
646
652
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rz-body", children: [
@@ -733,7 +739,7 @@ function Tabs({ options, value, onChange, label = "Sections" }) {
733
739
  }
734
740
 
735
741
  // src/version.ts
736
- var ADMIN_VERSION = "0.15.5" ;
742
+ var ADMIN_VERSION = "0.15.7" ;
737
743
 
738
744
  // src/studio-ui/css.ts
739
745
  var STUDIO_CSS = `
@@ -784,11 +790,12 @@ var STUDIO_CSS = `
784
790
  .rz-admin .rz-table--posts colgroup, .rz-admin .rz-table--posts thead { display: none; }
785
791
  .rz-admin .rz-table--posts tr { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .9rem; padding: .8rem .9rem; border-bottom: 1px solid var(--separator); }
786
792
  .rz-admin .rz-table--posts tr:last-child { border-bottom: 0; }
787
- .rz-admin .rz-table--posts td { display: block; padding: 0; border: 0; white-space: normal; overflow: visible; }
788
- .rz-admin .rz-table--posts .rz-title-cell { flex: 1 1 100%; min-width: 0; margin-bottom: .15rem; }
793
+ .rz-admin .rz-table--posts td, .rz-admin .rz-table--posts td.rz-fit { display: block; width: auto; padding: 0; border: 0; white-space: nowrap; overflow: visible; }
794
+ .rz-admin .rz-table--posts .rz-title-cell { flex: 1 1 100%; min-width: 0; margin-bottom: .15rem; white-space: normal; }
789
795
  .rz-admin .rz-table--posts .rz-title-cell .rz-title-text { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-weight: 500; color: var(--text-primary); }
790
796
  .rz-admin .rz-table--posts .rz-title-link { display: inline; }
791
797
  .rz-admin .rz-table--posts .rz-slug { font-weight: 400; color: var(--text-muted); overflow-wrap: anywhere; -webkit-line-clamp: 1; }
798
+ .rz-admin [data-slugs="off"] .rz-table--posts .rz-slug { display: none; }
792
799
  .rz-admin .rz-table--posts td.rz-fit { font-size: .85rem; }
793
800
  .rz-admin .rz-table--posts td.rz-fit:last-child { margin-left: auto; }
794
801
  }
@@ -942,6 +949,10 @@ var STUDIO_CSS = `
942
949
  .rz-admin .rz-update--strip { margin: 0 0 1.5rem; }
943
950
  .rz-admin .rz-update__row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.1rem; }
944
951
  .rz-admin .rz-update__title { display: inline-flex; align-items: center; gap: .55rem; font-weight: 600; color: var(--text-primary); }
952
+ .rz-admin .rz-update--line { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1rem; padding: .55rem 1.1rem; font-size: .875rem; }
953
+ .rz-admin .rz-update--line .rz-update__later { margin-left: auto; }
954
+ .rz-admin .rz-update__row .rz-update__done { flex: 1; margin-top: .5rem; }
955
+ .rz-admin .rz-update__row .rz-update__later { align-self: flex-end; margin-top: .5rem; }
945
956
  .rz-admin .rz-update__title::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 18%, transparent); }
946
957
  .rz-admin .rz-update__link { display: inline-flex; align-items: center; gap: .3rem; background: none; border: 0; padding: 0; font: inherit; font-size: .875rem; color: var(--signal); cursor: pointer; text-decoration: none; }
947
958
  .rz-admin .rz-update__link:hover { color: var(--text-primary); }
@@ -953,14 +964,16 @@ var STUDIO_CSS = `
953
964
  `;
954
965
  var POLL_MS = 8e3;
955
966
  var LOCAL_FALLBACK_MS = 15e4;
967
+ var SLOW_MS = 4 * 6e4;
956
968
  var GIVE_UP_MS = 15 * 6e4;
957
- function useDeployed(active, mergedSha) {
969
+ function useDeployed(active, mergedSha, attempt = 0) {
958
970
  const [state, setState] = react.useState("waiting");
959
971
  react.useEffect(() => {
960
972
  if (!active) return;
961
973
  let stop = false;
962
974
  let baseline;
963
975
  const started = Date.now();
976
+ setState("waiting");
964
977
  const read2 = async () => {
965
978
  try {
966
979
  const r = await fetch("/api/version", { cache: "no-store" });
@@ -984,22 +997,24 @@ function useDeployed(active, mergedSha) {
984
997
  return;
985
998
  }
986
999
  if (elapsed >= GIVE_UP_MS) {
987
- setState("slow");
1000
+ setState("stalled");
988
1001
  return;
989
1002
  }
1003
+ if (elapsed >= SLOW_MS) setState("slow");
990
1004
  setTimeout(tick, POLL_MS);
991
1005
  };
992
1006
  void tick();
993
1007
  return () => {
994
1008
  stop = true;
995
1009
  };
996
- }, [active, mergedSha]);
1010
+ }, [active, mergedSha, attempt]);
997
1011
  return state;
998
1012
  }
999
1013
  var KEY = "rz-update-installing";
1014
+ var MIN_KEY = "rz-update-minimized";
1000
1015
  function readInstalling() {
1001
1016
  try {
1002
- const raw = sessionStorage.getItem(KEY);
1017
+ const raw = localStorage.getItem(KEY);
1003
1018
  if (!raw) return null;
1004
1019
  const v = JSON.parse(raw);
1005
1020
  return typeof v.version === "string" ? v : null;
@@ -1009,8 +1024,11 @@ function readInstalling() {
1009
1024
  }
1010
1025
  function writeInstalling(i) {
1011
1026
  try {
1012
- if (i) sessionStorage.setItem(KEY, JSON.stringify(i));
1013
- else sessionStorage.removeItem(KEY);
1027
+ if (i) localStorage.setItem(KEY, JSON.stringify(i));
1028
+ else {
1029
+ localStorage.removeItem(KEY);
1030
+ localStorage.removeItem(MIN_KEY);
1031
+ }
1014
1032
  } catch {
1015
1033
  }
1016
1034
  }
@@ -1031,21 +1049,55 @@ function useInstalling() {
1031
1049
  return [installing, update];
1032
1050
  }
1033
1051
  function InstallTracker({ installing, compact = false }) {
1034
- const deploy = useDeployed(true, installing.sha);
1052
+ const { actions, supportName } = useStudio();
1053
+ const [attempt, setAttempt] = react.useState(0);
1054
+ const [nudge, setNudge] = react.useState(null);
1055
+ const deploy = useDeployed(true, installing.sha, attempt);
1035
1056
  const live = deploy === "live";
1057
+ const late = deploy === "slow" || deploy === "stalled";
1058
+ const doNudge = async () => {
1059
+ if (!actions.nudgeBuild) return;
1060
+ setNudge("busy");
1061
+ const out = await actions.nudgeBuild();
1062
+ setNudge(out);
1063
+ if (out.state === "sent") setAttempt((n) => n + 1);
1064
+ };
1065
+ const [minimized, setMinimized] = react.useState(false);
1066
+ react.useEffect(() => {
1067
+ try {
1068
+ setMinimized(localStorage.getItem(MIN_KEY) === "1");
1069
+ } catch {
1070
+ }
1071
+ }, []);
1072
+ const minimize = (on) => {
1073
+ try {
1074
+ on ? localStorage.setItem(MIN_KEY, "1") : localStorage.removeItem(MIN_KEY);
1075
+ } catch {
1076
+ }
1077
+ setMinimized(on);
1078
+ };
1079
+ const reload = /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "rz-update__link", onClick: () => window.location.reload(), children: "Reload Studio" });
1080
+ if (live || minimized && compact) {
1081
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `rz-update rz-update--line${compact ? " rz-update--strip" : ""}`, role: "status", children: [
1082
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rz-update__title", children: live ? `Studio ${installing.version} is live` : `Installing Studio ${installing.version}` }),
1083
+ live ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1084
+ reload,
1085
+ " to start using it."
1086
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rz-muted", children: "The website is rebuilding \u2014 keep working." }),
1087
+ !live && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "rz-update__later", onClick: () => minimize(false), children: "Show progress" })
1088
+ ] });
1089
+ }
1036
1090
  const steps = [
1037
1091
  { label: "Updated", state: "done", note: `Studio ${installing.version}` },
1038
- { label: "Live", state: live ? "done" : "active", note: live ? "On the site now" : deploy === "slow" ? "Taking longer than usual" : "Rebuilding, about two minutes" }
1092
+ { label: "Live", state: "active", note: late ? "Taking longer than usual" : "Rebuilding the website" }
1039
1093
  ];
1040
1094
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `rz-update${compact ? " rz-update--strip" : ""}`, role: "status", children: [
1041
1095
  /* @__PURE__ */ jsxRuntime.jsx(Steps, { steps }),
1042
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rz-update__done", children: live ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1043
- "Studio ",
1044
- installing.version,
1045
- " is live. ",
1046
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "rz-update__link", onClick: () => window.location.reload(), children: "Reload Studio" }),
1047
- " to start using it \u2014 the version at the foot of the sidebar will change."
1048
- ] }) : "Update accepted. Nothing to do meanwhile \u2014 keep working. The website is rebuilding with the new Studio; this turns green when it's done, in about two minutes." })
1096
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rz-update__row", children: [
1097
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rz-update__done", children: !late ? "Update accepted. Nothing to do meanwhile \u2014 keep working. The website is rebuilding with the new Studio; usually a few minutes, sometimes longer. This turns green when it's done." : nudge === "busy" ? "Asking the hosting service to build again\u2026" : nudge?.state === "sent" ? "Asked. The rebuild should start within a minute; this turns green when it's done." : nudge?.state === "error" ? `That didn't work (${nudge.message}). Tell ${supportName} \u2014 it's a one-click fix on their side.` : nudge?.state === "unavailable" || !actions.nudgeBuild ? `This is taking longer than usual. Occasionally the hosting service misses a rebuild \u2014 tell ${supportName}; it's a one-click fix on their side, and nothing on your website has changed.` : "This is taking longer than usual. Occasionally the hosting service misses a rebuild. You can ask it again \u2014 it's safe to press, nothing on your website changes." }),
1098
+ late && actions.nudgeBuild && nudge !== "busy" && nudge?.state !== "sent" && nudge?.state !== "unavailable" && /* @__PURE__ */ jsxRuntime.jsx(Button, { size: "sm", onClick: doNudge, children: "Nudge the build" }),
1099
+ compact && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "rz-update__later", onClick: () => minimize(true), children: "Minimize" })
1100
+ ] })
1049
1101
  ] });
1050
1102
  }
1051
1103
  var HIDE_KEY = "rz-update-later";
@@ -3178,7 +3230,7 @@ function PublishPanel({ number, htmlUrl, merged, closed = false, branch, removal
3178
3230
  {
3179
3231
  label: removal ? "Removed" : "Live",
3180
3232
  state: onSite ? "done" : live ? "active" : "todo",
3181
- note: onSite ? removal ? "Off the site" : "On the site" : live ? deploy === "slow" ? "Taking longer than usual" : "Rebuilding, about two minutes" : "Automatic"
3233
+ note: onSite ? removal ? "Off the site" : "On the site" : live ? deploy === "waiting" ? "Rebuilding the website" : "Taking longer than usual" : "Automatic"
3182
3234
  }
3183
3235
  ];
3184
3236
  if (discarded) {
@@ -3200,7 +3252,7 @@ function PublishPanel({ number, htmlUrl, merged, closed = false, branch, removal
3200
3252
  }
3201
3253
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3202
3254
  /* @__PURE__ */ jsxRuntime.jsx(Steps, { steps }),
3203
- live ? onSite ? /* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: 0 }, children: removal ? `Done \u2014 the ${noun} is off the website.` : "Done \u2014 your change is on the website now." }) : deploy === "slow" ? /* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: 0 }, children: "The site is taking longer than usual to rebuild. It will get there; check back in a few minutes." }) : /* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: 0 }, children: "Published. The website is rebuilding with your change \u2014 this usually takes about two minutes. Stay here and this page will tell you the moment it's live; if you look at the site before then you'll still see the old version." }) : stale ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rz-alert admin__alert", children: [
3255
+ live ? onSite ? /* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: 0 }, children: removal ? `Done \u2014 the ${noun} is off the website.` : "Done \u2014 your change is on the website now." }) : deploy === "stalled" ? /* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: 0 }, children: "The website still hasn't rebuilt. Your change is saved and published; the rebuild just hasn't happened. Tell your web team \u2014 it's a one-click fix on their side." }) : deploy === "slow" ? /* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: 0 }, children: "The site is taking longer than usual to rebuild. It will get there; check back in a few minutes." }) : /* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: 0 }, children: "Published. The website is rebuilding with your change \u2014 usually a few minutes. Stay here and this page will tell you the moment it's live; if you look at the site before then you'll still see the old version." }) : stale ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rz-alert admin__alert", children: [
3204
3256
  "Someone else changed this file first. ",
3205
3257
  /* @__PURE__ */ jsxRuntime.jsx(Link3__default.default, { href: "/admin", children: "Open it again" }),
3206
3258
  ", make your change on the latest version, and publish."
@@ -3220,7 +3272,7 @@ function PublishPanel({ number, htmlUrl, merged, closed = false, branch, removal
3220
3272
  noun
3221
3273
  ] })),
3222
3274
  /* @__PURE__ */ jsxRuntime.jsx(LinkButton, { variant: removal || !liveUrl ? "primary" : "secondary", href: listUrl, children: backLabel }),
3223
- live && !onSite && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rz-actions__hint", children: deploy === "slow" ? "Still rebuilding." : "Waiting for the site to rebuild\u2026" })
3275
+ live && !onSite && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rz-actions__hint", children: deploy === "waiting" ? "Waiting for the site to rebuild\u2026" : "Still rebuilding." })
3224
3276
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3225
3277
  /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "primary", disabled: pending || !ready, onClick: publish, children: pending ? "Publishing\u2026" : "Publish" }),
3226
3278
  previewUrl && ready && /* @__PURE__ */ jsxRuntime.jsx(LinkButton, { external: true, href: previewUrl, children: "Preview the change" }),
@@ -5224,7 +5276,7 @@ The new version didn't build cleanly against your website. Nothing was installed
5224
5276
 
5225
5277
  ## The tracker is stuck on "Live"
5226
5278
 
5227
- The rebuild usually takes about two minutes; occasionally the hosting service is slow and it takes ten. If the tracker says *taking longer than usual*, that's all it means. Leave the page and come back \u2014 the update is already accepted and will finish on its own.
5279
+ The rebuild usually takes a few minutes. After a while the tracker says *taking longer than usual* and, on most sites, offers **Nudge the build**. Press it \u2014 it asks the hosting service to build the website again. It's safe: the update is already accepted, nothing on your website changes, and pressing it twice does no harm. If the button isn't there, or it doesn't help within ten minutes, tell {supportName}; it's a one-click fix on their side. Either way you can leave the page and come back \u2014 the tracker remembers.
5228
5280
 
5229
5281
  ## I'm not seeing updates at all
5230
5282
 
@@ -5670,6 +5722,7 @@ function BackArrow() {
5670
5722
  // src/studio-ui/types.ts
5671
5723
  var ACTION_NAMES = [
5672
5724
  "updateStudio",
5725
+ "nudgeBuild",
5673
5726
  "publishContent",
5674
5727
  "removeContent",
5675
5728
  "mergeContentPr",