@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
package/dist/next/components.cjs
CHANGED
|
@@ -445,14 +445,14 @@ function SidebarTrigger({
|
|
|
445
445
|
"data-slot": "sidebar-trigger",
|
|
446
446
|
variant: "ghost",
|
|
447
447
|
size: "icon",
|
|
448
|
-
className: cn("size-7"
|
|
448
|
+
className: cn(className, "size-7"),
|
|
449
449
|
onClick: (event) => {
|
|
450
450
|
onClick?.(event);
|
|
451
451
|
toggleSidebar();
|
|
452
452
|
},
|
|
453
453
|
...props,
|
|
454
454
|
children: [
|
|
455
|
-
/* @__PURE__ */ jsxRuntime.jsx(LucideIcons.
|
|
455
|
+
/* @__PURE__ */ jsxRuntime.jsx(LucideIcons.MenuIcon, {}),
|
|
456
456
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Toggle Sidebar" })
|
|
457
457
|
]
|
|
458
458
|
}
|
|
@@ -484,12 +484,11 @@ function SidebarRail({ className, ...props }) {
|
|
|
484
484
|
}
|
|
485
485
|
function SidebarInset({ className, ...props }) {
|
|
486
486
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
487
|
-
"
|
|
487
|
+
"div",
|
|
488
488
|
{
|
|
489
489
|
"data-slot": "sidebar-inset",
|
|
490
490
|
className: cn(
|
|
491
491
|
"bg-background relative flex w-full flex-1 flex-col",
|
|
492
|
-
"px-4",
|
|
493
492
|
"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",
|
|
494
493
|
className
|
|
495
494
|
),
|
|
@@ -757,6 +756,7 @@ function getIconComponent(icon) {
|
|
|
757
756
|
}
|
|
758
757
|
function NavMain({ items }) {
|
|
759
758
|
const pathname = navigation.usePathname();
|
|
759
|
+
const { isMobile, setOpenMobile } = useSidebar();
|
|
760
760
|
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
761
761
|
console.log("[NavMain] Received items:", {
|
|
762
762
|
itemsCount: items.length,
|
|
@@ -800,59 +800,105 @@ function NavMain({ items }) {
|
|
|
800
800
|
groupsCount: groups.length,
|
|
801
801
|
groups: groups.map((group) => ({
|
|
802
802
|
hasLabel: !!group.label,
|
|
803
|
+
labelTitle: group.label?.title,
|
|
803
804
|
itemsCount: group.items.length,
|
|
804
805
|
items: group.items.map((item) => item.title)
|
|
805
806
|
}))
|
|
806
807
|
});
|
|
808
|
+
const firstGroup = groups.length > 0 ? groups[0] : null;
|
|
809
|
+
console.log("[NavMain] Will render:", {
|
|
810
|
+
groupsLength: groups.length,
|
|
811
|
+
willRender: groups.length > 0,
|
|
812
|
+
firstGroupHasItems: firstGroup ? firstGroup.items.length > 0 : false,
|
|
813
|
+
firstGroupHasLabel: !!firstGroup?.label
|
|
814
|
+
});
|
|
807
815
|
}
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
816
|
+
if (groups.length === 0) {
|
|
817
|
+
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
818
|
+
console.warn("[NavMain] No groups to render, returning null");
|
|
819
|
+
}
|
|
820
|
+
return null;
|
|
821
|
+
}
|
|
822
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: groups.map((group, groupIndex) => {
|
|
823
|
+
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
824
|
+
console.log(`[NavMain] Rendering group ${groupIndex}:`, {
|
|
825
|
+
hasLabel: !!group.label,
|
|
826
|
+
itemsCount: group.items.length,
|
|
827
|
+
willRenderLabel: !!group.label,
|
|
828
|
+
willRenderItems: group.items.length > 0
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(SidebarGroup, { children: [
|
|
832
|
+
group.label && /* @__PURE__ */ jsxRuntime.jsxs(SidebarGroupLabel, { children: [
|
|
833
|
+
group.label.icon && /* @__PURE__ */ jsxRuntime.jsx(group.label.icon, { className: "mr-2" }),
|
|
834
|
+
group.label.title
|
|
835
|
+
] }),
|
|
836
|
+
group.items.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(SidebarMenu, { children: group.items.map((item) => {
|
|
837
|
+
const isActive = pathname === item.url || item.isActive;
|
|
838
|
+
const hasSubItems = item.items && item.items.length > 0;
|
|
839
|
+
if (hasSubItems) {
|
|
840
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
841
|
+
Collapsible,
|
|
842
|
+
{
|
|
843
|
+
asChild: true,
|
|
844
|
+
defaultOpen: isActive,
|
|
845
|
+
className: "group/collapsible",
|
|
846
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(SidebarMenuItem, { children: [
|
|
847
|
+
/* @__PURE__ */ jsxRuntime.jsx(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
848
|
+
SidebarMenuButton,
|
|
849
|
+
{
|
|
850
|
+
tooltip: item.title,
|
|
851
|
+
isActive,
|
|
852
|
+
children: [
|
|
853
|
+
item.icon && /* @__PURE__ */ jsxRuntime.jsx(item.icon, {}),
|
|
854
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: item.title }),
|
|
855
|
+
/* @__PURE__ */ jsxRuntime.jsx(LucideIcons.ChevronRight, { className: "ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" })
|
|
856
|
+
]
|
|
857
|
+
}
|
|
858
|
+
) }),
|
|
859
|
+
/* @__PURE__ */ jsxRuntime.jsx(CollapsibleContent2, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSub, { children: item.items?.map((subItem) => /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubButton, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
860
|
+
Link__default.default,
|
|
861
|
+
{
|
|
862
|
+
href: subItem.url,
|
|
863
|
+
onClick: () => {
|
|
864
|
+
if (isMobile) {
|
|
865
|
+
setOpenMobile(false);
|
|
866
|
+
}
|
|
867
|
+
},
|
|
868
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: subItem.title })
|
|
869
|
+
}
|
|
870
|
+
) }) }, subItem.title)) }) })
|
|
871
|
+
] })
|
|
872
|
+
},
|
|
873
|
+
item.title
|
|
874
|
+
);
|
|
875
|
+
}
|
|
876
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
877
|
+
SidebarMenuButton,
|
|
819
878
|
{
|
|
820
879
|
asChild: true,
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
SidebarMenuButton,
|
|
844
|
-
{
|
|
845
|
-
asChild: true,
|
|
846
|
-
tooltip: item.title,
|
|
847
|
-
isActive,
|
|
848
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(Link__default.default, { href: item.url, children: [
|
|
849
|
-
item.icon && /* @__PURE__ */ jsxRuntime.jsx(item.icon, {}),
|
|
850
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: item.title })
|
|
851
|
-
] })
|
|
852
|
-
}
|
|
853
|
-
) }, item.title);
|
|
854
|
-
}) })
|
|
855
|
-
] }, groupIndex)) });
|
|
880
|
+
tooltip: item.title,
|
|
881
|
+
isActive,
|
|
882
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
883
|
+
Link__default.default,
|
|
884
|
+
{
|
|
885
|
+
href: item.url,
|
|
886
|
+
onClick: () => {
|
|
887
|
+
if (isMobile) {
|
|
888
|
+
setOpenMobile(false);
|
|
889
|
+
}
|
|
890
|
+
},
|
|
891
|
+
children: [
|
|
892
|
+
item.icon && /* @__PURE__ */ jsxRuntime.jsx(item.icon, {}),
|
|
893
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: item.title })
|
|
894
|
+
]
|
|
895
|
+
}
|
|
896
|
+
)
|
|
897
|
+
}
|
|
898
|
+
) }, item.title);
|
|
899
|
+
}) })
|
|
900
|
+
] }, groupIndex);
|
|
901
|
+
}) });
|
|
856
902
|
}
|
|
857
903
|
function Avatar({
|
|
858
904
|
className,
|
|
@@ -1085,11 +1131,19 @@ function TeamSwitcher({
|
|
|
1085
1131
|
const isAppOrgRoute = pathname.startsWith("/app/") && pathSegments.length > 2 && pathSegments[2] !== "user";
|
|
1086
1132
|
const pathOrgId = isAppOrgRoute ? pathSegments[2] : null;
|
|
1087
1133
|
const currentOrgId = organizationId || (pathOrgId && teams.some((team) => team.id === pathOrgId) ? pathOrgId : null);
|
|
1088
|
-
const activeTeam = currentOrgId ? teams.find((team) => team.id === currentOrgId) : null;
|
|
1089
1134
|
const handleTeamChange = (teamId) => {
|
|
1135
|
+
if (isMobile && sidebar?.setOpenMobile) {
|
|
1136
|
+
sidebar.setOpenMobile(false);
|
|
1137
|
+
}
|
|
1090
1138
|
router.push(`/app/${teamId}/home`);
|
|
1091
1139
|
router.refresh();
|
|
1092
1140
|
};
|
|
1141
|
+
const handleManageOrganizations = () => {
|
|
1142
|
+
if (isMobile && sidebar?.setOpenMobile) {
|
|
1143
|
+
sidebar.setOpenMobile(false);
|
|
1144
|
+
}
|
|
1145
|
+
router.push("/app/user/organizations");
|
|
1146
|
+
};
|
|
1093
1147
|
const teamsWithLogo = teams.map((org) => {
|
|
1094
1148
|
const logoIcon = org.logo ? getIconComponent(org.logo) : LucideIcons.GalleryVerticalEnd;
|
|
1095
1149
|
return {
|
|
@@ -1099,6 +1153,7 @@ function TeamSwitcher({
|
|
|
1099
1153
|
plan: org.plan || "Member"
|
|
1100
1154
|
};
|
|
1101
1155
|
});
|
|
1156
|
+
const activeTeamWithLogo = currentOrgId ? teamsWithLogo.find((team) => team.id === currentOrgId) : null;
|
|
1102
1157
|
if (teamsWithLogo.length === 0) {
|
|
1103
1158
|
return /* @__PURE__ */ jsxRuntime.jsx(SidebarMenu, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsxs(SidebarMenuButton, { size: "lg", className: "cursor-default", children: [
|
|
1104
1159
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-muted flex aspect-square size-8 items-center justify-center rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsx(LucideIcons.GalleryVerticalEnd, { className: "size-4 text-muted-foreground" }) }),
|
|
@@ -1108,70 +1163,6 @@ function TeamSwitcher({
|
|
|
1108
1163
|
] })
|
|
1109
1164
|
] }) }) });
|
|
1110
1165
|
}
|
|
1111
|
-
if (!activeTeam) {
|
|
1112
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SidebarMenu, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
|
|
1113
|
-
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1114
|
-
SidebarMenuButton,
|
|
1115
|
-
{
|
|
1116
|
-
size: "lg",
|
|
1117
|
-
className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
|
|
1118
|
-
children: [
|
|
1119
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-muted flex aspect-square size-8 items-center justify-center rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsx(LucideIcons.GalleryVerticalEnd, { className: "size-4 text-muted-foreground" }) }),
|
|
1120
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
1121
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium", children: "Organizations" }),
|
|
1122
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "truncate text-xs text-muted-foreground", children: [
|
|
1123
|
-
teamsWithLogo.length,
|
|
1124
|
-
" available"
|
|
1125
|
-
] })
|
|
1126
|
-
] }),
|
|
1127
|
-
/* @__PURE__ */ jsxRuntime.jsx(LucideIcons.ChevronsUpDown, { className: "ml-auto" })
|
|
1128
|
-
]
|
|
1129
|
-
}
|
|
1130
|
-
) }),
|
|
1131
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1132
|
-
DropdownMenuContent,
|
|
1133
|
-
{
|
|
1134
|
-
className: "w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",
|
|
1135
|
-
align: "start",
|
|
1136
|
-
side: isMobile ? "bottom" : "right",
|
|
1137
|
-
sideOffset: 4,
|
|
1138
|
-
children: [
|
|
1139
|
-
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuLabel, { className: "text-muted-foreground text-xs", children: "Select an organization" }),
|
|
1140
|
-
teamsWithLogo.map((team) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1141
|
-
DropdownMenuItem,
|
|
1142
|
-
{
|
|
1143
|
-
onClick: () => handleTeamChange(team.id),
|
|
1144
|
-
className: "gap-2 p-2",
|
|
1145
|
-
children: [
|
|
1146
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-6 items-center justify-center rounded-md border", children: /* @__PURE__ */ jsxRuntime.jsx(team.logo, { className: "size-3.5 shrink-0" }) }),
|
|
1147
|
-
team.name
|
|
1148
|
-
]
|
|
1149
|
-
},
|
|
1150
|
-
team.id
|
|
1151
|
-
)),
|
|
1152
|
-
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
|
|
1153
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1154
|
-
DropdownMenuItem,
|
|
1155
|
-
{
|
|
1156
|
-
className: "gap-2 p-2",
|
|
1157
|
-
onClick: () => router.push("/app/user/organizations"),
|
|
1158
|
-
children: [
|
|
1159
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-6 items-center justify-center rounded-md border bg-transparent", children: /* @__PURE__ */ jsxRuntime.jsx(LucideIcons.GalleryVerticalEnd, { className: "size-4" }) }),
|
|
1160
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground font-medium", children: "Manage organizations" })
|
|
1161
|
-
]
|
|
1162
|
-
}
|
|
1163
|
-
)
|
|
1164
|
-
]
|
|
1165
|
-
}
|
|
1166
|
-
)
|
|
1167
|
-
] }) }) });
|
|
1168
|
-
}
|
|
1169
|
-
const activeTeamWithLogo = teamsWithLogo.find(
|
|
1170
|
-
(team) => team.id === currentOrgId
|
|
1171
|
-
);
|
|
1172
|
-
if (!activeTeamWithLogo) {
|
|
1173
|
-
return null;
|
|
1174
|
-
}
|
|
1175
1166
|
return /* @__PURE__ */ jsxRuntime.jsx(SidebarMenu, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
|
|
1176
1167
|
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1177
1168
|
SidebarMenuButton,
|
|
@@ -1179,10 +1170,18 @@ function TeamSwitcher({
|
|
|
1179
1170
|
size: "lg",
|
|
1180
1171
|
className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
|
|
1181
1172
|
children: [
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium", children: activeTeamWithLogo.name })
|
|
1185
|
-
|
|
1173
|
+
activeTeamWithLogo ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1174
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsx(activeTeamWithLogo.logo, { className: "size-4" }) }),
|
|
1175
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid flex-1 text-left text-sm leading-tight", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium", children: activeTeamWithLogo.name }) })
|
|
1176
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1177
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-muted flex aspect-square size-8 items-center justify-center rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsx(LucideIcons.GalleryVerticalEnd, { className: "size-4 text-muted-foreground" }) }),
|
|
1178
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
1179
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium", children: "Organizations" }),
|
|
1180
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "truncate text-xs text-muted-foreground", children: [
|
|
1181
|
+
teamsWithLogo.length,
|
|
1182
|
+
" available"
|
|
1183
|
+
] })
|
|
1184
|
+
] })
|
|
1186
1185
|
] }),
|
|
1187
1186
|
/* @__PURE__ */ jsxRuntime.jsx(LucideIcons.ChevronsUpDown, { className: "ml-auto" })
|
|
1188
1187
|
]
|
|
@@ -1196,7 +1195,7 @@ function TeamSwitcher({
|
|
|
1196
1195
|
side: isMobile ? "bottom" : "right",
|
|
1197
1196
|
sideOffset: 4,
|
|
1198
1197
|
children: [
|
|
1199
|
-
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuLabel, { className: "text-muted-foreground text-xs", children: "Organizations" }),
|
|
1198
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuLabel, { className: "text-muted-foreground text-xs", children: activeTeamWithLogo ? "Organizations" : "Select an organization" }),
|
|
1200
1199
|
teamsWithLogo.map((team) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1201
1200
|
DropdownMenuItem,
|
|
1202
1201
|
{
|
|
@@ -1215,7 +1214,7 @@ function TeamSwitcher({
|
|
|
1215
1214
|
DropdownMenuItem,
|
|
1216
1215
|
{
|
|
1217
1216
|
className: "gap-2 p-2",
|
|
1218
|
-
onClick:
|
|
1217
|
+
onClick: handleManageOrganizations,
|
|
1219
1218
|
children: [
|
|
1220
1219
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-6 items-center justify-center rounded-md border bg-transparent", children: /* @__PURE__ */ jsxRuntime.jsx(LucideIcons.GalleryVerticalEnd, { className: "size-4" }) }),
|
|
1221
1220
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground font-medium", children: "Manage organizations" })
|
|
@@ -1243,16 +1242,12 @@ function useNavigation({
|
|
|
1243
1242
|
enabled,
|
|
1244
1243
|
organizationId,
|
|
1245
1244
|
apiBaseUrl,
|
|
1246
|
-
willFetch: enabled
|
|
1245
|
+
willFetch: enabled
|
|
1247
1246
|
});
|
|
1248
1247
|
}
|
|
1249
|
-
if (!enabled
|
|
1248
|
+
if (!enabled) {
|
|
1250
1249
|
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
1251
|
-
console.log("[useNavigation] Skipping fetch:"
|
|
1252
|
-
reason: !enabled ? "disabled" : "no organizationId",
|
|
1253
|
-
enabled,
|
|
1254
|
-
organizationId
|
|
1255
|
-
});
|
|
1250
|
+
console.log("[useNavigation] Skipping fetch: disabled");
|
|
1256
1251
|
}
|
|
1257
1252
|
setItems([]);
|
|
1258
1253
|
setOrganizations([]);
|
|
@@ -1260,7 +1255,7 @@ function useNavigation({
|
|
|
1260
1255
|
return;
|
|
1261
1256
|
}
|
|
1262
1257
|
const fetchNavigation = async () => {
|
|
1263
|
-
const url = `${apiBaseUrl}/navigation/${organizationId}`;
|
|
1258
|
+
const url = organizationId ? `${apiBaseUrl}/navigation/${organizationId}` : `${apiBaseUrl}/navigation`;
|
|
1264
1259
|
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
1265
1260
|
console.log("[useNavigation] Fetching navigation:", url);
|
|
1266
1261
|
}
|
|
@@ -1288,7 +1283,8 @@ function useNavigation({
|
|
|
1288
1283
|
console.log("[useNavigation] Navigation data received:", {
|
|
1289
1284
|
itemsCount: data.items?.length || 0,
|
|
1290
1285
|
organizationsCount: data.organizations?.length || 0,
|
|
1291
|
-
hasUser: !!data.user
|
|
1286
|
+
hasUser: !!data.user,
|
|
1287
|
+
organizationId: data.organizationId
|
|
1292
1288
|
});
|
|
1293
1289
|
}
|
|
1294
1290
|
setItems(data.items || []);
|
|
@@ -1440,6 +1436,22 @@ function AppSidebar({
|
|
|
1440
1436
|
/* @__PURE__ */ jsxRuntime.jsx(SidebarRail, {})
|
|
1441
1437
|
] });
|
|
1442
1438
|
}
|
|
1439
|
+
function AppHeader() {
|
|
1440
|
+
const { isMobile } = useSidebar();
|
|
1441
|
+
if (!isMobile) {
|
|
1442
|
+
return null;
|
|
1443
|
+
}
|
|
1444
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "p-2 relative flex items-center justify-center", children: [
|
|
1445
|
+
/* @__PURE__ */ jsxRuntime.jsx(SidebarTrigger, { className: "absolute left-2" }),
|
|
1446
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-sans text-xl", children: "Random Truffle" })
|
|
1447
|
+
] });
|
|
1448
|
+
}
|
|
1449
|
+
function SidebarContent2({ children }) {
|
|
1450
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1451
|
+
/* @__PURE__ */ jsxRuntime.jsx(AppHeader, {}),
|
|
1452
|
+
/* @__PURE__ */ jsxRuntime.jsx("main", { className: "px-4 py-2 md:py-4", children })
|
|
1453
|
+
] });
|
|
1454
|
+
}
|
|
1443
1455
|
function AppLayout({
|
|
1444
1456
|
user,
|
|
1445
1457
|
organizationId,
|
|
@@ -1455,10 +1467,7 @@ function AppLayout({
|
|
|
1455
1467
|
apiBaseUrl
|
|
1456
1468
|
}
|
|
1457
1469
|
),
|
|
1458
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1459
|
-
/* @__PURE__ */ jsxRuntime.jsx(SidebarTrigger, {}),
|
|
1460
|
-
children
|
|
1461
|
-
] })
|
|
1470
|
+
/* @__PURE__ */ jsxRuntime.jsx(SidebarInset, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarContent2, { children }) })
|
|
1462
1471
|
] });
|
|
1463
1472
|
}
|
|
1464
1473
|
|