Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

feat: add toggles for collapsing sidebars

Brad Barbin52b0e4a38b98
diff --git a/apps/carbon/app/components/Layout/Panels.tsx b/apps/carbon/app/components/Layout/Panels.tsx
new file mode 100644
index 0000000000..a93a0b1c1a
--- /dev/null
+++ b/apps/carbon/app/components/Layout/Panels.tsx
@@ -0,0 +1,104 @@
+import {
+ ResizableHandle,
+ ResizablePanel,
+ ResizablePanelGroup,
+} from "@carbon/react";
+import { createContext, useContext, useEffect, useRef, useState } from "react";
+import type { ImperativePanelHandle } from "react-resizable-panels";
+
+interface PanelContextType {
+ isExplorerCollapsed: boolean;
+ isPropertiesCollapsed: boolean;
+ toggleExplorer: () => void;
+ toggleProperties: () => void;
+ setIsExplorerCollapsed: (collapsed: boolean) => void;
+ setIsPropertiesCollapsed: (collapsed: boolean) => void;
+}
+
+const PanelContext = createContext<PanelContextType>({
+ isExplorerCollapsed: false,
+ isPropertiesCollapsed: false,
+ toggleExplorer: () => {},
+ toggleProperties: () => {},
+ setIsExplorerCollapsed: () => {},
+ setIsPropertiesCollapsed: () => {},
+});
+
+export function usePanels() {
+ const context = useContext(PanelContext);
+ if (!context) {
+ throw new Error("usePanels must be used within a PanelProvider");
+ }
+ return context;
+}
+
+interface PanelProviderProps {
+ children: React.ReactNode;
+}
+
+export function PanelProvider({ children }: PanelProviderProps) {
+ const [isExplorerCollapsed, setIsExplorerCollapsed] = useState(false);
+ const [isPropertiesCollapsed, setIsPropertiesCollapsed] = useState(false);
+
+ const value = {
+ isExplorerCollapsed,
+ isPropertiesCollapsed,
+ toggleExplorer: () => setIsExplorerCollapsed((prev) => !prev),
+ toggleProperties: () => setIsPropertiesCollapsed((prev) => !prev),
+ setIsExplorerCollapsed,
+ setIsPropertiesCollapsed,
+ };
+
+ return (
+ <PanelContext.Provider value={value}>{children}</PanelContext.Provider>
+ );
+}
+
+interface ResizablePanelsProps {
+ explorer?: React.ReactNode;
+ content: React.ReactNode;
+ properties?: React.ReactNode;
+}
+
+export function ResizablePanels({
+ explorer,
+ content,
+ properties,
+}: ResizablePanelsProps) {
+ const { isExplorerCollapsed, isPropertiesCollapsed, setIsExplorerCollapsed } =
+ usePanels();
+ const panelRef = useRef<ImperativePanelHandle>(null);
+
+ useEffect(() => {
+ if (isExplorerCollapsed) {
+ panelRef.current?.collapse();
+ } else {
+ panelRef.current?.expand();
+ }
+ }, [isExplorerCollapsed]);
+
+ return (
+ <ResizablePanelGroup direction="horizontal">
+ <ResizablePanel
+ ref={panelRef}
+ order={1}
+ minSize={10}
+ className="bg-card shadow-lg"
+ collapsible
+ defaultSize={isExplorerCollapsed ? 0 : 20}
+ collapsedSize={0}
+ onCollapse={() => setIsExplorerCollapsed(true)}
+ onExpand={() => setIsExplorerCollapsed(false)}
+ >
+ {!isExplorerCollapsed && explorer}
+ </ResizablePanel>
+ <ResizableHandle withHandle />
+ <ResizablePanel order={2} className="z-1">
+ <div className="flex h-[calc(100dvh-99px)] overflow-hidden w-full">
+ {content}
+ {!isPropertiesCollapsed && properties}
+ </div>
+ </ResizablePanel>
+ </ResizablePanelGroup>
+ );
+}
diff --git a/apps/carbon/app/components/Layout/index.ts b/apps/carbon/app/components/Layout/index.ts
index 62e673f499..8642b4fa89 100644
--- a/apps/carbon/app/components/Layout/index.ts
+++ b/apps/carbon/app/components/Layout/index.ts
@@ -1,4 +1,5 @@
import Background from "./Background";
+
import {
CollapsibleSidebar,
ContentSidebar,
@@ -7,6 +8,7 @@ import {
GroupedContentSidebar,
PrimaryNavigation,
} from "./Navigation";
+import { PanelProvider, ResizablePanels, usePanels } from "./Panels";
import Topbar from "./Topbar";
@@ -17,6 +19,9 @@ export {
DetailSidebar,
DetailsTopbar,
GroupedContentSidebar,
+ PanelProvider,
PrimaryNavigation,
+ ResizablePanels,
Topbar,
+ usePanels,
};
diff --git a/apps/carbon/app/components/Table/components/Filter/Filter.tsx b/apps/carbon/app/components/Table/components/Filter/Filter.tsx
index f6e931f606..ed0d4d269f 100644
--- a/apps/carbon/app/components/Table/components/Filter/Filter.tsx
+++ b/apps/carbon/app/components/Table/components/Filter/Filter.tsx
@@ -11,7 +11,6 @@ import {
PopoverContent,
PopoverTrigger,
reactNodeToString,
- ScrollArea,
VStack,
} from "@carbon/react";
import { useFetcher } from "@remix-run/react";
@@ -181,7 +180,7 @@ const Filter = forwardRef<HTMLButtonElement, FilterProps>(
))}
</CommandGroup>
) : (
- <ScrollArea className="max-h-[300px]">
+ <div className="max-h-[300px] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent">
<CommandGroup>
{activeOptions.map((option) => {
const isChecked = hasFilter(
@@ -222,7 +221,7 @@ const Filter = forwardRef<HTMLButtonElement, FilterProps>(
);
})}
</CommandGroup>
- </ScrollArea>
+ </div>
)}
</Command>
</PopoverContent>
diff --git a/apps/carbon/app/modules/production/ui/Jobs/JobHeader.tsx b/apps/carbon/app/modules/production/ui/Jobs/JobHeader.tsx
index 372f1031d8..f9dde65bff 100644
--- a/apps/carbon/app/modules/production/ui/Jobs/JobHeader.tsx
+++ b/apps/carbon/app/modules/production/ui/Jobs/JobHeader.tsx
@@ -10,6 +10,7 @@ import {
DropdownMenuTrigger,
HStack,
Heading,
+ IconButton,
Modal,
ModalBody,
ModalContent,
@@ -27,6 +28,8 @@ import {
LuHardHat,
LuList,
LuPackage,
+ LuPanelLeft,
+ LuPanelRight,
LuPauseCircle,
LuPlayCircle,
LuRefreshCw,
@@ -36,6 +39,7 @@ import {
LuTable,
} from "react-icons/lu";
import { RiProgress8Line } from "react-icons/ri";
+import { usePanels } from "~/components/Layout";
import { useOptimisticLocation, usePermissions, useRouteData } from "~/hooks";
import { path } from "~/utils/path";
import type { Job } from "../../types";
@@ -48,6 +52,7 @@ const JobHeader = () => {
if (!jobId) throw new Error("jobId not found");
const location = useOptimisticLocation();
+ const { toggleExplorer, toggleProperties } = usePanels();
const releaseModal = useDisclosure();
const cancelModal = useDisclosure();
@@ -73,8 +78,14 @@ const JobHeader = () => {
return (
<>
- <div className="flex flex-shrink-0 items-center justify-between px-4 py-2 bg-card border-b border-border h-[50px]">
+ <div className="flex flex-shrink-0 items-center justify-between p-2 bg-card border-b border-border h-[50px]">
<HStack>
+ <IconButton
+ aria-label="Toggle Explorer"
+ icon={<LuPanelLeft />}
+ onClick={toggleExplorer}
+ variant="ghost"
+ />
<Link to={path.to.jobDetails(jobId)}>
<Heading size="h3" className="flex items-center gap-2">
<span>{routeData?.job?.jobId}</span>
@@ -250,6 +261,12 @@ const JobHeader = () => {
</Button>
</>
)}
+ <IconButton
+ aria-label="Toggle Properties"
+ icon={<LuPanelRight />}
+ onClick={toggleProperties}
+ variant="ghost"
+ />
</HStack>
</div>
{releaseModal.isOpen && (
diff --git a/apps/carbon/app/modules/sales/ui/Quotes/QuoteHeader.tsx b/apps/carbon/app/modules/sales/ui/Quotes/QuoteHeader.tsx
index 3e2d57d25a..70b074fc72 100644
--- a/apps/carbon/app/modules/sales/ui/Quotes/QuoteHeader.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotes/QuoteHeader.tsx
@@ -7,6 +7,7 @@ import {
DropdownMenuTrigger,
HStack,
Heading,
+ IconButton,
Input,
InputGroup,
InputRightElement,
@@ -27,6 +28,8 @@ import {
LuExternalLink,
LuEye,
LuFile,
+ LuPanelLeft,
+ LuPanelRight,
LuRefreshCw,
LuShare,
LuStopCircle,
@@ -34,6 +37,7 @@ import {
LuXCircle,
} from "react-icons/lu";
import { Copy } from "~/components";
+import { usePanels } from "~/components/Layout";
import { usePermissions, useRouteData } from "~/hooks";
import type { Quotation, QuotationLine, QuotationPrice } from "~/modules/sales";
@@ -47,6 +51,8 @@ const QuoteHeader = () => {
const { quoteId } = useParams();
if (!quoteId) throw new Error("quoteId not found");
+ const { toggleExplorer, toggleProperties } = usePanels();
+
const routeData = useRouteData<{
quote: Quotation;
lines: QuotationLine[];
@@ -66,9 +72,15 @@ const QuoteHeader = () => {
return (
<>
- <div className="flex flex-shrink-0 items-center justify-between px-4 py-2 bg-card border-b border-border h-[50px]">
+ <div className="flex flex-shrink-0 items-center justify-between p-2 bg-card border-b border-border h-[50px]">
<HStack className="w-full justify-between">
<HStack>
+ <IconButton
+ aria-label="Toggle Explorer"
+ icon={<LuPanelLeft />}
+ onClick={toggleExplorer}
+ variant="ghost"
+ />
<Link to={path.to.quoteDetails(quoteId)}>
<Heading size="h3" className="flex items-center gap-2">
<span>{routeData?.quote?.quoteId}</span>
@@ -268,6 +280,12 @@ const QuoteHeader = () => {
</Button>
</statusFetcher.Form>
)}
+ <IconButton
+ aria-label="Toggle Properties"
+ icon={<LuPanelRight />}
+ onClick={toggleProperties}
+ variant="ghost"
+ />
</HStack>
</HStack>
</div>
diff --git a/apps/carbon/app/modules/sales/ui/SalesOrder/SalesOrderHeader.tsx b/apps/carbon/app/modules/sales/ui/SalesOrder/SalesOrderHeader.tsx
index eeb05da588..cebc8cc19a 100644
--- a/apps/carbon/app/modules/sales/ui/SalesOrder/SalesOrderHeader.tsx
+++ b/apps/carbon/app/modules/sales/ui/SalesOrder/SalesOrderHeader.tsx
@@ -1,15 +1,28 @@
-import { Button, HStack, Heading } from "@carbon/react";
+import {
+ Button,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+ HStack,
+ Heading,
+ IconButton,
+} from "@carbon/react";
import { Link, useFetcher, useParams } from "@remix-run/react";
import {
LuCheckCheck,
+ LuChevronDown,
LuEye,
LuFile,
+ LuPanelLeft,
+ LuPanelRight,
LuRefreshCw,
LuStopCircle,
LuTruck,
} from "react-icons/lu";
+import { usePanels } from "~/components/Layout";
import { usePermissions, useRouteData } from "~/hooks";
import type { SalesOrder, SalesOrderLine } from "~/modules/sales";
import { path } from "~/utils/path";
@@ -20,6 +33,8 @@ const SalesOrderHeader = () => {
const { orderId } = useParams();
if (!orderId) throw new Error("orderId not found");
+ const { toggleExplorer, toggleProperties } = usePanels();
+
const routeData = useRouteData<{
salesOrder: SalesOrder;
lines: SalesOrderLine[];
@@ -31,9 +46,15 @@ const SalesOrderHeader = () => {
return (
<>
- <div className="flex flex-shrink-0 items-center justify-between px-4 py-2 bg-card border-b border-border h-[50px]">
+ <div className="flex flex-shrink-0 items-center justify-between p-2 bg-card border-b border-border h-[50px]">
<HStack className="w-full justify-between">
<HStack>
+ <IconButton
+ aria-label="Toggle Explorer"
+ icon={<LuPanelLeft />}
+ onClick={toggleExplorer}
+ variant="ghost"
+ />
<Link to={path.to.salesOrderDetails(orderId)}>
<Heading size="h3" className="flex items-center gap-2">
<span>{routeData?.salesOrder?.salesOrderId}</span>
@@ -42,15 +63,29 @@ const SalesOrderHeader = () => {
<SalesStatus status={routeData?.salesOrder?.status} />
</HStack>
<HStack>
- <Button leftIcon={<LuEye />} variant="secondary" asChild>
- <a
- target="_blank"
- href={path.to.file.salesOrder(orderId)}
- rel="noreferrer"
- >
- Preview
- </a>
- </Button>
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button
+ leftIcon={<LuEye />}
+ variant="secondary"
+ rightIcon={<LuChevronDown />}
+ >
+ Preview
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent>
+ <DropdownMenuItem asChild>
+ <a
+ target="_blank"
+ href={path.to.file.salesOrder(orderId)}
+ rel="noreferrer"
+ >
+ PDF
+ </a>
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+
{(routeData?.salesOrder?.status === "Draft" ||
routeData?.salesOrder?.status === "Needs Approval") && (
<>
@@ -139,6 +174,12 @@ const SalesOrderHeader = () => {
</Button>
</statusFetcher.Form>
)}
+ <IconButton
+ aria-label="Toggle Properties"
+ icon={<LuPanelRight />}
+ onClick={toggleProperties}
+ variant="ghost"
+ />
</HStack>
</HStack>
</div>
diff --git a/apps/carbon/app/modules/sales/ui/SalesRFQ/SalesRFQHeader.tsx b/apps/carbon/app/modules/sales/ui/SalesRFQ/SalesRFQHeader.tsx
index ab61dbad0a..b418a35eb1 100644
--- a/apps/carbon/app/modules/sales/ui/SalesRFQ/SalesRFQHeader.tsx
+++ b/apps/carbon/app/modules/sales/ui/SalesRFQ/SalesRFQHeader.tsx
@@ -5,6 +5,7 @@ import {
Button,
HStack,
Heading,
+ IconButton,
Modal,
ModalBody,
ModalContent,
@@ -17,8 +18,15 @@ import {
import { Link, useFetcher, useParams } from "@remix-run/react";
import { useEffect } from "react";
-import { LuAlertTriangle, LuRefreshCw, LuXCircle } from "react-icons/lu";
+import {
+ LuAlertTriangle,
+ LuPanelLeft,
+ LuPanelRight,
+ LuRefreshCw,
+ LuXCircle,
+} from "react-icons/lu";
import { RiProgress4Line } from "react-icons/ri";
+import { usePanels } from "~/components/Layout";
import { usePermissions, useRouteData } from "~/hooks";
import type { SalesRFQ, SalesRFQLine } from "~/modules/sales";
import { path } from "~/utils/path";
@@ -30,6 +38,7 @@ const SalesRFQHeader = () => {
const convertToQuoteModal = useDisclosure();
const requiresCustomerAlert = useDisclosure();
+ const { toggleExplorer, toggleProperties } = usePanels();
const permissions = usePermissions();
@@ -43,12 +52,17 @@ const SalesRFQHeader = () => {
const statusFetcher = useFetcher<{}>();
return (
- <div className="flex flex-shrink-0 items-center justify-between px-4 py-2 bg-card border-b border-border h-[50px]">
+ <div className="flex flex-shrink-0 items-center justify-between p-2 bg-card border-b border-border h-[50px]">
<HStack className="w-full justify-between">
<HStack>
+ <IconButton
+ aria-label="Toggle Explorer"
+ icon={<LuPanelLeft />}
+ onClick={toggleExplorer}
+ variant="ghost"
+ />
<Link to={path.to.salesRfqDetails(rfqId)}>
<Heading size="h3" className="flex items-center gap-2">
- {/* <ModuleIcon icon={<RiProgress2Line />} /> */}
<span>{routeData?.rfqSummary?.rfqId}</span>
</Heading>
</Link>
@@ -146,6 +160,12 @@ const SalesRFQHeader = () => {
</Button>
</>
)}
+ <IconButton
+ aria-label="Toggle Properties"
+ icon={<LuPanelRight />}
+ onClick={toggleProperties}
+ variant="ghost"
+ />
</HStack>
</HStack>
{convertToQuoteModal.isOpen && (
diff --git a/apps/carbon/app/routes/x+/job+/$jobId.details.tsx b/apps/carbon/app/routes/x+/job+/$jobId.details.tsx
index d5b75c38e3..dd9123b711 100644
--- a/apps/carbon/app/routes/x+/job+/$jobId.details.tsx
+++ b/apps/carbon/app/routes/x+/job+/$jobId.details.tsx
@@ -129,8 +129,8 @@ export default function JobDetailsRoute() {
}}
modelPath={jobData?.job?.modelPath ?? null}
title="CAD Model"
- uploadClassName="min-h-[420px]"
- viewerClassName="min-h-[420px]"
+ uploadClassName="aspect-square min-h-[420px]"
+ viewerClassName="aspect-square min-h-[420px]"
/>
</div>
)}
diff --git a/apps/carbon/app/routes/x+/job+/$jobId.tsx b/apps/carbon/app/routes/x+/job+/$jobId.tsx
index f673444849..dc9dc85798 100644
--- a/apps/carbon/app/routes/x+/job+/$jobId.tsx
+++ b/apps/carbon/app/routes/x+/job+/$jobId.tsx
@@ -1,12 +1,7 @@
import { error, getCarbonServiceRole } from "@carbon/auth";
import { requirePermissions } from "@carbon/auth/auth.server";
import { flash } from "@carbon/auth/session.server";
-import {
- ClientOnly,
- ResizableHandle,
- ResizablePanel,
- ResizablePanelGroup,
-} from "@carbon/react";
+import { ClientOnly } from "@carbon/react";
import {
Await,
defer,
@@ -17,6 +12,7 @@ import {
} from "@remix-run/react";
import type { LoaderFunctionArgs } from "@vercel/remix";
import { Suspense } from "react";
+import { PanelProvider, ResizablePanels } from "~/components/Layout/Panels";
import { ExplorerSkeleton } from "~/components/Skeletons";
import { flattenTree } from "~/components/TreeView";
import {
@@ -74,57 +70,51 @@ export default function JobRoute() {
const { method } = useLoaderData<typeof loader>();
return (
- <div className="flex flex-col h-[calc(100dvh-49px)] overflow-hidden w-full">
- <JobHeader />
- <div className="flex h-[calc(100dvh-99px)] overflow-hidden w-full">
- <div className="flex flex-grow overflow-hidden">
- <ClientOnly fallback={null}>
- {() => (
- <ResizablePanelGroup direction="horizontal">
- <ResizablePanel
- order={1}
- minSize={10}
- defaultSize={20}
- className="bg-card shadow-lg"
- >
- <div className="grid w-full h-[calc(100dvh-99px)] overflow-hidden p-2">
- <Suspense fallback={<ExplorerSkeleton />}>
- <Await
- resolve={method}
- errorElement={
- <div className="p-2 text-red-500">
- Error loading job tree.
- </div>
- }
- >
- {(resolvedMethod) => (
- <JobBoMExplorer
- method={
- resolvedMethod.data &&
- resolvedMethod.data.length > 0
- ? flattenTree(resolvedMethod.data[0])
- : []
- }
- />
- )}
- </Await>
- </Suspense>
- </div>
- </ResizablePanel>
- <ResizableHandle withHandle />
- <ResizablePanel order={2} className="z-1">
- <div className="flex h-[calc(100dvh-99px)] overflow-hidden w-full">
+ <PanelProvider>
+ <div className="flex flex-col h-[calc(100dvh-49px)] overflow-hidden w-full">
+ <JobHeader />
+ <div className="flex h-[calc(100dvh-99px)] overflow-hidden w-full">
+ <div className="flex flex-grow overflow-hidden">
+ <ClientOnly fallback={null}>
+ {() => (
+ <ResizablePanels
+ explorer={
+ <div className="grid w-full h-[calc(100dvh-99px)] overflow-hidden p-2">
+ <Suspense fallback={<ExplorerSkeleton />}>
+ <Await
+ resolve={method}
+ errorElement={
+ <div className="p-2 text-red-500">
+ Error loading job tree.
+ </div>
+ }
+ >
+ {(resolvedMethod) => (
+ <JobBoMExplorer
+ method={
+ resolvedMethod.data &&
+ resolvedMethod.data.length > 0
+ ? flattenTree(resolvedMethod.data[0])
+ : []
+ }
+ />
+ )}
+ </Await>
+ </Suspense>
+ </div>
+ }
+ content={
<div className="h-[calc(100dvh-99px)] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">
<Outlet />
</div>
- <JobProperties />
- </div>
- </ResizablePanel>
- </ResizablePanelGroup>
- )}
- </ClientOnly>
+ }
+ properties={<JobProperties />}
+ />
+ )}
+ </ClientOnly>
+ </div>
</div>
</div>
- </div>
+ </PanelProvider>
);
}
diff --git a/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsx b/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsx
index 3784a57b28..0e265c9f3f 100644
--- a/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsx
@@ -197,8 +197,8 @@ export default function QuoteLine() {
}}
modelPath={line?.modelPath ?? null}
title="CAD Model"
- uploadClassName="min-h-[420px]"
- viewerClassName="min-h-[420px]"
+ uploadClassName="aspect-square min-h-[420px]"
+ viewerClassName="aspect-square min-h-[420px]"
/>
</div>
diff --git a/apps/carbon/app/routes/x+/quote+/$quoteId.tsx b/apps/carbon/app/routes/x+/quote+/$quoteId.tsx
index bbd00a733c..bbc829a4df 100644
--- a/apps/carbon/app/routes/x+/quote+/$quoteId.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$quoteId.tsx
@@ -1,16 +1,11 @@
import { error, getCarbonServiceRole } from "@carbon/auth";
import { requirePermissions } from "@carbon/auth/auth.server";
import { flash } from "@carbon/auth/session.server";
-import {
- ClientOnly,
- ResizableHandle,
- ResizablePanel,
- ResizablePanelGroup,
- VStack,
-} from "@carbon/react";
+import { ClientOnly, VStack } from "@carbon/react";
import { Outlet, useLoaderData, useParams } from "@remix-run/react";
import type { LoaderFunctionArgs } from "@vercel/remix";
import { defer, redirect } from "@vercel/remix";
+import { PanelProvider, ResizablePanels } from "~/components/Layout/Panels";
import { getCurrencyByCode } from "~/modules/accounting";
import {
getCustomer,
@@ -118,40 +113,29 @@ export default function QuoteRoute() {
const { methods } = useLoaderData<typeof loader>();
return (
- <div className="flex flex-col h-[calc(100dvh-49px)] overflow-hidden w-full">
- <QuoteHeader />
- <div className="flex h-[calc(100dvh-99px)] overflow-hidden w-full">
- <div className="flex flex-grow overflow-hidden">
- <ClientOnly fallback={null}>
- {() => (
- <ResizablePanelGroup direction="horizontal">
- <ResizablePanel
- order={1}
- minSize={10}
- defaultSize={20}
- className="bg-card shadow-lg"
- >
- <div className="grid w-full h-[calc(100dvh-99px)] overflow-hidden">
- <QuoteExplorer methods={methods} />
- </div>
- </ResizablePanel>
- <ResizableHandle withHandle />
- <ResizablePanel order={2} className="z-1">
- <div className="flex h-[calc(100dvh-99px)] overflow-hidden w-full">
+ <PanelProvider>
+ <div className="flex flex-col h-[calc(100dvh-49px)] overflow-hidden w-full">
+ <QuoteHeader />
+ <div className="flex h-[calc(100dvh-99px)] overflow-hidden w-full">
+ <div className="flex flex-grow overflow-hidden">
+ <ClientOnly fallback={null}>
+ {() => (
+ <ResizablePanels
+ explorer={<QuoteExplorer methods={methods} />}
+ content={
<div className="h-[calc(100dvh-99px)] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">
<VStack spacing={2} className="p-2">
<Outlet />
</VStack>
</div>
-
- <QuoteProperties />
- </div>
- </ResizablePanel>
- </ResizablePanelGroup>
- )}
- </ClientOnly>
+ }
+ properties={<QuoteProperties />}
+ />
+ )}
+ </ClientOnly>
+ </div>
</div>
</div>
- </div>
+ </PanelProvider>
);
}
diff --git a/apps/carbon/app/routes/x+/sales-order+/$orderId.$lineId.details.tsx b/apps/carbon/app/routes/x+/sales-order+/$orderId.$lineId.details.tsx
index 816992a490..415d4515bb 100644
--- a/apps/carbon/app/routes/x+/sales-order+/$orderId.$lineId.details.tsx
+++ b/apps/carbon/app/routes/x+/sales-order+/$orderId.$lineId.details.tsx
@@ -236,8 +236,8 @@ export default function EditSalesOrderLineRoute() {
}}
modelPath={line?.modelPath ?? null}
title="CAD Model"
- uploadClassName="min-h-[420px]"
- viewerClassName="min-h-[420px]"
+ uploadClassName="aspect-square min-h-[420px]"
+ viewerClassName="aspect-square min-h-[420px]"
/>
</div>
<Outlet />
diff --git a/apps/carbon/app/routes/x+/sales-order+/$orderId.$lineId.job.tsx b/apps/carbon/app/routes/x+/sales-order+/$orderId.$lineId.job.tsx
index 99cf430298..8d45bd6da5 100644
--- a/apps/carbon/app/routes/x+/sales-order+/$orderId.$lineId.job.tsx
+++ b/apps/carbon/app/routes/x+/sales-order+/$orderId.$lineId.job.tsx
@@ -117,5 +117,5 @@ export async function action({ request, params }: ActionFunctionArgs) {
userId,
});
- throw redirect(path.to.salesOrderLine(orderId, lineId));
+ throw redirect(path.to.jobDetails(id));
}
diff --git a/apps/carbon/app/routes/x+/sales-order+/$orderId.tsx b/apps/carbon/app/routes/x+/sales-order+/$orderId.tsx
index 15d831aea2..89ba1beb1b 100644
--- a/apps/carbon/app/routes/x+/sales-order+/$orderId.tsx
+++ b/apps/carbon/app/routes/x+/sales-order+/$orderId.tsx
@@ -1,17 +1,11 @@
import { error, getCarbonServiceRole } from "@carbon/auth";
import { requirePermissions } from "@carbon/auth/auth.server";
import { flash } from "@carbon/auth/session.server";
-import {
- ClientOnly,
- ResizableHandle,
- ResizablePanel,
- ResizablePanelGroup,
- ScrollArea,
- VStack,
-} from "@carbon/react";
+import { ClientOnly, VStack } from "@carbon/react";
import { Outlet, useParams } from "@remix-run/react";
import type { LoaderFunctionArgs } from "@vercel/remix";
import { defer, redirect } from "@vercel/remix";
+import { PanelProvider, ResizablePanels } from "~/components/Layout/Panels";
import {
getCustomer,
getOpportunityBySalesOrder,
@@ -75,43 +69,29 @@ export default function SalesOrderRoute() {
if (!orderId) throw new Error("Could not find orderId");
return (
- <div className="flex flex-col h-[calc(100dvh-49px)] w-full">
- <SalesOrderHeader />
- <div className="flex h-[calc(100dvh-99px)] w-full">
- <div className="flex h-full w-full overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent">
+ <PanelProvider>
+ <div className="flex flex-col h-[calc(100dvh-49px)] overflow-hidden w-full">
+ <SalesOrderHeader />
+ <div className="flex h-[calc(100dvh-99px)] overflow-hidden w-full">
<div className="flex flex-grow overflow-hidden">
<ClientOnly fallback={null}>
{() => (
- <ResizablePanelGroup direction="horizontal">
- <ResizablePanel
- order={1}
- minSize={10}
- defaultSize={20}
- className="bg-card h-full shadow-lg"
- >
- <ScrollArea className="h-[calc(100dvh-99px)]">
- <div className="grid w-full h-full overflow-hidden">
- <SalesOrderExplorer />
- </div>
- </ScrollArea>
- </ResizablePanel>
- <ResizableHandle withHandle />
- <ResizablePanel order={2}>
- <div className="flex h-[calc(100dvh-99px)] w-full">
- <div className="flex h-full w-full overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent">
- <VStack spacing={2} className="p-2">
- <Outlet />
- </VStack>
- </div>
- <SalesOrderProperties />
+ <ResizablePanels
+ explorer={<SalesOrderExplorer />}
+ content={
+ <div className="h-[calc(100dvh-99px)] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">
+ <VStack spacing={2} className="p-2">
+ <Outlet />
+ </VStack>
</div>
- </ResizablePanel>
- </ResizablePanelGroup>
+ }
+ properties={<SalesOrderProperties />}
+ />
)}
</ClientOnly>
</div>
</div>
</div>
- </div>
+ </PanelProvider>
);
}
diff --git a/apps/carbon/app/routes/x+/sales-rfq+/$rfqId.$lineId.details.tsx b/apps/carbon/app/routes/x+/sales-rfq+/$rfqId.$lineId.details.tsx
index 991fa021bd..714f9ae60e 100644
--- a/apps/carbon/app/routes/x+/sales-rfq+/$rfqId.$lineId.details.tsx
+++ b/apps/carbon/app/routes/x+/sales-rfq+/$rfqId.$lineId.details.tsx
@@ -154,8 +154,8 @@ export default function SalesRFQLine() {
}}
modelPath={line?.modelPath ?? null}
title="CAD Model"
- uploadClassName="min-h-[420px]"
- viewerClassName="min-h-[420px]"
+ uploadClassName="aspect-square min-h-[420px]"
+ viewerClassName="aspect-square min-h-[420px]"
/>
</div>
diff --git a/apps/carbon/app/routes/x+/sales-rfq+/$rfqId.tsx b/apps/carbon/app/routes/x+/sales-rfq+/$rfqId.tsx
index 598386ed2d..ad1f5720a2 100644
--- a/apps/carbon/app/routes/x+/sales-rfq+/$rfqId.tsx
+++ b/apps/carbon/app/routes/x+/sales-rfq+/$rfqId.tsx
@@ -1,8 +1,5 @@
import {
ClientOnly,
- ResizableHandle,
- ResizablePanel,
- ResizablePanelGroup,
supportedModelTypes,
VStack,
type JSONContent,
@@ -28,6 +25,7 @@ import {
import { error, getCarbonServiceRole } from "@carbon/auth";
import { requirePermissions } from "@carbon/auth/auth.server";
import { flash } from "@carbon/auth/session.server";
+import { PanelProvider, ResizablePanels } from "~/components/Layout/Panels";
import { useOptimisticDocumentDrag } from "~/modules/sales/ui/SalesRFQ/useOptimiticDocumentDrag";
import type { Handle } from "~/utils/handle";
import { path } from "~/utils/path";
@@ -148,42 +146,30 @@ export default function SalesRFQRoute() {
return (
<DndContext onDragEnd={handleDragEnd}>
- <div className="flex flex-col h-[calc(100dvh-49px)] w-full">
- <SalesRFQHeader />
- <div className="flex h-[calc(100dvh-99px)] w-full">
- <div className="flex h-full w-full overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent">
+ <PanelProvider>
+ <div className="flex flex-col h-[calc(100dvh-49px)] overflow-hidden w-full">
+ <SalesRFQHeader />
+ <div className="flex h-[calc(100dvh-99px)] overflow-hidden w-full">
<div className="flex flex-grow overflow-hidden">
<ClientOnly fallback={null}>
{() => (
- <ResizablePanelGroup direction="horizontal">
- <ResizablePanel
- order={1}
- minSize={10}
- defaultSize={20}
- className="bg-card h-full z-0 shadow-lg"
- >
- <div className="grid w-full h-full overflow-hidden">
- <SalesRFQExplorer />
+ <ResizablePanels
+ explorer={<SalesRFQExplorer />}
+ content={
+ <div className="h-[calc(100dvh-99px)] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">
+ <VStack spacing={2} className="p-2">
+ <Outlet />
+ </VStack>
</div>
- </ResizablePanel>
- <ResizableHandle withHandle />
- <ResizablePanel order={2} className="z-1">
- <div className="flex h-[calc(100dvh-99px)] w-full">
- <div className="flex h-full w-full overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent">
- <VStack spacing={2} className="p-2">
- <Outlet />
- </VStack>
- </div>
- <SalesRFQProperties />
- </div>
- </ResizablePanel>
- </ResizablePanelGroup>
+ }
+ properties={<SalesRFQProperties />}
+ />
)}
</ClientOnly>
</div>
</div>
</div>
- </div>
+ </PanelProvider>
</DndContext>
);
}