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(mobile): one PhoneActionBar for record, document and quantities pages

aashu6b361eb9c4a3
diff --git a/apps/erp/app/components/DocumentPage/DocumentPageHeader.tsx b/apps/erp/app/components/DocumentPage/DocumentPageHeader.tsx
index 22d54c08e8..65d6198928 100644
--- a/apps/erp/app/components/DocumentPage/DocumentPageHeader.tsx
+++ b/apps/erp/app/components/DocumentPage/DocumentPageHeader.tsx
@@ -16,7 +16,7 @@ import { useLingui } from "@lingui/react/macro";
import type { ReactNode } from "react";
import { Children, useEffect, useRef, useState } from "react";
import { LuEllipsisVertical, LuPanelRight } from "react-icons/lu";
-import { BottomBar } from "../Layout/Mobile/ChromeSlots";
+import { PhoneActionBar } from "../Layout/Mobile/ChromeSlots";
import { RecordPhoneChrome } from "../Layout/RecordHeader";
import { useDocumentPage } from "./DocumentPage";
@@ -110,11 +110,9 @@ export function DocumentPageHeader({
</header>
) : null}
{actions ? (
- <BottomBar>
- <div className="flex items-center gap-2 border-t border-border bg-card px-4 pt-2 pb-safe-4 [&>*]:min-w-0 [&>*]:flex-1">
- {actions}
- </div>
- </BottomBar>
+ <PhoneActionBar className="[&>*]:min-w-0 [&>*]:flex-1">
+ {actions}
+ </PhoneActionBar>
) : null}
</>
);
diff --git a/apps/erp/app/components/Layout/Mobile/ChromeSlots.tsx b/apps/erp/app/components/Layout/Mobile/ChromeSlots.tsx
index c9c5bdc4ba..d35c0faca4 100644
--- a/apps/erp/app/components/Layout/Mobile/ChromeSlots.tsx
+++ b/apps/erp/app/components/Layout/Mobile/ChromeSlots.tsx
@@ -2,7 +2,7 @@
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
-import { useViewport } from "@carbon/react";
+import { cn, useViewport } from "@carbon/react";
import type { ReactNode } from "react";
import { Children, useEffect, useState } from "react";
import { createPortalSlot } from "./slots";
@@ -37,6 +37,28 @@ export function AppBarActions({ children }: { children: ReactNode }) {
/** A compact bottom bar (action bar or bulk bar) that replaces the tab bar. */
export const BottomBar = bottomBarSlot.Fill;
+/** A page's phone action bar: its buttons in one row over the tab bar. */
+export function PhoneActionBar({
+ children,
+ className
+}: {
+ children: ReactNode;
+ className?: string;
+}) {
+ return (
+ <BottomBar>
+ <div
+ className={cn(
+ "flex items-center gap-2 border-t border-border bg-card px-4 pt-2 pb-safe-4",
+ className
+ )}
+ >
+ {children}
+ </div>
+ </BottomBar>
+ );
+}
+
/**
* Publish an element's height as a CSS variable on <html> while compact, so
* the app's existing `calc(100dvh - var(--…))` frames fit between the bars.
diff --git a/apps/erp/app/components/Layout/RecordHeader.tsx b/apps/erp/app/components/Layout/RecordHeader.tsx
index acdd93cb73..a4a50ae6a2 100644
--- a/apps/erp/app/components/Layout/RecordHeader.tsx
+++ b/apps/erp/app/components/Layout/RecordHeader.tsx
@@ -33,7 +33,7 @@ import { Link } from "react-router";
import { create } from "zustand";
import {
AppBarActions,
- BottomBar,
+ PhoneActionBar,
useCompactCssVar
} from "./Mobile/ChromeSlots";
import { createPortalSlot } from "./Mobile/slots";
@@ -244,13 +244,11 @@ export function RecordPhoneChrome({
) : null}
{hasIcon || hasPrimary || hasSecondary ? (
- <BottomBar>
- <div className="flex items-center gap-2 border-t border-border bg-card px-4 pt-2 pb-safe-4 [&>*]:min-w-0">
- <iconSlot.Target className="flex shrink-0 empty:hidden" />
- <primarySlot.Target className={cellClassName} />
- <secondarySlot.Target className={cellClassName} />
- </div>
- </BottomBar>
+ <PhoneActionBar className="[&>*]:min-w-0">
+ <iconSlot.Target className="flex shrink-0 empty:hidden" />
+ <primarySlot.Target className={cellClassName} />
+ <secondarySlot.Target className={cellClassName} />
+ </PhoneActionBar>
) : null}
</>
);
diff --git a/apps/erp/app/modules/inventory/ui/Inventory/InventoryStorageUnits.tsx b/apps/erp/app/modules/inventory/ui/Inventory/InventoryStorageUnits.tsx
index 1aabde6e60..3b4c6573d2 100644
--- a/apps/erp/app/modules/inventory/ui/Inventory/InventoryStorageUnits.tsx
+++ b/apps/erp/app/modules/inventory/ui/Inventory/InventoryStorageUnits.tsx
@@ -57,7 +57,7 @@ import { Input, Location, Select, TextArea } from "~/components/Form";
import ScrapReason from "~/components/Form/ScrapReason";
import StorageUnit from "~/components/Form/StorageUnit";
import { useUnitOfMeasure } from "~/components/Form/UnitOfMeasure";
-import { BottomBar } from "~/components/Layout/Mobile/ChromeSlots";
+import { PhoneActionBar } from "~/components/Layout/Mobile/ChromeSlots";
import { usePermissions, usePrinting, useQuantityFormatter } from "~/hooks";
import type {
ItemStorageUnitQuantities,
@@ -596,17 +596,15 @@ const InventoryStorageUnits = ({
</CardContent>
</Card>
{isQuantity ? (
- <BottomBar>
- <div className="flex items-center gap-2 border-t border-border bg-card px-4 pt-2 pb-safe-4">
- <Button
- size="lg"
- className="w-full"
- onClick={() => openAdjustmentModal()}
- >
- <Trans>Update Inventory</Trans>
- </Button>
- </div>
- </BottomBar>
+ <PhoneActionBar>
+ <Button
+ size="lg"
+ className="w-full"
+ onClick={() => openAdjustmentModal()}
+ >
+ <Trans>Update Inventory</Trans>
+ </Button>
+ </PhoneActionBar>
) : null}
{adjustmentModal.isOpen && (
<Modal