@logickernel/bridge 0.9.7 → 0.9.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 +143 -134
- package/dist/next/components.cjs.map +1 -1
- package/dist/next/components.d.cts +2 -2
- package/dist/next/components.d.ts +2 -2
- package/dist/next/components.js +144 -135
- package/dist/next/components.js.map +1 -1
- package/package.json +1 -1
|
@@ -75,7 +75,7 @@ declare function useNavigation({ organizationId, apiBaseUrl, enabled, }?: UseNav
|
|
|
75
75
|
interface NavMainProps {
|
|
76
76
|
items: NavigationItem[];
|
|
77
77
|
}
|
|
78
|
-
declare function NavMain({ items }: NavMainProps): react_jsx_runtime.JSX.Element;
|
|
78
|
+
declare function NavMain({ items }: NavMainProps): react_jsx_runtime.JSX.Element | null;
|
|
79
79
|
|
|
80
80
|
interface NavUserProps {
|
|
81
81
|
user: User;
|
|
@@ -86,7 +86,7 @@ interface TeamSwitcherProps {
|
|
|
86
86
|
teams: NavigationOrganization[];
|
|
87
87
|
organizationId?: string;
|
|
88
88
|
}
|
|
89
|
-
declare function TeamSwitcher({ teams, organizationId, }: TeamSwitcherProps): react_jsx_runtime.JSX.Element
|
|
89
|
+
declare function TeamSwitcher({ teams, organizationId, }: TeamSwitcherProps): react_jsx_runtime.JSX.Element;
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
92
|
* Icon mapper utility
|
|
@@ -75,7 +75,7 @@ declare function useNavigation({ organizationId, apiBaseUrl, enabled, }?: UseNav
|
|
|
75
75
|
interface NavMainProps {
|
|
76
76
|
items: NavigationItem[];
|
|
77
77
|
}
|
|
78
|
-
declare function NavMain({ items }: NavMainProps): react_jsx_runtime.JSX.Element;
|
|
78
|
+
declare function NavMain({ items }: NavMainProps): react_jsx_runtime.JSX.Element | null;
|
|
79
79
|
|
|
80
80
|
interface NavUserProps {
|
|
81
81
|
user: User;
|
|
@@ -86,7 +86,7 @@ interface TeamSwitcherProps {
|
|
|
86
86
|
teams: NavigationOrganization[];
|
|
87
87
|
organizationId?: string;
|
|
88
88
|
}
|
|
89
|
-
declare function TeamSwitcher({ teams, organizationId, }: TeamSwitcherProps): react_jsx_runtime.JSX.Element
|
|
89
|
+
declare function TeamSwitcher({ teams, organizationId, }: TeamSwitcherProps): react_jsx_runtime.JSX.Element;
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
92
|
* Icon mapper utility
|
package/dist/next/components.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useState, useEffect } from 'react';
|
|
|
3
3
|
import { Slot } from '@radix-ui/react-slot';
|
|
4
4
|
import { cva } from 'class-variance-authority';
|
|
5
5
|
import * as LucideIcons from 'lucide-react';
|
|
6
|
-
import { ChevronRight, ChevronsUpDown, BadgeCheck, LogOut, GalleryVerticalEnd, Check,
|
|
6
|
+
import { ChevronRight, ChevronsUpDown, BadgeCheck, LogOut, GalleryVerticalEnd, Check, XIcon, MenuIcon } from 'lucide-react';
|
|
7
7
|
import { clsx } from 'clsx';
|
|
8
8
|
import { twMerge } from 'tailwind-merge';
|
|
9
9
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
@@ -416,14 +416,14 @@ function SidebarTrigger({
|
|
|
416
416
|
"data-slot": "sidebar-trigger",
|
|
417
417
|
variant: "ghost",
|
|
418
418
|
size: "icon",
|
|
419
|
-
className: cn("size-7"
|
|
419
|
+
className: cn(className, "size-7"),
|
|
420
420
|
onClick: (event) => {
|
|
421
421
|
onClick?.(event);
|
|
422
422
|
toggleSidebar();
|
|
423
423
|
},
|
|
424
424
|
...props,
|
|
425
425
|
children: [
|
|
426
|
-
/* @__PURE__ */ jsx(
|
|
426
|
+
/* @__PURE__ */ jsx(MenuIcon, {}),
|
|
427
427
|
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Toggle Sidebar" })
|
|
428
428
|
]
|
|
429
429
|
}
|
|
@@ -455,12 +455,11 @@ function SidebarRail({ className, ...props }) {
|
|
|
455
455
|
}
|
|
456
456
|
function SidebarInset({ className, ...props }) {
|
|
457
457
|
return /* @__PURE__ */ jsx(
|
|
458
|
-
"
|
|
458
|
+
"div",
|
|
459
459
|
{
|
|
460
460
|
"data-slot": "sidebar-inset",
|
|
461
461
|
className: cn(
|
|
462
462
|
"bg-background relative flex w-full flex-1 flex-col",
|
|
463
|
-
"px-4",
|
|
464
463
|
"md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",
|
|
465
464
|
className
|
|
466
465
|
),
|
|
@@ -728,6 +727,7 @@ function getIconComponent(icon) {
|
|
|
728
727
|
}
|
|
729
728
|
function NavMain({ items }) {
|
|
730
729
|
const pathname = usePathname();
|
|
730
|
+
const { isMobile, setOpenMobile } = useSidebar();
|
|
731
731
|
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
732
732
|
console.log("[NavMain] Received items:", {
|
|
733
733
|
itemsCount: items.length,
|
|
@@ -771,59 +771,105 @@ function NavMain({ items }) {
|
|
|
771
771
|
groupsCount: groups.length,
|
|
772
772
|
groups: groups.map((group) => ({
|
|
773
773
|
hasLabel: !!group.label,
|
|
774
|
+
labelTitle: group.label?.title,
|
|
774
775
|
itemsCount: group.items.length,
|
|
775
776
|
items: group.items.map((item) => item.title)
|
|
776
777
|
}))
|
|
777
778
|
});
|
|
779
|
+
const firstGroup = groups.length > 0 ? groups[0] : null;
|
|
780
|
+
console.log("[NavMain] Will render:", {
|
|
781
|
+
groupsLength: groups.length,
|
|
782
|
+
willRender: groups.length > 0,
|
|
783
|
+
firstGroupHasItems: firstGroup ? firstGroup.items.length > 0 : false,
|
|
784
|
+
firstGroupHasLabel: !!firstGroup?.label
|
|
785
|
+
});
|
|
778
786
|
}
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
787
|
+
if (groups.length === 0) {
|
|
788
|
+
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
789
|
+
console.warn("[NavMain] No groups to render, returning null");
|
|
790
|
+
}
|
|
791
|
+
return null;
|
|
792
|
+
}
|
|
793
|
+
return /* @__PURE__ */ jsx(Fragment, { children: groups.map((group, groupIndex) => {
|
|
794
|
+
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
795
|
+
console.log(`[NavMain] Rendering group ${groupIndex}:`, {
|
|
796
|
+
hasLabel: !!group.label,
|
|
797
|
+
itemsCount: group.items.length,
|
|
798
|
+
willRenderLabel: !!group.label,
|
|
799
|
+
willRenderItems: group.items.length > 0
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
return /* @__PURE__ */ jsxs(SidebarGroup, { children: [
|
|
803
|
+
group.label && /* @__PURE__ */ jsxs(SidebarGroupLabel, { children: [
|
|
804
|
+
group.label.icon && /* @__PURE__ */ jsx(group.label.icon, { className: "mr-2" }),
|
|
805
|
+
group.label.title
|
|
806
|
+
] }),
|
|
807
|
+
group.items.length > 0 && /* @__PURE__ */ jsx(SidebarMenu, { children: group.items.map((item) => {
|
|
808
|
+
const isActive = pathname === item.url || item.isActive;
|
|
809
|
+
const hasSubItems = item.items && item.items.length > 0;
|
|
810
|
+
if (hasSubItems) {
|
|
811
|
+
return /* @__PURE__ */ jsx(
|
|
812
|
+
Collapsible,
|
|
813
|
+
{
|
|
814
|
+
asChild: true,
|
|
815
|
+
defaultOpen: isActive,
|
|
816
|
+
className: "group/collapsible",
|
|
817
|
+
children: /* @__PURE__ */ jsxs(SidebarMenuItem, { children: [
|
|
818
|
+
/* @__PURE__ */ jsx(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
819
|
+
SidebarMenuButton,
|
|
820
|
+
{
|
|
821
|
+
tooltip: item.title,
|
|
822
|
+
isActive,
|
|
823
|
+
children: [
|
|
824
|
+
item.icon && /* @__PURE__ */ jsx(item.icon, {}),
|
|
825
|
+
/* @__PURE__ */ jsx("span", { children: item.title }),
|
|
826
|
+
/* @__PURE__ */ jsx(ChevronRight, { className: "ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" })
|
|
827
|
+
]
|
|
828
|
+
}
|
|
829
|
+
) }),
|
|
830
|
+
/* @__PURE__ */ jsx(CollapsibleContent2, { children: /* @__PURE__ */ jsx(SidebarMenuSub, { children: item.items?.map((subItem) => /* @__PURE__ */ jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsx(SidebarMenuSubButton, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
831
|
+
Link,
|
|
832
|
+
{
|
|
833
|
+
href: subItem.url,
|
|
834
|
+
onClick: () => {
|
|
835
|
+
if (isMobile) {
|
|
836
|
+
setOpenMobile(false);
|
|
837
|
+
}
|
|
838
|
+
},
|
|
839
|
+
children: /* @__PURE__ */ jsx("span", { children: subItem.title })
|
|
840
|
+
}
|
|
841
|
+
) }) }, subItem.title)) }) })
|
|
842
|
+
] })
|
|
843
|
+
},
|
|
844
|
+
item.title
|
|
845
|
+
);
|
|
846
|
+
}
|
|
847
|
+
return /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(
|
|
848
|
+
SidebarMenuButton,
|
|
790
849
|
{
|
|
791
850
|
asChild: true,
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
children: /* @__PURE__ */ jsxs(
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
SidebarMenuButton,
|
|
815
|
-
{
|
|
816
|
-
asChild: true,
|
|
817
|
-
tooltip: item.title,
|
|
818
|
-
isActive,
|
|
819
|
-
children: /* @__PURE__ */ jsxs(Link, { href: item.url, children: [
|
|
820
|
-
item.icon && /* @__PURE__ */ jsx(item.icon, {}),
|
|
821
|
-
/* @__PURE__ */ jsx("span", { children: item.title })
|
|
822
|
-
] })
|
|
823
|
-
}
|
|
824
|
-
) }, item.title);
|
|
825
|
-
}) })
|
|
826
|
-
] }, groupIndex)) });
|
|
851
|
+
tooltip: item.title,
|
|
852
|
+
isActive,
|
|
853
|
+
children: /* @__PURE__ */ jsxs(
|
|
854
|
+
Link,
|
|
855
|
+
{
|
|
856
|
+
href: item.url,
|
|
857
|
+
onClick: () => {
|
|
858
|
+
if (isMobile) {
|
|
859
|
+
setOpenMobile(false);
|
|
860
|
+
}
|
|
861
|
+
},
|
|
862
|
+
children: [
|
|
863
|
+
item.icon && /* @__PURE__ */ jsx(item.icon, {}),
|
|
864
|
+
/* @__PURE__ */ jsx("span", { children: item.title })
|
|
865
|
+
]
|
|
866
|
+
}
|
|
867
|
+
)
|
|
868
|
+
}
|
|
869
|
+
) }, item.title);
|
|
870
|
+
}) })
|
|
871
|
+
] }, groupIndex);
|
|
872
|
+
}) });
|
|
827
873
|
}
|
|
828
874
|
function Avatar({
|
|
829
875
|
className,
|
|
@@ -1056,11 +1102,19 @@ function TeamSwitcher({
|
|
|
1056
1102
|
const isAppOrgRoute = pathname.startsWith("/app/") && pathSegments.length > 2 && pathSegments[2] !== "user";
|
|
1057
1103
|
const pathOrgId = isAppOrgRoute ? pathSegments[2] : null;
|
|
1058
1104
|
const currentOrgId = organizationId || (pathOrgId && teams.some((team) => team.id === pathOrgId) ? pathOrgId : null);
|
|
1059
|
-
const activeTeam = currentOrgId ? teams.find((team) => team.id === currentOrgId) : null;
|
|
1060
1105
|
const handleTeamChange = (teamId) => {
|
|
1106
|
+
if (isMobile && sidebar?.setOpenMobile) {
|
|
1107
|
+
sidebar.setOpenMobile(false);
|
|
1108
|
+
}
|
|
1061
1109
|
router.push(`/app/${teamId}/home`);
|
|
1062
1110
|
router.refresh();
|
|
1063
1111
|
};
|
|
1112
|
+
const handleManageOrganizations = () => {
|
|
1113
|
+
if (isMobile && sidebar?.setOpenMobile) {
|
|
1114
|
+
sidebar.setOpenMobile(false);
|
|
1115
|
+
}
|
|
1116
|
+
router.push("/app/user/organizations");
|
|
1117
|
+
};
|
|
1064
1118
|
const teamsWithLogo = teams.map((org) => {
|
|
1065
1119
|
const logoIcon = org.logo ? getIconComponent(org.logo) : GalleryVerticalEnd;
|
|
1066
1120
|
return {
|
|
@@ -1070,6 +1124,7 @@ function TeamSwitcher({
|
|
|
1070
1124
|
plan: org.plan || "Member"
|
|
1071
1125
|
};
|
|
1072
1126
|
});
|
|
1127
|
+
const activeTeamWithLogo = currentOrgId ? teamsWithLogo.find((team) => team.id === currentOrgId) : null;
|
|
1073
1128
|
if (teamsWithLogo.length === 0) {
|
|
1074
1129
|
return /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(SidebarMenuButton, { size: "lg", className: "cursor-default", children: [
|
|
1075
1130
|
/* @__PURE__ */ jsx("div", { className: "bg-muted flex aspect-square size-8 items-center justify-center rounded-lg", children: /* @__PURE__ */ jsx(GalleryVerticalEnd, { className: "size-4 text-muted-foreground" }) }),
|
|
@@ -1079,70 +1134,6 @@ function TeamSwitcher({
|
|
|
1079
1134
|
] })
|
|
1080
1135
|
] }) }) });
|
|
1081
1136
|
}
|
|
1082
|
-
if (!activeTeam) {
|
|
1083
|
-
return /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
1084
|
-
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
1085
|
-
SidebarMenuButton,
|
|
1086
|
-
{
|
|
1087
|
-
size: "lg",
|
|
1088
|
-
className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
|
|
1089
|
-
children: [
|
|
1090
|
-
/* @__PURE__ */ jsx("div", { className: "bg-muted flex aspect-square size-8 items-center justify-center rounded-lg", children: /* @__PURE__ */ jsx(GalleryVerticalEnd, { className: "size-4 text-muted-foreground" }) }),
|
|
1091
|
-
/* @__PURE__ */ jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
1092
|
-
/* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: "Organizations" }),
|
|
1093
|
-
/* @__PURE__ */ jsxs("span", { className: "truncate text-xs text-muted-foreground", children: [
|
|
1094
|
-
teamsWithLogo.length,
|
|
1095
|
-
" available"
|
|
1096
|
-
] })
|
|
1097
|
-
] }),
|
|
1098
|
-
/* @__PURE__ */ jsx(ChevronsUpDown, { className: "ml-auto" })
|
|
1099
|
-
]
|
|
1100
|
-
}
|
|
1101
|
-
) }),
|
|
1102
|
-
/* @__PURE__ */ jsxs(
|
|
1103
|
-
DropdownMenuContent,
|
|
1104
|
-
{
|
|
1105
|
-
className: "w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",
|
|
1106
|
-
align: "start",
|
|
1107
|
-
side: isMobile ? "bottom" : "right",
|
|
1108
|
-
sideOffset: 4,
|
|
1109
|
-
children: [
|
|
1110
|
-
/* @__PURE__ */ jsx(DropdownMenuLabel, { className: "text-muted-foreground text-xs", children: "Select an organization" }),
|
|
1111
|
-
teamsWithLogo.map((team) => /* @__PURE__ */ jsxs(
|
|
1112
|
-
DropdownMenuItem,
|
|
1113
|
-
{
|
|
1114
|
-
onClick: () => handleTeamChange(team.id),
|
|
1115
|
-
className: "gap-2 p-2",
|
|
1116
|
-
children: [
|
|
1117
|
-
/* @__PURE__ */ jsx("div", { className: "flex size-6 items-center justify-center rounded-md border", children: /* @__PURE__ */ jsx(team.logo, { className: "size-3.5 shrink-0" }) }),
|
|
1118
|
-
team.name
|
|
1119
|
-
]
|
|
1120
|
-
},
|
|
1121
|
-
team.id
|
|
1122
|
-
)),
|
|
1123
|
-
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
1124
|
-
/* @__PURE__ */ jsxs(
|
|
1125
|
-
DropdownMenuItem,
|
|
1126
|
-
{
|
|
1127
|
-
className: "gap-2 p-2",
|
|
1128
|
-
onClick: () => router.push("/app/user/organizations"),
|
|
1129
|
-
children: [
|
|
1130
|
-
/* @__PURE__ */ jsx("div", { className: "flex size-6 items-center justify-center rounded-md border bg-transparent", children: /* @__PURE__ */ jsx(GalleryVerticalEnd, { className: "size-4" }) }),
|
|
1131
|
-
/* @__PURE__ */ jsx("div", { className: "text-muted-foreground font-medium", children: "Manage organizations" })
|
|
1132
|
-
]
|
|
1133
|
-
}
|
|
1134
|
-
)
|
|
1135
|
-
]
|
|
1136
|
-
}
|
|
1137
|
-
)
|
|
1138
|
-
] }) }) });
|
|
1139
|
-
}
|
|
1140
|
-
const activeTeamWithLogo = teamsWithLogo.find(
|
|
1141
|
-
(team) => team.id === currentOrgId
|
|
1142
|
-
);
|
|
1143
|
-
if (!activeTeamWithLogo) {
|
|
1144
|
-
return null;
|
|
1145
|
-
}
|
|
1146
1137
|
return /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
1147
1138
|
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
1148
1139
|
SidebarMenuButton,
|
|
@@ -1150,10 +1141,18 @@ function TeamSwitcher({
|
|
|
1150
1141
|
size: "lg",
|
|
1151
1142
|
className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
|
|
1152
1143
|
children: [
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
/* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: activeTeamWithLogo.name })
|
|
1156
|
-
|
|
1144
|
+
activeTeamWithLogo ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1145
|
+
/* @__PURE__ */ jsx("div", { className: "bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg", children: /* @__PURE__ */ jsx(activeTeamWithLogo.logo, { className: "size-4" }) }),
|
|
1146
|
+
/* @__PURE__ */ jsx("div", { className: "grid flex-1 text-left text-sm leading-tight", children: /* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: activeTeamWithLogo.name }) })
|
|
1147
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1148
|
+
/* @__PURE__ */ jsx("div", { className: "bg-muted flex aspect-square size-8 items-center justify-center rounded-lg", children: /* @__PURE__ */ jsx(GalleryVerticalEnd, { className: "size-4 text-muted-foreground" }) }),
|
|
1149
|
+
/* @__PURE__ */ jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
1150
|
+
/* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: "Organizations" }),
|
|
1151
|
+
/* @__PURE__ */ jsxs("span", { className: "truncate text-xs text-muted-foreground", children: [
|
|
1152
|
+
teamsWithLogo.length,
|
|
1153
|
+
" available"
|
|
1154
|
+
] })
|
|
1155
|
+
] })
|
|
1157
1156
|
] }),
|
|
1158
1157
|
/* @__PURE__ */ jsx(ChevronsUpDown, { className: "ml-auto" })
|
|
1159
1158
|
]
|
|
@@ -1167,7 +1166,7 @@ function TeamSwitcher({
|
|
|
1167
1166
|
side: isMobile ? "bottom" : "right",
|
|
1168
1167
|
sideOffset: 4,
|
|
1169
1168
|
children: [
|
|
1170
|
-
/* @__PURE__ */ jsx(DropdownMenuLabel, { className: "text-muted-foreground text-xs", children: "Organizations" }),
|
|
1169
|
+
/* @__PURE__ */ jsx(DropdownMenuLabel, { className: "text-muted-foreground text-xs", children: activeTeamWithLogo ? "Organizations" : "Select an organization" }),
|
|
1171
1170
|
teamsWithLogo.map((team) => /* @__PURE__ */ jsxs(
|
|
1172
1171
|
DropdownMenuItem,
|
|
1173
1172
|
{
|
|
@@ -1186,7 +1185,7 @@ function TeamSwitcher({
|
|
|
1186
1185
|
DropdownMenuItem,
|
|
1187
1186
|
{
|
|
1188
1187
|
className: "gap-2 p-2",
|
|
1189
|
-
onClick:
|
|
1188
|
+
onClick: handleManageOrganizations,
|
|
1190
1189
|
children: [
|
|
1191
1190
|
/* @__PURE__ */ jsx("div", { className: "flex size-6 items-center justify-center rounded-md border bg-transparent", children: /* @__PURE__ */ jsx(GalleryVerticalEnd, { className: "size-4" }) }),
|
|
1192
1191
|
/* @__PURE__ */ jsx("div", { className: "text-muted-foreground font-medium", children: "Manage organizations" })
|
|
@@ -1214,16 +1213,12 @@ function useNavigation({
|
|
|
1214
1213
|
enabled,
|
|
1215
1214
|
organizationId,
|
|
1216
1215
|
apiBaseUrl,
|
|
1217
|
-
willFetch: enabled
|
|
1216
|
+
willFetch: enabled
|
|
1218
1217
|
});
|
|
1219
1218
|
}
|
|
1220
|
-
if (!enabled
|
|
1219
|
+
if (!enabled) {
|
|
1221
1220
|
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
1222
|
-
console.log("[useNavigation] Skipping fetch:"
|
|
1223
|
-
reason: !enabled ? "disabled" : "no organizationId",
|
|
1224
|
-
enabled,
|
|
1225
|
-
organizationId
|
|
1226
|
-
});
|
|
1221
|
+
console.log("[useNavigation] Skipping fetch: disabled");
|
|
1227
1222
|
}
|
|
1228
1223
|
setItems([]);
|
|
1229
1224
|
setOrganizations([]);
|
|
@@ -1231,7 +1226,7 @@ function useNavigation({
|
|
|
1231
1226
|
return;
|
|
1232
1227
|
}
|
|
1233
1228
|
const fetchNavigation = async () => {
|
|
1234
|
-
const url = `${apiBaseUrl}/navigation/${organizationId}`;
|
|
1229
|
+
const url = organizationId ? `${apiBaseUrl}/navigation/${organizationId}` : `${apiBaseUrl}/navigation`;
|
|
1235
1230
|
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
1236
1231
|
console.log("[useNavigation] Fetching navigation:", url);
|
|
1237
1232
|
}
|
|
@@ -1259,7 +1254,8 @@ function useNavigation({
|
|
|
1259
1254
|
console.log("[useNavigation] Navigation data received:", {
|
|
1260
1255
|
itemsCount: data.items?.length || 0,
|
|
1261
1256
|
organizationsCount: data.organizations?.length || 0,
|
|
1262
|
-
hasUser: !!data.user
|
|
1257
|
+
hasUser: !!data.user,
|
|
1258
|
+
organizationId: data.organizationId
|
|
1263
1259
|
});
|
|
1264
1260
|
}
|
|
1265
1261
|
setItems(data.items || []);
|
|
@@ -1411,6 +1407,22 @@ function AppSidebar({
|
|
|
1411
1407
|
/* @__PURE__ */ jsx(SidebarRail, {})
|
|
1412
1408
|
] });
|
|
1413
1409
|
}
|
|
1410
|
+
function AppHeader() {
|
|
1411
|
+
const { isMobile } = useSidebar();
|
|
1412
|
+
if (!isMobile) {
|
|
1413
|
+
return null;
|
|
1414
|
+
}
|
|
1415
|
+
return /* @__PURE__ */ jsxs("header", { className: "p-2 relative flex items-center justify-center", children: [
|
|
1416
|
+
/* @__PURE__ */ jsx(SidebarTrigger, { className: "absolute left-2" }),
|
|
1417
|
+
/* @__PURE__ */ jsx("span", { className: "font-sans text-xl", children: "Random Truffle" })
|
|
1418
|
+
] });
|
|
1419
|
+
}
|
|
1420
|
+
function SidebarContent2({ children }) {
|
|
1421
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1422
|
+
/* @__PURE__ */ jsx(AppHeader, {}),
|
|
1423
|
+
/* @__PURE__ */ jsx("main", { className: "px-4 py-2 md:py-4", children })
|
|
1424
|
+
] });
|
|
1425
|
+
}
|
|
1414
1426
|
function AppLayout({
|
|
1415
1427
|
user,
|
|
1416
1428
|
organizationId,
|
|
@@ -1426,10 +1438,7 @@ function AppLayout({
|
|
|
1426
1438
|
apiBaseUrl
|
|
1427
1439
|
}
|
|
1428
1440
|
),
|
|
1429
|
-
/* @__PURE__ */
|
|
1430
|
-
/* @__PURE__ */ jsx(SidebarTrigger, {}),
|
|
1431
|
-
children
|
|
1432
|
-
] })
|
|
1441
|
+
/* @__PURE__ */ jsx(SidebarInset, { children: /* @__PURE__ */ jsx(SidebarContent2, { children }) })
|
|
1433
1442
|
] });
|
|
1434
1443
|
}
|
|
1435
1444
|
|