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.

style: fix layout so panes are scrollable but nav is not

Brad Barbin11d71d0221b0
diff --git a/apps/carbon/app/components/Layout/Navigation/CollapsibleSidebar.tsx b/apps/carbon/app/components/Layout/Navigation/CollapsibleSidebar.tsx
index d07057e3d9..71782d61ed 100644
--- a/apps/carbon/app/components/Layout/Navigation/CollapsibleSidebar.tsx
+++ b/apps/carbon/app/components/Layout/Navigation/CollapsibleSidebar.tsx
@@ -2,7 +2,6 @@ import {
IconButton,
Tooltip,
TooltipContent,
- TooltipProvider,
TooltipTrigger,
useDisclosure,
} from "@carbon/react";
@@ -30,21 +29,21 @@ export const CollapsibleSidebar = ({
}, [width]);
return (
- <TooltipProvider>
- <motion.div
- animate={sidebar.isOpen ? "visible" : "hidden"}
- initial={variants.visible}
- transition={{ duration: 0.2, ease: "easeInOut" }}
- variants={variants}
- className="bg-popover text-popover-foreground border-r border-border h-full min-h-[calc(100vh-50px)] sticky top-50 z-[3]"
- >
+ <motion.div
+ animate={sidebar.isOpen ? "visible" : "hidden"}
+ initial={variants.visible}
+ transition={{ duration: 0.2, ease: "easeInOut" }}
+ variants={variants}
+ className="relative flex h-[calc(100vh-49px)]"
+ >
+ <div className="h-full w-full overflow-y-scroll bg-card border-r border-border">
<Tooltip>
<TooltipTrigger asChild>
<IconButton
onClick={sidebar.onToggle}
icon={sidebar.isOpen ? <TbArrowBarLeft /> : <TbArrowBarRight />}
aria-label="Toggle sidebar"
- className="bg-popover inline-block border border-border border-l-0 absolute pl-2 top-[calc(100vh-135px)] text-muted-foreground right-[-32px] left-auto rounded-l-none z-[3] hover:bg-popover p-0"
+ className="bg-popover inline-block border border-border border-l-0 absolute pl-2 top-[calc(100vh-135px)] text-muted-foreground right-[-31px] left-auto rounded-l-none z-[3] hover:bg-popover p-0"
/>
</TooltipTrigger>
@@ -54,7 +53,7 @@ export const CollapsibleSidebar = ({
</Tooltip>
{sidebar.isOpen ? children : null}
- </motion.div>
- </TooltipProvider>
+ </div>
+ </motion.div>
);
};
diff --git a/apps/carbon/app/components/Layout/Navigation/DetailSidebar.tsx b/apps/carbon/app/components/Layout/Navigation/DetailSidebar.tsx
index 636a61c996..b916c4b3a7 100644
--- a/apps/carbon/app/components/Layout/Navigation/DetailSidebar.tsx
+++ b/apps/carbon/app/components/Layout/Navigation/DetailSidebar.tsx
@@ -4,7 +4,6 @@ import {
HStack,
Tooltip,
TooltipContent,
- TooltipProvider,
TooltipTrigger,
VStack,
useKeyboardShortcuts,
@@ -37,42 +36,40 @@ const DetailSidebar = ({ links }: DetailSidebarProps) => {
);
return (
- <TooltipProvider>
- <VStack className="overflow-y-auto h-full" spacing={1}>
- {links.map((route) => {
- const isActive = matches.some(
- (match) =>
- (match.pathname.includes(route.to) && route.to !== "") ||
- (match.id.includes(".index") && route.to === "")
- );
+ <VStack className="overflow-y-auto h-full" spacing={1}>
+ {links.map((route) => {
+ const isActive = matches.some(
+ (match) =>
+ (match.pathname.includes(route.to) && route.to !== "") ||
+ (match.id.includes(".index") && route.to === "")
+ );
- return (
- <Tooltip key={route.name}>
- <TooltipTrigger className="w-full">
- <Button
- asChild
- variant={isActive ? "primary" : "ghost"}
- className="w-full justify-start"
- >
- <Link to={route.to} prefetch="intent">
- {route.icon && <route.icon className="mr-2" />}
- <span>{route.name}</span>
- {route.count !== undefined && (
- <Count count={route.count} className="ml-auto" />
- )}
- </Link>
- </Button>
- </TooltipTrigger>
- {route.shortcut && (
- <TooltipContent side="right">
- <HStack>{prettifyKeyboardShortcut(route.shortcut)}</HStack>
- </TooltipContent>
- )}
- </Tooltip>
- );
- })}
- </VStack>
- </TooltipProvider>
+ return (
+ <Tooltip key={route.name}>
+ <TooltipTrigger className="w-full">
+ <Button
+ asChild
+ variant={isActive ? "primary" : "ghost"}
+ className="w-full justify-start"
+ >
+ <Link to={route.to} prefetch="intent">
+ {route.icon && <route.icon className="mr-2" />}
+ <span>{route.name}</span>
+ {route.count !== undefined && (
+ <Count count={route.count} className="ml-auto" />
+ )}
+ </Link>
+ </Button>
+ </TooltipTrigger>
+ {route.shortcut && (
+ <TooltipContent side="right">
+ <HStack>{prettifyKeyboardShortcut(route.shortcut)}</HStack>
+ </TooltipContent>
+ )}
+ </Tooltip>
+ );
+ })}
+ </VStack>
);
};
diff --git a/apps/carbon/app/components/New.tsx b/apps/carbon/app/components/New.tsx
index 4beff38d8a..dd767c8563 100644
--- a/apps/carbon/app/components/New.tsx
+++ b/apps/carbon/app/components/New.tsx
@@ -4,7 +4,6 @@ import {
Kbd,
Tooltip,
TooltipContent,
- TooltipProvider,
TooltipTrigger,
useKeyboardShortcuts,
} from "@carbon/react";
@@ -27,23 +26,21 @@ const New = ({ label, to }: NewProps) => {
});
return (
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger>
- <Button asChild leftIcon={<IoMdAdd />} ref={buttonRef}>
- <Link to={to} prefetch="intent">
- New
- </Link>
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- <HStack>
- <span>New {label}</span>
- <Kbd>N</Kbd>
- </HStack>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger>
+ <Button asChild leftIcon={<IoMdAdd />} ref={buttonRef}>
+ <Link to={to} prefetch="intent">
+ New
+ </Link>
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <HStack>
+ <span>New {label}</span>
+ <Kbd>N</Kbd>
+ </HStack>
+ </TooltipContent>
+ </Tooltip>
);
};
diff --git a/apps/carbon/app/components/Selectors/UserSelect/components/SelectionList.tsx b/apps/carbon/app/components/Selectors/UserSelect/components/SelectionList.tsx
index 509fb85481..8767cd4412 100644
--- a/apps/carbon/app/components/Selectors/UserSelect/components/SelectionList.tsx
+++ b/apps/carbon/app/components/Selectors/UserSelect/components/SelectionList.tsx
@@ -4,7 +4,6 @@ import {
IconButton,
Tooltip,
TooltipContent,
- TooltipProvider,
TooltipTrigger,
} from "@carbon/react";
import { useMemo } from "react";
@@ -38,89 +37,85 @@ const SelectionList = () => {
);
return (
- <TooltipProvider>
- <ul
- className="w-full mt-1"
- style={{
- maxWidth: width,
- maxHeight: selectionsMaxHeight,
- overflowY: selectionsMaxHeight ? "auto" : undefined,
- }}
- >
- {selected.map((item) => {
- const id = `UserSelection:SelectedItem-${item.id}`;
- const canExpand = !checkedSelections && !readOnly && isGroup(item);
+ <ul
+ className="w-full mt-1"
+ style={{
+ maxWidth: width,
+ maxHeight: selectionsMaxHeight,
+ overflowY: selectionsMaxHeight ? "auto" : undefined,
+ }}
+ >
+ {selected.map((item) => {
+ const id = `UserSelection:SelectedItem-${item.id}`;
+ const canExpand = !checkedSelections && !readOnly && isGroup(item);
- return (
- <li className="p-2 rounded-md hover:bg-accent" key={item.id}>
- <div className="flex items-center space-x-2">
- {checkedSelections ? (
- <HStack className="w-full">
- <Checkbox
- id={`${instanceId}:${id}:checkbox`}
- data-testid={id}
- isChecked={item.isChecked}
- onCheckedChange={() => onToggleChecked(item)}
+ return (
+ <li className="p-2 rounded-md hover:bg-accent" key={item.id}>
+ <div className="flex items-center space-x-2">
+ {checkedSelections ? (
+ <HStack className="w-full">
+ <Checkbox
+ id={`${instanceId}:${id}:checkbox`}
+ data-testid={id}
+ isChecked={item.isChecked}
+ onCheckedChange={() => onToggleChecked(item)}
+ />
+ <p className="flex-grow text-sm line-clamp-1">{item.label}</p>
+ </HStack>
+ ) : (
+ <>
+ {"fullName" in item ? (
+ <Avatar
+ name={item.fullName ?? undefined}
+ path={item.avatarUrl}
+ size="sm"
/>
- <p className="flex-grow text-sm line-clamp-1">
- {item.label}
- </p>
- </HStack>
- ) : (
- <>
- {"fullName" in item ? (
- <Avatar
- name={item.fullName ?? undefined}
- path={item.avatarUrl}
- size="sm"
- />
- ) : (
- <Avatar name={item.name} path={null} size="sm" />
- )}
+ ) : (
+ <Avatar name={item.name} path={null} size="sm" />
+ )}
- <div className="flex items-center flex-grow">
- <p className="text-sm line-clamp-1">{item.label}</p>
- </div>
- </>
- )}
+ <div className="flex items-center flex-grow">
+ <p className="text-sm line-clamp-1">{item.label}</p>
+ </div>
+ </>
+ )}
- {!!canExpand && (
- <Tooltip>
- <TooltipTrigger>
- <IconButton
- aria-label={`Expand ${item.label}`}
- icon={<MdPlaylistAdd />}
- onClick={() => onExplode(item)}
- variant="secondary"
- />
- </TooltipTrigger>
- <TooltipContent side="top">
- <span>Expand</span>
- </TooltipContent>
- </Tooltip>
- )}
+ {!!canExpand && (
+ <Tooltip>
+ <TooltipTrigger>
+ <IconButton
+ aria-label={`Expand ${item.label}`}
+ icon={<MdPlaylistAdd />}
+ onClick={() => onExplode(item)}
+ variant="secondary"
+ />
+ </TooltipTrigger>
+ <TooltipContent side="top">
+ <span>Expand</span>
+ </TooltipContent>
+ </Tooltip>
+ )}
- {!readOnly && !alwaysSelected.includes(item.id) && (
- <Tooltip>
- <TooltipTrigger>
- <IconButton
- aria-label={`Remove ${item.label}`}
- icon={<MdOutlineClear />}
- onClick={() => onDeselect(item)}
- variant="secondary"
- />
- </TooltipTrigger>
- <TooltipContent side="top">
- <span>Remove</span>
- </TooltipContent>
- </Tooltip>
- )}
- </div>
- </li>
- );
- })}
- </ul>
- </TooltipProvider>
+ {!readOnly && !alwaysSelected.includes(item.id) && (
+ <Tooltip>
+ <TooltipTrigger>
+ <IconButton
+ aria-label={`Remove ${item.label}`}
+ icon={<MdOutlineClear />}
+ onClick={() => onDeselect(item)}
+ variant="secondary"
+ />
+ </TooltipTrigger>
+ <TooltipContent side="top">
+ <span>Remove</span>
+ </TooltipContent>
+ </Tooltip>
+ )}
+ </div>
+ </li>
+ );
+ })}
+ </ul>
);
};
diff --git a/apps/carbon/app/components/Table/components/Pagination/Pagination.tsx b/apps/carbon/app/components/Table/components/Pagination/Pagination.tsx
index 35d7824b47..c701e45f53 100644
--- a/apps/carbon/app/components/Table/components/Pagination/Pagination.tsx
+++ b/apps/carbon/app/components/Table/components/Pagination/Pagination.tsx
@@ -11,7 +11,6 @@ import {
IconButton,
Tooltip,
TooltipContent,
- TooltipProvider,
TooltipTrigger,
useKeyboardShortcuts,
} from "@carbon/react";
@@ -103,7 +102,7 @@ export const PaginationButtons = ({
return (
<>
{condensed ? (
- <TooltipProvider>
+ <>
<Tooltip>
<TooltipTrigger>
<IconButton
@@ -132,9 +131,9 @@ export const PaginationButtons = ({
<HStack>{prettifyKeyboardShortcut("ArrowRight")}</HStack>
</TooltipContent>
</Tooltip>
- </TooltipProvider>
+ </>
) : (
- <TooltipProvider>
+ <>
<div className="text-foreground flex text-sm font-medium align-center">
{count > 0 ? offset + 1 : 0} - {Math.min(offset + pageSize, count)}{" "}
of {count}
@@ -171,7 +170,7 @@ export const PaginationButtons = ({
<HStack>{prettifyKeyboardShortcut("ArrowRight")}</HStack>
</TooltipContent>
</Tooltip>
- </TooltipProvider>
+ </>
)}
</>
);
diff --git a/apps/carbon/app/modules/sales/ui/Quotation/QuotationExplorer.tsx b/apps/carbon/app/modules/sales/ui/Quotation/QuotationExplorer.tsx
index cc18f37201..d652963826 100644
--- a/apps/carbon/app/modules/sales/ui/Quotation/QuotationExplorer.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotation/QuotationExplorer.tsx
@@ -543,7 +543,7 @@ const QuotationExplorer = () => {
</Tooltip>
</HStack>
</VStack>
- <VStack className="min-h-[calc(100vh-210px)] p-2 w-full">
+ <VStack className="h-full w-full p-2">
<div className="w-full h-full overflow-auto" role="tree">
{renderBillOfMaterial(tree)}
</div>
diff --git a/apps/carbon/app/modules/sales/ui/Quotation/QuotationLineForm.tsx b/apps/carbon/app/modules/sales/ui/Quotation/QuotationLineForm.tsx
index dba53d5027..f348bb49de 100644
--- a/apps/carbon/app/modules/sales/ui/Quotation/QuotationLineForm.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotation/QuotationLineForm.tsx
@@ -217,6 +217,7 @@ const QuotationLineForm = ({ initialValues }: QuotationLineFormProps) => {
}))}
className={cn(!isEditing && "sr-only")}
/>
+
<CustomFormFields table="quoteLine" />
</div>
</VStack>
diff --git a/apps/carbon/app/root.tsx b/apps/carbon/app/root.tsx
index 3dbedf28ff..2aebf86330 100644
--- a/apps/carbon/app/root.tsx
+++ b/apps/carbon/app/root.tsx
@@ -116,7 +116,7 @@ function Document({
<title>{title}</title>
<Links />
</head>
- <body className="bg-background">
+ <body className="h-full bg-background">
{children}
<ScrollRestoration />
<Scripts />
diff --git a/apps/carbon/app/routes/x+/_layout.tsx b/apps/carbon/app/routes/x+/_layout.tsx
index beacd010d2..f470c19243 100644
--- a/apps/carbon/app/routes/x+/_layout.tsx
+++ b/apps/carbon/app/routes/x+/_layout.tsx
@@ -1,4 +1,3 @@
-import { Toaster, VStack } from "@carbon/react";
import type { LoaderFunctionArgs } from "@remix-run/node";
import { json, redirect } from "@remix-run/node";
import { Outlet, useLoaderData, useNavigation } from "@remix-run/react";
@@ -21,6 +20,7 @@ import {
} from "~/services/session.server";
import { path } from "~/utils/path";
+import { TooltipProvider } from "@carbon/react";
import type { ShouldRevalidateFunction } from "@remix-run/react";
export const shouldRevalidate: ShouldRevalidateFunction = ({
@@ -94,7 +94,26 @@ export default function AuthenticatedRoute() {
return (
<SupabaseProvider session={session}>
<RealtimeDataProvider>
- <div className="h-screen min-h-[0px] basis-0 flex-1">
+ <TooltipProvider>
+ <div className="min-h-full flex flex-col">
+ <div className="flex-none" />
+ <div className="h-screen min-h-[0px] basis-0 flex-1">
+ <div className="flex h-full">
+ <IconSidebar />
+ <div className="flex w-full h-full">
+ <div className="w-full h-full flex-1 overflow-hidden">
+ <main className="h-full flex flex-col flex-1 w-full overflow-x-hidden">
+ <Topbar />
+ <main className="flex-1 overflow-y-auto max-h-[calc(100vh-49px)]">
+ <Outlet />
+ </main>
+ </main>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ {/* <div className="h-screen min-h-[0px] basis-0 flex-1">
<div className="flex h-full">
<IconSidebar />
<div className="w-full h-full">
@@ -109,7 +128,8 @@ export default function AuthenticatedRoute() {
</div>
</div>
<Toaster />
- </div>
+ </div> */}
+ </TooltipProvider>
</RealtimeDataProvider>
</SupabaseProvider>
);
diff --git a/apps/carbon/app/routes/x+/part+/_layout.tsx b/apps/carbon/app/routes/x+/part+/_layout.tsx
index f34c99f077..dfb8ca8b41 100644
--- a/apps/carbon/app/routes/x+/part+/_layout.tsx
+++ b/apps/carbon/app/routes/x+/part+/_layout.tsx
@@ -35,7 +35,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
export default function PartRoute() {
return (
- <VStack spacing={4} className="h-full p-2">
+ <VStack spacing={4} className="h-full p-4">
<Outlet />
</VStack>
);
diff --git a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.details.tsx b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.details.tsx
index 2e593a36e5..682e58c026 100644
--- a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.details.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.details.tsx
@@ -1,12 +1,37 @@
-import { validationError, validator } from "@carbon/remix-validated-form";
+import {
+ Button,
+ Card,
+ CardAction,
+ CardContent,
+ CardFooter,
+ CardHeader,
+ CardTitle,
+ Enumerable,
+ HStack,
+ IconButton,
+ Table,
+ Tbody,
+ Td,
+ Tfoot,
+ Th,
+ Thead,
+ Tr,
+ VStack,
+} from "@carbon/react";
+import {
+ ValidatedForm,
+ validationError,
+ validator,
+} from "@carbon/remix-validated-form";
import type { ActionFunctionArgs, LoaderFunctionArgs } from "@remix-run/node";
import { json, redirect } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
+import { BsThreeDotsVertical } from "react-icons/bs";
+import { z } from "zod";
+import { Number, Submit } from "~/components/Form";
import {
QuotationLineForm,
- QuotationLineQuantities,
getQuoteLine,
- getQuoteLineQuantities,
quotationLineValidator,
upsertQuoteLine,
} from "~/modules/sales";
@@ -26,14 +51,10 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const { lineId } = params;
if (!lineId) throw notFound("lineId not found");
- const [quotationLine, quotationLineQuantities] = await Promise.all([
- getQuoteLine(client, lineId),
- getQuoteLineQuantities(client, lineId),
- ]);
+ const [quotationLine] = await Promise.all([getQuoteLine(client, lineId)]);
return json({
quotationLine: quotationLine?.data ?? null,
- quotationLineQuantities: quotationLineQuantities?.data ?? [],
});
}
@@ -77,8 +98,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
}
export default function EditQuotationLineRoute() {
- const { quotationLine, quotationLineQuantities } =
- useLoaderData<typeof loader>();
+ const { quotationLine } = useLoaderData<typeof loader>();
if (!quotationLine) throw new Error("Could not find quotation line");
const initialValues = {
@@ -99,10 +119,228 @@ export default function EditQuotationLineRoute() {
return (
<>
<QuotationLineForm key={initialValues.id} initialValues={initialValues} />
- <QuotationLineQuantities
- quotationLine={quotationLine}
- quotationLineQuantities={quotationLineQuantities}
- />
+ <QuotationCostingTable />
+ <QuotationLinePrice />
</>
);
}
+
+export function QuotationCostingTable() {
+ return (
+ <Card>
+ <HStack className="justify-between items-start">
+ <CardHeader>
+ <CardTitle>Costing</CardTitle>
+ </CardHeader>
+ <CardAction>
+ <IconButton
+ variant="secondary"
+ icon={<BsThreeDotsVertical />}
+ aria-label="Options"
+ />
+ </CardAction>
+ </HStack>
+ <CardContent>
+ <Table>
+ <Thead>
+ <Tr>
+ <Th className="font-mono"></Th>
+ <Th className="font-mono">1</Th>
+ <Th className="font-mono">25</Th>
+ <Th className="font-mono">50</Th>
+ <Th className="font-mono">100</Th>
+ </Tr>
+ </Thead>
+ <Tbody>
+ <Tr>
+ <Td className="border-r border-border">
+ <HStack className="w-full justify-between ">
+ <span>Total Raw Material</span>
+ <Enumerable value="Material" />
+ </HStack>
+ </Td>
+ <Td className="font-mono">
+ <VStack spacing={0}>
+ <span>$3.00</span>
+ <span className="text-muted-foreground text-xs">$3.00</span>
+ </VStack>
+ </Td>
+ <Td className="font-mono">
+ <VStack spacing={0}>
+ <span>$75.00</span>
+ <span className="text-muted-foreground text-xs">$3.00</span>
+ </VStack>
+ </Td>
+ <Td className="font-mono">
+ <VStack spacing={0}>
+ <span>$150.00</span>
+ <span className="text-muted-foreground text-xs">$3.00</span>
+ </VStack>
+ </Td>
+ <Td className="font-mono">
+ <VStack spacing={0}>
+ <span>$300.00</span>
+ <span className="text-muted-foreground text-xs">$3.00</span>
+ </VStack>
+ </Td>
+ </Tr>
+ <Tr>
+ <Td className="border-r border-border">
+ <HStack className="w-full justify-between ">
+ <span>Total Labor &amp; Overhead</span>
+ <Enumerable value="Labor" />
+ </HStack>
+ </Td>
+ <Td className="font-mono">
+ <VStack spacing={0}>
+ <span>$3.00</span>
+ <span className="text-muted-foreground text-xs">$3.00</span>
+ </VStack>
+ </Td>
+ <Td className="font-mono">
+ <VStack spacing={0}>
+ <span>$75.00</span>
+ <span className="text-muted-foreground text-xs">$3.00</span>
+ </VStack>
+ </Td>
+ <Td className="font-mono">
+ <VStack spacing={0}>
+ <span>$150.00</span>
+ <span className="text-muted-foreground text-xs">$3.00</span>
+ </VStack>
+ </Td>
+ <Td className="font-mono">
+ <VStack spacing={0}>
+ <span>$300.00</span>
+ <span className="text-muted-foreground text-xs">$3.00</span>
+ </VStack>
+ </Td>
+ </Tr>
+ <Tr>
+ <Td className="border-r border-border">
+ <HStack className="w-full justify-between ">
+ <span>Total Outside Processing</span>
+ <Enumerable value="Subcontract" />
+ </HStack>
+ </Td>
+ <Td className="font-mono">
+ <VStack spacing={0}>
+ <span>$0.00</span>
+ <span className="text-muted-foreground text-xs">$0.00</span>
+ </VStack>
+ </Td>
+ <Td className="font-mono">
+ <VStack spacing={0}>
+ <span>$0.00</span>
+ <span className="text-muted-foreground text-xs">$0.00</span>
+ </VStack>
+ </Td>
+ <Td className="font-mono">
+ <VStack spacing={0}>
+ <span>$0.00</span>
+ <span className="text-muted-foreground text-xs">$0.00</span>
+ </VStack>
+ </Td>
+ <Td className="font-mono">
+ <VStack spacing={0}>
+ <span>$0.00</span>
+ <span className="text-muted-foreground text-xs">$0.00</span>
+ </VStack>
+ </Td>
+ </Tr>
+ <Tr className="font-bold">
+ <Td className="border-r border-border">
+ <HStack className="w-full justify-between ">
+ <span>Total Cost</span>
+ </HStack>
+ </Td>
+ <Td className="font-mono">
+ <VStack spacing={0}>
+ <span>$6.00</span>
+ <span className="text-muted-foreground text-xs">$6.00</span>
+ </VStack>
+ </Td>
+ <Td className="font-mono">
+ <VStack spacing={0}>
+ <span>$150.00</span>
+ <span className="text-muted-foreground text-xs">$6.00</span>
+ </VStack>
+ </Td>
+ <Td className="font-mono">
+ <VStack spacing={0}>
+ <span>$300.00</span>
+ <span className="text-muted-foreground text-xs">$6.00</span>
+ </VStack>
+ </Td>
+ <Td className="font-mono">
+ <VStack spacing={0}>
+ <span>$600.00</span>
+ <span className="text-muted-foreground text-xs">$6.00</span>
+ </VStack>
+ </Td>
+ </Tr>
+ </Tbody>
+ <Tfoot>
+ <Tr className="font-bold">
+ <Td className="border-r border-border"></Td>
+ <Td className="font-mono text-center">
+ <Button size="sm" variant="secondary">
+ Add
+ </Button>
+ </Td>
+ <Td className="font-mono text-center">
+ <Button size="sm" variant="secondary">
+ Add
+ </Button>
+ </Td>
+ <Td className="font-mono text-center">
+ <Button size="sm" variant="secondary">
+ Add
+ </Button>
+ </Td>
+ <Td className="font-mono text-center">
+ <Button size="sm" variant="secondary">
+ Add
+ </Button>
+ </Td>
+ </Tr>
+ </Tfoot>
+ </Table>
+ </CardContent>
+ </Card>
+ );
+}
+
+export function QuotationLinePrice() {
+ return (
+ <ValidatedForm validator={z.object({})} className="w-full">
+ <Card>
+ <CardHeader>
+ <CardTitle>Pricing</CardTitle>
+ </CardHeader>
+ <CardContent>
+ <div className="grid w-full gap-x-8 gap-y-2 grid-cols-1 lg:grid-cols-3">
+ <Number name="quantity" label="Quantity" />
+ <Number
+ name="unitCost"
+ label="Unit Cost"
+ formatOptions={{ style: "currency", currency: "USD" }}
+ />
+ <Number name="leadTime" label="Lead Time (Days)" />
+ <Number name="discountPercent" label="Discount %" />
+ <Number name="markupPercent" label="Markup %" />
+ <Number
+ name="extendedPrice"
+ label="Extended Price"
+ isReadOnly
+ formatOptions={{ style: "currency", currency: "USD" }}
+ />
+ </div>
+ </CardContent>
+ <CardFooter>
+ <Submit>Save</Submit>
+ </CardFooter>
+ </Card>
+ </ValidatedForm>
+ );
+}
diff --git a/apps/carbon/app/routes/x+/quote+/$id.tsx b/apps/carbon/app/routes/x+/quote+/$id.tsx
index 223cbbe3ee..95f86cce82 100644
--- a/apps/carbon/app/routes/x+/quote+/$id.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$id.tsx
@@ -9,7 +9,6 @@ import {
} from "@carbon/react";
import type { ActionFunctionArgs, LoaderFunctionArgs } from "@remix-run/node";
import { json, redirect } from "@remix-run/node";
-import type { ShouldRevalidateFunction } from "@remix-run/react";
import { Outlet, useLoaderData, useParams } from "@remix-run/react";
import { useEffect, useRef } from "react";
import {
@@ -18,7 +17,6 @@ import {
EmployeeAvatar,
useOptimisticAssignment,
} from "~/components";
-import { CollapsibleSidebar } from "~/components/Layout";
import { useSupabase } from "~/lib/supabase";
import { getLocationsList } from "~/modules/resources";
import {
@@ -48,21 +46,6 @@ export const handle: Handle = {
to: path.to.quotes,
};
-// TODO: remove this
-export const shouldRevalidate: ShouldRevalidateFunction = ({
- currentUrl,
- currentParams,
- nextUrl,
-}) => {
- // we don't want to revalidate if we're making an update to the quote line quantities
- // because it'll cause an infinite loop
- return !(
- currentUrl.pathname === nextUrl.pathname &&
- "lineId" in currentParams &&
- currentUrl.pathname.includes("details")
- );
-};
-
export async function loader({ request, params }: LoaderFunctionArgs) {
const { client } = await requirePermissions(request, {
view: "sales",
@@ -177,9 +160,12 @@ export default function QuotationRoute() {
: quotation?.assignee;
return (
- <div className="grid grid-cols-[auto_1fr] w-full">
- <CollapsibleSidebar width={280}>
- <VStack className="border-b border-border px-4 py-2" spacing={1}>
+ <div className="flex h-[calc(100vh-49px)]">
+ <VStack className="w-96 h-full z-40 overflow-y-scroll bg-card border-r border-border">
+ <VStack
+ className="bg-card border-b border-border px-4 py-2 sticky top-0 z-50"
+ spacing={1}
+ >
<HStack className="justify-between w-full">
<Heading size="h4" noOfLines={1}>
{quote.quote?.quoteId}
@@ -200,25 +186,36 @@ export default function QuotationRoute() {
</HStack>
</VStack>
<QuotationExplorer />
- </CollapsibleSidebar>
-
- <VStack className="px-4 py-2">
- <Menubar>
- <Assign id={id} table="quote" value={assignee ?? undefined} />
- <MenubarItem asChild>
- <a target="_blank" href={path.to.file.quote(id)} rel="noreferrer">
- Preview
- </a>
- </MenubarItem>
- <MenubarItem
- onClick={releaseDisclosure.onOpen}
- // isDisabled={isReleased}
- >
- Release
- </MenubarItem>
- </Menubar>
- <Outlet />
</VStack>
+
+ <div className="flex w-full h-full">
+ <div className="w-full h-full flex-1 overflow-hidden">
+ <VStack
+ spacing={4}
+ className="h-full w-full overflow-x-hidden flex-1 p-4"
+ >
+ <Menubar>
+ <Assign id={id} table="quote" value={assignee ?? undefined} />
+ <MenubarItem asChild>
+ <a
+ target="_blank"
+ href={path.to.file.quote(id)}
+ rel="noreferrer"
+ >
+ Preview
+ </a>
+ </MenubarItem>
+ <MenubarItem
+ onClick={releaseDisclosure.onOpen}
+ // isDisabled={isReleased}
+ >
+ Release
+ </MenubarItem>
+ </Menubar>
+ <Outlet />
+ </VStack>
+ </div>
+ </div>
{releaseDisclosure.isOpen && (
<QuotationReleaseModal
quotation={quotation}
diff --git a/apps/carbon/app/routes/x+/quote+/_layout.tsx b/apps/carbon/app/routes/x+/quote+/_layout.tsx
index e889481771..24228b8da7 100644
--- a/apps/carbon/app/routes/x+/quote+/_layout.tsx
+++ b/apps/carbon/app/routes/x+/quote+/_layout.tsx
@@ -1,4 +1,3 @@
-import { VStack } from "@carbon/react";
import type { MetaFunction } from "@remix-run/node";
import { Outlet } from "@remix-run/react";
import type { Handle } from "~/utils/handle";
@@ -15,9 +14,5 @@ export const handle: Handle = {
};
export default function QuotationRoute() {
- return (
- <VStack spacing={4} className="h-full">
- <Outlet />
- </VStack>
- );
+ return <Outlet />;
}
diff --git a/packages/react/src/Table.tsx b/packages/react/src/Table.tsx
index 2e11d9715e..769f1883c3 100644
--- a/packages/react/src/Table.tsx
+++ b/packages/react/src/Table.tsx
@@ -22,7 +22,7 @@ const Thead = forwardRef<
>(({ className, ...props }, ref) => (
<thead
ref={ref}
- className={cn("[&_tr]:border-b border-border", className)}
+ className={cn("bg-card [&_tr]:border-b border-border", className)}
{...props}
/>
));
@@ -42,7 +42,7 @@ const Tfoot = forwardRef<
>(({ className, ...props }, ref) => (
<tfoot
ref={ref}
- className={cn("bg-muted font-medium text-foreground", className)}
+ className={cn("font-medium text-foreground", className)}
{...props}
/>
));
@@ -53,7 +53,7 @@ const Tr = forwardRef<HTMLTableRowElement, HTMLAttributes<HTMLTableRowElement>>(
<tr
ref={ref}
className={cn(
- "border-b border-border transition-colors data-[state=selected]:bg-muted",
+ "bg-card border-b border-border transition-colors data-[state=selected]:bg-muted",
className
)}
{...props}
@@ -69,7 +69,7 @@ const Th = forwardRef<
<th
ref={ref}
className={cn(
- "bg-card h-11 px-6 text-left align-middle uppercase font-bold tracking-tight text-muted-foreground [&:has([role=checkbox])]:pr-0",
+ "h-11 px-6 text-left align-middle uppercase font-bold tracking-tight text-muted-foreground [&:has([role=checkbox])]:pr-0",
className
)}
{...props}