@logickernel/bridge 0.11.5 → 0.11.6
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.cjs
CHANGED
|
@@ -757,8 +757,16 @@ function getIconComponent(icon) {
|
|
|
757
757
|
function NavMain({ items }) {
|
|
758
758
|
const pathname = navigation.usePathname();
|
|
759
759
|
const { isMobile, setOpenMobile } = useSidebar();
|
|
760
|
-
const
|
|
761
|
-
|
|
760
|
+
const getCurrentContext = () => {
|
|
761
|
+
const segments = pathname.split("/").filter(Boolean);
|
|
762
|
+
if (segments.length === 0) return null;
|
|
763
|
+
return `/${segments[0]}`;
|
|
764
|
+
};
|
|
765
|
+
const shouldUseLink = (url) => {
|
|
766
|
+
const currentContext = getCurrentContext();
|
|
767
|
+
if (!currentContext) return false;
|
|
768
|
+
if (url.startsWith(currentContext)) return true;
|
|
769
|
+
return false;
|
|
762
770
|
};
|
|
763
771
|
const handleClick = () => {
|
|
764
772
|
if (isMobile) {
|
|
@@ -865,24 +873,24 @@ function NavMain({ items }) {
|
|
|
865
873
|
}
|
|
866
874
|
) }),
|
|
867
875
|
/* @__PURE__ */ jsxRuntime.jsx(CollapsibleContent2, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSub, { children: item.items?.map((subItem) => {
|
|
868
|
-
if (
|
|
869
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubButton, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
876
|
+
if (shouldUseLink(subItem.url)) {
|
|
877
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubButton, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Link__default.default, { href: subItem.url, onClick: handleClick, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: subItem.title }) }) }) }, subItem.title);
|
|
870
878
|
}
|
|
871
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubButton, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
879
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubButton, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: subItem.url, onClick: handleClick, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: subItem.title }) }) }) }, subItem.title);
|
|
872
880
|
}) }) })
|
|
873
881
|
] })
|
|
874
882
|
},
|
|
875
883
|
item.title
|
|
876
884
|
);
|
|
877
885
|
}
|
|
878
|
-
if (
|
|
886
|
+
if (shouldUseLink(item.url)) {
|
|
879
887
|
return /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
880
888
|
SidebarMenuButton,
|
|
881
889
|
{
|
|
882
890
|
asChild: true,
|
|
883
891
|
tooltip: item.title,
|
|
884
892
|
isActive,
|
|
885
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
893
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(Link__default.default, { href: item.url, onClick: handleClick, children: [
|
|
886
894
|
item.icon && /* @__PURE__ */ jsxRuntime.jsx(item.icon, {}),
|
|
887
895
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: item.title })
|
|
888
896
|
] })
|
|
@@ -895,7 +903,7 @@ function NavMain({ items }) {
|
|
|
895
903
|
asChild: true,
|
|
896
904
|
tooltip: item.title,
|
|
897
905
|
isActive,
|
|
898
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
906
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: item.url, onClick: handleClick, children: [
|
|
899
907
|
item.icon && /* @__PURE__ */ jsxRuntime.jsx(item.icon, {}),
|
|
900
908
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: item.title })
|
|
901
909
|
] })
|