@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.cjs
CHANGED
|
@@ -757,25 +757,36 @@ function getIconComponent(icon) {
|
|
|
757
757
|
function NavMain({ items }) {
|
|
758
758
|
const pathname = navigation.usePathname();
|
|
759
759
|
const { isMobile, setOpenMobile } = useSidebar();
|
|
760
|
-
const
|
|
761
|
-
const segments =
|
|
760
|
+
const getContextFromPath = (path) => {
|
|
761
|
+
const segments = path.split("/").filter(Boolean);
|
|
762
762
|
if (segments.length === 0) return null;
|
|
763
763
|
return `/${segments[0]}`;
|
|
764
764
|
};
|
|
765
|
+
const getCurrentContext = () => {
|
|
766
|
+
if (typeof window !== "undefined") {
|
|
767
|
+
const fullPath = window.location.pathname;
|
|
768
|
+
return getContextFromPath(fullPath);
|
|
769
|
+
}
|
|
770
|
+
return getContextFromPath(pathname);
|
|
771
|
+
};
|
|
765
772
|
const shouldUseLink = (url) => {
|
|
766
773
|
const currentContext = getCurrentContext();
|
|
774
|
+
const urlContext = getContextFromPath(url);
|
|
767
775
|
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
768
|
-
const willUseLink = currentContext
|
|
776
|
+
const willUseLink = currentContext && urlContext && currentContext === urlContext;
|
|
769
777
|
console.log("[NavMain] shouldUseLink check:", {
|
|
770
778
|
url,
|
|
771
779
|
currentPathname: pathname,
|
|
780
|
+
windowPathname: typeof window !== "undefined" ? window.location.pathname : "N/A",
|
|
772
781
|
currentContext,
|
|
773
|
-
|
|
782
|
+
urlContext,
|
|
783
|
+
contextsMatch: currentContext === urlContext,
|
|
774
784
|
willUseLink
|
|
775
785
|
});
|
|
776
786
|
}
|
|
777
|
-
if (
|
|
778
|
-
|
|
787
|
+
if (currentContext && urlContext && currentContext === urlContext) {
|
|
788
|
+
return true;
|
|
789
|
+
}
|
|
779
790
|
return false;
|
|
780
791
|
};
|
|
781
792
|
const handleClick = (e) => {
|