@realiizlabs/admin 0.14.0 → 0.14.1

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.
@@ -2,7 +2,7 @@ import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
  import { C as ContentTypeEntry } from '../types-DeHdasdP.cjs';
4
4
  import { c as SiteBranding, d as SiteMember } from '../members-nhbRSYyr.cjs';
5
- import { S as ShellUser, N as NavItem } from '../Sidebar-Dvrc9_xR.cjs';
5
+ import { S as ShellUser, N as NavItem } from '../Sidebar-Dz_qJOSx.cjs';
6
6
  import { a as PullRequestStatus } from '../types-BP5G1myE.cjs';
7
7
  import 'zod';
8
8
  import '@supabase/supabase-js';
@@ -175,9 +175,11 @@ declare function publicDirOf(entry: {
175
175
  * active nav item, plus Studio's page styles injected once. Session, nav and
176
176
  * branding arrive as props from the site's server layout.
177
177
  */
178
- declare function StudioShellFrame({ siteName, logoUrl, user, role, nav, pinnedNav, branding, children }: {
178
+ declare function StudioShellFrame({ siteName, logoUrl, siteUrl, user, role, nav, pinnedNav, branding, children }: {
179
179
  siteName: string;
180
180
  logoUrl?: string | null;
181
+ /** The live website (SITE_URL). The brand and the avatar menu open it in a new tab. */
182
+ siteUrl?: string | null;
181
183
  user: ShellUser | null;
182
184
  role: string | null;
183
185
  nav: NavItem[];
@@ -2,7 +2,7 @@ import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
  import { C as ContentTypeEntry } from '../types-DeHdasdP.js';
4
4
  import { c as SiteBranding, d as SiteMember } from '../members-nhbRSYyr.js';
5
- import { S as ShellUser, N as NavItem } from '../Sidebar-Dvrc9_xR.js';
5
+ import { S as ShellUser, N as NavItem } from '../Sidebar-Dz_qJOSx.js';
6
6
  import { a as PullRequestStatus } from '../types-BP5G1myE.js';
7
7
  import 'zod';
8
8
  import '@supabase/supabase-js';
@@ -175,9 +175,11 @@ declare function publicDirOf(entry: {
175
175
  * active nav item, plus Studio's page styles injected once. Session, nav and
176
176
  * branding arrive as props from the site's server layout.
177
177
  */
178
- declare function StudioShellFrame({ siteName, logoUrl, user, role, nav, pinnedNav, branding, children }: {
178
+ declare function StudioShellFrame({ siteName, logoUrl, siteUrl, user, role, nav, pinnedNav, branding, children }: {
179
179
  siteName: string;
180
180
  logoUrl?: string | null;
181
+ /** The live website (SITE_URL). The brand and the avatar menu open it in a new tab. */
182
+ siteUrl?: string | null;
181
183
  user: ShellUser | null;
182
184
  role: string | null;
183
185
  nav: NavItem[];
@@ -154,6 +154,32 @@ function Sidebar({ items, pinned = [], activeHref, basePath }) {
154
154
  )
155
155
  ] });
156
156
  }
157
+ function buttonClass(variant = "secondary", size = "md", extra) {
158
+ return ["rz-btn", `rz-btn--${variant}`, `rz-btn--${size}`, extra].filter(Boolean).join(" ");
159
+ }
160
+ function Button({ variant = "secondary", size = "md", className, type = "button", ...rest }) {
161
+ return /* @__PURE__ */ jsx("button", { type, className: buttonClass(variant, size, className), ...rest });
162
+ }
163
+ function LinkButton({ variant = "secondary", size = "md", className, external, forward, children, ...rest }) {
164
+ const extra = external ? { target: "_blank", rel: "noreferrer", ...rest } : rest;
165
+ return /* @__PURE__ */ jsxs("a", { className: buttonClass(variant, size, className), ...extra, children: [
166
+ children,
167
+ external && /* @__PURE__ */ jsx(OutboundArrow, {}),
168
+ forward && !external && /* @__PURE__ */ jsx(ForwardArrow, {})
169
+ ] });
170
+ }
171
+ function ForwardArrow() {
172
+ return /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "rz-arrow rz-arrow--fwd", children: [
173
+ /* @__PURE__ */ jsx("path", { d: "M5 12h14" }),
174
+ /* @__PURE__ */ jsx("path", { d: "m13 6 6 6-6 6" })
175
+ ] });
176
+ }
177
+ function OutboundArrow() {
178
+ return /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "rz-arrow", children: [
179
+ /* @__PURE__ */ jsx("path", { d: "M7 17 17 7" }),
180
+ /* @__PURE__ */ jsx("path", { d: "M7 7h10v10" })
181
+ ] });
182
+ }
157
183
  var THEME_KEY = "rz-admin-theme";
158
184
  function useTheme(defaultTheme = "light") {
159
185
  const [theme, setTheme] = useState(defaultTheme);
@@ -205,12 +231,16 @@ var HelpIcon = () => /* @__PURE__ */ jsxs("svg", { ...ico, children: [
205
231
  /* @__PURE__ */ jsx("path", { d: "M2 4h6a4 4 0 0 1 4 4v12a3 3 0 0 0-3-3H2z" }),
206
232
  /* @__PURE__ */ jsx("path", { d: "M22 4h-6a4 4 0 0 0-4 4v12a3 3 0 0 1 3-3h7z" })
207
233
  ] });
234
+ var GlobeIcon = () => /* @__PURE__ */ jsxs("svg", { ...ico, children: [
235
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9" }),
236
+ /* @__PURE__ */ jsx("path", { d: "M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18" })
237
+ ] });
208
238
  var OutIcon = () => /* @__PURE__ */ jsxs("svg", { ...ico, children: [
209
239
  /* @__PURE__ */ jsx("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }),
210
240
  /* @__PURE__ */ jsx("path", { d: "M16 17l5-5-5-5" }),
211
241
  /* @__PURE__ */ jsx("path", { d: "M21 12H9" })
212
242
  ] });
213
- function AccountMenu({ user, role, theme, onTheme, signOutPath, accountHref, helpHref }) {
243
+ function AccountMenu({ user, role, theme, onTheme, signOutPath, accountHref, helpHref, siteUrl }) {
214
244
  const [open, setOpen] = useState(false);
215
245
  const wrap = useRef(null);
216
246
  useEffect(() => {
@@ -245,7 +275,12 @@ function AccountMenu({ user, role, theme, onTheme, signOutPath, accountHref, hel
245
275
  /* @__PURE__ */ jsx("span", { children: "Theme" }),
246
276
  /* @__PURE__ */ jsx("span", { className: "rz-menu__end", children: /* @__PURE__ */ jsx(ThemeToggle, { theme, onChange: onTheme }) })
247
277
  ] }),
248
- (accountHref || helpHref) && /* @__PURE__ */ jsx("div", { className: "rz-menu__sep" }),
278
+ (siteUrl || accountHref || helpHref) && /* @__PURE__ */ jsx("div", { className: "rz-menu__sep" }),
279
+ siteUrl && /* @__PURE__ */ jsxs("a", { href: siteUrl, target: "_blank", rel: "noreferrer", role: "menuitem", className: "rz-menu__item", children: [
280
+ /* @__PURE__ */ jsx(GlobeIcon, {}),
281
+ "View website",
282
+ /* @__PURE__ */ jsx("span", { className: "rz-menu__end", children: /* @__PURE__ */ jsx(OutboundArrow, {}) })
283
+ ] }),
249
284
  accountHref && /* @__PURE__ */ jsxs("a", { href: accountHref, role: "menuitem", className: "rz-menu__item", children: [
250
285
  /* @__PURE__ */ jsx(UserIcon, {}),
251
286
  "Account"
@@ -262,19 +297,28 @@ function AccountMenu({ user, role, theme, onTheme, signOutPath, accountHref, hel
262
297
  ] })
263
298
  ] });
264
299
  }
265
- function TopBar({ siteName, productName, logoUrl, homeHref, user, role, theme, onTheme, signOutPath, accountHref, helpHref }) {
300
+ function TopBar({ siteName, productName, logoUrl, homeHref, siteUrl, user, role, theme, onTheme, signOutPath, accountHref, helpHref }) {
266
301
  return /* @__PURE__ */ jsxs("header", { className: "rz-topbar", children: [
267
- /* @__PURE__ */ jsxs("a", { href: homeHref, className: "rz-topbar__brand", children: [
268
- logoUrl && /* @__PURE__ */ jsx("img", { src: logoUrl, alt: "", className: "rz-topbar__logo" }),
269
- /* @__PURE__ */ jsx("span", { children: siteName }),
270
- /* @__PURE__ */ jsx("span", { className: "rz-topbar__product", children: productName })
271
- ] }),
302
+ /* @__PURE__ */ jsxs(
303
+ "a",
304
+ {
305
+ href: siteUrl || homeHref,
306
+ className: "rz-topbar__brand",
307
+ ...siteUrl ? { target: "_blank", rel: "noreferrer", title: "Open the live website in a new tab" } : {},
308
+ children: [
309
+ logoUrl && /* @__PURE__ */ jsx("img", { src: logoUrl, alt: "", className: "rz-topbar__logo" }),
310
+ /* @__PURE__ */ jsx("span", { children: siteName }),
311
+ /* @__PURE__ */ jsx("span", { className: "rz-topbar__product", children: productName }),
312
+ siteUrl && /* @__PURE__ */ jsx(OutboundArrow, {})
313
+ ]
314
+ }
315
+ ),
272
316
  user && role && /* @__PURE__ */ jsxs("div", { className: "rz-topbar__right", children: [
273
317
  /* @__PURE__ */ jsxs("span", { className: "rz-topbar__greeting", "data-testid": "rz-greeting", children: [
274
318
  "Welcome back, ",
275
319
  firstNameOf(user)
276
320
  ] }),
277
- /* @__PURE__ */ jsx(AccountMenu, { user, role, theme, onTheme, signOutPath, accountHref, helpHref })
321
+ /* @__PURE__ */ jsx(AccountMenu, { user, role, theme, onTheme, signOutPath, accountHref, helpHref, siteUrl })
278
322
  ] })
279
323
  ] });
280
324
  }
@@ -334,6 +378,8 @@ var SHELL_CSS = `
334
378
  .rz-topbar__brand { display: flex; align-items: center; gap: .6rem; font-weight: 600; font-size: .9375rem; text-decoration: none; }
335
379
  .rz-topbar__logo { height: 22px; width: auto; display: block; }
336
380
  .rz-topbar__product { font-weight: 400; color: var(--text-secondary); }
381
+ .rz-topbar__brand .rz-arrow { color: var(--text-muted); opacity: 0; transition: opacity .15s, transform .15s; }
382
+ .rz-topbar__brand:hover .rz-arrow { opacity: 1; }
337
383
  .rz-topbar__right { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
338
384
  .rz-topbar__greeting { color: var(--text-secondary); font-size: .8rem; }
339
385
  .rz-body { display: flex; flex: 1; min-height: 0; }
@@ -545,6 +591,7 @@ function AdminShell({
545
591
  signOutPath,
546
592
  accountHref,
547
593
  helpHref,
594
+ siteUrl,
548
595
  branding,
549
596
  defaultTheme = "light",
550
597
  children
@@ -561,6 +608,7 @@ function AdminShell({
561
608
  siteName: shownName,
562
609
  productName,
563
610
  logoUrl: shownLogo,
611
+ siteUrl,
564
612
  homeHref: basePath,
565
613
  user,
566
614
  role,
@@ -577,32 +625,6 @@ function AdminShell({
577
625
  ] })
578
626
  ] });
579
627
  }
580
- function buttonClass(variant = "secondary", size = "md", extra) {
581
- return ["rz-btn", `rz-btn--${variant}`, `rz-btn--${size}`, extra].filter(Boolean).join(" ");
582
- }
583
- function Button({ variant = "secondary", size = "md", className, type = "button", ...rest }) {
584
- return /* @__PURE__ */ jsx("button", { type, className: buttonClass(variant, size, className), ...rest });
585
- }
586
- function LinkButton({ variant = "secondary", size = "md", className, external, forward, children, ...rest }) {
587
- const extra = external ? { target: "_blank", rel: "noreferrer", ...rest } : rest;
588
- return /* @__PURE__ */ jsxs("a", { className: buttonClass(variant, size, className), ...extra, children: [
589
- children,
590
- external && /* @__PURE__ */ jsx(OutboundArrow, {}),
591
- forward && !external && /* @__PURE__ */ jsx(ForwardArrow, {})
592
- ] });
593
- }
594
- function ForwardArrow() {
595
- return /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "rz-arrow rz-arrow--fwd", children: [
596
- /* @__PURE__ */ jsx("path", { d: "M5 12h14" }),
597
- /* @__PURE__ */ jsx("path", { d: "m13 6 6 6-6 6" })
598
- ] });
599
- }
600
- function OutboundArrow() {
601
- return /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "rz-arrow", children: [
602
- /* @__PURE__ */ jsx("path", { d: "M7 17 17 7" }),
603
- /* @__PURE__ */ jsx("path", { d: "M7 7h10v10" })
604
- ] });
605
- }
606
628
  function Card({ title, meta, note, children, actions, className }) {
607
629
  return /* @__PURE__ */ jsxs("div", { className: ["rz-card", className].filter(Boolean).join(" "), children: [
608
630
  title && /* @__PURE__ */ jsx("div", { className: "rz-card__title", children: title }),
@@ -867,11 +889,11 @@ var STUDIO_CSS = `
867
889
  .rz-admin .rz-arrow--back { transform: none; }
868
890
  @media (prefers-reduced-motion: no-preference) { .rz-admin a:hover .rz-arrow--back { transform: translateX(-4px); } }
869
891
  `;
870
- function StudioShellFrame({ siteName, logoUrl, user, role, nav, pinnedNav, branding, children }) {
892
+ function StudioShellFrame({ siteName, logoUrl, siteUrl, user, role, nav, pinnedNav, branding, children }) {
871
893
  const pathname = usePathname() ?? "/admin";
872
894
  return /* @__PURE__ */ jsxs(Fragment, { children: [
873
895
  /* @__PURE__ */ jsx("style", { children: STUDIO_CSS }),
874
- /* @__PURE__ */ jsx(AdminShell, { siteName, logoUrl: logoUrl ?? void 0, user, role, nav, pinnedNav, branding, accountHref: null, activeHref: pathname, children })
896
+ /* @__PURE__ */ jsx(AdminShell, { siteName, logoUrl: logoUrl ?? void 0, siteUrl, user, role, nav, pinnedNav, branding, accountHref: null, activeHref: pathname, children })
875
897
  ] });
876
898
  }
877
899
 
@@ -3920,7 +3942,7 @@ Open the avatar menu (top right) and choose **Sign out**.
3920
3942
  section: "start",
3921
3943
  title: "Finding your way around",
3922
3944
  summary: "The sidebar, the dashboard, the lists, and the avatar menu.",
3923
- keywords: ["sidebar", "dashboard", "navigation", "menu", "settings"],
3945
+ keywords: ["sidebar", "dashboard", "navigation", "menu", "settings", "view website", "live site", "visit site"],
3924
3946
  body: `
3925
3947
  ## The sidebar
3926
3948
 
@@ -3932,9 +3954,13 @@ On a narrow screen the sidebar collapses to icons; press the arrow at the bottom
3932
3954
 
3933
3955
  Every row is one item: its title, date, status and a **View live** link. **+ New** at the top starts a new one. Click a title to edit it. The **Status** column links straight to a waiting change.
3934
3956
 
3957
+ ## Getting to the live website
3958
+
3959
+ Click the site name at the top left \u2014 it opens the live website in a new tab (hover and an arrow appears). The avatar menu has the same thing as **View website**. Each item's list row also has **View live** for that one page.
3960
+
3935
3961
  ## The avatar menu
3936
3962
 
3937
- Top right, your photo or initials. From here: **Account**, **Help center** (this page), a light/dark toggle, and **Sign out**.
3963
+ Top right, your photo or initials. From here: a light/dark toggle, **View website**, **Account**, **Help center** (this page), and **Sign out**.
3938
3964
 
3939
3965
  ## The Ask bubble
3940
3966