@open-mercato/ui 0.6.7-develop.6775.1.c2313bb8a3 → 0.6.7-develop.6785.1.1dd7cfac55
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/ai/AiChat.js +21 -2
- package/dist/ai/AiChat.js.map +2 -2
- package/dist/backend/AppShell.js +43 -4
- package/dist/backend/AppShell.js.map +2 -2
- package/dist/portal/PortalContext.js +1 -1
- package/dist/portal/PortalContext.js.map +2 -2
- package/dist/portal/utils/nav.js +2 -3
- package/dist/portal/utils/nav.js.map +2 -2
- package/package.json +3 -3
- package/src/ai/AiChat.tsx +30 -1
- package/src/ai/__tests__/AiChat.test.tsx +31 -0
- package/src/backend/AppShell.tsx +55 -4
- package/src/backend/__tests__/AppShell.test.tsx +65 -7
- package/src/portal/PortalContext.tsx +1 -1
- package/src/portal/utils/__tests__/nav.test.ts +2 -2
- package/src/portal/utils/nav.ts +3 -4
package/dist/backend/AppShell.js
CHANGED
|
@@ -87,6 +87,45 @@ function shouldBypassLogoOptimization(src) {
|
|
|
87
87
|
const value = src ?? "";
|
|
88
88
|
return /^https?:\/\//.test(value) || /^\/api\/attachments\/(?:image|file)\//.test(value);
|
|
89
89
|
}
|
|
90
|
+
function ShellBrandLogo({
|
|
91
|
+
logo,
|
|
92
|
+
brandName,
|
|
93
|
+
unoptimized,
|
|
94
|
+
compact = false,
|
|
95
|
+
mobile = false
|
|
96
|
+
}) {
|
|
97
|
+
const src = logo?.src ?? "/open-mercato.svg";
|
|
98
|
+
const alt = logo?.alt ?? brandName;
|
|
99
|
+
const isCustomLogo = Boolean(logo?.src);
|
|
100
|
+
const preserveAspectRatio = Boolean(logo?.preserveAspectRatio);
|
|
101
|
+
if (!isCustomLogo || !preserveAspectRatio) {
|
|
102
|
+
return /* @__PURE__ */ jsx(
|
|
103
|
+
Image,
|
|
104
|
+
{
|
|
105
|
+
src,
|
|
106
|
+
alt,
|
|
107
|
+
width: mobile ? 28 : 40,
|
|
108
|
+
height: mobile ? 28 : 40,
|
|
109
|
+
className: `${mobile ? "rounded" : "rounded-full"} shrink-0 object-cover`,
|
|
110
|
+
unoptimized: unoptimized ? true : void 0
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
const width = compact ? 40 : mobile ? 96 : 120;
|
|
115
|
+
const height = mobile ? 28 : 40;
|
|
116
|
+
const className = compact ? "h-10 max-w-10 w-auto shrink-0 object-contain" : mobile ? "h-7 max-w-24 w-auto shrink-0 object-contain" : "h-10 max-w-[120px] w-auto shrink-0 object-contain";
|
|
117
|
+
return /* @__PURE__ */ jsx(
|
|
118
|
+
Image,
|
|
119
|
+
{
|
|
120
|
+
src,
|
|
121
|
+
alt,
|
|
122
|
+
width,
|
|
123
|
+
height,
|
|
124
|
+
className,
|
|
125
|
+
unoptimized: unoptimized ? true : void 0
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
}
|
|
90
129
|
function mergeSidebarItemsWithInjected(items, injectedItems, t) {
|
|
91
130
|
if (injectedItems.length === 0) return items;
|
|
92
131
|
const builtInById = /* @__PURE__ */ new Map();
|
|
@@ -514,7 +553,7 @@ function AppShellBody({ productName, logo, email, canManageUpgradeActions = fals
|
|
|
514
553
|
className: `flex items-center gap-3 rounded-xl transition-colors hover:bg-muted ${compact ? "p-2 justify-center" : "p-3"}`,
|
|
515
554
|
"aria-label": t("appShell.goToDashboard"),
|
|
516
555
|
children: [
|
|
517
|
-
/* @__PURE__ */ jsx(
|
|
556
|
+
/* @__PURE__ */ jsx(ShellBrandLogo, { logo: resolvedLogo, brandName: resolvedBrandName, compact, unoptimized: resolvedLogoBypassesOptimization }),
|
|
518
557
|
!compact && /* @__PURE__ */ jsx("span", { className: "truncate text-sm font-medium text-foreground", children: resolvedBrandName })
|
|
519
558
|
]
|
|
520
559
|
}
|
|
@@ -617,7 +656,7 @@ function AppShellBody({ productName, logo, email, canManageUpgradeActions = fals
|
|
|
617
656
|
className: `flex items-center gap-3 rounded-xl transition-colors hover:bg-muted ${compact ? "p-2 justify-center" : "p-3"}`,
|
|
618
657
|
"aria-label": t("appShell.goToDashboard"),
|
|
619
658
|
children: [
|
|
620
|
-
/* @__PURE__ */ jsx(
|
|
659
|
+
/* @__PURE__ */ jsx(ShellBrandLogo, { logo: resolvedLogo, brandName: resolvedBrandName, compact, unoptimized: resolvedLogoBypassesOptimization }),
|
|
621
660
|
!compact && /* @__PURE__ */ jsx("span", { className: "truncate text-sm font-medium text-foreground", children: resolvedBrandName })
|
|
622
661
|
]
|
|
623
662
|
}
|
|
@@ -677,7 +716,7 @@ function AppShellBody({ productName, logo, email, canManageUpgradeActions = fals
|
|
|
677
716
|
className: `flex items-center gap-3 rounded-xl transition-colors hover:bg-muted ${compact ? "p-2 justify-center" : "p-3"}`,
|
|
678
717
|
"aria-label": t("appShell.goToDashboard"),
|
|
679
718
|
children: [
|
|
680
|
-
/* @__PURE__ */ jsx(
|
|
719
|
+
/* @__PURE__ */ jsx(ShellBrandLogo, { logo: resolvedLogo, brandName: resolvedBrandName, compact, unoptimized: resolvedLogoBypassesOptimization }),
|
|
681
720
|
!compact && /* @__PURE__ */ jsx("span", { className: "truncate text-sm font-medium text-foreground", children: resolvedBrandName })
|
|
682
721
|
]
|
|
683
722
|
}
|
|
@@ -1080,7 +1119,7 @@ function AppShellBody({ productName, logo, email, canManageUpgradeActions = fals
|
|
|
1080
1119
|
/* @__PURE__ */ jsxs("aside", { className: "absolute left-0 top-0 flex h-full w-[280px] max-w-[85vw] flex-col bg-background border-r shadow-lg overflow-hidden", children: [
|
|
1081
1120
|
/* @__PURE__ */ jsxs("div", { className: "shrink-0 flex items-center justify-between gap-2 border-b px-4 py-3", children: [
|
|
1082
1121
|
/* @__PURE__ */ jsxs(Link, { href: "/backend", className: "flex items-center gap-2 min-w-0 text-sm font-semibold", onClick: () => setMobileOpen(false), "aria-label": t("appShell.goToDashboard"), children: [
|
|
1083
|
-
/* @__PURE__ */ jsx(
|
|
1122
|
+
/* @__PURE__ */ jsx(ShellBrandLogo, { logo: resolvedLogo, brandName: resolvedBrandName, mobile: true, unoptimized: resolvedLogoBypassesOptimization }),
|
|
1084
1123
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: resolvedBrandName })
|
|
1085
1124
|
] }),
|
|
1086
1125
|
/* @__PURE__ */ jsx(IconButton, { variant: "ghost", size: "sm", onClick: () => setMobileOpen(false), "aria-label": t("appShell.closeMenu"), children: /* @__PURE__ */ jsx(X, { className: "size-4" }) })
|