@protobase/ui 0.27.0 → 0.28.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/dist/app/app.js CHANGED
@@ -201,6 +201,7 @@ const Routes = ({ workspace, sidebarMode, assistant, runtime }) => {
201
201
  signIn: user ? void 0 : signIn.link(),
202
202
  workspace: current?.organization?.name ?? workspace,
203
203
  appName: meta.appName,
204
+ appIcon: meta.appIcon,
204
205
  logo: ProjectLogo,
205
206
  navGroups: groups,
206
207
  bottomBar: bottomBarFromMeta(meta, basePath, place),
@@ -10,7 +10,7 @@ import { useEffect, useRef, useState } from "react";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
11
  //#region src/app-shell/app-shell.tsx
12
12
  const drawerId = "app-drawer";
13
- const AppShell = ({ sidebarMode, activeItem, breadcrumb, user, workspace, appName, logo, actions, rightPanel, forceExpanded, profileMenuOpen, navGroups, userMenu, bottomBar, onNavigate, onSignOut, signIn, organizations, roles, theme, search, pageScroll: scrollsByDefault = false, className, children }) => {
13
+ const AppShell = ({ sidebarMode, activeItem, breadcrumb, user, workspace, appName, appIcon, logo, actions, rightPanel, forceExpanded, profileMenuOpen, navGroups, userMenu, bottomBar, onNavigate, onSignOut, signIn, organizations, roles, theme, search, pageScroll: scrollsByDefault = false, className, children }) => {
14
14
  const desktop = useIsDesktop();
15
15
  const [drawerOpen, setDrawerOpen] = useState(false);
16
16
  useEffect(() => {
@@ -31,6 +31,7 @@ const AppShell = ({ sidebarMode, activeItem, breadcrumb, user, workspace, appNam
31
31
  user,
32
32
  workspace,
33
33
  appName,
34
+ appIcon,
34
35
  forceExpanded,
35
36
  profileMenuOpen,
36
37
  groups: navGroups,
@@ -4,12 +4,14 @@ export declare const LogoMark: ({ className }: {
4
4
  className?: string;
5
5
  }) => import("react").JSX.Element;
6
6
  /**
7
- * What the logo at the top of the sidebar gets: `compact` when the sidebar shows only icons, the workspace's name, and
8
- * the app's name, such as `Property Finder` (`PROTOBASE_APP_NAME` or `createAuth`'s `appName`).
7
+ * What the logo at the top of the sidebar gets: `compact` when the sidebar shows only icons, the workspace's name, the
8
+ * app's name, such as `Property Finder` (`PROTOBASE_APP_NAME` or `createAuth`'s `appName`), and the path of its own
9
+ * icon, its `protobase.favicon.svg`, when the project has one.
9
10
  */
10
11
  export type ShellLogoProps = {
11
12
  compact: boolean;
12
13
  workspace?: string;
13
14
  appName?: string;
15
+ appIcon?: string;
14
16
  };
15
17
  //#endregion
@@ -31,16 +31,21 @@ const Wordmark = ({ className }) => /* @__PURE__ */ jsx("svg", {
31
31
  });
32
32
  const brandName = "Protobase";
33
33
  /**
34
- * The logo at the top of the sidebar: Protobase's mark, then the app's name, as the brand's wordmark when the app goes by
35
- * Protobase's name, with the workspace's name under it; the mark alone when compact.
34
+ * The logo at the top of the sidebar: the app's own icon, else Protobase's mark, then the app's name, as the brand's
35
+ * wordmark when the app goes by Protobase's name and has no icon of its own, with the workspace's name under it; the
36
+ * icon alone when compact.
36
37
  */
37
- const Logo = ({ compact, workspace, appName }) => /* @__PURE__ */ jsxs("div", {
38
+ const Logo = ({ compact, workspace, appName, appIcon }) => /* @__PURE__ */ jsxs("div", {
38
39
  className: "flex items-center gap-2.5 overflow-hidden",
39
- children: [/* @__PURE__ */ jsx(LogoMark, {}), !compact && /* @__PURE__ */ jsxs("div", {
40
+ children: [appIcon ? /* @__PURE__ */ jsx("img", {
41
+ src: appIcon,
42
+ alt: "",
43
+ className: "size-7 shrink-0 object-contain"
44
+ }) : /* @__PURE__ */ jsx(LogoMark, {}), !compact && /* @__PURE__ */ jsxs("div", {
40
45
  className: "flex min-w-0 flex-col gap-0.5 leading-tight",
41
- children: [appName && appName !== brandName ? /* @__PURE__ */ jsx("div", {
46
+ children: [appIcon || appName && appName !== brandName ? /* @__PURE__ */ jsx("div", {
42
47
  className: "truncate text-sm font-semibold text-foreground",
43
- children: appName
48
+ children: appName ?? brandName
44
49
  }) : /* @__PURE__ */ jsx(Wordmark, { className: "self-start" }), workspace && /* @__PURE__ */ jsx("div", {
45
50
  className: "truncate text-[11px] text-muted-foreground",
46
51
  children: workspace
@@ -11,7 +11,7 @@ import { SidebarGroup } from "./sidebar-group.js";
11
11
  import { LogIn } from "lucide-react";
12
12
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
13
  //#region src/app-shell/sidebar.tsx
14
- const Sidebar = ({ mode, activeItem, user, workspace, appName, forceExpanded, profileMenuOpen, groups = navGroups, userMenu, onNavigate, onSignOut, signIn, organizations, roles, theme, sticky, logo: SidebarLogo = Logo }) => {
14
+ const Sidebar = ({ mode, activeItem, user, workspace, appName, appIcon, forceExpanded, profileMenuOpen, groups = navGroups, userMenu, onNavigate, onSignOut, signIn, organizations, roles, theme, sticky, logo: SidebarLogo = Logo }) => {
15
15
  const expanding = mode === "icon-expand";
16
16
  const expanded = expanding && forceExpanded;
17
17
  const inline = isTextMode(mode) || expanding;
@@ -26,7 +26,8 @@ const Sidebar = ({ mode, activeItem, user, workspace, appName, forceExpanded, pr
26
26
  children: /* @__PURE__ */ jsx(SidebarLogo, {
27
27
  compact: !inline,
28
28
  workspace,
29
- appName
29
+ appName,
30
+ appIcon
30
31
  })
31
32
  }),
32
33
  /* @__PURE__ */ jsx("div", {
@@ -7,6 +7,8 @@ export type MetaData = {
7
7
  etag: string;
8
8
  /** The app's name, which ends the tab titles. */
9
9
  appName: string;
10
+ /** The path of the app's own icon, when the project has one, which the sidebar's logo draws. */
11
+ appIcon?: string;
10
12
  resources: Record<string, ResourceModel>;
11
13
  views: Record<string, ViewModel>;
12
14
  /** Composed pages by name. */
@@ -27,6 +27,7 @@ const useMeta = () => {
27
27
  return {
28
28
  etag: result.etag,
29
29
  appName: result.meta.appName,
30
+ ...result.meta.appIcon && { appIcon: result.meta.appIcon },
30
31
  resources: Object.fromEntries(result.meta.resources.map((model) => [model.name, model])),
31
32
  views: Object.fromEntries(result.meta.views.map((model) => [model.resource, model])),
32
33
  pages: Object.fromEntries((result.meta.pages ?? []).map((model) => [model.name, model])),
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.27.0";
2
+ var version = "0.28.0";
3
3
  var protobase = { "pluginApi": 1 };
4
4
  //#endregion
5
5
  export { protobase, version };