@logickernel/bridge 0.11.5 → 0.11.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.
package/dist/next/components.js
CHANGED
|
@@ -728,8 +728,16 @@ function getIconComponent(icon) {
|
|
|
728
728
|
function NavMain({ items }) {
|
|
729
729
|
const pathname = usePathname();
|
|
730
730
|
const { isMobile, setOpenMobile } = useSidebar();
|
|
731
|
-
const
|
|
732
|
-
|
|
731
|
+
const getCurrentContext = () => {
|
|
732
|
+
const segments = pathname.split("/").filter(Boolean);
|
|
733
|
+
if (segments.length === 0) return null;
|
|
734
|
+
return `/${segments[0]}`;
|
|
735
|
+
};
|
|
736
|
+
const shouldUseLink = (url) => {
|
|
737
|
+
const currentContext = getCurrentContext();
|
|
738
|
+
if (!currentContext) return false;
|
|
739
|
+
if (url.startsWith(currentContext)) return true;
|
|
740
|
+
return false;
|
|
733
741
|
};
|
|
734
742
|
const handleClick = () => {
|
|
735
743
|
if (isMobile) {
|
|
@@ -836,24 +844,24 @@ function NavMain({ items }) {
|
|
|
836
844
|
}
|
|
837
845
|
) }),
|
|
838
846
|
/* @__PURE__ */ jsx(CollapsibleContent2, { children: /* @__PURE__ */ jsx(SidebarMenuSub, { children: item.items?.map((subItem) => {
|
|
839
|
-
if (
|
|
840
|
-
return /* @__PURE__ */ jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsx(SidebarMenuSubButton, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
847
|
+
if (shouldUseLink(subItem.url)) {
|
|
848
|
+
return /* @__PURE__ */ jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsx(SidebarMenuSubButton, { asChild: true, children: /* @__PURE__ */ jsx(Link, { href: subItem.url, onClick: handleClick, children: /* @__PURE__ */ jsx("span", { children: subItem.title }) }) }) }, subItem.title);
|
|
841
849
|
}
|
|
842
|
-
return /* @__PURE__ */ jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsx(SidebarMenuSubButton, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
850
|
+
return /* @__PURE__ */ jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsx(SidebarMenuSubButton, { asChild: true, children: /* @__PURE__ */ jsx("a", { href: subItem.url, className: "text-red-500", onClick: handleClick, children: /* @__PURE__ */ jsx("span", { children: subItem.title }) }) }) }, subItem.title);
|
|
843
851
|
}) }) })
|
|
844
852
|
] })
|
|
845
853
|
},
|
|
846
854
|
item.title
|
|
847
855
|
);
|
|
848
856
|
}
|
|
849
|
-
if (
|
|
857
|
+
if (shouldUseLink(item.url)) {
|
|
850
858
|
return /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(
|
|
851
859
|
SidebarMenuButton,
|
|
852
860
|
{
|
|
853
861
|
asChild: true,
|
|
854
862
|
tooltip: item.title,
|
|
855
863
|
isActive,
|
|
856
|
-
children: /* @__PURE__ */ jsxs(
|
|
864
|
+
children: /* @__PURE__ */ jsxs(Link, { href: item.url, onClick: handleClick, children: [
|
|
857
865
|
item.icon && /* @__PURE__ */ jsx(item.icon, {}),
|
|
858
866
|
/* @__PURE__ */ jsx("span", { children: item.title })
|
|
859
867
|
] })
|
|
@@ -866,7 +874,7 @@ function NavMain({ items }) {
|
|
|
866
874
|
asChild: true,
|
|
867
875
|
tooltip: item.title,
|
|
868
876
|
isActive,
|
|
869
|
-
children: /* @__PURE__ */ jsxs(
|
|
877
|
+
children: /* @__PURE__ */ jsxs("a", { href: item.url, onClick: handleClick, children: [
|
|
870
878
|
item.icon && /* @__PURE__ */ jsx(item.icon, {}),
|
|
871
879
|
/* @__PURE__ */ jsx("span", { children: item.title })
|
|
872
880
|
] })
|