@collabdt/core 0.4.3 → 0.4.4
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/core/components/ui/AppSidebar.js +1 -1
- package/dist/core/components/ui/AppSidebar.js.map +1 -1
- package/dist/core/components/ui/InfoSidebar/Header.d.ts.map +1 -1
- package/dist/core/components/ui/InfoSidebar/Header.js +12 -5
- package/dist/core/components/ui/InfoSidebar/Header.js.map +1 -1
- package/dist/core/components/ui/Sidebar.d.ts.map +1 -1
- package/dist/core/components/ui/Sidebar.js +9 -3
- package/dist/core/components/ui/Sidebar.js.map +1 -1
- package/dist/core/components/viewers/pointcloud/PointCloudViewer.d.ts.map +1 -1
- package/dist/core/components/viewers/pointcloud/PointCloudViewer.js +19 -3
- package/dist/core/components/viewers/pointcloud/PointCloudViewer.js.map +1 -1
- package/dist/core/hooks/ui/useResizableSidebarWidth.d.ts +3 -3
- package/dist/core/hooks/ui/useResizableSidebarWidth.d.ts.map +1 -1
- package/dist/core/hooks/ui/useResizableSidebarWidth.js.map +1 -1
- package/package.json +1 -1
|
@@ -49,7 +49,7 @@ function AppSidebar({ children, signOut }) {
|
|
|
49
49
|
"button",
|
|
50
50
|
{
|
|
51
51
|
onClick: toggleMenuSidebar,
|
|
52
|
-
className: "text-muted-foreground hover:text-primary px-2 py-1.5 rounded-r-
|
|
52
|
+
className: "text-muted-foreground hover:text-primary px-2 py-1.5 rounded-r-sm bg-sidebar",
|
|
53
53
|
style: {
|
|
54
54
|
border: "1px solid rgba(128,128,128,0.2)",
|
|
55
55
|
borderLeft: "none",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/components/ui/AppSidebar.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\n\r\n// Dependencies\r\n\r\n// Icons\r\nimport * as LR from 'lucide-react'\r\nimport Link from 'next/link'\r\nimport { useSession } from 'next-auth/react'\r\nimport { useTranslations } from 'next-intl'\r\nimport * as React from 'react'\r\n\r\n\r\nimport { useMenusContext } from '../../store'\r\nimport { ViewerNames } from '../../types'\r\nimport { BugReportDialog } from '../support/BugReportDialog'\r\nimport { FeatureRequestDialog } from '../support/FeatureRequestDialog'\r\n\r\nimport { Button } from './Button'\r\nimport { CdtIcon } from './Icons/CdtIcon'\r\n\r\nimport { Sidebar, useSidebar, NavUser } from './'\r\n\r\nexport const handleChangeViewer = (\r\n viewer: ViewerNames,\r\n setSelectedItem: React.Dispatch<React.SetStateAction<any>>,\r\n setSelectedSite: React.Dispatch<React.SetStateAction<any>>,\r\n setSelectedFile: React.Dispatch<React.SetStateAction<any>>,\r\n setView: React.Dispatch<React.SetStateAction<'table' | 'detail'>>,\r\n menusDispatch: any,\r\n) => {\r\n // Reset selected item, file, & view when changing viewer\r\n setSelectedItem(null)\r\n setSelectedSite(null)\r\n setSelectedFile(null)\r\n setView('table')\r\n\r\n menusDispatch({\r\n type: 'SET_VIEWER',\r\n payload: { currentViewer: viewer },\r\n })\r\n}\r\n\r\ninterface AppSidebarProps {\r\n children?: React.ReactNode\r\n signOut: (options?: { redirectTo?: string; redirect?: boolean }) => Promise<void>\r\n}\r\n\r\nexport function AppSidebar({ children, signOut }: AppSidebarProps) {\r\n // Translations\r\n const t = useTranslations('AppSidebar')\r\n\r\n const { state: menusState } = useMenusContext()\r\n const { data: session } = useSession()\r\n\r\n const {\r\n sidebarState, isMobile, openMobile, toggleMenuSidebar,\r\n bugReportOpen, setBugReportOpen, featureRequestOpen, setFeatureRequestOpen,\r\n } = useSidebar()\r\n\r\n const { currentViewer } = menusState.menus\r\n\r\n // On mobile, treat the sheet open as expanded so labels render when the drawer is visible\r\n const isCollapsed = isMobile ? !openMobile : sidebarState === 'collapsed'\r\n\r\n // Determine the collapsible type based on the current viewer\r\n const collapsibleType = currentViewer === ViewerNames.auth ? 'offcanvas' : 'icon'\r\n\r\n return (\r\n <>\r\n {/* Always show toggle button on mobile when collapsed */}\r\n {isMobile && isCollapsed && (\r\n <div\r\n id=\"sidebar-toggle-button-mobile\"\r\n className=\"fixed left-0 bottom-[10px] z-[100] flex items-center justify-center pointer-events-auto\"\r\n >\r\n <button\r\n onClick={toggleMenuSidebar}\r\n className=\"text-muted-foreground hover:text-primary px-2 py-1.5 rounded-r-
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/components/ui/AppSidebar.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\n\r\n// Dependencies\r\n\r\n// Icons\r\nimport * as LR from 'lucide-react'\r\nimport Link from 'next/link'\r\nimport { useSession } from 'next-auth/react'\r\nimport { useTranslations } from 'next-intl'\r\nimport * as React from 'react'\r\n\r\n\r\nimport { useMenusContext } from '../../store'\r\nimport { ViewerNames } from '../../types'\r\nimport { BugReportDialog } from '../support/BugReportDialog'\r\nimport { FeatureRequestDialog } from '../support/FeatureRequestDialog'\r\n\r\nimport { Button } from './Button'\r\nimport { CdtIcon } from './Icons/CdtIcon'\r\n\r\nimport { Sidebar, useSidebar, NavUser } from './'\r\n\r\nexport const handleChangeViewer = (\r\n viewer: ViewerNames,\r\n setSelectedItem: React.Dispatch<React.SetStateAction<any>>,\r\n setSelectedSite: React.Dispatch<React.SetStateAction<any>>,\r\n setSelectedFile: React.Dispatch<React.SetStateAction<any>>,\r\n setView: React.Dispatch<React.SetStateAction<'table' | 'detail'>>,\r\n menusDispatch: any,\r\n) => {\r\n // Reset selected item, file, & view when changing viewer\r\n setSelectedItem(null)\r\n setSelectedSite(null)\r\n setSelectedFile(null)\r\n setView('table')\r\n\r\n menusDispatch({\r\n type: 'SET_VIEWER',\r\n payload: { currentViewer: viewer },\r\n })\r\n}\r\n\r\ninterface AppSidebarProps {\r\n children?: React.ReactNode\r\n signOut: (options?: { redirectTo?: string; redirect?: boolean }) => Promise<void>\r\n}\r\n\r\nexport function AppSidebar({ children, signOut }: AppSidebarProps) {\r\n // Translations\r\n const t = useTranslations('AppSidebar')\r\n\r\n const { state: menusState } = useMenusContext()\r\n const { data: session } = useSession()\r\n\r\n const {\r\n sidebarState, isMobile, openMobile, toggleMenuSidebar,\r\n bugReportOpen, setBugReportOpen, featureRequestOpen, setFeatureRequestOpen,\r\n } = useSidebar()\r\n\r\n const { currentViewer } = menusState.menus\r\n\r\n // On mobile, treat the sheet open as expanded so labels render when the drawer is visible\r\n const isCollapsed = isMobile ? !openMobile : sidebarState === 'collapsed'\r\n\r\n // Determine the collapsible type based on the current viewer\r\n const collapsibleType = currentViewer === ViewerNames.auth ? 'offcanvas' : 'icon'\r\n\r\n return (\r\n <>\r\n {/* Always show toggle button on mobile when collapsed */}\r\n {isMobile && isCollapsed && (\r\n <div\r\n id=\"sidebar-toggle-button-mobile\"\r\n className=\"fixed left-0 bottom-[10px] z-[100] flex items-center justify-center pointer-events-auto\"\r\n >\r\n <button\r\n onClick={toggleMenuSidebar}\r\n className=\"text-muted-foreground hover:text-primary px-2 py-1.5 rounded-r-sm bg-sidebar\"\r\n style={{\r\n border: '1px solid rgba(128,128,128,0.2)',\r\n borderLeft: 'none',\r\n boxShadow: '4px 0 8px -4px rgba(0,0,0,0.12)',\r\n }}\r\n >\r\n <LR.ChevronRight className=\"w-6 h-6\" />\r\n </button>\r\n </div>\r\n )}\r\n <Sidebar collapsible={collapsibleType} className=\"border-none z-50 shadow-md relative\" >\r\n {/* Sidebar toggle button - right side inside Sidebar */}\r\n {(sidebarState === 'expanded') && (\r\n <div id='sidebar-toggle-button' className='absolute right-2 top-2 flex items-center justify-center pointer-events-auto z-50'>\r\n <button onClick={toggleMenuSidebar} className='text-muted-foreground hover:text-primary p-1'>\r\n <LR.X className='w-5' />\r\n </button>\r\n </div>\r\n )}\r\n {/* Show collapsed toggle only on desktop */}\r\n {!isMobile && sidebarState !== 'expanded' && (\r\n <div id='sidebar-toggle-button' className='absolute -right-1 max-h-1 top-1/2 -translate-y-1/2 flex items-center justify-center pointer-events-auto z-50'>\r\n <button\r\n onClick={toggleMenuSidebar}\r\n className=\"text-muted-foreground hover:text-primary p-0 rounded-md bg-sidebar\"\r\n style={{ borderRight: '1px solid rgba(128,128,128,0.2)', boxShadow: '4px 0 8px -4px rgba(0,0,0,0.12)' }}\r\n >\r\n <LR.ChevronRight className=\"w-4\" />\r\n </button>\r\n </div>\r\n )}\r\n {children}\r\n <div\r\n className={`w-full flex flex-col ${\r\n sidebarState === 'expanded'\r\n ? 'items-center justify-center'\r\n : 'justify-center pb-4'\r\n }`}\r\n >\r\n {/* Nav User */}\r\n <NavUser signOut={signOut} />\r\n\r\n {!isCollapsed ? (\r\n <Link\r\n href=\"https://collabdt.org/\"\r\n target=\"_blank\"\r\n rel=\"noopener noreferrer\"\r\n className=\"w-full\"\r\n >\r\n <Button\r\n title={t('home')}\r\n variant=\"ghost\"\r\n className=\"text-xs scale-[85%] py-0 my-0 w-full flex flex-row items-center justify-center gap-2\"\r\n >\r\n <CdtIcon monochromatic />\r\n <span>{t('home')}</span>\r\n </Button>\r\n </Link>\r\n ) : null}\r\n </div>\r\n </Sidebar>\r\n\r\n {/* Rendered outside <Sidebar> (and its mobile Sheet) so they survive the\r\n Sheet closing — see the SidebarContext comment for why. */}\r\n <BugReportDialog\r\n open={bugReportOpen}\r\n onOpenChange={setBugReportOpen}\r\n userEmail={session?.user?.email ?? undefined}\r\n viewer={currentViewer}\r\n />\r\n <FeatureRequestDialog\r\n open={featureRequestOpen}\r\n onOpenChange={setFeatureRequestOpen}\r\n userEmail={session?.user?.email ?? undefined}\r\n viewer={currentViewer}\r\n />\r\n </>\r\n )\r\n}"],"mappings":";AAwEI,mBAgBQ,KA2CI,YA3DZ;AA/DJ,YAAY,QAAQ;AACpB,OAAO,UAAU;AACjB,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAIhC,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC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ui/InfoSidebar/Header.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../../../src/core/components/ui/InfoSidebar/Header.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAGpE,UAAU,WAAW;IACnB,eAAe,EAAE,QAAQ,GAAG,IAAI,CAAA;IAChC,mBAAmB,EAAE,OAAO,CAAA;IAC5B,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B;AAED,wBAAgB,MAAM,CAAC,EACrB,eAAe,EACf,mBAAmB,EACnB,YAAY,GACb,EAAE,WAAW,qBAkEb"}
|
|
@@ -4,6 +4,7 @@ import * as LR from "lucide-react";
|
|
|
4
4
|
import { useTranslations } from "next-intl";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { MapContext } from "../../../store";
|
|
7
|
+
import { cn } from "../../../utils/utils";
|
|
7
8
|
import { Button } from "../Button";
|
|
8
9
|
import { LoadingSpinner } from "../LoadingSpinner";
|
|
9
10
|
import { useSidebar } from "../Sidebar";
|
|
@@ -12,7 +13,7 @@ function Header({
|
|
|
12
13
|
loadingBuildingInfo,
|
|
13
14
|
organization
|
|
14
15
|
}) {
|
|
15
|
-
var _a;
|
|
16
|
+
var _a, _b;
|
|
16
17
|
const t = useTranslations("SidebarHeader");
|
|
17
18
|
const { setOpenInfo } = useSidebar();
|
|
18
19
|
const { state: mapState } = React.useContext(MapContext);
|
|
@@ -26,18 +27,24 @@ function Header({
|
|
|
26
27
|
};
|
|
27
28
|
const { currentLocation } = mapState.map;
|
|
28
29
|
return /* @__PURE__ */ jsx("div", { className: "p-4", children: /* @__PURE__ */ jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 w-full justify-between", children: [
|
|
29
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-1 flex justify-center", children: loadingBuildingInfo ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
30
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-1 flex justify-center min-w-0 flex-1", children: loadingBuildingInfo ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 min-w-0", children: [
|
|
30
31
|
/* @__PURE__ */ jsx(LoadingSpinner, {}),
|
|
31
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-muted-foreground", children: t("loadingText") })
|
|
32
|
-
] }) : /* @__PURE__ */ jsx("h2", { className: "text-sm font-semibold text-foreground", children: (currentBuilding == null ? void 0 : currentBuilding.buildingName) || ((currentLocation == null ? void 0 : currentLocation.municipality) ? (currentLocation == null ? void 0 : currentLocation.countrySubdivision) ? `${currentLocation.municipality}, ${formatSubdivision(currentLocation.countrySubdivision)}` : currentLocation.municipality : formatSubdivision(currentLocation == null ? void 0 : currentLocation.countrySubdivision) || countryName) }) }),
|
|
32
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-muted-foreground truncate", children: t("loadingText") })
|
|
33
|
+
] }) : /* @__PURE__ */ jsx("h2", { className: "text-sm font-semibold text-foreground truncate", title: (_b = currentBuilding == null ? void 0 : currentBuilding.buildingName) != null ? _b : void 0, children: (currentBuilding == null ? void 0 : currentBuilding.buildingName) || ((currentLocation == null ? void 0 : currentLocation.municipality) ? (currentLocation == null ? void 0 : currentLocation.countrySubdivision) ? `${currentLocation.municipality}, ${formatSubdivision(currentLocation.countrySubdivision)}` : currentLocation.municipality : formatSubdivision(currentLocation == null ? void 0 : currentLocation.countrySubdivision) || countryName) }) }),
|
|
33
34
|
/* @__PURE__ */ jsx(
|
|
34
35
|
Button,
|
|
35
36
|
{
|
|
37
|
+
type: "button",
|
|
36
38
|
variant: "ghost",
|
|
37
39
|
size: "icon",
|
|
38
|
-
className:
|
|
40
|
+
className: cn(
|
|
41
|
+
"group/sidebar-trigger relative shrink-0 z-10 opacity-70 hover:opacity-100 transition-opacity duration-200 hover:bg-transparent",
|
|
42
|
+
// Widen the tap target on touch viewports (36px button -> 52px hit area).
|
|
43
|
+
"after:absolute after:-inset-2 after:md:hidden"
|
|
44
|
+
),
|
|
39
45
|
onClick: () => setOpenInfo(false),
|
|
40
46
|
title: t("closeInfoToggle"),
|
|
47
|
+
"aria-label": t("closeInfoToggle"),
|
|
41
48
|
children: /* @__PURE__ */ jsx(LR.PanelLeftClose, { className: "h-4 w-4" })
|
|
42
49
|
}
|
|
43
50
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/core/components/ui/InfoSidebar/Header.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as LR from 'lucide-react'\r\nimport { useTranslations } from 'next-intl'\r\nimport * as React from 'react'\r\n\r\nimport { MapContext } from '../../../store'\r\nimport { Button } from '../Button'\r\nimport { LoadingSpinner } from '../LoadingSpinner'\r\nimport { useSidebar } from '../Sidebar'\r\n\r\nimport type { Building, Organization } from '../../../types/dbTypes'\r\n\r\n\r\ninterface HeaderProps {\r\n currentBuilding: Building | null\r\n loadingBuildingInfo: boolean\r\n organization?: Organization\r\n}\r\n\r\nexport function Header({\r\n currentBuilding,\r\n loadingBuildingInfo,\r\n organization,\r\n}: HeaderProps) {\r\n // Translation\r\n const t = useTranslations('SidebarHeader')\r\n const { setOpenInfo } = useSidebar()\r\n const { state: mapState } = React.useContext(MapContext)\r\n const countryCode = organization?.country\r\n const countryName = countryCode\r\n ? (new Intl.DisplayNames(['en'], { type: 'region' }).of(countryCode.toUpperCase()) ?? countryCode)\r\n : ''\r\n\r\n // Strip country prefix from ISO 3166-2 codes: \"CA-ON\" → \"ON\", \"CA_ON\" → \"ON\", \"CAON\" → \"ON\"\r\n const formatSubdivision = (code: string | null | undefined): string => {\r\n if (!code) return ''\r\n const normalized = code.replace('_', '-')\r\n const withDash = normalized.includes('-') ? normalized : `${normalized.slice(0, 2)}-${normalized.slice(2)}`\r\n return withDash.split('-').slice(1).join('-')\r\n }\r\n const { currentLocation } = mapState.map\r\n\r\n return (\r\n <div className=\"p-4\">\r\n <div className=\"flex items-center\">\r\n <div className=\"flex items-center gap-2 w-full justify-between\">\r\n <div className=\"space-y-1 flex justify-center\">\r\n {loadingBuildingInfo\r\n ? (\r\n <div className=\"flex items-center gap-2\">\r\n <LoadingSpinner />\r\n <span className=\"text-sm font-medium text-muted-foreground\">{t('loadingText')}</span>\r\n </div>\r\n )\r\n : (\r\n <h2 className=\"text-sm font-semibold text-foreground\">\r\n {currentBuilding?.buildingName ||\r\n (\r\n currentLocation?.municipality\r\n ? (currentLocation?.countrySubdivision\r\n ? `${currentLocation.municipality}, ${formatSubdivision(currentLocation.countrySubdivision)}`\r\n : currentLocation.municipality)\r\n : (formatSubdivision(currentLocation?.countrySubdivision) || countryName)\r\n )\r\n }\r\n </h2>\r\n )}\r\n </div>\r\n <Button\r\n variant=\"ghost\"\r\n size=\"icon\"\r\n className
|
|
1
|
+
{"version":3,"sources":["../../../../../src/core/components/ui/InfoSidebar/Header.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as LR from 'lucide-react'\r\nimport { useTranslations } from 'next-intl'\r\nimport * as React from 'react'\r\n\r\nimport { MapContext } from '../../../store'\r\nimport { cn } from '../../../utils/utils'\r\nimport { Button } from '../Button'\r\nimport { LoadingSpinner } from '../LoadingSpinner'\r\nimport { useSidebar } from '../Sidebar'\r\n\r\nimport type { Building, Organization } from '../../../types/dbTypes'\r\n\r\n\r\ninterface HeaderProps {\r\n currentBuilding: Building | null\r\n loadingBuildingInfo: boolean\r\n organization?: Organization\r\n}\r\n\r\nexport function Header({\r\n currentBuilding,\r\n loadingBuildingInfo,\r\n organization,\r\n}: HeaderProps) {\r\n // Translation\r\n const t = useTranslations('SidebarHeader')\r\n const { setOpenInfo } = useSidebar()\r\n const { state: mapState } = React.useContext(MapContext)\r\n const countryCode = organization?.country\r\n const countryName = countryCode\r\n ? (new Intl.DisplayNames(['en'], { type: 'region' }).of(countryCode.toUpperCase()) ?? countryCode)\r\n : ''\r\n\r\n // Strip country prefix from ISO 3166-2 codes: \"CA-ON\" → \"ON\", \"CA_ON\" → \"ON\", \"CAON\" → \"ON\"\r\n const formatSubdivision = (code: string | null | undefined): string => {\r\n if (!code) return ''\r\n const normalized = code.replace('_', '-')\r\n const withDash = normalized.includes('-') ? normalized : `${normalized.slice(0, 2)}-${normalized.slice(2)}`\r\n return withDash.split('-').slice(1).join('-')\r\n }\r\n const { currentLocation } = mapState.map\r\n\r\n return (\r\n <div className=\"p-4\">\r\n <div className=\"flex items-center\">\r\n <div className=\"flex items-center gap-2 w-full justify-between\">\r\n {/* min-w-0 so a long building/municipality name truncates instead of growing the row\r\n and pushing the close button past the sidebar's overflow-hidden edge. */}\r\n <div className=\"space-y-1 flex justify-center min-w-0 flex-1\">\r\n {loadingBuildingInfo\r\n ? (\r\n <div className=\"flex items-center gap-2 min-w-0\">\r\n <LoadingSpinner />\r\n <span className=\"text-sm font-medium text-muted-foreground truncate\">{t('loadingText')}</span>\r\n </div>\r\n )\r\n : (\r\n <h2 className=\"text-sm font-semibold text-foreground truncate\" title={currentBuilding?.buildingName ?? undefined}>\r\n {currentBuilding?.buildingName ||\r\n (\r\n currentLocation?.municipality\r\n ? (currentLocation?.countrySubdivision\r\n ? `${currentLocation.municipality}, ${formatSubdivision(currentLocation.countrySubdivision)}`\r\n : currentLocation.municipality)\r\n : (formatSubdivision(currentLocation?.countrySubdivision) || countryName)\r\n )\r\n }\r\n </h2>\r\n )}\r\n </div>\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n size=\"icon\"\r\n className={cn(\r\n 'group/sidebar-trigger relative shrink-0 z-10 opacity-70 hover:opacity-100 transition-opacity duration-200 hover:bg-transparent',\r\n // Widen the tap target on touch viewports (36px button -> 52px hit area).\r\n 'after:absolute after:-inset-2 after:md:hidden',\r\n )}\r\n onClick={() => setOpenInfo(false)}\r\n title={t('closeInfoToggle')}\r\n aria-label={t('closeInfoToggle')}\r\n >\r\n <LR.PanelLeftClose className=\"h-4 w-4\" />\r\n </Button>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}"],"mappings":";AAwDgB,SACE,KADF;AAnDhB,YAAY,QAAQ;AACpB,SAAS,uBAAuB;AAChC,YAAY,WAAW;AAEvB,SAAS,kBAAkB;AAC3B,SAAS,UAAU;AACnB,SAAS,cAAc;AACvB,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAWpB,SAAS,OAAO;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AACF,GAAgB;AA5BhB;AA8BE,QAAM,IAAI,gBAAgB,eAAe;AACzC,QAAM,EAAE,YAAY,IAAI,WAAW;AACnC,QAAM,EAAE,OAAO,SAAS,IAAI,MAAM,WAAW,UAAU;AACvD,QAAM,cAAc,6CAAc;AAClC,QAAM,cAAc,eACf,SAAI,KAAK,aAAa,CAAC,IAAI,GAAG,EAAE,MAAM,SAAS,CAAC,EAAE,GAAG,YAAY,YAAY,CAAC,MAA9E,YAAmF,cACpF;AAGJ,QAAM,oBAAoB,CAAC,SAA4C;AACrE,QAAI,CAAC,KAAM,QAAO;AAClB,UAAM,aAAa,KAAK,QAAQ,KAAK,GAAG;AACxC,UAAM,WAAW,WAAW,SAAS,GAAG,IAAI,aAAa,GAAG,WAAW,MAAM,GAAG,CAAC,CAAC,IAAI,WAAW,MAAM,CAAC,CAAC;AACzG,WAAO,SAAS,MAAM,GAAG,EAAE,MAAM,CAAC,EAAE,KAAK,GAAG;AAAA,EAC9C;AACA,QAAM,EAAE,gBAAgB,IAAI,SAAS;AAErC,SACE,oBAAC,SAAI,WAAU,OACb,8BAAC,SAAI,WAAU,qBACb,+BAAC,SAAI,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AAA;AAGF,QAAA,MAAM,kBAAkB;cAEuB,OAAO;mDAkBpD,CAAA;AAGF,QAAA,MAAM,mBAAmB,mKAUvB,CAAA;AAGF,QAAA,MAAM,WAAW,yKAUf,CAAA;AAGF,QAAA,MAAM,eAAe,kKAUnB,CAAA;AAyBF,QAAA,MAAM,iBAAiB;cAGT,OAAO;eACN,OAAO;cACR,MAAM,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC;;;;oHAmDjE,CAAA;AAGD,QAAA,MAAM,iBAAiB;cAGT,OAAO;kBACH,OAAO;mDAwBvB,CAAA;AAGF,QAAA,MAAM,gBAAgB,mKAkBpB,CAAA;AAGF,QAAA,MAAM,mBAAmB;eAGV,OAAO;gDAgCpB,CAAA;AAGF,QAAA,MAAM,cAAc,yKAclB,CAAA;AAGF,QAAA,MAAM,kBAAkB,kKAG6B,CAAA;AAGrD,QAAA,MAAM,oBAAoB;cAGZ,OAAO;WACV,IAAI,GAAG,IAAI;eACP,OAAO;mDAsBpB,CAAA;AAGF,OAAO,EACL,OAAO,EACP,cAAc,EACd,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,UAAU,GACX,CAAA"}
|
|
@@ -208,14 +208,20 @@ const SidebarProvider = React.forwardRef(
|
|
|
208
208
|
"data-state": openInfo ? "open" : "closed",
|
|
209
209
|
"aria-hidden": !openInfo,
|
|
210
210
|
className: cn(
|
|
211
|
-
|
|
211
|
+
// z-50, not z-40: several in-viewer panels (BIM properties menu, IDS legend) are
|
|
212
|
+
// fixed at z-50 and used to paint over this overlay's header, swallowing taps on
|
|
213
|
+
// the close button. This div is the last child of the wrapper, so at an equal
|
|
214
|
+
// z-index it wins on DOM order, while portalled Radix layers (dialogs, dropdowns,
|
|
215
|
+
// tooltips — also z-50, mounted on body) still stack above it.
|
|
216
|
+
"fixed inset-y-0 z-50 max-w-full overflow-hidden transition-[transform,opacity] duration-300 ease-in-out will-change-transform",
|
|
212
217
|
infoResizing && "select-none",
|
|
213
218
|
openInfo ? "translate-x-0 opacity-100" : "-translate-x-full opacity-0 pointer-events-none"
|
|
214
219
|
),
|
|
215
220
|
style: {
|
|
216
221
|
left: isMobile ? "0" : open ? "var(--sidebar-width)" : "var(--sidebar-width-icon)",
|
|
217
|
-
// Desktop: user-resizable width (persisted).
|
|
218
|
-
|
|
222
|
+
// Desktop: user-resizable width (persisted).
|
|
223
|
+
// Mobile: same drawer width as the AppSidebar sheet, so both sidebars match.
|
|
224
|
+
width: isMobile ? SIDEBAR_WIDTH_MOBILE : infoWidth
|
|
219
225
|
},
|
|
220
226
|
children: [
|
|
221
227
|
/* @__PURE__ */ jsx(InfoSidebar, { minioBaseUrl, martinBaseUrl, organization, pointcloudApiUrl }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/components/ui/Sidebar.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport { Slot } from '@radix-ui/react-slot'\r\nimport { cva } from 'class-variance-authority'\r\nimport * as LR from 'lucide-react'\r\nimport { useTranslations } from 'next-intl'\r\nimport * as React from 'react'\r\n\r\nimport { useIsMobile } from '../../hooks/ui/use-mobile'\r\nimport { useResizableSidebarWidth } from '../../hooks/ui/useResizableSidebarWidth'\r\nimport { MenusContext } from '../../store/Menus/context'\r\nimport { cn } from '../../utils/utils'\r\nimport NavigationBar from '../TopNavigationBar'\r\n\r\nimport { Button } from './Button'\r\nimport { InfoSidebar } from './InfoSidebar'\r\nimport { Input } from './Input'\r\nimport { Separator } from './Separator'\r\nimport {\r\n Sheet,\r\n SheetContent,\r\n SheetDescription,\r\n SheetHeader,\r\n SheetTitle,\r\n} from './Sheet'\r\nimport { Skeleton } from './Skeleton'\r\nimport {\r\n Tooltip,\r\n TooltipContent,\r\n TooltipProvider,\r\n TooltipTrigger,\r\n} from './Tooltip'\r\n\r\n// Menus context\r\n\r\n// Custom components\r\n\r\n\r\n\r\nimport type { VariantProps } from 'class-variance-authority';\r\n\r\n\r\nconst SIDEBAR_COOKIE_NAME = 'sidebar_state'\r\nconst SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7\r\nconst SIDEBAR_WIDTH = '16rem'\r\nconst SIDEBAR_WIDTH_MOBILE = '18rem'\r\nconst SIDEBAR_WIDTH_ICON = '3rem'\r\nconst SIDEBAR_KEYBOARD_SHORTCUT = 'b'\r\n\r\ntype SidebarContextProps = {\r\n sidebarState: 'expanded' | 'collapsed'\r\n open: boolean\r\n setOpenMenu: (open: boolean) => void\r\n openMobile: boolean\r\n setOpenMobile: (open: boolean) => void\r\n openInfo: boolean\r\n setOpenInfo: (open: boolean) => void\r\n isMobile: boolean\r\n toggleMenuSidebar: () => void\r\n toggleInfoSidebar: () => void\r\n geocodeEarthApiKey?: string\r\n geocoderUrl?: string\r\n // Rendered outside the mobile Sheet (see AppSidebar) so they survive the\r\n // Sheet closing — Radix unmounts the Sheet's whole subtree on close, which\r\n // would otherwise take these dialogs down with it right after they open.\r\n bugReportOpen: boolean\r\n setBugReportOpen: (open: boolean) => void\r\n featureRequestOpen: boolean\r\n setFeatureRequestOpen: (open: boolean) => void\r\n}\r\n\r\nconst SidebarContext = React.createContext<SidebarContextProps | null>(null)\r\n\r\nfunction useSidebar() {\r\n const context = React.useContext(SidebarContext)\r\n if (!context) {\r\n throw new Error('useSidebar must be used within a SidebarProvider.')\r\n }\r\n\r\n return context\r\n}\r\n\r\nconst SidebarProvider = React.forwardRef<\r\n HTMLDivElement,\r\n React.ComponentProps<'div'> & {\r\n defaultOpen?: boolean\r\n open?: boolean\r\n onOpenChange?: (open: boolean) => void\r\n minioBaseUrl?: string\r\n martinBaseUrl?: string\r\n organization?: import('../../types/dbTypes').Organization\r\n pointcloudApiUrl?: string\r\n geocodeEarthApiKey?: string\r\n geocoderUrl?: string\r\n }\r\n>(\r\n (\r\n {\r\n defaultOpen = false,\r\n open: openProp,\r\n onOpenChange: setOpenProp,\r\n className,\r\n style,\r\n children,\r\n minioBaseUrl,\r\n martinBaseUrl,\r\n organization,\r\n pointcloudApiUrl,\r\n geocodeEarthApiKey,\r\n geocoderUrl,\r\n ...props\r\n },\r\n ref,\r\n ) => {\r\n const isMobile = useIsMobile()\r\n const tInfo = useTranslations('InfoSidebar')\r\n // User-resizable width for the InfoSidebar overlay (desktop only; persisted).\r\n const {\r\n width: infoWidth,\r\n isResizing: infoResizing,\r\n canResize: canResizeInfo,\r\n startResize: startInfoResize,\r\n } = useResizableSidebarWidth()\r\n const [openMobile, setOpenMobile] = React.useState(false)\r\n const [openInfo, setOpenInfo] = React.useState(false)\r\n const [bugReportOpen, setBugReportOpen] = React.useState(false)\r\n const [featureRequestOpen, setFeatureRequestOpen] = React.useState(false)\r\n\r\n // This is the internal state of the sidebar.\r\n // We use openProp and setOpenProp for control from outside the component.\r\n const [_open, _setOpen] = React.useState(defaultOpen)\r\n const open = openProp ?? _open\r\n const setOpenMenu = React.useCallback(\r\n (value: boolean | ((value: boolean) => boolean)) => {\r\n const openState = typeof value === 'function' ? value(open) : value\r\n if (setOpenProp) {\r\n setOpenProp(openState)\r\n }\r\n else {\r\n _setOpen(openState)\r\n }\r\n\r\n // This sets the cookie to keep the sidebar state.\r\n document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`\r\n },\r\n [setOpenProp, open],\r\n )\r\n\r\n // Helper to toggle the menu sidebar.\r\n const toggleMenuSidebar = React.useCallback(() => {\r\n if (isMobile) {\r\n setOpenMobile(open => !open)\r\n }\r\n else {\r\n setOpenMenu((open) => {\r\n const newOpenState = !open\r\n // If opening menu sidebar, close info sidebar\r\n // if (newOpenState && openInfo) {\r\n // setOpenInfo(false)\r\n // }\r\n return newOpenState\r\n })\r\n }\r\n }, [isMobile, setOpenMenu, setOpenMobile, openInfo, setOpenInfo])\r\n\r\n // Helper to toggle the info sidebar.\r\n const toggleInfoSidebar = React.useCallback(() => {\r\n setOpenInfo((openInfoState) => {\r\n const newOpenInfoState = !openInfoState\r\n // If opening info sidebar, close menu sidebar\r\n if (newOpenInfoState && (isMobile ? openMobile : open)) {\r\n if (isMobile) {\r\n setOpenMobile(false)\r\n }\r\n else {\r\n setOpenMenu(false)\r\n }\r\n }\r\n return newOpenInfoState\r\n })\r\n }, [setOpenInfo, open, openMobile, isMobile, setOpenMenu, setOpenMobile])\r\n\r\n // Adds a keyboard shortcut to toggle the sidebar.\r\n React.useEffect(() => {\r\n const handleKeyDown = (event: KeyboardEvent) => {\r\n if (\r\n event.key === SIDEBAR_KEYBOARD_SHORTCUT\r\n && (event.metaKey || event.ctrlKey)\r\n ) {\r\n event.preventDefault()\r\n toggleMenuSidebar()\r\n }\r\n\r\n // Close InfoSidebar on Escape key\r\n if (event.key === 'Escape' && openInfo) {\r\n event.preventDefault()\r\n setOpenInfo(false)\r\n }\r\n }\r\n\r\n window.addEventListener('keydown', handleKeyDown)\r\n return () => window.removeEventListener('keydown', handleKeyDown)\r\n }, [toggleMenuSidebar, openInfo, setOpenInfo])\r\n\r\n // We add a state so that we can do data-state=\"expanded\" or \"collapsed\".\r\n // On mobile, reflect the Sheet open state; on desktop, reflect the sidebar open state.\r\n const sidebarState = (isMobile ? openMobile : open) ? 'expanded' : 'collapsed'\r\n\r\n const contextValue = React.useMemo<SidebarContextProps>(\r\n () => ({\r\n sidebarState,\r\n open,\r\n setOpenMenu,\r\n isMobile,\r\n openMobile,\r\n setOpenMobile,\r\n openInfo,\r\n setOpenInfo,\r\n toggleMenuSidebar,\r\n toggleInfoSidebar,\r\n geocodeEarthApiKey,\r\n geocoderUrl,\r\n bugReportOpen,\r\n setBugReportOpen,\r\n featureRequestOpen,\r\n setFeatureRequestOpen,\r\n }),\r\n [sidebarState, open, setOpenMenu, isMobile, openMobile, setOpenMobile, openInfo, setOpenInfo, toggleMenuSidebar, toggleInfoSidebar, geocodeEarthApiKey, geocoderUrl, bugReportOpen, featureRequestOpen],\r\n )\r\n\r\n return (\r\n <SidebarContext.Provider value={contextValue}>\r\n <TooltipProvider delayDuration={0}>\r\n <div\r\n style={\r\n {\r\n '--sidebar-width': SIDEBAR_WIDTH,\r\n '--sidebar-width-icon': SIDEBAR_WIDTH_ICON,\r\n ...style,\r\n } as React.CSSProperties\r\n }\r\n className={cn(\r\n 'group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar',\r\n className,\r\n )}\r\n ref={ref}\r\n {...props}\r\n >\r\n {children}\r\n\r\n {/* InfoSidebar overlay */}\r\n\r\n <div\r\n data-state={openInfo ? 'open' : 'closed'}\r\n aria-hidden={!openInfo}\r\n className={cn(\r\n 'fixed inset-y-0 z-40 w-full overflow-hidden transition-[transform,opacity] duration-300 ease-in-out will-change-transform',\r\n infoResizing && 'select-none',\r\n openInfo\r\n ? 'translate-x-0 opacity-100'\r\n : '-translate-x-full opacity-0 pointer-events-none'\r\n )}\r\n style={{\r\n left: isMobile\r\n ? '0'\r\n : (open ? 'var(--sidebar-width)' : 'var(--sidebar-width-icon)'),\r\n // Desktop: user-resizable width (persisted). Mobile: full-width.\r\n width: isMobile ? '100%' : infoWidth,\r\n }}\r\n >\r\n <InfoSidebar minioBaseUrl={minioBaseUrl} martinBaseUrl={martinBaseUrl} organization={organization} pointcloudApiUrl={pointcloudApiUrl} />\r\n\r\n {/* Right-edge drag handle (desktop only). Drag to resize the sidebar width. */}\r\n {canResizeInfo && (\r\n <div\r\n role=\"separator\"\r\n aria-orientation=\"vertical\"\r\n aria-label={tInfo('resizeHandleLabel')}\r\n onPointerDown={startInfoResize}\r\n style={{ touchAction: 'none' }}\r\n className=\"absolute inset-y-0 right-0 z-10 w-0.5 cursor-ew-resize bg-border/80 hover:bg-accent\"\r\n />\r\n )}\r\n </div>\r\n </div>\r\n </TooltipProvider>\r\n </SidebarContext.Provider>\r\n )\r\n },\r\n)\r\nSidebarProvider.displayName = 'SidebarProvider'\r\nconst Sidebar = React.forwardRef<\r\n HTMLDivElement,\r\n React.ComponentProps<'div'> & {\r\n side?: 'left' | 'right'\r\n variant?: 'sidebar' | 'floating' | 'inset'\r\n collapsible?: 'offcanvas' | 'icon' | 'none'\r\n }\r\n>(\r\n (\r\n {\r\n side = 'left',\r\n variant = 'sidebar',\r\n collapsible = 'offcanvas',\r\n className,\r\n children,\r\n ...props\r\n },\r\n ref,\r\n ) => {\r\n // Get auth state from MenusContext\r\n const { state, isAuthPage } = React.useContext(MenusContext)\r\n const { isMobile, sidebarState, openMobile, setOpenMobile } = useSidebar()\r\n\r\n // Translation\r\n const t = useTranslations('Sidebar')\r\n\r\n // Don't render sidebar at all for auth pages\r\n if (isAuthPage || state.menus.currentViewer === 'auth') {\r\n return null\r\n }\r\n\r\n if (collapsible === 'none') {\r\n return (\r\n <div\r\n className={cn(\r\n 'flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground',\r\n className,\r\n )}\r\n ref={ref}\r\n {...props}\r\n >\r\n {children}\r\n </div>\r\n )\r\n }\r\n\r\n if (isMobile) {\r\n return (\r\n <Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>\r\n <SheetContent\r\n data-sidebar=\"sidebar\"\r\n data-mobile=\"true\"\r\n className=\"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden\"\r\n style={\r\n {\r\n '--sidebar-width': SIDEBAR_WIDTH_MOBILE,\r\n } as React.CSSProperties\r\n }\r\n side={side}\r\n >\r\n <SheetHeader className=\"sr-only\">\r\n <SheetTitle>{t('title')}</SheetTitle>\r\n <SheetDescription>{t('description')}</SheetDescription>\r\n </SheetHeader>\r\n <div className=\"flex h-full w-full flex-col\">{children}</div>\r\n </SheetContent>\r\n </Sheet>\r\n )\r\n }\r\n\r\n return (\r\n <div\r\n ref={ref}\r\n className=\"group peer text-sidebar-foreground md:block\" // removed default hidden class\r\n data-state={sidebarState}\r\n data-collapsible={sidebarState === 'collapsed' ? collapsible : ''}\r\n data-variant={variant}\r\n data-side={side}\r\n >\r\n {/* This is what handles the sidebar gap on desktop */}\r\n <div\r\n className={cn(\r\n 'relative w-[--sidebar-width] bg-transparent transition-[width] duration-200 ease-linear',\r\n 'group-data-[collapsible=offcanvas]:w-0',\r\n 'group-data-[side=right]:rotate-180',\r\n variant === 'floating' || variant === 'inset'\r\n ? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]'\r\n : 'group-data-[collapsible=icon]:w-[--sidebar-width-icon]',\r\n )}\r\n />\r\n <div\r\n className={cn(\r\n // removed default hidden class\r\n 'fixed inset-y-0 z-10 h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear md:flex',\r\n side === 'left'\r\n ? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'\r\n : 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',\r\n // Adjust the padding for floating and inset variants.\r\n variant === 'floating' || variant === 'inset'\r\n ? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]'\r\n : 'group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l',\r\n className,\r\n )}\r\n {...props}\r\n >\r\n <div\r\n data-sidebar=\"sidebar\"\r\n className=\"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow\"\r\n >\r\n {children}\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n },\r\n)\r\nSidebar.displayName = 'Sidebar'\r\n\r\nconst SidebarTrigger = React.forwardRef<\r\n React.ElementRef<typeof Button>,\r\n React.ComponentProps<typeof Button>\r\n>(({ className, onClick, ...props }, ref) => {\r\n const { toggleMenuSidebar, geocodeEarthApiKey, geocoderUrl } = useSidebar()\r\n\r\n const { state } = React.useContext(MenusContext)\r\n const currentViewer = state.menus.currentViewer\r\n\r\n if (currentViewer === 'auth') return null\r\n\r\n // Render MenuButtons only for interactive viewers\r\n if (currentViewer === 'map' || currentViewer === 'bim' || currentViewer === 'pointcloud') {\r\n return <NavigationBar geocodeEarthApiKey={geocodeEarthApiKey} geocoderUrl={geocoderUrl} />\r\n }\r\n\r\n // Default trigger for all other content types\r\n return (\r\n <Button\r\n ref={ref}\r\n variant=\"ghost\"\r\n size=\"icon\"\r\n data-sidebar=\"trigger\"\r\n onClick={(e) => {\r\n toggleMenuSidebar()\r\n onClick?.(e)\r\n }}\r\n\r\n className={cn(\r\n '',\r\n className,\r\n 'opacity-70 hover:opacity-100 transition-opacity duration-200 hover:bg-transparent',\r\n )}\r\n {...props}\r\n >\r\n <LR.PanelLeft />\r\n <span className=\"sr-only\">Toggle Sidebar</span>\r\n </Button>\r\n )\r\n})\r\nSidebarTrigger.displayName = 'SidebarTrigger'\r\n\r\nconst SidebarRail = React.forwardRef<\r\n HTMLButtonElement,\r\n React.ComponentProps<'button'>\r\n>(({ className, ...props }, ref) => {\r\n const { toggleMenuSidebar } = useSidebar()\r\n\r\n return (\r\n <button\r\n ref={ref}\r\n data-sidebar=\"rail\"\r\n aria-label=\"Toggle Sidebar\"\r\n tabIndex={-1}\r\n onClick={toggleMenuSidebar}\r\n title=\"Toggle Sidebar\"\r\n className={cn(\r\n // removed default hidden class\r\n 'absolute inset-y-0 z-20 w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex',\r\n '[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize',\r\n '[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize',\r\n 'group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar',\r\n '[[data-side=left][data-collapsible=offcanvas]_&]:-right-2',\r\n '[[data-side=right][data-collapsible=offcanvas]_&]:-left-2',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarRail.displayName = 'SidebarRail'\r\n\r\nconst SidebarInset = React.forwardRef<\r\n HTMLDivElement,\r\n React.ComponentProps<'main'>\r\n>(({ className, ...props }, ref) => {\r\n return (\r\n <main\r\n ref={ref}\r\n className={cn(\r\n 'relative flex w-full flex-1 flex-col bg-background',\r\n 'md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarInset.displayName = 'SidebarInset'\r\n\r\nconst SidebarInput = React.forwardRef<\r\n React.ElementRef<typeof Input>,\r\n React.ComponentProps<typeof Input>\r\n>(({ className, ...props }, ref) => {\r\n return (\r\n <Input\r\n ref={ref}\r\n data-sidebar=\"input\"\r\n className={cn(\r\n 'h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarInput.displayName = 'SidebarInput'\r\n\r\nconst SidebarHeader = React.forwardRef<\r\n HTMLDivElement,\r\n React.ComponentProps<'div'>\r\n>(({ className, ...props }, ref) => {\r\n return (\r\n <div\r\n ref={ref}\r\n data-sidebar=\"header\"\r\n className={cn('flex flex-col gap-2 p-2', className)}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarHeader.displayName = 'SidebarHeader'\r\n\r\nconst SidebarFooter = React.forwardRef<\r\n HTMLDivElement,\r\n React.ComponentProps<'div'>\r\n>(({ className, ...props }, ref) => {\r\n return (\r\n <div\r\n ref={ref}\r\n data-sidebar=\"footer\"\r\n className={cn('flex flex-col gap-2 p-2', className)}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarFooter.displayName = 'SidebarFooter'\r\n\r\nconst SidebarSeparator = React.forwardRef<\r\n React.ElementRef<typeof Separator>,\r\n React.ComponentProps<typeof Separator>\r\n>(({ className, ...props }, ref) => {\r\n return (\r\n <Separator\r\n ref={ref}\r\n data-sidebar=\"separator\"\r\n className={cn('mx-2 w-auto bg-sidebar-border', className)}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarSeparator.displayName = 'SidebarSeparator'\r\n\r\nconst SidebarContent = React.forwardRef<\r\n HTMLDivElement,\r\n React.ComponentProps<'div'>\r\n>(({ className, ...props }, ref) => {\r\n return (\r\n <div\r\n ref={ref}\r\n data-sidebar=\"content\"\r\n className={cn(\r\n 'flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarContent.displayName = 'SidebarContent'\r\n\r\nconst SidebarGroup = React.forwardRef<\r\n HTMLDivElement,\r\n React.ComponentProps<'div'>\r\n>(({ className, ...props }, ref) => {\r\n return (\r\n <div\r\n ref={ref}\r\n data-sidebar=\"group\"\r\n className={cn('relative flex w-full min-w-0 flex-col p-2', className)}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarGroup.displayName = 'SidebarGroup'\r\n\r\nconst SidebarGroupLabel = React.forwardRef<\r\n HTMLDivElement,\r\n React.ComponentProps<'div'> & { asChild?: boolean }\r\n>(({ className, asChild = false, ...props }, ref) => {\r\n const Comp = asChild ? Slot : 'div'\r\n\r\n return (\r\n <Comp\r\n ref={ref}\r\n data-sidebar=\"group-label\"\r\n className={cn(\r\n 'flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',\r\n 'group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarGroupLabel.displayName = 'SidebarGroupLabel'\r\n\r\nconst SidebarGroupAction = React.forwardRef<\r\n HTMLButtonElement,\r\n React.ComponentProps<'button'> & { asChild?: boolean }\r\n>(({ className, asChild = false, ...props }, ref) => {\r\n const Comp = asChild ? Slot : 'button'\r\n\r\n return (\r\n <Comp\r\n ref={ref}\r\n data-sidebar=\"group-action\"\r\n className={cn(\r\n 'absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',\r\n // Increases the hit area of the button on mobile.\r\n 'after:absolute after:-inset-2 after:md:hidden',\r\n 'group-data-[collapsible=icon]:hidden',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarGroupAction.displayName = 'SidebarGroupAction'\r\n\r\nconst SidebarGroupContent = React.forwardRef<\r\n HTMLDivElement,\r\n React.ComponentProps<'div'>\r\n>(({ className, ...props }, ref) => (\r\n <div\r\n ref={ref}\r\n data-sidebar=\"group-content\"\r\n className={cn('w-full text-sm', className)}\r\n {...props}\r\n />\r\n))\r\nSidebarGroupContent.displayName = 'SidebarGroupContent'\r\n\r\nconst SidebarMenu = React.forwardRef<\r\n HTMLUListElement,\r\n React.ComponentProps<'ul'>\r\n>(({ className, ...props }, ref) => (\r\n <ul\r\n ref={ref}\r\n data-sidebar=\"menu\"\r\n className={cn('flex w-full min-w-0 flex-col gap-1', className)}\r\n {...props}\r\n />\r\n))\r\nSidebarMenu.displayName = 'SidebarMenu'\r\n\r\nconst SidebarMenuItem = React.forwardRef<\r\n HTMLLIElement,\r\n React.ComponentProps<'li'>\r\n>(({ className, ...props }, ref) => (\r\n <li\r\n ref={ref}\r\n data-sidebar=\"menu-item\"\r\n className={cn('group/menu-item relative', className)}\r\n {...props}\r\n />\r\n))\r\nSidebarMenuItem.displayName = 'SidebarMenuItem'\r\n\r\nconst sidebarMenuButtonVariants = cva(\r\n 'peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',\r\n {\r\n variants: {\r\n variant: {\r\n default: 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',\r\n outline:\r\n 'bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]',\r\n },\r\n size: {\r\n default: 'h-8 text-sm',\r\n sm: 'h-7 text-xs',\r\n lg: 'h-12 text-sm group-data-[collapsible=icon]:!p-0',\r\n },\r\n },\r\n defaultVariants: {\r\n variant: 'default',\r\n size: 'default',\r\n },\r\n },\r\n)\r\n\r\nconst SidebarMenuButton = React.forwardRef<\r\n HTMLButtonElement,\r\n React.ComponentProps<'button'> & {\r\n asChild?: boolean\r\n isActive?: boolean\r\n tooltip?: string | React.ComponentProps<typeof TooltipContent>\r\n } & VariantProps<typeof sidebarMenuButtonVariants>\r\n>(\r\n (\r\n {\r\n asChild = false,\r\n isActive = false,\r\n variant = 'default',\r\n size = 'default',\r\n tooltip,\r\n className,\r\n ...props\r\n },\r\n ref,\r\n ) => {\r\n const Comp = asChild ? Slot : 'button'\r\n const { isMobile, sidebarState } = useSidebar()\r\n\r\n const button = (\r\n <Comp\r\n ref={ref}\r\n data-sidebar=\"menu-button\"\r\n data-size={size}\r\n data-active={isActive}\r\n className={cn(sidebarMenuButtonVariants({ variant, size }), className)}\r\n {...props}\r\n />\r\n )\r\n\r\n if (!tooltip) {\r\n return button\r\n }\r\n\r\n if (typeof tooltip === 'string') {\r\n tooltip = {\r\n children: tooltip,\r\n }\r\n }\r\n\r\n return (\r\n <Tooltip>\r\n <TooltipTrigger asChild>{button}</TooltipTrigger>\r\n <TooltipContent\r\n side=\"right\"\r\n align=\"center\"\r\n hidden={sidebarState !== 'collapsed' || isMobile}\r\n {...tooltip}\r\n />\r\n </Tooltip>\r\n )\r\n },\r\n)\r\nSidebarMenuButton.displayName = 'SidebarMenuButton'\r\n\r\nconst SidebarMenuAction = React.forwardRef<\r\n HTMLButtonElement,\r\n React.ComponentProps<'button'> & {\r\n asChild?: boolean\r\n showOnHover?: boolean\r\n }\r\n>(({ className, asChild = false, showOnHover = false, ...props }, ref) => {\r\n const Comp = asChild ? Slot : 'button'\r\n\r\n return (\r\n <Comp\r\n ref={ref}\r\n data-sidebar=\"menu-action\"\r\n className={cn(\r\n 'absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0',\r\n // Increases the hit area of the button on mobile.\r\n 'after:absolute after:-inset-2 after:md:hidden',\r\n 'peer-data-[size=sm]/menu-button:top-1',\r\n 'peer-data-[size=default]/menu-button:top-1.5',\r\n 'peer-data-[size=lg]/menu-button:top-2.5',\r\n 'group-data-[collapsible=icon]:hidden',\r\n showOnHover\r\n && 'group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarMenuAction.displayName = 'SidebarMenuAction'\r\n\r\nconst SidebarMenuBadge = React.forwardRef<\r\n HTMLDivElement,\r\n React.ComponentProps<'div'>\r\n>(({ className, ...props }, ref) => (\r\n <div\r\n ref={ref}\r\n data-sidebar=\"menu-badge\"\r\n className={cn(\r\n 'pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground',\r\n 'peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground',\r\n 'peer-data-[size=sm]/menu-button:top-1',\r\n 'peer-data-[size=default]/menu-button:top-1.5',\r\n 'peer-data-[size=lg]/menu-button:top-2.5',\r\n 'group-data-[collapsible=icon]:hidden',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n))\r\nSidebarMenuBadge.displayName = 'SidebarMenuBadge'\r\n\r\nconst SidebarMenuSkeleton = React.forwardRef<\r\n HTMLDivElement,\r\n React.ComponentProps<'div'> & {\r\n showIcon?: boolean\r\n }\r\n>(({ className, showIcon = false, ...props }, ref) => {\r\n // Random width between 50 to 90%.\r\n const width = React.useMemo(() => {\r\n return `${Math.floor(Math.random() * 40) + 50}%`\r\n }, [])\r\n\r\n return (\r\n <div\r\n ref={ref}\r\n data-sidebar=\"menu-skeleton\"\r\n className={cn('flex h-8 items-center gap-2 rounded-md px-2', className)}\r\n {...props}\r\n >\r\n {showIcon && (\r\n <Skeleton\r\n className=\"size-4 rounded-md\"\r\n data-sidebar=\"menu-skeleton-icon\"\r\n />\r\n )}\r\n <Skeleton\r\n className=\"h-4 max-w-[--skeleton-width] flex-1\"\r\n data-sidebar=\"menu-skeleton-text\"\r\n style={\r\n {\r\n '--skeleton-width': width,\r\n } as React.CSSProperties\r\n }\r\n />\r\n </div>\r\n )\r\n})\r\nSidebarMenuSkeleton.displayName = 'SidebarMenuSkeleton'\r\n\r\nconst SidebarMenuSub = React.forwardRef<\r\n HTMLUListElement,\r\n React.ComponentProps<'ul'>\r\n>(({ className, ...props }, ref) => (\r\n <ul\r\n ref={ref}\r\n data-sidebar=\"menu-sub\"\r\n className={cn(\r\n 'mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5',\r\n 'group-data-[collapsible=icon]:hidden',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n))\r\nSidebarMenuSub.displayName = 'SidebarMenuSub'\r\n\r\nconst SidebarMenuSubItem = React.forwardRef<\r\n HTMLLIElement,\r\n React.ComponentProps<'li'>\r\n>(({ ...props }, ref) => <li ref={ref} {...props} />)\r\nSidebarMenuSubItem.displayName = 'SidebarMenuSubItem'\r\n\r\nconst SidebarMenuSubButton = React.forwardRef<\r\n HTMLAnchorElement,\r\n React.ComponentProps<'a'> & {\r\n asChild?: boolean\r\n size?: 'sm' | 'md'\r\n isActive?: boolean\r\n }\r\n>(({ asChild = false, size = 'md', isActive, className, ...props }, ref) => {\r\n const Comp = asChild ? Slot : 'a'\r\n\r\n return (\r\n <Comp\r\n ref={ref}\r\n data-sidebar=\"menu-sub-button\"\r\n data-size={size}\r\n data-active={isActive}\r\n className={cn(\r\n 'flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground',\r\n 'data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground',\r\n size === 'sm' && 'text-xs',\r\n size === 'md' && 'text-sm',\r\n 'group-data-[collapsible=icon]:hidden',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarMenuSubButton.displayName = 'SidebarMenuSubButton'\r\n\r\nexport {\r\n Sidebar,\r\n SidebarContent,\r\n SidebarFooter,\r\n SidebarGroup,\r\n SidebarGroupAction,\r\n SidebarGroupContent,\r\n SidebarGroupLabel,\r\n SidebarHeader,\r\n SidebarInput,\r\n SidebarInset,\r\n SidebarMenu,\r\n SidebarMenuAction,\r\n SidebarMenuBadge,\r\n SidebarMenuButton,\r\n SidebarMenuItem,\r\n SidebarMenuSkeleton,\r\n SidebarMenuSub,\r\n SidebarMenuSubButton,\r\n SidebarMenuSubItem,\r\n SidebarProvider,\r\n SidebarRail,\r\n SidebarSeparator,\r\n SidebarTrigger,\r\n useSidebar,\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+PY,SAkBE,KAlBF;AA1PZ,SAAS,YAAY;AACrB,SAAS,WAAW;AACpB,YAAY,QAAQ;AACpB,SAAS,uBAAuB;AAChC,YAAY,WAAW;AAEvB,SAAS,mBAAmB;AAC5B,SAAS,gCAAgC;AACzC,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AACnB,OAAO,mBAAmB;AAE1B,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gBAAgB;AACzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAWP,MAAM,sBAAsB;AAC5B,MAAM,yBAAyB,KAAK,KAAK,KAAK;AAC9C,MAAM,gBAAgB;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AA,QACf;AAAA,QAEF;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,gBAAa;AAAA,YACb,OACE;AAAA,cACE,oBAAoB;AAAA,YACtB;AAAA;AAAA,QAEJ;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;AACD,oBAAoB,cAAc;AAElC,MAAM,iBAAiB,MAAM,WAG3B,CAAC,IAAyB,QAAK;AAA9B,eAAE,YAv1BL,IAu1BG,IAAgB,kBAAhB,IAAgB,CAAd;AACH;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,gBAAa;AAAA,MACb,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,OACI;AAAA,EACN;AAAA,CACD;AACD,eAAe,cAAc;AAE7B,MAAM,qBAAqB,MAAM,WAG/B,CAAC,IAAc,QAAK;AAAnB,MAAK,kBAAL,IAAK;AAAiB,6BAAC,uBAAG,OAAc,MAAO;AAAA,CAAE;AACpD,mBAAmB,cAAc;AAEjC,MAAM,uBAAuB,MAAM,WAOjC,CAAC,IAAiE,QAAQ;AAAzE,eAAE,YAAU,OAAO,OAAO,MAAM,UAAU,UAl3B7C,IAk3BG,IAAwD,kBAAxD,IAAwD,CAAtD,WAAiB,QAAa,YAAU;AAC3C,QAAM,OAAO,UAAU,OAAO;AAE9B,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,gBAAa;AAAA,MACb,aAAW;AAAA,MACX,eAAa;AAAA,MACb,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA,SAAS,QAAQ;AAAA,QACjB,SAAS,QAAQ;AAAA,QACjB;AAAA,QACA;AAAA,MACF;AAAA,OACI;AAAA,EACN;AAEJ,CAAC;AACD,qBAAqB,cAAc;","names":["open"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/components/ui/Sidebar.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport { Slot } from '@radix-ui/react-slot'\r\nimport { cva } from 'class-variance-authority'\r\nimport * as LR from 'lucide-react'\r\nimport { useTranslations } from 'next-intl'\r\nimport * as React from 'react'\r\n\r\nimport { useIsMobile } from '../../hooks/ui/use-mobile'\r\nimport { useResizableSidebarWidth } from '../../hooks/ui/useResizableSidebarWidth'\r\nimport { MenusContext } from '../../store/Menus/context'\r\nimport { cn } from '../../utils/utils'\r\nimport NavigationBar from '../TopNavigationBar'\r\n\r\nimport { Button } from './Button'\r\nimport { InfoSidebar } from './InfoSidebar'\r\nimport { Input } from './Input'\r\nimport { Separator } from './Separator'\r\nimport {\r\n Sheet,\r\n SheetContent,\r\n SheetDescription,\r\n SheetHeader,\r\n SheetTitle,\r\n} from './Sheet'\r\nimport { Skeleton } from './Skeleton'\r\nimport {\r\n Tooltip,\r\n TooltipContent,\r\n TooltipProvider,\r\n TooltipTrigger,\r\n} from './Tooltip'\r\n\r\n// Menus context\r\n\r\n// Custom components\r\n\r\n\r\n\r\nimport type { VariantProps } from 'class-variance-authority';\r\n\r\n\r\nconst SIDEBAR_COOKIE_NAME = 'sidebar_state'\r\nconst SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7\r\nconst SIDEBAR_WIDTH = '16rem'\r\nconst SIDEBAR_WIDTH_MOBILE = '18rem'\r\nconst SIDEBAR_WIDTH_ICON = '3rem'\r\nconst SIDEBAR_KEYBOARD_SHORTCUT = 'b'\r\n\r\ntype SidebarContextProps = {\r\n sidebarState: 'expanded' | 'collapsed'\r\n open: boolean\r\n setOpenMenu: (open: boolean) => void\r\n openMobile: boolean\r\n setOpenMobile: (open: boolean) => void\r\n openInfo: boolean\r\n setOpenInfo: (open: boolean) => void\r\n isMobile: boolean\r\n toggleMenuSidebar: () => void\r\n toggleInfoSidebar: () => void\r\n geocodeEarthApiKey?: string\r\n geocoderUrl?: string\r\n // Rendered outside the mobile Sheet (see AppSidebar) so they survive the\r\n // Sheet closing — Radix unmounts the Sheet's whole subtree on close, which\r\n // would otherwise take these dialogs down with it right after they open.\r\n bugReportOpen: boolean\r\n setBugReportOpen: (open: boolean) => void\r\n featureRequestOpen: boolean\r\n setFeatureRequestOpen: (open: boolean) => void\r\n}\r\n\r\nconst SidebarContext = React.createContext<SidebarContextProps | null>(null)\r\n\r\nfunction useSidebar() {\r\n const context = React.useContext(SidebarContext)\r\n if (!context) {\r\n throw new Error('useSidebar must be used within a SidebarProvider.')\r\n }\r\n\r\n return context\r\n}\r\n\r\nconst SidebarProvider = React.forwardRef<\r\n HTMLDivElement,\r\n React.ComponentProps<'div'> & {\r\n defaultOpen?: boolean\r\n open?: boolean\r\n onOpenChange?: (open: boolean) => void\r\n minioBaseUrl?: string\r\n martinBaseUrl?: string\r\n organization?: import('../../types/dbTypes').Organization\r\n pointcloudApiUrl?: string\r\n geocodeEarthApiKey?: string\r\n geocoderUrl?: string\r\n }\r\n>(\r\n (\r\n {\r\n defaultOpen = false,\r\n open: openProp,\r\n onOpenChange: setOpenProp,\r\n className,\r\n style,\r\n children,\r\n minioBaseUrl,\r\n martinBaseUrl,\r\n organization,\r\n pointcloudApiUrl,\r\n geocodeEarthApiKey,\r\n geocoderUrl,\r\n ...props\r\n },\r\n ref,\r\n ) => {\r\n const isMobile = useIsMobile()\r\n const tInfo = useTranslations('InfoSidebar')\r\n // User-resizable width for the InfoSidebar overlay (desktop only; persisted).\r\n const {\r\n width: infoWidth,\r\n isResizing: infoResizing,\r\n canResize: canResizeInfo,\r\n startResize: startInfoResize,\r\n } = useResizableSidebarWidth()\r\n const [openMobile, setOpenMobile] = React.useState(false)\r\n const [openInfo, setOpenInfo] = React.useState(false)\r\n const [bugReportOpen, setBugReportOpen] = React.useState(false)\r\n const [featureRequestOpen, setFeatureRequestOpen] = React.useState(false)\r\n\r\n // This is the internal state of the sidebar.\r\n // We use openProp and setOpenProp for control from outside the component.\r\n const [_open, _setOpen] = React.useState(defaultOpen)\r\n const open = openProp ?? _open\r\n const setOpenMenu = React.useCallback(\r\n (value: boolean | ((value: boolean) => boolean)) => {\r\n const openState = typeof value === 'function' ? value(open) : value\r\n if (setOpenProp) {\r\n setOpenProp(openState)\r\n }\r\n else {\r\n _setOpen(openState)\r\n }\r\n\r\n // This sets the cookie to keep the sidebar state.\r\n document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`\r\n },\r\n [setOpenProp, open],\r\n )\r\n\r\n // Helper to toggle the menu sidebar.\r\n const toggleMenuSidebar = React.useCallback(() => {\r\n if (isMobile) {\r\n setOpenMobile(open => !open)\r\n }\r\n else {\r\n setOpenMenu((open) => {\r\n const newOpenState = !open\r\n // If opening menu sidebar, close info sidebar\r\n // if (newOpenState && openInfo) {\r\n // setOpenInfo(false)\r\n // }\r\n return newOpenState\r\n })\r\n }\r\n }, [isMobile, setOpenMenu, setOpenMobile, openInfo, setOpenInfo])\r\n\r\n // Helper to toggle the info sidebar.\r\n const toggleInfoSidebar = React.useCallback(() => {\r\n setOpenInfo((openInfoState) => {\r\n const newOpenInfoState = !openInfoState\r\n // If opening info sidebar, close menu sidebar\r\n if (newOpenInfoState && (isMobile ? openMobile : open)) {\r\n if (isMobile) {\r\n setOpenMobile(false)\r\n }\r\n else {\r\n setOpenMenu(false)\r\n }\r\n }\r\n return newOpenInfoState\r\n })\r\n }, [setOpenInfo, open, openMobile, isMobile, setOpenMenu, setOpenMobile])\r\n\r\n // Adds a keyboard shortcut to toggle the sidebar.\r\n React.useEffect(() => {\r\n const handleKeyDown = (event: KeyboardEvent) => {\r\n if (\r\n event.key === SIDEBAR_KEYBOARD_SHORTCUT\r\n && (event.metaKey || event.ctrlKey)\r\n ) {\r\n event.preventDefault()\r\n toggleMenuSidebar()\r\n }\r\n\r\n // Close InfoSidebar on Escape key\r\n if (event.key === 'Escape' && openInfo) {\r\n event.preventDefault()\r\n setOpenInfo(false)\r\n }\r\n }\r\n\r\n window.addEventListener('keydown', handleKeyDown)\r\n return () => window.removeEventListener('keydown', handleKeyDown)\r\n }, [toggleMenuSidebar, openInfo, setOpenInfo])\r\n\r\n // We add a state so that we can do data-state=\"expanded\" or \"collapsed\".\r\n // On mobile, reflect the Sheet open state; on desktop, reflect the sidebar open state.\r\n const sidebarState = (isMobile ? openMobile : open) ? 'expanded' : 'collapsed'\r\n\r\n const contextValue = React.useMemo<SidebarContextProps>(\r\n () => ({\r\n sidebarState,\r\n open,\r\n setOpenMenu,\r\n isMobile,\r\n openMobile,\r\n setOpenMobile,\r\n openInfo,\r\n setOpenInfo,\r\n toggleMenuSidebar,\r\n toggleInfoSidebar,\r\n geocodeEarthApiKey,\r\n geocoderUrl,\r\n bugReportOpen,\r\n setBugReportOpen,\r\n featureRequestOpen,\r\n setFeatureRequestOpen,\r\n }),\r\n [sidebarState, open, setOpenMenu, isMobile, openMobile, setOpenMobile, openInfo, setOpenInfo, toggleMenuSidebar, toggleInfoSidebar, geocodeEarthApiKey, geocoderUrl, bugReportOpen, featureRequestOpen],\r\n )\r\n\r\n return (\r\n <SidebarContext.Provider value={contextValue}>\r\n <TooltipProvider delayDuration={0}>\r\n <div\r\n style={\r\n {\r\n '--sidebar-width': SIDEBAR_WIDTH,\r\n '--sidebar-width-icon': SIDEBAR_WIDTH_ICON,\r\n ...style,\r\n } as React.CSSProperties\r\n }\r\n className={cn(\r\n 'group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar',\r\n className,\r\n )}\r\n ref={ref}\r\n {...props}\r\n >\r\n {children}\r\n\r\n {/* InfoSidebar overlay */}\r\n\r\n <div\r\n data-state={openInfo ? 'open' : 'closed'}\r\n aria-hidden={!openInfo}\r\n className={cn(\r\n // z-50, not z-40: several in-viewer panels (BIM properties menu, IDS legend) are\r\n // fixed at z-50 and used to paint over this overlay's header, swallowing taps on\r\n // the close button. This div is the last child of the wrapper, so at an equal\r\n // z-index it wins on DOM order, while portalled Radix layers (dialogs, dropdowns,\r\n // tooltips — also z-50, mounted on body) still stack above it.\r\n 'fixed inset-y-0 z-50 max-w-full overflow-hidden transition-[transform,opacity] duration-300 ease-in-out will-change-transform',\r\n infoResizing && 'select-none',\r\n openInfo\r\n ? 'translate-x-0 opacity-100'\r\n : '-translate-x-full opacity-0 pointer-events-none'\r\n )}\r\n style={{\r\n left: isMobile\r\n ? '0'\r\n : (open ? 'var(--sidebar-width)' : 'var(--sidebar-width-icon)'),\r\n // Desktop: user-resizable width (persisted).\r\n // Mobile: same drawer width as the AppSidebar sheet, so both sidebars match.\r\n width: isMobile ? SIDEBAR_WIDTH_MOBILE : infoWidth,\r\n }}\r\n >\r\n <InfoSidebar minioBaseUrl={minioBaseUrl} martinBaseUrl={martinBaseUrl} organization={organization} pointcloudApiUrl={pointcloudApiUrl} />\r\n\r\n {/* Right-edge drag handle (desktop only). Drag to resize the sidebar width. */}\r\n {canResizeInfo && (\r\n <div\r\n role=\"separator\"\r\n aria-orientation=\"vertical\"\r\n aria-label={tInfo('resizeHandleLabel')}\r\n onPointerDown={startInfoResize}\r\n style={{ touchAction: 'none' }}\r\n className=\"absolute inset-y-0 right-0 z-10 w-0.5 cursor-ew-resize bg-border/80 hover:bg-accent\"\r\n />\r\n )}\r\n </div>\r\n </div>\r\n </TooltipProvider>\r\n </SidebarContext.Provider>\r\n )\r\n },\r\n)\r\nSidebarProvider.displayName = 'SidebarProvider'\r\nconst Sidebar = React.forwardRef<\r\n HTMLDivElement,\r\n React.ComponentProps<'div'> & {\r\n side?: 'left' | 'right'\r\n variant?: 'sidebar' | 'floating' | 'inset'\r\n collapsible?: 'offcanvas' | 'icon' | 'none'\r\n }\r\n>(\r\n (\r\n {\r\n side = 'left',\r\n variant = 'sidebar',\r\n collapsible = 'offcanvas',\r\n className,\r\n children,\r\n ...props\r\n },\r\n ref,\r\n ) => {\r\n // Get auth state from MenusContext\r\n const { state, isAuthPage } = React.useContext(MenusContext)\r\n const { isMobile, sidebarState, openMobile, setOpenMobile } = useSidebar()\r\n\r\n // Translation\r\n const t = useTranslations('Sidebar')\r\n\r\n // Don't render sidebar at all for auth pages\r\n if (isAuthPage || state.menus.currentViewer === 'auth') {\r\n return null\r\n }\r\n\r\n if (collapsible === 'none') {\r\n return (\r\n <div\r\n className={cn(\r\n 'flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground',\r\n className,\r\n )}\r\n ref={ref}\r\n {...props}\r\n >\r\n {children}\r\n </div>\r\n )\r\n }\r\n\r\n if (isMobile) {\r\n return (\r\n <Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>\r\n <SheetContent\r\n data-sidebar=\"sidebar\"\r\n data-mobile=\"true\"\r\n className=\"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden\"\r\n style={\r\n {\r\n '--sidebar-width': SIDEBAR_WIDTH_MOBILE,\r\n } as React.CSSProperties\r\n }\r\n side={side}\r\n >\r\n <SheetHeader className=\"sr-only\">\r\n <SheetTitle>{t('title')}</SheetTitle>\r\n <SheetDescription>{t('description')}</SheetDescription>\r\n </SheetHeader>\r\n <div className=\"flex h-full w-full flex-col\">{children}</div>\r\n </SheetContent>\r\n </Sheet>\r\n )\r\n }\r\n\r\n return (\r\n <div\r\n ref={ref}\r\n className=\"group peer text-sidebar-foreground md:block\" // removed default hidden class\r\n data-state={sidebarState}\r\n data-collapsible={sidebarState === 'collapsed' ? collapsible : ''}\r\n data-variant={variant}\r\n data-side={side}\r\n >\r\n {/* This is what handles the sidebar gap on desktop */}\r\n <div\r\n className={cn(\r\n 'relative w-[--sidebar-width] bg-transparent transition-[width] duration-200 ease-linear',\r\n 'group-data-[collapsible=offcanvas]:w-0',\r\n 'group-data-[side=right]:rotate-180',\r\n variant === 'floating' || variant === 'inset'\r\n ? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]'\r\n : 'group-data-[collapsible=icon]:w-[--sidebar-width-icon]',\r\n )}\r\n />\r\n <div\r\n className={cn(\r\n // removed default hidden class\r\n 'fixed inset-y-0 z-10 h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear md:flex',\r\n side === 'left'\r\n ? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'\r\n : 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',\r\n // Adjust the padding for floating and inset variants.\r\n variant === 'floating' || variant === 'inset'\r\n ? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]'\r\n : 'group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l',\r\n className,\r\n )}\r\n {...props}\r\n >\r\n <div\r\n data-sidebar=\"sidebar\"\r\n className=\"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow\"\r\n >\r\n {children}\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n },\r\n)\r\nSidebar.displayName = 'Sidebar'\r\n\r\nconst SidebarTrigger = React.forwardRef<\r\n React.ElementRef<typeof Button>,\r\n React.ComponentProps<typeof Button>\r\n>(({ className, onClick, ...props }, ref) => {\r\n const { toggleMenuSidebar, geocodeEarthApiKey, geocoderUrl } = useSidebar()\r\n\r\n const { state } = React.useContext(MenusContext)\r\n const currentViewer = state.menus.currentViewer\r\n\r\n if (currentViewer === 'auth') return null\r\n\r\n // Render MenuButtons only for interactive viewers\r\n if (currentViewer === 'map' || currentViewer === 'bim' || currentViewer === 'pointcloud') {\r\n return <NavigationBar geocodeEarthApiKey={geocodeEarthApiKey} geocoderUrl={geocoderUrl} />\r\n }\r\n\r\n // Default trigger for all other content types\r\n return (\r\n <Button\r\n ref={ref}\r\n variant=\"ghost\"\r\n size=\"icon\"\r\n data-sidebar=\"trigger\"\r\n onClick={(e) => {\r\n toggleMenuSidebar()\r\n onClick?.(e)\r\n }}\r\n\r\n className={cn(\r\n '',\r\n className,\r\n 'opacity-70 hover:opacity-100 transition-opacity duration-200 hover:bg-transparent',\r\n )}\r\n {...props}\r\n >\r\n <LR.PanelLeft />\r\n <span className=\"sr-only\">Toggle Sidebar</span>\r\n </Button>\r\n )\r\n})\r\nSidebarTrigger.displayName = 'SidebarTrigger'\r\n\r\nconst SidebarRail = React.forwardRef<\r\n HTMLButtonElement,\r\n React.ComponentProps<'button'>\r\n>(({ className, ...props }, ref) => {\r\n const { toggleMenuSidebar } = useSidebar()\r\n\r\n return (\r\n <button\r\n ref={ref}\r\n data-sidebar=\"rail\"\r\n aria-label=\"Toggle Sidebar\"\r\n tabIndex={-1}\r\n onClick={toggleMenuSidebar}\r\n title=\"Toggle Sidebar\"\r\n className={cn(\r\n // removed default hidden class\r\n 'absolute inset-y-0 z-20 w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex',\r\n '[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize',\r\n '[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize',\r\n 'group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar',\r\n '[[data-side=left][data-collapsible=offcanvas]_&]:-right-2',\r\n '[[data-side=right][data-collapsible=offcanvas]_&]:-left-2',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarRail.displayName = 'SidebarRail'\r\n\r\nconst SidebarInset = React.forwardRef<\r\n HTMLDivElement,\r\n React.ComponentProps<'main'>\r\n>(({ className, ...props }, ref) => {\r\n return (\r\n <main\r\n ref={ref}\r\n className={cn(\r\n 'relative flex w-full flex-1 flex-col bg-background',\r\n 'md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarInset.displayName = 'SidebarInset'\r\n\r\nconst SidebarInput = React.forwardRef<\r\n React.ElementRef<typeof Input>,\r\n React.ComponentProps<typeof Input>\r\n>(({ className, ...props }, ref) => {\r\n return (\r\n <Input\r\n ref={ref}\r\n data-sidebar=\"input\"\r\n className={cn(\r\n 'h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarInput.displayName = 'SidebarInput'\r\n\r\nconst SidebarHeader = React.forwardRef<\r\n HTMLDivElement,\r\n React.ComponentProps<'div'>\r\n>(({ className, ...props }, ref) => {\r\n return (\r\n <div\r\n ref={ref}\r\n data-sidebar=\"header\"\r\n className={cn('flex flex-col gap-2 p-2', className)}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarHeader.displayName = 'SidebarHeader'\r\n\r\nconst SidebarFooter = React.forwardRef<\r\n HTMLDivElement,\r\n React.ComponentProps<'div'>\r\n>(({ className, ...props }, ref) => {\r\n return (\r\n <div\r\n ref={ref}\r\n data-sidebar=\"footer\"\r\n className={cn('flex flex-col gap-2 p-2', className)}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarFooter.displayName = 'SidebarFooter'\r\n\r\nconst SidebarSeparator = React.forwardRef<\r\n React.ElementRef<typeof Separator>,\r\n React.ComponentProps<typeof Separator>\r\n>(({ className, ...props }, ref) => {\r\n return (\r\n <Separator\r\n ref={ref}\r\n data-sidebar=\"separator\"\r\n className={cn('mx-2 w-auto bg-sidebar-border', className)}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarSeparator.displayName = 'SidebarSeparator'\r\n\r\nconst SidebarContent = React.forwardRef<\r\n HTMLDivElement,\r\n React.ComponentProps<'div'>\r\n>(({ className, ...props }, ref) => {\r\n return (\r\n <div\r\n ref={ref}\r\n data-sidebar=\"content\"\r\n className={cn(\r\n 'flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarContent.displayName = 'SidebarContent'\r\n\r\nconst SidebarGroup = React.forwardRef<\r\n HTMLDivElement,\r\n React.ComponentProps<'div'>\r\n>(({ className, ...props }, ref) => {\r\n return (\r\n <div\r\n ref={ref}\r\n data-sidebar=\"group\"\r\n className={cn('relative flex w-full min-w-0 flex-col p-2', className)}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarGroup.displayName = 'SidebarGroup'\r\n\r\nconst SidebarGroupLabel = React.forwardRef<\r\n HTMLDivElement,\r\n React.ComponentProps<'div'> & { asChild?: boolean }\r\n>(({ className, asChild = false, ...props }, ref) => {\r\n const Comp = asChild ? Slot : 'div'\r\n\r\n return (\r\n <Comp\r\n ref={ref}\r\n data-sidebar=\"group-label\"\r\n className={cn(\r\n 'flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',\r\n 'group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarGroupLabel.displayName = 'SidebarGroupLabel'\r\n\r\nconst SidebarGroupAction = React.forwardRef<\r\n HTMLButtonElement,\r\n React.ComponentProps<'button'> & { asChild?: boolean }\r\n>(({ className, asChild = false, ...props }, ref) => {\r\n const Comp = asChild ? Slot : 'button'\r\n\r\n return (\r\n <Comp\r\n ref={ref}\r\n data-sidebar=\"group-action\"\r\n className={cn(\r\n 'absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',\r\n // Increases the hit area of the button on mobile.\r\n 'after:absolute after:-inset-2 after:md:hidden',\r\n 'group-data-[collapsible=icon]:hidden',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarGroupAction.displayName = 'SidebarGroupAction'\r\n\r\nconst SidebarGroupContent = React.forwardRef<\r\n HTMLDivElement,\r\n React.ComponentProps<'div'>\r\n>(({ className, ...props }, ref) => (\r\n <div\r\n ref={ref}\r\n data-sidebar=\"group-content\"\r\n className={cn('w-full text-sm', className)}\r\n {...props}\r\n />\r\n))\r\nSidebarGroupContent.displayName = 'SidebarGroupContent'\r\n\r\nconst SidebarMenu = React.forwardRef<\r\n HTMLUListElement,\r\n React.ComponentProps<'ul'>\r\n>(({ className, ...props }, ref) => (\r\n <ul\r\n ref={ref}\r\n data-sidebar=\"menu\"\r\n className={cn('flex w-full min-w-0 flex-col gap-1', className)}\r\n {...props}\r\n />\r\n))\r\nSidebarMenu.displayName = 'SidebarMenu'\r\n\r\nconst SidebarMenuItem = React.forwardRef<\r\n HTMLLIElement,\r\n React.ComponentProps<'li'>\r\n>(({ className, ...props }, ref) => (\r\n <li\r\n ref={ref}\r\n data-sidebar=\"menu-item\"\r\n className={cn('group/menu-item relative', className)}\r\n {...props}\r\n />\r\n))\r\nSidebarMenuItem.displayName = 'SidebarMenuItem'\r\n\r\nconst sidebarMenuButtonVariants = cva(\r\n 'peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',\r\n {\r\n variants: {\r\n variant: {\r\n default: 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',\r\n outline:\r\n 'bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]',\r\n },\r\n size: {\r\n default: 'h-8 text-sm',\r\n sm: 'h-7 text-xs',\r\n lg: 'h-12 text-sm group-data-[collapsible=icon]:!p-0',\r\n },\r\n },\r\n defaultVariants: {\r\n variant: 'default',\r\n size: 'default',\r\n },\r\n },\r\n)\r\n\r\nconst SidebarMenuButton = React.forwardRef<\r\n HTMLButtonElement,\r\n React.ComponentProps<'button'> & {\r\n asChild?: boolean\r\n isActive?: boolean\r\n tooltip?: string | React.ComponentProps<typeof TooltipContent>\r\n } & VariantProps<typeof sidebarMenuButtonVariants>\r\n>(\r\n (\r\n {\r\n asChild = false,\r\n isActive = false,\r\n variant = 'default',\r\n size = 'default',\r\n tooltip,\r\n className,\r\n ...props\r\n },\r\n ref,\r\n ) => {\r\n const Comp = asChild ? Slot : 'button'\r\n const { isMobile, sidebarState } = useSidebar()\r\n\r\n const button = (\r\n <Comp\r\n ref={ref}\r\n data-sidebar=\"menu-button\"\r\n data-size={size}\r\n data-active={isActive}\r\n className={cn(sidebarMenuButtonVariants({ variant, size }), className)}\r\n {...props}\r\n />\r\n )\r\n\r\n if (!tooltip) {\r\n return button\r\n }\r\n\r\n if (typeof tooltip === 'string') {\r\n tooltip = {\r\n children: tooltip,\r\n }\r\n }\r\n\r\n return (\r\n <Tooltip>\r\n <TooltipTrigger asChild>{button}</TooltipTrigger>\r\n <TooltipContent\r\n side=\"right\"\r\n align=\"center\"\r\n hidden={sidebarState !== 'collapsed' || isMobile}\r\n {...tooltip}\r\n />\r\n </Tooltip>\r\n )\r\n },\r\n)\r\nSidebarMenuButton.displayName = 'SidebarMenuButton'\r\n\r\nconst SidebarMenuAction = React.forwardRef<\r\n HTMLButtonElement,\r\n React.ComponentProps<'button'> & {\r\n asChild?: boolean\r\n showOnHover?: boolean\r\n }\r\n>(({ className, asChild = false, showOnHover = false, ...props }, ref) => {\r\n const Comp = asChild ? Slot : 'button'\r\n\r\n return (\r\n <Comp\r\n ref={ref}\r\n data-sidebar=\"menu-action\"\r\n className={cn(\r\n 'absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0',\r\n // Increases the hit area of the button on mobile.\r\n 'after:absolute after:-inset-2 after:md:hidden',\r\n 'peer-data-[size=sm]/menu-button:top-1',\r\n 'peer-data-[size=default]/menu-button:top-1.5',\r\n 'peer-data-[size=lg]/menu-button:top-2.5',\r\n 'group-data-[collapsible=icon]:hidden',\r\n showOnHover\r\n && 'group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarMenuAction.displayName = 'SidebarMenuAction'\r\n\r\nconst SidebarMenuBadge = React.forwardRef<\r\n HTMLDivElement,\r\n React.ComponentProps<'div'>\r\n>(({ className, ...props }, ref) => (\r\n <div\r\n ref={ref}\r\n data-sidebar=\"menu-badge\"\r\n className={cn(\r\n 'pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground',\r\n 'peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground',\r\n 'peer-data-[size=sm]/menu-button:top-1',\r\n 'peer-data-[size=default]/menu-button:top-1.5',\r\n 'peer-data-[size=lg]/menu-button:top-2.5',\r\n 'group-data-[collapsible=icon]:hidden',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n))\r\nSidebarMenuBadge.displayName = 'SidebarMenuBadge'\r\n\r\nconst SidebarMenuSkeleton = React.forwardRef<\r\n HTMLDivElement,\r\n React.ComponentProps<'div'> & {\r\n showIcon?: boolean\r\n }\r\n>(({ className, showIcon = false, ...props }, ref) => {\r\n // Random width between 50 to 90%.\r\n const width = React.useMemo(() => {\r\n return `${Math.floor(Math.random() * 40) + 50}%`\r\n }, [])\r\n\r\n return (\r\n <div\r\n ref={ref}\r\n data-sidebar=\"menu-skeleton\"\r\n className={cn('flex h-8 items-center gap-2 rounded-md px-2', className)}\r\n {...props}\r\n >\r\n {showIcon && (\r\n <Skeleton\r\n className=\"size-4 rounded-md\"\r\n data-sidebar=\"menu-skeleton-icon\"\r\n />\r\n )}\r\n <Skeleton\r\n className=\"h-4 max-w-[--skeleton-width] flex-1\"\r\n data-sidebar=\"menu-skeleton-text\"\r\n style={\r\n {\r\n '--skeleton-width': width,\r\n } as React.CSSProperties\r\n }\r\n />\r\n </div>\r\n )\r\n})\r\nSidebarMenuSkeleton.displayName = 'SidebarMenuSkeleton'\r\n\r\nconst SidebarMenuSub = React.forwardRef<\r\n HTMLUListElement,\r\n React.ComponentProps<'ul'>\r\n>(({ className, ...props }, ref) => (\r\n <ul\r\n ref={ref}\r\n data-sidebar=\"menu-sub\"\r\n className={cn(\r\n 'mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5',\r\n 'group-data-[collapsible=icon]:hidden',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n))\r\nSidebarMenuSub.displayName = 'SidebarMenuSub'\r\n\r\nconst SidebarMenuSubItem = React.forwardRef<\r\n HTMLLIElement,\r\n React.ComponentProps<'li'>\r\n>(({ ...props }, ref) => <li ref={ref} {...props} />)\r\nSidebarMenuSubItem.displayName = 'SidebarMenuSubItem'\r\n\r\nconst SidebarMenuSubButton = React.forwardRef<\r\n HTMLAnchorElement,\r\n React.ComponentProps<'a'> & {\r\n asChild?: boolean\r\n size?: 'sm' | 'md'\r\n isActive?: boolean\r\n }\r\n>(({ asChild = false, size = 'md', isActive, className, ...props }, ref) => {\r\n const Comp = asChild ? Slot : 'a'\r\n\r\n return (\r\n <Comp\r\n ref={ref}\r\n data-sidebar=\"menu-sub-button\"\r\n data-size={size}\r\n data-active={isActive}\r\n className={cn(\r\n 'flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground',\r\n 'data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground',\r\n size === 'sm' && 'text-xs',\r\n size === 'md' && 'text-sm',\r\n 'group-data-[collapsible=icon]:hidden',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n )\r\n})\r\nSidebarMenuSubButton.displayName = 'SidebarMenuSubButton'\r\n\r\nexport {\r\n Sidebar,\r\n SidebarContent,\r\n SidebarFooter,\r\n SidebarGroup,\r\n SidebarGroupAction,\r\n SidebarGroupContent,\r\n SidebarGroupLabel,\r\n SidebarHeader,\r\n SidebarInput,\r\n SidebarInset,\r\n SidebarMenu,\r\n SidebarMenuAction,\r\n SidebarMenuBadge,\r\n SidebarMenuButton,\r\n SidebarMenuItem,\r\n SidebarMenuSkeleton,\r\n SidebarMenuSub,\r\n SidebarMenuSubButton,\r\n SidebarMenuSubItem,\r\n SidebarProvider,\r\n Sidebar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C,uBAAG,OAAc,MAAO;AAAA,CAAE;AACpD,mBAAmB,cAAc;AAEjC,MAAM,uBAAuB,MAAM,WAOjC,CAAC,IAAiE,QAAQ;AAAzE,eAAE,YAAU,OAAO,OAAO,MAAM,UAAU,UAx3B7C,IAw3BG,IAAwD,kBAAxD,IAAwD,CAAtD,WAAiB,QAAa,YAAU;AAC3C,QAAM,OAAO,UAAU,OAAO;AAE9B,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,gBAAa;AAAA,MACb,aAAW;AAAA,MACX,eAAa;AAAA,MACb,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA,SAAS,QAAQ;AAAA,QACjB,SAAS,QAAQ;AAAA,QACjB;AAAA,QACA;AAAA,MACF;AAAA,OACI;AAAA,EACN;AAEJ,CAAC;AACD,qBAAqB,cAAc;","names":["open"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PointCloudViewer.d.ts","sourceRoot":"","sources":["../../../../../src/core/components/viewers/pointcloud/PointCloudViewer.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAmB/B,wBAAgB,gBAAgB,CAAC,EAAE,gBAAgB,EAAE,EAAE;IAAE,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"PointCloudViewer.d.ts","sourceRoot":"","sources":["../../../../../src/core/components/viewers/pointcloud/PointCloudViewer.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAmB/B,wBAAgB,gBAAgB,CAAC,EAAE,gBAAgB,EAAE,EAAE;IAAE,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE,qBA0PnF"}
|
|
@@ -171,7 +171,11 @@ function PointCloudViewer({ pointcloudApiUrl }) {
|
|
|
171
171
|
left: 0,
|
|
172
172
|
top: 0,
|
|
173
173
|
width: "100%",
|
|
174
|
-
height: "100%"
|
|
174
|
+
height: "100%",
|
|
175
|
+
// Clip everything the viewer paints. Without this, anything that
|
|
176
|
+
// momentarily exceeds these bounds (see the container below) leaks into
|
|
177
|
+
// the app's `overflow-auto` main element and makes the page scrollable.
|
|
178
|
+
overflow: "hidden"
|
|
175
179
|
},
|
|
176
180
|
children: [
|
|
177
181
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -194,12 +198,24 @@ function PointCloudViewer({ pointcloudApiUrl }) {
|
|
|
194
198
|
style: {
|
|
195
199
|
position: "absolute",
|
|
196
200
|
inset: 0,
|
|
197
|
-
backgroundSize: "cover"
|
|
201
|
+
backgroundSize: "cover",
|
|
202
|
+
// Potree sizes its canvas from renderArea.clientWidth/Height inside its
|
|
203
|
+
// own render loop, so the canvas trails the container by a frame. On
|
|
204
|
+
// mobile the visible viewport keeps changing as the browser toolbar
|
|
205
|
+
// slides, so the stale (larger) absolutely positioned canvas escaped
|
|
206
|
+
// this container, made the page scrollable, which slid the toolbar
|
|
207
|
+
// again — an endless scroll/shake loop. Upstream avoids it via
|
|
208
|
+
// `#potree_render_area { overflow: hidden }`, but we never load
|
|
209
|
+
// potree.css (see loadAllAssets), so clip it here.
|
|
210
|
+
overflow: "hidden",
|
|
211
|
+
// Touch drags belong to the camera, not to the page scroller.
|
|
212
|
+
touchAction: "none",
|
|
213
|
+
overscrollBehavior: "none"
|
|
198
214
|
}
|
|
199
215
|
}
|
|
200
216
|
)
|
|
201
217
|
] }),
|
|
202
|
-
!hasPointCloudFiles && !hasLoadedClouds && /* @__PURE__ */ jsx("div", { className: "absolute inset-0", style: { zIndex: 10 }, children: /* @__PURE__ */ jsx(PointCloudLoadingState, { pointcloudApiUrl }) })
|
|
218
|
+
!hasPointCloudFiles && !hasLoadedClouds && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 overflow-y-auto overscroll-contain", style: { zIndex: 10 }, children: /* @__PURE__ */ jsx(PointCloudLoadingState, { pointcloudApiUrl }) })
|
|
203
219
|
]
|
|
204
220
|
}
|
|
205
221
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/core/components/viewers/pointcloud/PointCloudViewer.tsx"],"sourcesContent":["\"use client\"\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport { useSearchParams } from \"next/navigation\";\r\nimport * as React from \"react\";\r\nimport * as THREE from \"three\";\r\n\r\nimport { useFilesByBuildingId } from '../../../hooks/files/files'\r\nimport { BuildingsContext, PointCloudContext } from '../../../store'\r\nimport { usePointCloudCoordinateSystem } from '../useCoordinateSystem';\r\n\r\nimport { PointCloudLoadingState } from \"./src/PointCloudLoadingState\";\r\nimport { ViewportGizmo } from './src/ViewportGizmo';\r\nimport { loadAllAssets } from \"./utils/potreeLoader\";\r\n\r\n\r\n// import { useAppConfigContext } from '../../../store/AppConfig/context'\r\nimport { restoreCameraFromUrl } from \"./utils/restoreCameraFromUrl\";\r\n\r\n\r\n\r\n\r\n\r\nexport function PointCloudViewer({ pointcloudApiUrl }: { pointcloudApiUrl?: string }) {\r\n // Enforce Z-up coordinate system for Potree. Resets to Y-up on unmount\r\n // so the BIM viewer doesn't inherit Z-up when switching viewers.\r\n usePointCloudCoordinateSystem();\r\n const API_BASE = pointcloudApiUrl ?? 'http://localhost:5101'\r\n\r\n const containerRef = React.useRef<HTMLDivElement>(null);\r\n const viewerRef = React.useRef<any | null>(null);\r\n const gizmoRef = React.useRef<ViewportGizmo | null>(null);\r\n // Tracks Potree point cloud objects keyed by point cloud ID\r\n const loadedCloudsRef = React.useRef<Map<string, any>>(new Map());\r\n // IDs currently being fetched/loaded — prevents duplicate loads while async is in-flight\r\n const pendingIdsRef = React.useRef<Set<string>>(new Set());\r\n const cameraRestoredRef = React.useRef(false);\r\n\r\n const { state: pointCloudState, dispatch: pointCloudDispatch } = React.useContext(PointCloudContext)\r\n const PointCloudGlobalState = pointCloudState.pointcloud\r\n\r\n const { state: buildingState } = React.useContext(BuildingsContext)\r\n const { building } = buildingState.buildings\r\n\r\n const searchParams = useSearchParams()\r\n\r\n // Get files for the building to check if there are LAZ/LAS files\r\n const { files, isError: filesError } = useFilesByBuildingId(building?.id)\r\n const hasPointCloudFiles = React.useMemo(() =>\r\n !filesError && files.some(file => {\r\n const ext = file.extension?.toLowerCase()\r\n if (!ext) return false\r\n return ext === \"laz\" || ext === \"las\"\r\n }),\r\n [files, filesError])\r\n\r\n // --- Load CSS/JS assets once\r\n React.useEffect(() => {\r\n (async () => {\r\n try {\r\n await loadAllAssets()\r\n pointCloudDispatch({ type: \"SET_READY\", payload: { ready: true } })\r\n }\r\n catch (err) {\r\n console.error(\"PointCloudViewer - Failed to load assets\", err)\r\n }\r\n })();\r\n }, []);\r\n\r\n // --- Init viewer once when ready. Separate from cloud loading so the viewer\r\n // persists across toggle on/off of individual point clouds.\r\n React.useEffect(() => {\r\n if (!PointCloudGlobalState.ready || !containerRef.current || !(window as any)?.Potree) return;\r\n\r\n const Potree = (window as any).Potree;\r\n const el = containerRef.current;\r\n\r\n // Clear tracking state since we're creating a fresh viewer\r\n loadedCloudsRef.current.clear();\r\n pendingIdsRef.current.clear();\r\n cameraRestoredRef.current = false;\r\n\r\n const viewer = new Potree.Viewer(el);\r\n viewerRef.current = viewer;\r\n\r\n viewer.setEDLEnabled(true);\r\n viewer.setFOV(60);\r\n viewer.setPointBudget(10_000_000);\r\n viewer.loadSettingsFromURL();\r\n viewer.setBackground(\"white\");\r\n\r\n const gizmo = new ViewportGizmo(viewer);\r\n gizmoRef.current = gizmo;\r\n gizmo.enabled = true;\r\n\r\n pointCloudDispatch({\r\n type: \"INIT\",\r\n payload: {\r\n initialState: {\r\n ready: true,\r\n viewer: viewerRef.current,\r\n }\r\n }\r\n })\r\n\r\n return () => {\r\n try {\r\n if (gizmoRef.current) {\r\n gizmoRef.current.dispose();\r\n gizmoRef.current = null;\r\n }\r\n const v = viewerRef.current;\r\n // Potree's render loop re-schedules itself via requestAnimationFrame with no stop API;\r\n // shadow it with a no-op so it halts on unmount instead of running forever against a\r\n // disposed renderer (otherwise a new loop accumulates on every visit).\r\n if (v) {\r\n v.loop = () => { };\r\n v.update = () => { };\r\n }\r\n if (v?.scene?.pointclouds) {\r\n v.scene.pointclouds.forEach((pc: any) => {\r\n v.scene.removePointCloud?.(pc) ?? v.scene.scene?.remove?.(pc);\r\n });\r\n }\r\n v?.renderer?.dispose?.();\r\n } catch { }\r\n loadedCloudsRef.current.clear();\r\n pendingIdsRef.current.clear();\r\n viewerRef.current = null;\r\n el.innerHTML = \"\";\r\n };\r\n }, [PointCloudGlobalState.ready]);\r\n\r\n // --- Add/remove point clouds whenever loadedPointCloudIds changes or the\r\n // viewer is (re)initialized (PointCloudGlobalState.viewer updates on INIT).\r\n React.useEffect(() => {\r\n const viewer = viewerRef.current;\r\n if (!PointCloudGlobalState.ready || !viewer) return;\r\n\r\n const Potree = (window as any).Potree;\r\n if (!Potree) return;\r\n\r\n const currentIds = new Set(PointCloudGlobalState.loadedPointCloudIds);\r\n const alreadyLoadedIds = new Set(loadedCloudsRef.current.keys());\r\n\r\n // Remove point clouds no longer in the list.\r\n // Potree classic has no removePointCloud() — splice from the internal\r\n // pointclouds array and remove from the Three.js scene separately.\r\n for (const id of alreadyLoadedIds) {\r\n if (!currentIds.has(id)) {\r\n const pc = loadedCloudsRef.current.get(id);\r\n if (pc) {\r\n try {\r\n const pcs: any[] = viewer.scene.pointclouds ?? [];\r\n const idx = pcs.indexOf(pc);\r\n if (idx !== -1) pcs.splice(idx, 1);\r\n viewer.scene.scene?.remove(pc);\r\n } catch { }\r\n loadedCloudsRef.current.delete(id);\r\n pendingIdsRef.current.delete(id);\r\n try { viewer.fitToScreen(); } catch { }\r\n }\r\n }\r\n }\r\n\r\n // Add newly requested point clouds.\r\n // Skip if already tracked in loadedCloudsRef OR still in-flight in pendingIdsRef\r\n // — prevents duplicate loads when Effect 2 fires again before the callback runs.\r\n for (const id of currentIds) {\r\n if (alreadyLoadedIds.has(id) || pendingIdsRef.current.has(id)) continue;\r\n\r\n pendingIdsRef.current.add(id);\r\n ; (async () => {\r\n try {\r\n const res = await fetch(`${API_BASE}/point-cloud/${encodeURIComponent(id)}`);\r\n const data = await res.json();\r\n const url = `${API_BASE}/private/${data.bucket}/${data.potreeMetadataFileKey}`;\r\n\r\n Potree.loadPointCloud(url, id, (e: any) => {\r\n pendingIdsRef.current.delete(id);\r\n // Bail if the viewer was torn down (or re-init'd) while this load was in flight —\r\n // the init-effect cleanup nulls viewerRef, so this guard avoids attaching to a dead viewer.\r\n if (viewerRef.current !== viewer) return;\r\n try {\r\n viewer.scene.addPointCloud(e.pointcloud);\r\n loadedCloudsRef.current.set(id, e.pointcloud);\r\n\r\n const mat = e.pointcloud.material;\r\n mat.size = 1;\r\n mat.pointSizeType = Potree.PointSizeType.ADAPTIVE;\r\n\r\n const restored = !cameraRestoredRef.current && restoreCameraFromUrl(viewer, searchParams)\r\n cameraRestoredRef.current = true;\r\n if (!restored) viewer.fitToScreen();\r\n\r\n if (gizmoRef.current) {\r\n gizmoRef.current.add();\r\n }\r\n } catch (err) {\r\n console.error(\"[PointCloudViewer] Error adding point cloud\", err);\r\n }\r\n });\r\n } catch (err) {\r\n pendingIdsRef.current.delete(id);\r\n console.error(\"[PointCloudViewer] Error fetching point cloud metadata\", err);\r\n }\r\n })();\r\n }\r\n }, [PointCloudGlobalState.loadedPointCloudIds, PointCloudGlobalState.viewer, PointCloudGlobalState.ready]);\r\n\r\n const { loadedPointCloudIds } = PointCloudGlobalState;\r\n const hasLoadedClouds = loadedPointCloudIds.length > 0;\r\n\r\n return (\r\n <div\r\n style={{\r\n position: \"absolute\",\r\n left: 0,\r\n top: 0,\r\n width: \"100%\",\r\n height: \"100%\",\r\n }}\r\n >\r\n {/* Potree container — always rendered so the viewer can measure its dimensions on init.\r\n PointCloudLoadingState sits above it via z-index when no clouds are loaded. */}\r\n <div>\r\n <div\r\n className={`pointer-events-none absolute inset-0 `}\r\n style={{\r\n zIndex: 9,\r\n background: 'radial-gradient(circle at center, rgba(220,220,220,0) 0%, rgba(220,220,220,0) 50%, rgba(220,220,220,0.9) 100%)',\r\n mixBlendMode: 'multiply'\r\n }}\r\n />\r\n <div\r\n ref={containerRef}\r\n className=\"potree_container\"\r\n style={{\r\n position: \"absolute\",\r\n inset: 0,\r\n backgroundSize: \"cover\",\r\n }}\r\n />\r\n </div>\r\n\r\n {/* Show PointCloudLoadingState only when there are no point cloud files uploaded at all.\r\n Rendered after the container so it layers on top (higher DOM order = higher paint order). */}\r\n {!hasPointCloudFiles && !hasLoadedClouds && (\r\n <div className=\"absolute inset-0\" style={{ zIndex: 10 }}>\r\n <PointCloudLoadingState pointcloudApiUrl={pointcloudApiUrl} />\r\n </div>\r\n )}\r\n </div>\r\n );\r\n}\r\n"],"mappings":";AAmOM,SACE,KADF;AA9NN,SAAS,uBAAuB;AAChC,YAAY,WAAW;AAGvB,SAAS,4BAA4B;AACrC,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,qCAAqC;AAE9C,SAAS,8BAA8B;AACvC,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAI9B,SAAS,4BAA4B;AAM9B,SAAS,iBAAiB,EAAE,iBAAiB,GAAkC;AAGpF,gCAA8B;AAC9B,QAAM,WAAW,8CAAoB;AAErC,QAAM,eAAe,MAAM,OAAuB,IAAI;AACtD,QAAM,YAAY,MAAM,OAAmB,IAAI;AAC/C,QAAM,WAAW,MAAM,OAA6B,IAAI;AAExD,QAAM,kBAAkB,MAAM,OAAyB,oBAAI,IAAI,CAAC;AAEhE,QAAM,gBAAgB,MAAM,OAAoB,oBAAI,IAAI,CAAC;AACzD,QAAM,oBAAoB,MAAM,OAAO,KAAK;AAE5C,QAAM,EAAE,OAAO,iBAAiB,UAAU,mBAAmB,IAAI,MAAM,WAAW,iBAAiB;AACnG,QAAM,wBAAwB,gBAAgB;AAE9C,QAAM,EAAE,OAAO,cAAc,IAAI,MAAM,WAAW,gBAAgB;AAClE,QAAM,EAAE,SAAS,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AAAA,QACH,SAAS,KAAK;AACZ,wBAAc,QAAQ,OAAO,EAAE;AAC/B,kBAAQ,MAAM,0DAA0D,GAAG;AAAA,QAC7E;AAAA,MACF,GAAG;AAAA,IACL;AAAA,EACF,GAAG,CAAC,sBAAsB,qBAAqB,sBAAsB,QAAQ,sBAAsB,KAAK,CAAC;AAEzG,QAAM,EAAE,oBAAoB,IAAI;AAChC,QAAM,kBAAkB,oBAAoB,SAAS;AAErD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,QACL,UAAU;AAAA,QACV,MAAM;AAAA,QACN,KAAK;AAAA,QACL,OAAO;AAAA,QACP,QAAQ;AAAA,MACV;AAAA,MAIA;AAAA,6BAAC,SACC;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,WAAW;AAAA,cACX,OAAO;AAAA,gBACL,QAAQ;AAAA,gBACR,YAAY;AAAA,gBACZ,cAAc;AAAA,cAChB;AAAA;AAAA,UACF;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,KAAK;AAAA,cACL,WAAU;AAAA,cACV,OAAO;AAAA,gBACL,UAAU;AAAA,gBACV,OAAO;AAAA,gBACP,gBAAgB;AAAA,cAClB;AAAA;AAAA,UACF;AAAA,WACF;AAAA,QAIC,CAAC,sBAAsB,CAAC,mBACvB,oBAAC,SAAI,WAAU,oBAAmB,OAAO,EAAE,QAAQ,GAAG,GACpD,8BAAC,0BAAuB,kBAAoC,GAC9D;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":["_a","_b","_c"]}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/core/components/viewers/pointcloud/PointCloudViewer.tsx"],"sourcesContent":["\"use client\"\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport { useSearchParams } from \"next/navigation\";\r\nimport * as React from \"react\";\r\nimport * as THREE from \"three\";\r\n\r\nimport { useFilesByBuildingId } from '../../../hooks/files/files'\r\nimport { BuildingsContext, PointCloudContext } from '../../../store'\r\nimport { usePointCloudCoordinateSystem } from '../useCoordinateSystem';\r\n\r\nimport { PointCloudLoadingState } from \"./src/PointCloudLoadingState\";\r\nimport { ViewportGizmo } from './src/ViewportGizmo';\r\nimport { loadAllAssets } from \"./utils/potreeLoader\";\r\n\r\n\r\n// import { useAppConfigContext } from '../../../store/AppConfig/context'\r\nimport { restoreCameraFromUrl } from \"./utils/restoreCameraFromUrl\";\r\n\r\n\r\n\r\n\r\n\r\nexport function PointCloudViewer({ pointcloudApiUrl }: { pointcloudApiUrl?: string }) {\r\n // Enforce Z-up coordinate system for Potree. Resets to Y-up on unmount\r\n // so the BIM viewer doesn't inherit Z-up when switching viewers.\r\n usePointCloudCoordinateSystem();\r\n const API_BASE = pointcloudApiUrl ?? 'http://localhost:5101'\r\n\r\n const containerRef = React.useRef<HTMLDivElement>(null);\r\n const viewerRef = React.useRef<any | null>(null);\r\n const gizmoRef = React.useRef<ViewportGizmo | null>(null);\r\n // Tracks Potree point cloud objects keyed by point cloud ID\r\n const loadedCloudsRef = React.useRef<Map<string, any>>(new Map());\r\n // IDs currently being fetched/loaded — prevents duplicate loads while async is in-flight\r\n const pendingIdsRef = React.useRef<Set<string>>(new Set());\r\n const cameraRestoredRef = React.useRef(false);\r\n\r\n const { state: pointCloudState, dispatch: pointCloudDispatch } = React.useContext(PointCloudContext)\r\n const PointCloudGlobalState = pointCloudState.pointcloud\r\n\r\n const { state: buildingState } = React.useContext(BuildingsContext)\r\n const { building } = buildingState.buildings\r\n\r\n const searchParams = useSearchParams()\r\n\r\n // Get files for the building to check if there are LAZ/LAS files\r\n const { files, isError: filesError } = useFilesByBuildingId(building?.id)\r\n const hasPointCloudFiles = React.useMemo(() =>\r\n !filesError && files.some(file => {\r\n const ext = file.extension?.toLowerCase()\r\n if (!ext) return false\r\n return ext === \"laz\" || ext === \"las\"\r\n }),\r\n [files, filesError])\r\n\r\n // --- Load CSS/JS assets once\r\n React.useEffect(() => {\r\n (async () => {\r\n try {\r\n await loadAllAssets()\r\n pointCloudDispatch({ type: \"SET_READY\", payload: { ready: true } })\r\n }\r\n catch (err) {\r\n console.error(\"PointCloudViewer - Failed to load assets\", err)\r\n }\r\n })();\r\n }, []);\r\n\r\n // --- Init viewer once when ready. Separate from cloud loading so the viewer\r\n // persists across toggle on/off of individual point clouds.\r\n React.useEffect(() => {\r\n if (!PointCloudGlobalState.ready || !containerRef.current || !(window as any)?.Potree) return;\r\n\r\n const Potree = (window as any).Potree;\r\n const el = containerRef.current;\r\n\r\n // Clear tracking state since we're creating a fresh viewer\r\n loadedCloudsRef.current.clear();\r\n pendingIdsRef.current.clear();\r\n cameraRestoredRef.current = false;\r\n\r\n const viewer = new Potree.Viewer(el);\r\n viewerRef.current = viewer;\r\n\r\n viewer.setEDLEnabled(true);\r\n viewer.setFOV(60);\r\n viewer.setPointBudget(10_000_000);\r\n viewer.loadSettingsFromURL();\r\n viewer.setBackground(\"white\");\r\n\r\n const gizmo = new ViewportGizmo(viewer);\r\n gizmoRef.current = gizmo;\r\n gizmo.enabled = true;\r\n\r\n pointCloudDispatch({\r\n type: \"INIT\",\r\n payload: {\r\n initialState: {\r\n ready: true,\r\n viewer: viewerRef.current,\r\n }\r\n }\r\n })\r\n\r\n return () => {\r\n try {\r\n if (gizmoRef.current) {\r\n gizmoRef.current.dispose();\r\n gizmoRef.current = null;\r\n }\r\n const v = viewerRef.current;\r\n // Potree's render loop re-schedules itself via requestAnimationFrame with no stop API;\r\n // shadow it with a no-op so it halts on unmount instead of running forever against a\r\n // disposed renderer (otherwise a new loop accumulates on every visit).\r\n if (v) {\r\n v.loop = () => { };\r\n v.update = () => { };\r\n }\r\n if (v?.scene?.pointclouds) {\r\n v.scene.pointclouds.forEach((pc: any) => {\r\n v.scene.removePointCloud?.(pc) ?? v.scene.scene?.remove?.(pc);\r\n });\r\n }\r\n v?.renderer?.dispose?.();\r\n } catch { }\r\n loadedCloudsRef.current.clear();\r\n pendingIdsRef.current.clear();\r\n viewerRef.current = null;\r\n el.innerHTML = \"\";\r\n };\r\n }, [PointCloudGlobalState.ready]);\r\n\r\n // --- Add/remove point clouds whenever loadedPointCloudIds changes or the\r\n // viewer is (re)initialized (PointCloudGlobalState.viewer updates on INIT).\r\n React.useEffect(() => {\r\n const viewer = viewerRef.current;\r\n if (!PointCloudGlobalState.ready || !viewer) return;\r\n\r\n const Potree = (window as any).Potree;\r\n if (!Potree) return;\r\n\r\n const currentIds = new Set(PointCloudGlobalState.loadedPointCloudIds);\r\n const alreadyLoadedIds = new Set(loadedCloudsRef.current.keys());\r\n\r\n // Remove point clouds no longer in the list.\r\n // Potree classic has no removePointCloud() — splice from the internal\r\n // pointclouds array and remove from the Three.js scene separately.\r\n for (const id of alreadyLoadedIds) {\r\n if (!currentIds.has(id)) {\r\n const pc = loadedCloudsRef.current.get(id);\r\n if (pc) {\r\n try {\r\n const pcs: any[] = viewer.scene.pointclouds ?? [];\r\n const idx = pcs.indexOf(pc);\r\n if (idx !== -1) pcs.splice(idx, 1);\r\n viewer.scene.scene?.remove(pc);\r\n } catch { }\r\n loadedCloudsRef.current.delete(id);\r\n pendingIdsRef.current.delete(id);\r\n try { viewer.fitToScreen(); } catch { }\r\n }\r\n }\r\n }\r\n\r\n // Add newly requested point clouds.\r\n // Skip if already tracked in loadedCloudsRef OR still in-flight in pendingIdsRef\r\n // — prevents duplicate loads when Effect 2 fires again before the callback runs.\r\n for (const id of currentIds) {\r\n if (alreadyLoadedIds.has(id) || pendingIdsRef.current.has(id)) continue;\r\n\r\n pendingIdsRef.current.add(id);\r\n ; (async () => {\r\n try {\r\n const res = await fetch(`${API_BASE}/point-cloud/${encodeURIComponent(id)}`);\r\n const data = await res.json();\r\n const url = `${API_BASE}/private/${data.bucket}/${data.potreeMetadataFileKey}`;\r\n\r\n Potree.loadPointCloud(url, id, (e: any) => {\r\n pendingIdsRef.current.delete(id);\r\n // Bail if the viewer was torn down (or re-init'd) while this load was in flight —\r\n // the init-effect cleanup nulls viewerRef, so this guard avoids attaching to a dead viewer.\r\n if (viewerRef.current !== viewer) return;\r\n try {\r\n viewer.scene.addPointCloud(e.pointcloud);\r\n loadedCloudsRef.current.set(id, e.pointcloud);\r\n\r\n const mat = e.pointcloud.material;\r\n mat.size = 1;\r\n mat.pointSizeType = Potree.PointSizeType.ADAPTIVE;\r\n\r\n const restored = !cameraRestoredRef.current && restoreCameraFromUrl(viewer, searchParams)\r\n cameraRestoredRef.current = true;\r\n if (!restored) viewer.fitToScreen();\r\n\r\n if (gizmoRef.current) {\r\n gizmoRef.current.add();\r\n }\r\n } catch (err) {\r\n console.error(\"[PointCloudViewer] Error adding point cloud\", err);\r\n }\r\n });\r\n } catch (err) {\r\n pendingIdsRef.current.delete(id);\r\n console.error(\"[PointCloudViewer] Error fetching point cloud metadata\", err);\r\n }\r\n })();\r\n }\r\n }, [PointCloudGlobalState.loadedPointCloudIds, PointCloudGlobalState.viewer, PointCloudGlobalState.ready]);\r\n\r\n const { loadedPointCloudIds } = PointCloudGlobalState;\r\n const hasLoadedClouds = loadedPointCloudIds.length > 0;\r\n\r\n return (\r\n <div\r\n style={{\r\n position: \"absolute\",\r\n left: 0,\r\n top: 0,\r\n width: \"100%\",\r\n height: \"100%\",\r\n // Clip everything the viewer paints. Without this, anything that\r\n // momentarily exceeds these bounds (see the container below) leaks into\r\n // the app's `overflow-auto` main element and makes the page scrollable.\r\n overflow: \"hidden\",\r\n }}\r\n >\r\n {/* Potree container — always rendered so the viewer can measure its dimensions on init.\r\n PointCloudLoadingState sits above it via z-index when no clouds are loaded. */}\r\n <div>\r\n <div\r\n className={`pointer-events-none absolute inset-0 `}\r\n style={{\r\n zIndex: 9,\r\n background: 'radial-gradient(circle at center, rgba(220,220,220,0) 0%, rgba(220,220,220,0) 50%, rgba(220,220,220,0.9) 100%)',\r\n mixBlendMode: 'multiply'\r\n }}\r\n />\r\n <div\r\n ref={containerRef}\r\n className=\"potree_container\"\r\n style={{\r\n position: \"absolute\",\r\n inset: 0,\r\n backgroundSize: \"cover\",\r\n // Potree sizes its canvas from renderArea.clientWidth/Height inside its\r\n // own render loop, so the canvas trails the container by a frame. On\r\n // mobile the visible viewport keeps changing as the browser toolbar\r\n // slides, so the stale (larger) absolutely positioned canvas escaped\r\n // this container, made the page scrollable, which slid the toolbar\r\n // again — an endless scroll/shake loop. Upstream avoids it via\r\n // `#potree_render_area { overflow: hidden }`, but we never load\r\n // potree.css (see loadAllAssets), so clip it here.\r\n overflow: \"hidden\",\r\n // Touch drags belong to the camera, not to the page scroller.\r\n touchAction: \"none\",\r\n overscrollBehavior: \"none\",\r\n }}\r\n />\r\n </div>\r\n\r\n {/* Show PointCloudLoadingState only when there are no point cloud files uploaded at all.\r\n Rendered after the container so it layers on top (higher DOM order = higher paint order).\r\n It is its own contained scroller: on a short screen the card can be taller than the\r\n viewport and the viewer root now clips, so scrolling stays inside this overlay\r\n instead of chaining out to the page. */}\r\n {!hasPointCloudFiles && !hasLoadedClouds && (\r\n <div className=\"absolute inset-0 overflow-y-auto overscroll-contain\" style={{ zIndex: 10 }}>\r\n <PointCloudLoadingState pointcloudApiUrl={pointcloudApiUrl} />\r\n </div>\r\n )}\r\n </div>\r\n );\r\n}\r\n"],"mappings":";AAuOM,SACE,KADF;AAlON,SAAS,uBAAuB;AAChC,YAAY,WAAW;AAGvB,SAAS,4BAA4B;AACrC,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,qCAAqC;AAE9C,SAAS,8BAA8B;AACvC,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAI9B,SAAS,4BAA4B;AAM9B,SAAS,iBAAiB,EAAE,iBAAiB,GAAkC;AAGpF,gCAA8B;AAC9B,QAAM,WAAW,8CAAoB;AAErC,QAAM,eAAe,MAAM,OAAuB,IAAI;AACtD,QAAM,YAAY,MAAM,OAAmB,IAAI;AAC/C,QAAM,WAAW,MAAM,OAA6B,IAAI;AAExD,QAAM,kBAAkB,MAAM,OAAyB,oBAAI,IAAI,CAAC;AAEhE,QAAM,gBAAg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AU,uDAAsD,OAAO,EAAE,QAAQ,GAAG,GACvF,8BAAC,0BAAuB,kBAAoC,GAC9D;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":["_a","_b","_c"]}
|
|
@@ -12,11 +12,11 @@ export declare function readStoredSidebarWidth(): number;
|
|
|
12
12
|
/** SSR-safe persist of a clamped width. Swallows storage errors (private mode, quota). */
|
|
13
13
|
export declare function writeStoredSidebarWidth(width: number): void;
|
|
14
14
|
export interface ResizableSidebarWidth {
|
|
15
|
-
/** Current width in px. Only meaningful when `canResize` is true; mobile
|
|
15
|
+
/** Current width in px. Only meaningful when `canResize` is true; mobile uses the fixed drawer width. */
|
|
16
16
|
width: number;
|
|
17
17
|
/** True while a drag is in progress (for cursor / no-select styling). */
|
|
18
18
|
isResizing: boolean;
|
|
19
|
-
/** True on desktop only. Mobile
|
|
19
|
+
/** True on desktop only. Mobile uses a fixed drawer width and is not resizable. */
|
|
20
20
|
canResize: boolean;
|
|
21
21
|
/** Attach to the drag handle's onPointerDown. */
|
|
22
22
|
startResize: (e: React.PointerEvent) => void;
|
|
@@ -24,7 +24,7 @@ export interface ResizableSidebarWidth {
|
|
|
24
24
|
/**
|
|
25
25
|
* Drives a user-resizable sidebar width on desktop. Width is restored from and persisted to
|
|
26
26
|
* localStorage, clamped to [MIN_SIDEBAR_WIDTH, MAX_SIDEBAR_WIDTH]. On mobile (`useIsMobile`)
|
|
27
|
-
* resizing is disabled and the sidebar
|
|
27
|
+
* resizing is disabled and the sidebar renders at the fixed mobile drawer width.
|
|
28
28
|
*/
|
|
29
29
|
export declare function useResizableSidebarWidth(): ResizableSidebarWidth;
|
|
30
30
|
//# sourceMappingURL=useResizableSidebarWidth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResizableSidebarWidth.d.ts","sourceRoot":"","sources":["../../../../src/core/hooks/ui/useResizableSidebarWidth.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;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,KAAK,IAAI,CAAA;CAC7C;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,qBAAqB,CA0ChE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/hooks/ui/useResizableSidebarWidth.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as React from 'react'\r\n\r\nimport { useIsMobile } from './use-mobile'\r\n\r\n/** Minimum sidebar width. Equal to the previous fixed width, so it never shrinks below the old default. */\r\nexport const MIN_SIDEBAR_WIDTH = 410\r\n/** Maximum sidebar width, roughly half a laptop viewport. */\r\nexport const MAX_SIDEBAR_WIDTH = 720\r\nexport const DEFAULT_SIDEBAR_WIDTH = MIN_SIDEBAR_WIDTH\r\nexport const SIDEBAR_WIDTH_STORAGE_KEY = 'cdt:sidebar-width'\r\n\r\n/** Clamp to [MIN, MAX]. NaN falls back to the default; ±Infinity clamps to the bounds. */\r\nexport function clampSidebarWidth(width: number): number {\r\n if (Number.isNaN(width)) return DEFAULT_SIDEBAR_WIDTH\r\n return Math.min(MAX_SIDEBAR_WIDTH, Math.max(MIN_SIDEBAR_WIDTH, width))\r\n}\r\n\r\n/** SSR-safe read of the persisted width, clamped; falls back to the default on missing/corrupt values. */\r\nexport function readStoredSidebarWidth(): number {\r\n if (typeof window === 'undefined') return DEFAULT_SIDEBAR_WIDTH\r\n try {\r\n const raw = window.localStorage.getItem(SIDEBAR_WIDTH_STORAGE_KEY)\r\n if (raw === null) return DEFAULT_SIDEBAR_WIDTH\r\n const parsed = Number.parseFloat(raw)\r\n if (!Number.isFinite(parsed)) return DEFAULT_SIDEBAR_WIDTH\r\n return clampSidebarWidth(parsed)\r\n } catch {\r\n return DEFAULT_SIDEBAR_WIDTH\r\n }\r\n}\r\n\r\n/** SSR-safe persist of a clamped width. Swallows storage errors (private mode, quota). */\r\nexport function writeStoredSidebarWidth(width: number): void {\r\n if (typeof window === 'undefined') return\r\n try {\r\n window.localStorage.setItem(SIDEBAR_WIDTH_STORAGE_KEY, String(clampSidebarWidth(width)))\r\n } catch {\r\n // ignore: storage may be unavailable (private mode / quota)\r\n }\r\n}\r\n\r\nexport interface ResizableSidebarWidth {\r\n /** Current width in px. Only meaningful when `canResize` is true; mobile
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/hooks/ui/useResizableSidebarWidth.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as React from 'react'\r\n\r\nimport { useIsMobile } from './use-mobile'\r\n\r\n/** Minimum sidebar width. Equal to the previous fixed width, so it never shrinks below the old default. */\r\nexport const MIN_SIDEBAR_WIDTH = 410\r\n/** Maximum sidebar width, roughly half a laptop viewport. */\r\nexport const MAX_SIDEBAR_WIDTH = 720\r\nexport const DEFAULT_SIDEBAR_WIDTH = MIN_SIDEBAR_WIDTH\r\nexport const SIDEBAR_WIDTH_STORAGE_KEY = 'cdt:sidebar-width'\r\n\r\n/** Clamp to [MIN, MAX]. NaN falls back to the default; ±Infinity clamps to the bounds. */\r\nexport function clampSidebarWidth(width: number): number {\r\n if (Number.isNaN(width)) return DEFAULT_SIDEBAR_WIDTH\r\n return Math.min(MAX_SIDEBAR_WIDTH, Math.max(MIN_SIDEBAR_WIDTH, width))\r\n}\r\n\r\n/** SSR-safe read of the persisted width, clamped; falls back to the default on missing/corrupt values. */\r\nexport function readStoredSidebarWidth(): number {\r\n if (typeof window === 'undefined') return DEFAULT_SIDEBAR_WIDTH\r\n try {\r\n const raw = window.localStorage.getItem(SIDEBAR_WIDTH_STORAGE_KEY)\r\n if (raw === null) return DEFAULT_SIDEBAR_WIDTH\r\n const parsed = Number.parseFloat(raw)\r\n if (!Number.isFinite(parsed)) return DEFAULT_SIDEBAR_WIDTH\r\n return clampSidebarWidth(parsed)\r\n } catch {\r\n return DEFAULT_SIDEBAR_WIDTH\r\n }\r\n}\r\n\r\n/** SSR-safe persist of a clamped width. Swallows storage errors (private mode, quota). */\r\nexport function writeStoredSidebarWidth(width: number): void {\r\n if (typeof window === 'undefined') return\r\n try {\r\n window.localStorage.setItem(SIDEBAR_WIDTH_STORAGE_KEY, String(clampSidebarWidth(width)))\r\n } catch {\r\n // ignore: storage may be unavailable (private mode / quota)\r\n }\r\n}\r\n\r\nexport interface ResizableSidebarWidth {\r\n /** Current width in px. Only meaningful when `canResize` is true; mobile uses the fixed drawer width. */\r\n width: number\r\n /** True while a drag is in progress (for cursor / no-select styling). */\r\n isResizing: boolean\r\n /** True on desktop only. Mobile uses a fixed drawer width and is not resizable. */\r\n canResize: boolean\r\n /** Attach to the drag handle's onPointerDown. */\r\n startResize: (e: React.PointerEvent) => void\r\n}\r\n\r\n/**\r\n * Drives a user-resizable sidebar width on desktop. Width is restored from and persisted to\r\n * localStorage, clamped to [MIN_SIDEBAR_WIDTH, MAX_SIDEBAR_WIDTH]. On mobile (`useIsMobile`)\r\n * resizing is disabled and the sidebar renders at the fixed mobile drawer width.\r\n */\r\nexport function useResizableSidebarWidth(): ResizableSidebarWidth {\r\n const isMobile = useIsMobile()\r\n const canResize = !isMobile\r\n\r\n const [width, setWidth] = React.useState<number>(DEFAULT_SIDEBAR_WIDTH)\r\n const [isResizing, setIsResizing] = React.useState(false)\r\n\r\n // Hydrate from storage after mount (avoids SSR/client mismatch on first paint).\r\n React.useEffect(() => {\r\n setWidth(readStoredSidebarWidth())\r\n }, [])\r\n\r\n const startResize = React.useCallback(\r\n (e: React.PointerEvent) => {\r\n if (!canResize) return\r\n e.preventDefault()\r\n setIsResizing(true)\r\n\r\n const startX = e.clientX\r\n const startWidth = width\r\n\r\n const onMove = (ev: PointerEvent) => {\r\n setWidth(clampSidebarWidth(startWidth + (ev.clientX - startX)))\r\n }\r\n const onUp = () => {\r\n setIsResizing(false)\r\n window.removeEventListener('pointermove', onMove)\r\n window.removeEventListener('pointerup', onUp)\r\n // Persist the final width; read the latest via the functional updater.\r\n setWidth(current => {\r\n writeStoredSidebarWidth(current)\r\n return current\r\n })\r\n }\r\n\r\n window.addEventListener('pointermove', onMove)\r\n window.addEventListener('pointerup', onUp)\r\n },\r\n [canResize, width]\r\n )\r\n\r\n return { width, isResizing, canResize, startResize }\r\n}\r\n"],"mappings":";AAKA,YAAY,WAAW;AAEvB,SAAS,mBAAmB;AAGrB,MAAM,oBAAoB;AAE1B,MAAM,oBAAoB;AAC1B,MAAM,wBAAwB;AAC9B,MAAM,4BAA4B;AAGlC,SAAS,kBAAkB,OAAuB;AACvD,MAAI,OAAO,MAAM,KAAK,EAAG,QAAO;AAChC,SAAO,KAAK,IAAI,mBAAmB,KAAK,IAAI,mBAAmB,KAAK,CAAC;AACvE;AAGO,SAAS,yBAAiC;AAC/C,MAAI,OAAO,WAAW,YAAa,QAAO;AAC1C,MAAI;AACF,UAAM,MAAM,OAAO,aAAa,QAAQ,yBAAyB;AACjE,QAAI,QAAQ,KAAM,QAAO;AACzB,UAAM,SAAS,OAAO,WAAW,GAAG;AACpC,QAAI,CAAC,OAAO,SAAS,MAAM,EAAG,QAAO;AACrC,WAAO,kBAAkB,MAAM;AAAA,EACjC,SAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGO,SAAS,wBAAwB,OAAqB;AAC3D,MAAI,OAAO,WAAW,YAAa;AACnC,MAAI;AACF,WAAO,aAAa,QAAQ,2BAA2B,OAAO,kBAAkB,KAAK,CAAC,CAAC;AAAA,EACzF,SAAQ;AAAA,EAER;AACF;AAkBO,SAAS,2BAAkD;AAChE,QAAM,WAAW,YAAY;AAC7B,QAAM,YAAY,CAAC;AAEnB,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAiB,qBAAqB;AACtE,QAAM,CAAC,YAAY,aAAa,IAAI,MAAM,SAAS,KAAK;AAGxD,QAAM,UAAU,MAAM;AACpB,aAAS,uBAAuB,CAAC;AAAA,EACnC,GAAG,CAAC,CAAC;AAEL,QAAM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