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.

refactor: make quote line a nodejs runtime function so we don't exceed the size limits

Brad Barbin41644810cde9
diff --git a/apps/carbon/app/modules/sales/ui/Quotes/QuoteSummary.tsx b/apps/carbon/app/modules/sales/ui/Quotes/QuoteSummary.tsx
index 86b71dfdb9..a581194abb 100644
--- a/apps/carbon/app/modules/sales/ui/Quotes/QuoteSummary.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotes/QuoteSummary.tsx
@@ -20,6 +20,7 @@ import {
import { formatDate } from "@carbon/utils";
import { useLocale } from "@react-aria/i18n";
import { Link, useParams } from "@remix-run/react";
+import { motion } from "framer-motion";
import MotionNumber from "motion-number";
import type { Dispatch, SetStateAction } from "react";
import { useEffect, useMemo, useState } from "react";
@@ -127,7 +128,13 @@ const LineItems = ({
}
return (
- <div key={line.id} className="border-b border-input py-6 w-full">
+ <motion.div
+ key={line.id}
+ initial={{ opacity: 0, y: 50 }}
+ animate={{ opacity: 1, y: 0 }}
+ transition={{ duration: 0.5 }}
+ className="border-b border-input py-6 w-full"
+ >
<HStack spacing={4} className="items-start">
{line.thumbnailPath ? (
<img
@@ -163,6 +170,14 @@ const LineItems = ({
</Link>
</HStack>
<HStack spacing={4}>
+ {/* <span className="font-medium text-xl">
+ {formatter.format(
+ (selectedLines[line.id!]?.convertedNetUnitPrice ??
+ 0) *
+ (selectedLines[line.id!]?.quantity ?? 0) +
+ (selectedLines[line.id!]?.convertedAddOn ?? 0)
+ )}
+ </span> */}
<MotionNumber
className="font-bold text-xl"
value={
@@ -179,16 +194,14 @@ const LineItems = ({
}}
locales={locale}
/>
- <div
- style={{
- transform: `rotate(${
- openItems.includes(line.id) ? "180deg" : "0deg"
- })`,
- transition: "transform 0.3s",
+ <motion.div
+ animate={{
+ rotate: openItems.includes(line.id) ? 180 : 0,
}}
+ transition={{ duration: 0.3 }}
>
<LuChevronDown size={24} />
- </div>
+ </motion.div>
</HStack>
</div>
<span className="text-muted-foreground text-base truncate">
@@ -198,15 +211,15 @@ const LineItems = ({
</VStack>
</HStack>
- <div
- style={{
- height: openItems.includes(line.id) ? "auto" : 0,
- opacity: openItems.includes(line.id) ? 1 : 0,
- marginTop: openItems.includes(line.id) ? 16 : 0,
- overflow: "hidden",
- transition: "all 0.3s",
+ <motion.div
+ initial="collapsed"
+ animate={openItems.includes(line.id) ? "open" : "collapsed"}
+ variants={{
+ open: { opacity: 1, height: "auto", marginTop: 16 },
+ collapsed: { opacity: 0, height: 0, marginTop: 0 },
}}
- className="w-full"
+ transition={{ duration: 0.3 }}
+ className="w-full overflow-hidden"
>
<LinePricingOptions
formatter={formatter}
@@ -219,8 +232,8 @@ const LineItems = ({
selectedLine={selectedLines[line.id!]}
setSelectedLines={setSelectedLines}
/>
- </div>
- </div>
+ </motion.div>
+ </motion.div>
);
})}
</VStack>
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 3f9a17bea4..e34e2937ca 100644
--- a/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsx
@@ -34,6 +34,10 @@ import {
import { setCustomFields } from "~/utils/form";
import { path } from "~/utils/path";
+export const config = {
+ runtime: "nodejs",
+};
+
export const loader = async ({ request, params }: LoaderFunctionArgs) => {
const { companyId } = await requirePermissions(request, {
view: "sales",