@logickernel/bridge 0.11.8 → 0.11.9
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,25 +728,36 @@ function getIconComponent(icon) {
|
|
|
728
728
|
function NavMain({ items }) {
|
|
729
729
|
const pathname = usePathname();
|
|
730
730
|
const { isMobile, setOpenMobile } = useSidebar();
|
|
731
|
-
const
|
|
732
|
-
const segments =
|
|
731
|
+
const getContextFromPath = (path) => {
|
|
732
|
+
const segments = path.split("/").filter(Boolean);
|
|
733
733
|
if (segments.length === 0) return null;
|
|
734
734
|
return `/${segments[0]}`;
|
|
735
735
|
};
|
|
736
|
+
const getCurrentContext = () => {
|
|
737
|
+
if (typeof window !== "undefined") {
|
|
738
|
+
const fullPath = window.location.pathname;
|
|
739
|
+
return getContextFromPath(fullPath);
|
|
740
|
+
}
|
|
741
|
+
return getContextFromPath(pathname);
|
|
742
|
+
};
|
|
736
743
|
const shouldUseLink = (url) => {
|
|
737
744
|
const currentContext = getCurrentContext();
|
|
745
|
+
const urlContext = getContextFromPath(url);
|
|
738
746
|
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
739
|
-
const willUseLink = currentContext
|
|
747
|
+
const willUseLink = currentContext && urlContext && currentContext === urlContext;
|
|
740
748
|
console.log("[NavMain] shouldUseLink check:", {
|
|
741
749
|
url,
|
|
742
750
|
currentPathname: pathname,
|
|
751
|
+
windowPathname: typeof window !== "undefined" ? window.location.pathname : "N/A",
|
|
743
752
|
currentContext,
|
|
744
|
-
|
|
753
|
+
urlContext,
|
|
754
|
+
contextsMatch: currentContext === urlContext,
|
|
745
755
|
willUseLink
|
|
746
756
|
});
|
|
747
757
|
}
|
|
748
|
-
if (
|
|
749
|
-
|
|
758
|
+
if (currentContext && urlContext && currentContext === urlContext) {
|
|
759
|
+
return true;
|
|
760
|
+
}
|
|
750
761
|
return false;
|
|
751
762
|
};
|
|
752
763
|
const handleClick = (e) => {
|