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: responsive design

Brad Barbin7af67db75b19
diff --git a/apps/carbon/app/components/Form/ConversionFactor.tsx b/apps/carbon/app/components/Form/ConversionFactor.tsx
index 9c5955bbe6..4f0c57f24b 100644
--- a/apps/carbon/app/components/Form/ConversionFactor.tsx
+++ b/apps/carbon/app/components/Form/ConversionFactor.tsx
@@ -23,7 +23,7 @@ import { twoDecimals } from "@carbon/utils";
import type { ElementRef } from "react";
import { forwardRef, useMemo, useRef, useState } from "react";
import { LuChevronDown, LuChevronUp } from "react-icons/lu";
-import { MdTranslate } from "react-icons/md";
+import { MdSwapHoriz, MdTranslate } from "react-icons/md";
import { useUnitOfMeasure } from "./UnitOfMeasure";
enum ConversionDirection {
@@ -193,6 +193,7 @@ const ConversionFactor = forwardRef<
className="border-dashed"
>
Switch
+ <MdSwapHoriz className="w-4 h-4 ml-1" />
</Button>
</div>
</VStack>
diff --git a/apps/carbon/app/components/Layout/Navigation/IconSidebar.tsx b/apps/carbon/app/components/Layout/Navigation/IconSidebar.tsx
index 533bd108c7..054d49f20a 100644
--- a/apps/carbon/app/components/Layout/Navigation/IconSidebar.tsx
+++ b/apps/carbon/app/components/Layout/Navigation/IconSidebar.tsx
@@ -3,9 +3,11 @@ import { Link, useMatches } from "@remix-run/react";
import { noop } from "@tanstack/react-table";
import { forwardRef, type AnchorHTMLAttributes } from "react";
import { BsFillHexagonFill } from "react-icons/bs";
+import { CgProfile } from "react-icons/cg";
import { z } from "zod";
import { useOptimisticLocation } from "~/hooks";
import type { Authenticated, NavItem } from "~/types";
+import { path } from "~/utils/path";
import { useModules } from "./useModules";
export const ModuleHandle = z.object({
@@ -29,7 +31,7 @@ const IconSidebar = () => {
}, new Set<string>());
return (
- <div className="w-14 h-full flex flex-col z-50">
+ <div className="w-14 h-full flex-col z-50 hidden sm:flex">
<nav
data-state={navigationPanel.isOpen ? "expanded" : "collapsed"}
className={cn(
@@ -41,33 +43,50 @@ const IconSidebar = () => {
onMouseEnter={navigationPanel.onOpen}
onMouseLeave={navigationPanel.onClose}
>
- <VStack spacing={1} className="flex flex-col justify-start px-2">
- <Button isIcon asChild variant="ghost" size="lg">
- <Link to="/">
- <BsFillHexagonFill />
- </Link>
- </Button>
+ <VStack
+ spacing={1}
+ className="flex flex-col justify-between h-full px-2"
+ >
+ <VStack spacing={1}>
+ <Button isIcon asChild variant="ghost" size="lg">
+ <Link to="/">
+ <BsFillHexagonFill />
+ </Link>
+ </Button>
+ {links.map((link) => {
+ const m = getModule(link.to);
+ const moduleMatches = matchedModules.has(m);
+ const anotherModuleMatches = links.some((l) => {
+ const m = getModule(l.to);
+ return matchedModules.has(m);
+ });
- {links.map((link) => {
- const m = getModule(link.to);
- const moduleMatches = matchedModules.has(m);
- const anotherModuleMatches = links.some((l) => {
- const m = getModule(l.to);
- return matchedModules.has(m);
- });
+ const isActive =
+ currentModule === m || (moduleMatches && !anotherModuleMatches);
+ return (
+ <NavigationIconLink
+ key={link.name}
+ link={link}
+ isActive={isActive}
+ isOpen={navigationPanel.isOpen}
+ onClick={navigationPanel.onClose}
+ />
+ );
+ })}
+ </VStack>
- const isActive =
- currentModule === m || (moduleMatches && !anotherModuleMatches);
- return (
- <NavigationIconLink
- key={link.name}
- link={link}
- isActive={isActive}
- isOpen={navigationPanel.isOpen}
- onClick={navigationPanel.onClose}
- />
- );
- })}
+ <VStack spacing={1}>
+ <NavigationIconLink
+ link={{
+ to: path.to.profile,
+ icon: CgProfile,
+ name: "Account",
+ }}
+ isActive={matchedModules.has(getModule(path.to.profile))}
+ isOpen={navigationPanel.isOpen}
+ onClick={navigationPanel.onClose}
+ />
+ </VStack>
</VStack>
</nav>
</div>
diff --git a/apps/carbon/app/components/Layout/Navigation/useModules.tsx b/apps/carbon/app/components/Layout/Navigation/useModules.tsx
index 120ab06181..2fb0b2256d 100644
--- a/apps/carbon/app/components/Layout/Navigation/useModules.tsx
+++ b/apps/carbon/app/components/Layout/Navigation/useModules.tsx
@@ -6,7 +6,6 @@ import {
BsPeopleFill,
BsShieldLock,
} from "react-icons/bs";
-import { CgProfile } from "react-icons/cg";
import { HiOutlineCube, HiOutlineDocumentDuplicate } from "react-icons/hi";
import { LuSettings2 } from "react-icons/lu";
import { TbPigMoney } from "react-icons/tb";
@@ -102,11 +101,6 @@ export function useModules() {
to: path.to.company,
icon: LuSettings2,
},
- {
- name: "My Account",
- to: path.to.profile,
- icon: CgProfile,
- },
];
return modules.filter((item) => {
diff --git a/apps/carbon/app/components/Layout/Topbar/Breadcrumbs.tsx b/apps/carbon/app/components/Layout/Topbar/Breadcrumbs.tsx
index c8f80087e0..42db582b0b 100644
--- a/apps/carbon/app/components/Layout/Topbar/Breadcrumbs.tsx
+++ b/apps/carbon/app/components/Layout/Topbar/Breadcrumbs.tsx
@@ -1,5 +1,6 @@
-import { HStack } from "@carbon/react";
-import { useMatches } from "@remix-run/react";
+import { Button, HStack, useWindowSize } from "@carbon/react";
+import { Link, useMatches } from "@remix-run/react";
+import { BsFillHexagonFill } from "react-icons/bs";
import { z } from "zod";
import {
BreadcrumbItem,
@@ -32,9 +33,20 @@ const Breadcrumbs = () => {
})
.filter(Boolean);
+ const { width } = useWindowSize();
+
return (
<HStack className="items-center h-full -ml-2" spacing={0}>
<BreadcrumbsBase className="line-clamp-1">
+ {width && width <= 640 && (
+ <BreadcrumbItem>
+ <Button isIcon asChild variant="ghost">
+ <Link to="/">
+ <BsFillHexagonFill />
+ </Link>
+ </Button>
+ </BreadcrumbItem>
+ )}
{breadcrumbs.map((breadcrumb, i) => (
<BreadcrumbItem key={i}>
<BreadcrumbLink
diff --git a/apps/carbon/app/components/Layout/Topbar/HelpMenu.tsx b/apps/carbon/app/components/Layout/Topbar/HelpMenu.tsx
index ac47cf2e98..2b5827ba6d 100644
--- a/apps/carbon/app/components/Layout/Topbar/HelpMenu.tsx
+++ b/apps/carbon/app/components/Layout/Topbar/HelpMenu.tsx
@@ -13,7 +13,12 @@ const HelpMenu = () => {
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <IconButton aria-label="Help" icon={<BiHelpCircle />} variant="ghost" />
+ <IconButton
+ className="hidden sm:block"
+ aria-label="Help"
+ icon={<BiHelpCircle />}
+ variant="ghost"
+ />
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-48">
<DropdownMenuItem asChild>
diff --git a/apps/carbon/app/components/Layout/Topbar/ModeSwitcher.tsx b/apps/carbon/app/components/Layout/Topbar/ModeSwitcher.tsx
index 3e5052c5f3..b7ea337ed7 100644
--- a/apps/carbon/app/components/Layout/Topbar/ModeSwitcher.tsx
+++ b/apps/carbon/app/components/Layout/Topbar/ModeSwitcher.tsx
@@ -23,6 +23,7 @@ const ModeSwitcher = () => {
onSubmit={() => {
document.body.removeAttribute("style");
}}
+ className="hidden sm:block"
>
<input type="hidden" name="mode" value={nextMode} />
diff --git a/apps/carbon/app/components/Layout/Topbar/Topbar.tsx b/apps/carbon/app/components/Layout/Topbar/Topbar.tsx
index afe57b4c36..c75147e4cb 100644
--- a/apps/carbon/app/components/Layout/Topbar/Topbar.tsx
+++ b/apps/carbon/app/components/Layout/Topbar/Topbar.tsx
@@ -8,7 +8,7 @@ import ModeSwitcher from "./ModeSwitcher";
const Topbar = () => {
return (
- <div className="grid bg-background text-foreground border-b border-border px-4 top-0 sticky z-10 space-x-4 grid-cols-[1fr_auto_1fr] items-center">
+ <div className="grid bg-background text-foreground border-b border-border px-4 top-0 sticky z-10 space-x-4 grid-cols-[auto_1fr] sm:grid-cols-[1fr_auto_1fr] items-center">
<Breadcrumbs />
<Search />
<HStack spacing={1} className="justify-end py-2">
diff --git a/apps/carbon/app/components/Search/DebouncedInput/DebouncedInput.tsx b/apps/carbon/app/components/Search/DebouncedInput/DebouncedInput.tsx
index 2d692ed2d2..0063e2e45a 100644
--- a/apps/carbon/app/components/Search/DebouncedInput/DebouncedInput.tsx
+++ b/apps/carbon/app/components/Search/DebouncedInput/DebouncedInput.tsx
@@ -26,7 +26,7 @@ const DebouncedInput = ({ param, ...props }: DebounceInputProps) => {
<Input
defaultValue={params.get(param) || ""}
onChange={(e) => setQuery(e.target.value)}
- className="w-[200px]"
+ className="w-[100px] sm:w-[200px]"
{...props}
/>
);
diff --git a/apps/carbon/app/components/Search/Search/Search.tsx b/apps/carbon/app/components/Search/Search/Search.tsx
index 5548516a91..74b55dd67a 100644
--- a/apps/carbon/app/components/Search/Search/Search.tsx
+++ b/apps/carbon/app/components/Search/Search/Search.tsx
@@ -255,7 +255,7 @@ const SearchButton = () => {
});
return (
- <>
+ <div className="hidden sm:block">
<Button
leftIcon={<RxMagnifyingGlass />}
variant="secondary"
@@ -268,7 +268,7 @@ const SearchButton = () => {
</HStack>
</Button>
<SearchModal isOpen={searchModal.isOpen} onClose={searchModal.onClose} />
- </>
+ </div>
);
};
diff --git a/apps/carbon/app/modules/parts/ui/Part/PartHeader.tsx b/apps/carbon/app/modules/parts/ui/Part/PartHeader.tsx
index c2dd2d96bb..7e46b44757 100644
--- a/apps/carbon/app/modules/parts/ui/Part/PartHeader.tsx
+++ b/apps/carbon/app/modules/parts/ui/Part/PartHeader.tsx
@@ -93,7 +93,7 @@ const PartHeader = () => {
</CardAttributeValue>
</CardAttribute>
<CardAttribute>
- <CardAttributeLabel>Unit of Measure</CardAttributeLabel>
+ <CardAttributeLabel>UoM</CardAttributeLabel>
<CardAttributeValue>
{routeData?.partSummary?.unitOfMeasureCode}
</CardAttributeValue>
diff --git a/apps/carbon/app/modules/purchasing/purchasing.models.ts b/apps/carbon/app/modules/purchasing/purchasing.models.ts
index 4adcfca910..44baf23b5b 100644
--- a/apps/carbon/app/modules/purchasing/purchasing.models.ts
+++ b/apps/carbon/app/modules/purchasing/purchasing.models.ts
@@ -97,6 +97,7 @@ export const purchaseOrderLineValidator = z
description: zfd.text(z.string().optional()),
purchaseQuantity: zfd.numeric(z.number().optional()),
unitOfMeasureCode: zfd.text(z.string().optional()),
+ conversionFactor: zfd.numeric(z.number().optional()),
unitPrice: zfd.numeric(z.number().optional()),
setupPrice: zfd.numeric(z.number().optional()),
locationId: zfd.text(z.string().optional()),
diff --git a/apps/carbon/app/modules/sales/ui/Quotation/QuotationExplorer.tsx b/apps/carbon/app/modules/sales/ui/Quotation/QuotationExplorer.tsx
index e202ea1d24..e1b760a3dd 100644
--- a/apps/carbon/app/modules/sales/ui/Quotation/QuotationExplorer.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotation/QuotationExplorer.tsx
@@ -466,13 +466,7 @@ const QuotationExplorer = () => {
return tree.map((node) => {
return (
<div className="w-full" role="group" key={`${node.id}:${node.type}`}>
- <HStack
- className="items-stretch w-full border-l border-border"
- spacing={0}
- style={{
- paddingLeft: `calc(${0.75 * level}rem)`,
- }}
- >
+ <HStack className="items-stretch w-full" spacing={0}>
<IconButton
aria-label={collapsedNodes[node.id] ? "Expand" : "Collapse"}
onClick={() => toggleNode(node.id)}
diff --git a/packages/react/src/Menubar.tsx b/packages/react/src/Menubar.tsx
index e8451c62d3..60fc949fa1 100644
--- a/packages/react/src/Menubar.tsx
+++ b/packages/react/src/Menubar.tsx
@@ -8,7 +8,7 @@ const Menubar = forwardRef<HTMLDivElement, ComponentProps<"div">>(
return (
<div
{...props}
- className="flex items-center bg-card border border-border rounded-lg shadow-sm justify-start p-1 w-full space-x-1"
+ className="flex items-center bg-card border border-border rounded-lg shadow-sm justify-start p-1 w-full space-x-1 overflow-x-scroll scrollbar-hide"
>
{children}
</div>
diff --git a/packages/react/src/hooks/index.ts b/packages/react/src/hooks/index.ts
index 178f6c3a20..2707f63683 100644
--- a/packages/react/src/hooks/index.ts
+++ b/packages/react/src/hooks/index.ts
@@ -7,6 +7,7 @@ import useKeyboardShortcuts from "./useKeyboardShortcuts";
import useLocalStorage from "./useLocalStorage";
import useMount from "./useMount";
import useOutsideClick from "./useOutsideClick";
+import useWindowSize from "./useWindowSize";
export {
useDebounce,
@@ -18,4 +19,5 @@ export {
useLocalStorage,
useMount,
useOutsideClick,
+ useWindowSize,
};
diff --git a/packages/react/src/hooks/useWindowSize.ts b/packages/react/src/hooks/useWindowSize.ts
new file mode 100644
index 0000000000..86848dbaea
--- /dev/null
+++ b/packages/react/src/hooks/useWindowSize.ts
@@ -0,0 +1,29 @@
+import { useLayoutEffect, useState } from "react";
+
+export default function useWindowSize() {
+ const [size, setSize] = useState<{
+ height: number | null;
+ width: number | null;
+ }>({
+ width: null,
+ height: null,
+ });
+
+ useLayoutEffect(() => {
+ const handleResize = () => {
+ setSize({
+ width: window.innerWidth,
+ height: window.innerHeight,
+ });
+ };
+
+ handleResize();
+ window.addEventListener("resize", handleResize);
+
+ return () => {
+ window.removeEventListener("resize", handleResize);
+ };
+ }, []);
+
+ return size;
+}
diff --git a/packages/react/src/index.tsx b/packages/react/src/index.tsx
index 4f073fa0e7..d874f1b530 100644
--- a/packages/react/src/index.tsx
+++ b/packages/react/src/index.tsx
@@ -227,6 +227,7 @@ import {
useKeyboardShortcuts,
useMount,
useOutsideClick,
+ useWindowSize,
} from "./hooks";
import { cn } from "./utils/cn";
import { getValidChildren, reactNodeToString } from "./utils/react";
@@ -445,6 +446,7 @@ export {
useModalDrawerType,
useMount,
useOutsideClick,
+ useWindowSize,
};
export type {
AvatarProps,