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): MES mounts stateful bars once, one tab-bar height, phone-only app bar; shared report stepping, AppBarAction and meta.mobileCell in the ERP

aashu1ee8c7b6d529
diff --git a/apps/erp/app/components/New.tsx b/apps/erp/app/components/New.tsx
index 695172ad20..7b6d8ae900 100644
--- a/apps/erp/app/components/New.tsx
+++ b/apps/erp/app/components/New.tsx
@@ -3,9 +3,15 @@
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
import type { ButtonProps } from "@carbon/react";
-import { Button, IconButton, useViewport } from "@carbon/react";
+import {
+ Button,
+ DropdownMenu,
+ DropdownMenuTrigger,
+ IconButton,
+ useViewport
+} from "@carbon/react";
import { useLingui } from "@lingui/react/macro";
-import type { ReactNode } from "react";
+import type { ReactElement, ReactNode } from "react";
import {
createContext,
useContext,
@@ -39,33 +45,38 @@ const getCount = () => mountedCount;
const getServerCount = () => 1;
type NewActionProps = {
- /** Accessible name of the phone "+". */
+ /** Accessible name of the phone icon. */
label: string;
isDisabled?: boolean;
/** The desktop control, rendered unchanged everywhere but the app bar. */
children: ReactNode;
-} & ({ to: string; onClick?: never } | { onClick: () => void; to?: never });
+} & (
+ | { to: string; onClick?: never; menu?: never }
+ | { onClick: () => void; to?: never; menu?: never }
+ | { menu: ReactNode; to?: never; onClick?: never }
+);
+
+type AppBarActionProps =
+ | (NewActionProps & { icon: ReactElement })
+ | { icon?: never; children: ReactNode };
/**
- * A page's create action. On phones it becomes the app bar "+" (a link to
- * `to`, or a button calling `onClick`) unless an ancestor places it inline,
- * e.g. as an empty state's primary action. Elsewhere it renders `children`.
+ * A page action that moves to the app bar on phones, as `icon`: a link to
+ * `to`, a button calling `onClick`, or a trigger opening `menu` (a
+ * `DropdownMenuContent`). Without `icon`, `children` move there unchanged.
+ * Elsewhere it renders `children`.
*/
-export function NewAction({
- label,
- isDisabled,
- to,
- onClick,
- children
-}: NewActionProps) {
+export function AppBarAction(props: AppBarActionProps) {
const { isPhone } = useViewport();
- const placement = useContext(NewPlacementContext);
- if (!isPhone || placement !== "appBar") return <>{children}</>;
+ if (!isPhone) return <>{props.children}</>;
+ if (props.icon === undefined) {
+ return <AppBarActions>{props.children}</AppBarActions>;
+ }
- const icon = <LuPlus className="size-6" />;
- return (
- <AppBarActions>
- {to ? (
+ const { icon, label, isDisabled, to, onClick, menu } = props;
+ if (to) {
+ return (
+ <AppBarActions>
<Button
asChild
isIcon
@@ -76,20 +87,44 @@ export function NewAction({
>
<Link to={to}>{icon}</Link>
</Button>
+ </AppBarActions>
+ );
+ }
+
+ const button = (
+ <IconButton
+ icon={icon}
+ variant="ghost"
+ size="lg"
+ aria-label={label}
+ isDisabled={isDisabled}
+ onClick={onClick}
+ />
+ );
+ return (
+ <AppBarActions>
+ {menu ? (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>{button}</DropdownMenuTrigger>
+ {menu}
+ </DropdownMenu>
) : (
- <IconButton
- icon={icon}
- variant="ghost"
- size="lg"
- aria-label={label}
- isDisabled={isDisabled}
- onClick={onClick}
- />
+ button
)}
</AppBarActions>
);
}
+/**
+ * A page's create action. On phones it becomes the app bar "+" unless an
+ * ancestor places it inline, e.g. as an empty state's primary action.
+ */
+export function NewAction(props: NewActionProps) {
+ const placement = useContext(NewPlacementContext);
+ if (placement !== "appBar") return <>{props.children}</>;
+ return <AppBarAction icon={<LuPlus className="size-6" />} {...props} />;
+}
+
type NewProps = {
label?: string;
to: string;
diff --git a/apps/erp/app/components/Table/components/Compact/CompactRow.tsx b/apps/erp/app/components/Table/components/Compact/CompactRow.tsx
index fecc0a1a25..eb2c47b248 100644
--- a/apps/erp/app/components/Table/components/Compact/CompactRow.tsx
+++ b/apps/erp/app/components/Table/components/Compact/CompactRow.tsx
@@ -16,8 +16,11 @@ function renderCell<T>(row: Row<T>, column: Column<T, unknown> | undefined) {
| Cell<T, unknown>
| undefined;
if (!cell) return null;
- const value = flexRender(cell.column.columnDef.cell, cell.getContext());
const { header, meta } = cell.column.columnDef;
+ const value = flexRender(
+ meta?.mobileCell ?? cell.column.columnDef.cell,
+ cell.getContext()
+ );
if (!meta?.mobileLabel || typeof header !== "string") return value;
return (
<>
@@ -38,7 +41,8 @@ type CompactRowProps<T> = {
/**
* One list row: line 1 = identity (P1) with the metric (P2) trailing,
* line 2 = context (P3), line 3 = status pills. Each slot renders the
- * column's own cell, so links, pills and money formats are the desktop ones.
+ * column's own cell (or its `meta.mobileCell`), so links, pills and money
+ * formats are the desktop ones.
* The P1 link is stretched over the row, so a tap anywhere opens the record
* at the desktop href; other controls sit above it.
*/
diff --git a/apps/erp/app/components/Table/types.ts b/apps/erp/app/components/Table/types.ts
index be11486990..3dc45b3d81 100644
--- a/apps/erp/app/components/Table/types.ts
+++ b/apps/erp/app/components/Table/types.ts
@@ -3,11 +3,11 @@
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
import "@tanstack/react-table";
-import type { ReactElement } from "react";
+import type { CellContext } from "@tanstack/react-table";
+import type { ReactElement, ReactNode } from "react";
import type { ColumnFilterData } from "./components/Filter/types";
declare module "@tanstack/react-table" {
- // biome-ignore lint/correctness/noUnusedVariables: suppressed due to migration
interface ColumnMeta<TData extends unknown, TValue> {
filter?: ColumnFilterData;
// Filter dropdown/chip label when `header` is JSX instead of a string.
@@ -52,6 +52,8 @@ declare module "@tanstack/react-table" {
/** Phones: lead this column's value with its (string) header, since a
* list row shows no column headers. */
mobileLabel?: boolean;
+ /** Phones: renders this column in the list row instead of `cell`. */
+ mobileCell?: (context: CellContext<TData, TValue>) => ReactNode;
}
}
diff --git a/apps/erp/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTableFilters.tsx b/apps/erp/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTableFilters.tsx
index 2755d03f3c..d903ee888a 100644
--- a/apps/erp/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTableFilters.tsx
+++ b/apps/erp/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTableFilters.tsx
@@ -4,22 +4,18 @@
import {
Button,
- DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
- DropdownMenuTrigger,
HStack,
- IconButton,
Input,
InputGroup,
- InputLeftElement,
- useViewport
+ InputLeftElement
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { LuCheckCheck, LuPlus, LuSearch, LuWallet, LuX } from "react-icons/lu";
import { Link } from "react-router";
import { New, PeriodSelector } from "~/components";
-import { AppBarActions } from "~/components/Layout/Mobile/ChromeSlots";
+import { AppBarAction } from "~/components/New";
import { usePermissions, useUrlParams } from "~/hooks";
type ChartOfAccountsTableFiltersProps = {
@@ -48,7 +44,6 @@ const ChartOfAccountsTableFilters = ({
const { t } = useLingui();
const [params, setParams] = useUrlParams();
const permissions = usePermissions();
- const { isPhone } = useViewport();
const newGroupTo = `new-group?${params.toString()}`;
const newAccountTo = `new?${params.toString()}`;
@@ -100,36 +95,27 @@ const ChartOfAccountsTableFilters = ({
</>
) : (
<>
- {permissions.can("create", "accounting") &&
- (isPhone ? (
- // Phones: one app bar "+" opens both Add actions, instead of
- // two identical "+" icons.
- <AppBarActions>
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <IconButton
- aria-label={t`Add`}
- icon={<LuPlus />}
- variant="ghost"
- size="lg"
- />
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end">
- <DropdownMenuItem asChild>
- <Link to={newGroupTo}>{t`Add Group`}</Link>
- </DropdownMenuItem>
- <DropdownMenuItem asChild>
- <Link to={newAccountTo}>{t`Add Account`}</Link>
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- </AppBarActions>
- ) : (
- <>
- <New label={t`Group`} to={newGroupTo} />
- <New label={t`Account`} to={newAccountTo} />
- </>
- ))}
+ {permissions.can("create", "accounting") && (
+ // Phones: one app bar "+" opens both Add actions, instead of
+ // two identical "+" icons.
+ <AppBarAction
+ icon={<LuPlus />}
+ label={t`Add`}
+ menu={
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem asChild>
+ <Link to={newGroupTo}>{t`Add Group`}</Link>
+ </DropdownMenuItem>
+ <DropdownMenuItem asChild>
+ <Link to={newAccountTo}>{t`Add Account`}</Link>
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ }
+ >
+ <New label={t`Group`} to={newGroupTo} />
+ <New label={t`Account`} to={newAccountTo} />
+ </AppBarAction>
+ )}
{canEnterOpeningBalances && (
<Button
variant="secondary"
diff --git a/apps/erp/app/modules/accounting/ui/JournalEntries/JournalEntriesTable.tsx b/apps/erp/app/modules/accounting/ui/JournalEntries/JournalEntriesTable.tsx
index d95fafd84e..014f9773be 100644
--- a/apps/erp/app/modules/accounting/ui/JournalEntries/JournalEntriesTable.tsx
+++ b/apps/erp/app/modules/accounting/ui/JournalEntries/JournalEntriesTable.tsx
@@ -7,8 +7,7 @@ import {
MENU_ITEM_SHORTCUTS,
MenuIcon,
MenuItem,
- useDisclosure,
- useViewport
+ useDisclosure
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import type { ColumnDef } from "@tanstack/react-table";
@@ -68,7 +67,6 @@ const JournalEntriesTable = memo(
const [selectedEntry, setSelectedEntry] =
useState<JournalEntryListItem | null>(null);
const deleteModal = useDisclosure();
- const { isPhone } = useViewport();
const columns = useMemo<ColumnDef<JournalEntryListItem>[]>(() => {
const defaultColumns: ColumnDef<JournalEntryListItem>[] = [
@@ -103,31 +101,29 @@ const JournalEntriesTable = memo(
{
accessorKey: "description",
header: t`Description`,
- cell: ({ row }) =>
- // Phones: plain text on the row's context line (P3).
- isPhone ? (
- row.original.description || "—"
- ) : (
- <HStack className="py-1" spacing={2}>
- <div className="w-8 h-8 bg-muted rounded-lg flex items-center justify-center flex-shrink-0 p-1">
- <JournalEntrySourceTypeIcon
- sourceType={row.original.sourceType ?? "Manual"}
- className="w-4 h-4 text-[#AAAAAA] dark:text-[#444]"
- />
- </div>
+ cell: ({ row }) => (
+ <HStack className="py-1" spacing={2}>
+ <div className="w-8 h-8 bg-muted rounded-lg flex items-center justify-center flex-shrink-0 p-1">
+ <JournalEntrySourceTypeIcon
+ sourceType={row.original.sourceType ?? "Manual"}
+ className="w-4 h-4 text-[#AAAAAA] dark:text-[#444]"
+ />
+ </div>
- <div className="flex flex-col max-w-[300px] truncate">
- <div className="text-sm line-clamp-1">
- {row.original.description || "—"}
- </div>
- <div className="text-xs text-muted-foreground">
- {row.original.sourceType || "—"}
- </div>
+ <div className="flex flex-col max-w-[300px] truncate">
+ <div className="text-sm line-clamp-1">
+ {row.original.description || "—"}
</div>
- </HStack>
- ),
+ <div className="text-xs text-muted-foreground">
+ {row.original.sourceType || "—"}
+ </div>
+ </div>
+ </HStack>
+ ),
meta: {
mobile: "P3",
+ // Phones: plain text on the row's context line.
+ mobileCell: ({ row }) => row.original.description || "—",
icon: <LuFileText />
}
},
@@ -243,7 +239,7 @@ const JournalEntriesTable = memo(
}
];
return defaultColumns;
- }, [currencyFormatter, isPhone, people, t]);
+ }, [currencyFormatter, people, t]);
const renderContextMenu = useCallback(
(row: JournalEntryListItem) => {
diff --git a/apps/erp/app/modules/accounting/ui/Reports/ColumnStepper.tsx b/apps/erp/app/modules/accounting/ui/Reports/ColumnStepper.tsx
index b666ec907d..d1f4623498 100644
--- a/apps/erp/app/modules/accounting/ui/Reports/ColumnStepper.tsx
+++ b/apps/erp/app/modules/accounting/ui/Reports/ColumnStepper.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 { IconButton } from "@carbon/react";
+import { IconButton, useViewport } from "@carbon/react";
import { useLingui } from "@lingui/react/macro";
import type { ReactNode } from "react";
import { useEffect, useState } from "react";
@@ -13,7 +13,7 @@ import { LuChevronLeft, LuChevronRight } from "react-icons/lu";
* (default: the last, i.e. the latest period) and stays in range when the
* column count changes.
*/
-export function useColumnStep(count: number, initial = count - 1) {
+function useColumnStep(count: number, initial = count - 1) {
const [index, setIndex] = useState(Math.max(0, initial));
// A new period range or column set starts again on its default column.
// biome-ignore lint/correctness/useExhaustiveDependencies: reset per column count only
@@ -30,7 +30,7 @@ export function useColumnStep(count: number, initial = count - 1) {
* Phones: the report's column header, one column at a time, with ‹ › to step
* to the neighbouring column.
*/
-export function ColumnStepper({
+function ColumnStepper({
index,
count,
onChange,
@@ -80,3 +80,41 @@ export function ColumnStepper({
</div>
);
}
+
+/** A report's frame; on phones it fills what the filter rows above it leave. */
+export const reportFrameClassName =
+ "h-[calc(100dvh-var(--header-height)-61px)] w-full max-md:h-auto max-md:min-h-0 max-md:flex-1";
+
+/**
+ * Phones: one value column at a time, with `stepper` in place of the desktop
+ * header. Desktop: no stepper, and the caller renders every column.
+ */
+export function useReportColumnStep({
+ count,
+ initial,
+ label,
+ detail
+}: {
+ count: number;
+ initial?: number;
+ label: (index: number) => ReactNode;
+ detail?: (index: number) => ReactNode;
+}) {
+ const { isPhone } = useViewport();
+ const [index, setIndex] = useColumnStep(count, initial);
+ return {
+ isPhone,
+ index,
+ estimatedRowHeight: () => (isPhone ? 44 : 36),
+ stepper:
+ isPhone && count > 0 ? (
+ <ColumnStepper
+ index={index}
+ count={count}
+ onChange={setIndex}
+ label={label(index)}
+ detail={detail?.(index)}
+ />
+ ) : null
+ };
+}
diff --git a/apps/erp/app/modules/accounting/ui/Reports/ExecutivePnlSummary.tsx b/apps/erp/app/modules/accounting/ui/Reports/ExecutivePnlSummary.tsx
index 2e134e7502..19976b64a6 100644
--- a/apps/erp/app/modules/accounting/ui/Reports/ExecutivePnlSummary.tsx
+++ b/apps/erp/app/modules/accounting/ui/Reports/ExecutivePnlSummary.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 { cn, useViewport } from "@carbon/react";
+import { cn } from "@carbon/react";
import type {
ReportColumnGranularity,
ReportPeriodBucket
@@ -12,9 +12,12 @@ import { useLocale } from "@react-aria/i18n";
import { memo, useEffect, useMemo, useRef } from "react";
import { useRealtime } from "~/hooks";
import type { ChartPeriodSeries } from "../../types";
-import { ColumnStepper, useColumnStep } from "./ColumnStepper";
+import { reportFrameClassName } from "./ColumnStepper";
import { computeExecutivePnl, type ExecutivePnlRowKey } from "./executivePnl";
-import { getPeriodColumnLabel } from "./MultiPeriodStatementTree";
+import {
+ getPeriodColumnLabel,
+ usePeriodStep
+} from "./MultiPeriodStatementTree";
const ACCOUNT_COLUMN_WIDTH = 360;
const PERIOD_COLUMN_WIDTH = 128;
@@ -45,14 +48,10 @@ const ExecutivePnlSummary = memo(
parentCurrency
}: ExecutivePnlSummaryProps) => {
const { t } = useLingui();
- const { isPhone } = useViewport();
- // Phones: one period at a time (the latest first), so the labels and
- // margins get the width the other periods took.
- const [periodIndex, setPeriodIndex] = useColumnStep(periods.length);
- const visiblePeriods = isPhone
- ? periods.slice(periodIndex, periodIndex + 1)
- : periods;
- const currentPeriod = periods[periodIndex];
+ const { isPhone, stepper, visiblePeriods } = usePeriodStep(
+ periods,
+ columns
+ );
const { locale } = useLocale();
useRealtime("journal");
const scrollRef = useRef<HTMLDivElement>(null);
@@ -107,49 +106,41 @@ const ExecutivePnlSummary = memo(
: ACCOUNT_COLUMN_WIDTH + periods.length * PERIOD_COLUMN_WIDTH + 16;
return (
- <div className="flex h-[calc(100dvh-var(--header-height)-61px)] w-full flex-col max-md:h-auto max-md:min-h-0 max-md:flex-1">
- {isPhone && currentPeriod ? (
- <ColumnStepper
- index={periodIndex}
- count={periods.length}
- onChange={setPeriodIndex}
- label={getPeriodColumnLabel(currentPeriod, columns, locale)}
- detail={currentPeriod.isPartial ? t`To Date` : undefined}
- />
- ) : null}
- {/* Header viewport — scrollLeft is mirrored from the body below */}
- <div
- ref={headerRef}
- className="shrink-0 overflow-x-hidden max-md:hidden"
- >
- <div
- className="flex h-12 items-center border-b border-border bg-card pr-4 text-sm font-medium text-foreground/80"
- style={{ minWidth: rowWidth }}
- >
+ <div className={cn("flex flex-col", reportFrameClassName)}>
+ {isPhone ? (
+ stepper
+ ) : (
+ // Header viewport — scrollLeft is mirrored from the body below
+ <div ref={headerRef} className="shrink-0 overflow-x-hidden">
<div
- className="sticky left-0 z-[2] flex h-full shrink-0 items-center bg-card px-4"
- style={{ width: ACCOUNT_COLUMN_WIDTH }}
+ className="flex h-12 items-center border-b border-border bg-card pr-4 text-sm font-medium text-foreground/80"
+ style={{ minWidth: rowWidth }}
>
- <Trans>Executive P&amp;L</Trans>
- </div>
- {periods.map((bucket) => (
<div
- key={bucket.key}
- className="flex shrink-0 flex-col items-end justify-center px-2 text-right"
- style={{ width: PERIOD_COLUMN_WIDTH }}
+ className="sticky left-0 z-[2] flex h-full shrink-0 items-center bg-card px-4"
+ style={{ width: ACCOUNT_COLUMN_WIDTH }}
>
- <span className="whitespace-nowrap">
- {getPeriodColumnLabel(bucket, columns, locale)}
- </span>
- {bucket.isPartial && (
- <span className="text-xs font-normal text-muted-foreground">
- {t`To Date`}
- </span>
- )}
+ <Trans>Executive P&amp;L</Trans>
</div>
- ))}
+ {periods.map((bucket) => (
+ <div
+ key={bucket.key}
+ className="flex shrink-0 flex-col items-end justify-center px-2 text-right"
+ style={{ width: PERIOD_COLUMN_WIDTH }}
+ >
+ <span className="whitespace-nowrap">
+ {getPeriodColumnLabel(bucket, columns, locale)}
+ </span>
+ {bucket.isPartial && (
+ <span className="text-xs font-normal text-muted-foreground">
+ {t`To Date`}
+ </span>
+ )}
+ </div>
+ ))}
+ </div>
</div>
- </div>
+ )}
<div
ref={scrollRef}
diff --git a/apps/erp/app/modules/accounting/ui/Reports/MultiPeriodStatementTree.tsx b/apps/erp/app/modules/accounting/ui/Reports/MultiPeriodStatementTree.tsx
index babce314cc..e66465d1e1 100644
--- a/apps/erp/app/modules/accounting/ui/Reports/MultiPeriodStatementTree.tsx
+++ b/apps/erp/app/modules/accounting/ui/Reports/MultiPeriodStatementTree.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 { cn, useViewport } from "@carbon/react";
+import { cn } from "@carbon/react";
import type {
ReportColumnGranularity,
ReportPeriodBucket
@@ -23,7 +23,7 @@ import { LevelLine, TreeView, useTree } from "~/components/TreeView";
import { useRealtime, useUrlParams } from "~/hooks";
import type { ChartPeriodSeries } from "../../types";
import { NET_INCOME_ACCOUNT_ID } from "../../types";
-import { ColumnStepper, useColumnStep } from "./ColumnStepper";
+import { reportFrameClassName, useReportColumnStep } from "./ColumnStepper";
import { accountsToFlatTree, filterAccounts } from "./reportTree";
const ACCOUNT_COLUMN_WIDTH = 360;
@@ -75,6 +75,32 @@ export function getPeriodColumnLabel(
}
}
+/**
+ * Phones: one period at a time (the latest first), so the row labels get the
+ * width the other periods took.
+ */
+export function usePeriodStep(
+ periods: ReportPeriodBucket[],
+ columns: ReportColumnGranularity
+) {
+ const { t } = useLingui();
+ const { locale } = useLocale();
+ const step = useReportColumnStep({
+ count: periods.length,
+ label: (index) => {
+ const bucket = periods[index];
+ return bucket ? getPeriodColumnLabel(bucket, columns, locale) : null;
+ },
+ detail: (index) => (periods[index]?.isPartial ? t`To Date` : undefined)
+ });
+ return {
+ ...step,
+ visiblePeriods: step.isPhone
+ ? periods.slice(step.index, step.index + 1)
+ : periods
+ };
+}
+
const MultiPeriodStatementTree = memo(
({
data,
@@ -87,14 +113,8 @@ const MultiPeriodStatementTree = memo(
ledgerPath
}: MultiPeriodStatementTreeProps) => {
const { t } = useLingui();
- const { isPhone } = useViewport();
- // Phones: one period at a time (the latest first), so the account name
- // gets the width the other periods took.
- const [periodIndex, setPeriodIndex] = useColumnStep(periods.length);
- const visiblePeriods = isPhone
- ? periods.slice(periodIndex, periodIndex + 1)
- : periods;
- const currentPeriod = periods[periodIndex];
+ const { isPhone, estimatedRowHeight, stepper, visiblePeriods } =
+ usePeriodStep(periods, columns);
const { locale } = useLocale();
useRealtime("journal");
const navigate = useNavigate();
@@ -141,7 +161,7 @@ const MultiPeriodStatementTree = memo(
} = useTree<ChartPeriodSeries, undefined>({
tree,
parentRef,
- estimatedRowHeight: () => (isPhone ? 44 : 36),
+ estimatedRowHeight,
isEager: true
});
@@ -150,18 +170,9 @@ const MultiPeriodStatementTree = memo(
: ACCOUNT_COLUMN_WIDTH + periods.length * PERIOD_COLUMN_WIDTH + 16;
return (
- // Phones: the filter rows differ in height, so the tree fills what is left.
- <div className="flex h-[calc(100dvh-var(--header-height)-61px)] w-full flex-col max-md:h-auto max-md:min-h-0 max-md:flex-1">
+ <div className={cn("flex flex-col", reportFrameClassName)}>
{isPhone ? (
- currentPeriod ? (
- <ColumnStepper
- index={periodIndex}
- count={periods.length}
- onChange={setPeriodIndex}
- label={getPeriodColumnLabel(currentPeriod, columns, locale)}
- detail={currentPeriod.isPartial ? t`To Date` : undefined}
- />
- ) : null
+ stepper
) : (
<>
{/* Header viewport — scrollLeft is mirrored from the tree below */}
diff --git a/apps/erp/app/modules/accounting/ui/Reports/PivotControlBar.tsx b/apps/erp/app/modules/accounting/ui/Reports/PivotControlBar.tsx
index 15a21db725..34522805d5 100644
--- a/apps/erp/app/modules/accounting/ui/Reports/PivotControlBar.tsx
+++ b/apps/erp/app/modules/accounting/ui/Reports/PivotControlBar.tsx
@@ -16,7 +16,6 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
HStack,
- IconButton,
MENU_ITEM_SHORTCUTS,
Switch
} from "@carbon/react";
@@ -35,8 +34,8 @@ import {
} from "react-icons/lu";
import { PeriodSelector } from "~/components";
import { DimensionEntityTypeIcon } from "~/components/Icons";
-import { AppBarActions } from "~/components/Layout/Mobile/ChromeSlots";
import ConfirmDelete from "~/components/Modals/ConfirmDelete";
+import { AppBarAction } from "~/components/New";
import { useUrlParams } from "~/hooks";
import { path } from "~/utils/path";
import type {
@@ -289,7 +288,7 @@ const PivotControlBar = ({
return (
<div className="flex flex-wrap px-4 py-3 items-center gap-2 justify-between bg-card border-b border-border w-full max-md:gap-1 max-md:px-0 max-md:py-1.5">
{/* Phones: the scope controls form one sideways-scrolling
- chip row; Download and the views menu sit on the line below. */}
+ chip row; Download and the views menu sit in the app bar. */}
<HStack className="flex-wrap gap-y-2 max-md:w-full max-md:flex-nowrap max-md:overflow-x-auto max-md:scrollbar-hide max-md:scroll-fade-x max-md:whitespace-nowrap max-md:px-4 max-md:py-1.5 max-md:[&>*]:shrink-0">
<PeriodSelector variant="range" />
<DropdownMenu>
@@ -504,26 +503,21 @@ const PivotControlBar = ({
)}
</HStack>
<HStack className="gap-2 max-md:hidden">
- <Button
- variant="secondary"
- leftIcon={<LuDownload />}
+ <AppBarAction
+ icon={<LuDownload />}
+ label={t`Download`}
onClick={onDownload}
>
- {t`Download`}
- </Button>
- {viewMenu}
+ <Button
+ variant="secondary"
+ leftIcon={<LuDownload />}
+ onClick={onDownload}
+ >
+ {t`Download`}
+ </Button>
+ </AppBarAction>
+ <AppBarAction>{viewMenu}</AppBarAction>
</HStack>
- {/* Phones: Download and the views menu sit in the app bar. */}
- <AppBarActions>
- <IconButton
- aria-label={t`Download`}
- variant="ghost"
- size="lg"
- icon={<LuDownload />}
- onClick={onDownload}
- />
- {viewMenu}
- </AppBarActions>
{saveModalOpen && (
<SaveViewModal
reportKey={reportKey}
diff --git a/apps/erp/app/modules/accounting/ui/Reports/PivotTree.tsx b/apps/erp/app/modules/accounting/ui/Reports/PivotTree.tsx
index 6df277ef39..9c992c2331 100644
--- a/apps/erp/app/modules/accounting/ui/Reports/PivotTree.tsx
+++ b/apps/erp/app/modules/accounting/ui/Reports/PivotTree.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 { cn, useViewport } from "@carbon/react";
+import { cn } from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { useLocale } from "@react-aria/i18n";
import { useVirtualizer } from "@tanstack/react-virtual";
@@ -18,7 +18,7 @@ import { LevelLine, TreeView, useTree } from "~/components/TreeView";
import { useRealtime, useUrlParams } from "~/hooks";
import type { PivotMeasure, PivotState } from "../../accounting.models";
import type { DimensionPivot } from "../../types";
-import { ColumnStepper, useColumnStep } from "./ColumnStepper";
+import { reportFrameClassName, useReportColumnStep } from "./ColumnStepper";
import type { PivotCellValue, PivotRowNode } from "./pivotData";
import {
applyPercentOfTotal,
@@ -83,7 +83,6 @@ function formatMeasureValue(value: number, measure: PivotMeasure): string {
const PivotTree = memo(
({ pivot, state, columnLabels, onCellClick }: PivotTreeProps) => {
const { t } = useLingui();
- const { isPhone } = useViewport();
const rowColumnWidth = ROW_COLUMN_WIDTH;
const { locale } = useLocale();
const [, setParams] = useUrlParams();
@@ -128,17 +127,28 @@ const PivotTree = memo(
);
const { flatTree, columnKeys, columnTotals, grandTotal } = pivotTree;
+ const columnLabel = (columnKey: string) =>
+ columnKey === UNASSIGNED_COLUMN_KEY
+ ? t`Unassigned`
+ : (columnLabels[columnKey] ?? columnKey);
// Phones: one value column at a time; the last step is the row total,
// shown first.
- const [columnIndex, setColumnIndex] = useColumnStep(columnKeys.length + 1);
+ const {
+ isPhone,
+ index: columnIndex,
+ estimatedRowHeight,
+ stepper
+ } = useReportColumnStep({
+ count: columnKeys.length + 1,
+ label: (index) => {
+ const columnKey = columnKeys[index];
+ return columnKey === undefined ? t`Total` : columnLabel(columnKey);
+ }
+ });
const phoneColumnKey: string | null =
columnIndex < columnKeys.length
? (columnKeys[columnIndex] ?? null)
: null;
- const columnLabel = (columnKey: string) =>
- columnKey === UNASSIGNED_COLUMN_KEY
- ? t`Unassigned`
- : (columnLabels[columnKey] ?? columnKey);
const percentFormatter = useMemo(
() =>
@@ -200,7 +210,7 @@ const PivotTree = memo(
} = useTree<PivotRowNode, undefined>({
tree: flatTree,
parentRef,
- estimatedRowHeight: () => (isPhone ? 44 : 36),
+ estimatedRowHeight,
isEager: true
});
@@ -260,89 +270,80 @@ const PivotTree = memo(
}
return (
- <div className="flex h-[calc(100dvh-var(--header-height)-61px)] w-full flex-col max-md:h-auto max-md:min-h-0 max-md:flex-1">
+ <div className={cn("flex flex-col", reportFrameClassName)}>
{pivot.hasMore && (
<div className="shrink-0 border-b border-border bg-card px-4 py-1.5 text-xs text-muted-foreground">
<p>{t`Showing the top 1,000 groups by amount`}</p>
</div>
)}
{isPhone ? (
- <ColumnStepper
- index={columnIndex}
- count={columnKeys.length + 1}
- onChange={setColumnIndex}
- label={
- phoneColumnKey === null ? t`Total` : columnLabel(phoneColumnKey)
- }
- />
- ) : null}
- {/* Header viewport — scrollLeft is mirrored from the tree below */}
- <div
- ref={headerRef}
- className="shrink-0 overflow-x-hidden max-md:hidden"
- >
- <div
- className="relative flex h-12 items-center border-b border-border bg-card text-sm font-medium text-foreground/80"
- style={{ minWidth: rowWidth }}
- >
- {/* Row-label header — sorts rows alphabetically by label */}
- <button
- type="button"
- className={cn(
- "group/header sticky left-0 z-[2] flex h-full shrink-0 items-center gap-1 bg-card px-4 text-muted-foreground hover:text-foreground",
- state.sort?.key === LABEL_SORT_KEY && "text-foreground"
- )}
- style={{ width: rowColumnWidth }}
- onClick={() => cycleSort(LABEL_SORT_KEY, "asc")}
- >
- {renderSortIndicator(LABEL_SORT_KEY)}
- </button>
- {virtualColumns.map((virtualColumn) => {
- const columnKey = columnKeys[virtualColumn.index];
- if (columnKey === undefined) return null;
- return (
- <button
- type="button"
- key={columnKey}
- className={cn(
- "group/header absolute top-0 flex h-full items-center justify-end gap-1 px-2 text-right hover:text-foreground",
- columnKey === UNASSIGNED_COLUMN_KEY &&
- "italic text-muted-foreground",
- state.sort?.key === columnKey && "text-foreground"
- )}
- style={{
- left: rowColumnWidth + virtualColumn.start,
- width: VALUE_COLUMN_WIDTH
- }}
- onClick={() => cycleSort(columnKey, "desc")}
- >
- <span className="truncate">
- {columnKey === UNASSIGNED_COLUMN_KEY
- ? t`Unassigned`
- : (columnLabels[columnKey] ?? columnKey)}
- </span>
- {renderSortIndicator(columnKey)}
- </button>
- );
- })}
- {/* Total header — sorts rows by their total */}
- <button
- type="button"
- className={cn(
- "group/header absolute top-0 flex h-full items-center justify-end gap-1 px-2 text-right hover:text-foreground",
- state.sort?.key === TOTAL_SORT_KEY && "text-foreground"
- )}
- style={{
- left: rowColumnWidth + totalColumnsWidth,
- width: VALUE_COLUMN_WIDTH
- }}
- onClick={() => cycleSort(TOTAL_SORT_KEY, "desc")}
+ stepper
+ ) : (
+ // Header viewport — scrollLeft is mirrored from the tree below
+ <div ref={headerRef} className="shrink-0 overflow-x-hidden">
+ <div
+ className="relative flex h-12 items-center border-b border-border bg-card text-sm font-medium text-foreground/80"
+ style={{ minWidth: rowWidth }}
>
- <Trans>Total</Trans>
- {renderSortIndicator(TOTAL_SORT_KEY)}
- </button>
+ {/* Row-label header — sorts rows alphabetically by label */}
+ <button
+ type="button"
+ className={cn(
+ "group/header sticky left-0 z-[2] flex h-full shrink-0 items-center gap-1 bg-card px-4 text-muted-foreground hover:text-foreground",
+ state.sort?.key === LABEL_SORT_KEY && "text-foreground"
+ )}
+ style={{ width: rowColumnWidth }}
+ onClick={() => cycleSort(LABEL_SORT_KEY, "asc")}
+ >
+ {renderSortIndicator(LABEL_SORT_KEY)}
+ </button>
+ {virtualColumns.map((virtualColumn) => {
+ const columnKey = columnKeys[virtualColumn.index];
+ if (columnKey === undefined) return null;
+ return (
+ <button
+ type="button"
+ key={columnKey}
+ className={cn(
+ "group/header absolute top-0 flex h-full items-center justify-end gap-1 px-2 text-right hover:text-foreground",
+ columnKey === UNASSIGNED_COLUMN_KEY &&
+ "italic text-muted-foreground",
+ state.sort?.key === columnKey && "text-foreground"
+ )}
+ style={{
+ left: rowColumnWidth + virtualColumn.start,
+ width: VALUE_COLUMN_WIDTH
+ }}
+ onClick={() => cycleSort(columnKey, "desc")}
+ >
+ <span className="truncate">
+ {columnKey === UNASSIGNED_COLUMN_KEY
+ ? t`Unassigned`
+ : (columnLabels[columnKey] ?? columnKey)}
+ </span>
+ {renderSortIndicator(columnKey)}
+ </button>
+ );
+ })}
+ {/* Total header — sorts rows by their total */}
+ <button
+ type="button"
+ className={cn(
+ "group/header absolute top-0 flex h-full items-center justify-end gap-1 px-2 text-right hover:text-foreground",
+ state.sort?.key === TOTAL_SORT_KEY && "text-foreground"
+ )}
+ style={{
+ left: rowColumnWidth + totalColumnsWidth,
+ width: VALUE_COLUMN_WIDTH
+ }}
+ onClick={() => cycleSort(TOTAL_SORT_KEY, "desc")}
+ >
+ <Trans>Total</Trans>
+ {renderSortIndicator(TOTAL_SORT_KEY)}
+ </button>
+ </div>
</div>
- </div>
+ )}
<TreeView<PivotRowNode>
tree={flatTree}
nodes={nodes}
@@ -558,66 +559,64 @@ const PivotTree = memo(
)}
</span>
</div>
- ) : null}
- {/* Column totals footer — scrollLeft mirrored from the tree above */}
- <div
- ref={footerRef}
- className="shrink-0 overflow-x-hidden max-md:hidden"
- >
- <div
- className="relative flex h-9 items-center border-t border-border bg-card text-sm font-semibold"
- style={{ minWidth: rowWidth }}
- >
+ ) : (
+ // Column totals footer — scrollLeft mirrored from the tree above
+ <div ref={footerRef} className="shrink-0 overflow-x-hidden">
<div
- className="sticky left-0 z-[2] flex h-full shrink-0 items-center bg-card px-4"
- style={{ width: rowColumnWidth }}
+ className="relative flex h-9 items-center border-t border-border bg-card text-sm font-semibold"
+ style={{ minWidth: rowWidth }}
>
- <Trans>Total</Trans>
- </div>
- {virtualColumns.map((virtualColumn) => {
- const columnKey = columnKeys[virtualColumn.index];
- if (columnKey === undefined) return null;
- return (
- <span
- key={columnKey}
- className="absolute top-0 flex h-full items-center justify-end px-2 text-right tabular-nums"
- style={{
- left: rowColumnWidth + virtualColumn.start,
- width: VALUE_COLUMN_WIDTH
- }}
- >
- {state.percentOfTotal
- ? percentFormatter.format(
- getPivotMeasureValue(
- columnTotals[columnKey],
- state.measure
- ) === 0
- ? 0
- : 1
- )
- : formatMeasureValue(
- getPivotMeasureValue(
- columnTotals[columnKey],
+ <div
+ className="sticky left-0 z-[2] flex h-full shrink-0 items-center bg-card px-4"
+ style={{ width: rowColumnWidth }}
+ >
+ <Trans>Total</Trans>
+ </div>
+ {virtualColumns.map((virtualColumn) => {
+ const columnKey = columnKeys[virtualColumn.index];
+ if (columnKey === undefined) return null;
+ return (
+ <span
+ key={columnKey}
+ className="absolute top-0 flex h-full items-center justify-end px-2 text-right tabular-nums"
+ style={{
+ left: rowColumnWidth + virtualColumn.start,
+ width: VALUE_COLUMN_WIDTH
+ }}
+ >
+ {state.percentOfTotal
+ ? percentFormatter.format(
+ getPivotMeasureValue(
+ columnTotals[columnKey],
+ state.measure
+ ) === 0
+ ? 0
+ : 1
+ )
+ : formatMeasureValue(
+ getPivotMeasureValue(
+ columnTotals[columnKey],
+ state.measure
+ ),
state.measure
- ),
- state.measure
- )}
- </span>
- );
- })}
- <span
- className="absolute top-0 flex h-full items-center justify-end px-2 text-right tabular-nums"
- style={{
- left: rowColumnWidth + totalColumnsWidth,
- width: VALUE_COLUMN_WIDTH
- }}
- >
- {state.percentOfTotal
- ? percentFormatter.format(grandTotalValue === 0 ? 0 : 1)
- : formatMeasureValue(grandTotalValue, state.measure)}
- </span>
+ )}
+ </span>
+ );
+ })}
+ <span
+ className="absolute top-0 flex h-full items-center justify-end px-2 text-right tabular-nums"
+ style={{
+ left: rowColumnWidth + totalColumnsWidth,
+ width: VALUE_COLUMN_WIDTH
+ }}
+ >
+ {state.percentOfTotal
+ ? percentFormatter.format(grandTotalValue === 0 ? 0 : 1)
+ : formatMeasureValue(grandTotalValue, state.measure)}
+ </span>
+ </div>
</div>
- </div>
+ )}
</div>
);
}
diff --git a/apps/erp/app/modules/accounting/ui/Reports/PurchasesControlBar.tsx b/apps/erp/app/modules/accounting/ui/Reports/PurchasesControlBar.tsx
index 005985e70f..7997cc907f 100644
--- a/apps/erp/app/modules/accounting/ui/Reports/PurchasesControlBar.tsx
+++ b/apps/erp/app/modules/accounting/ui/Reports/PurchasesControlBar.tsx
@@ -12,7 +12,6 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
HStack,
- IconButton,
Switch
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
@@ -27,7 +26,7 @@ import {
} from "react-icons/lu";
import { PeriodSelector } from "~/components";
import { DimensionEntityTypeIcon } from "~/components/Icons";
-import { AppBarActions } from "~/components/Layout/Mobile/ChromeSlots";
+import { AppBarAction } from "~/components/New";
import { useUrlParams } from "~/hooks";
import type { PivotMeasure, PivotState } from "../../accounting.models";
import {
@@ -158,7 +157,7 @@ const PurchasesControlBar = ({
return (
<div className="flex flex-wrap px-4 py-3 items-center gap-2 justify-between bg-card border-b border-border w-full max-md:gap-1 max-md:px-0 max-md:py-1.5">
{/* Phones: the scope controls form one sideways-scrolling chip
- row; Download sits on the line below. */}
+ row; Download sits in the app bar. */}
<HStack className="flex-wrap gap-y-2 max-md:w-full max-md:flex-nowrap max-md:overflow-x-auto max-md:scrollbar-hide max-md:scroll-fade-x max-md:whitespace-nowrap max-md:px-4 max-md:py-1.5 max-md:[&>*]:shrink-0">
<PeriodSelector variant="range" />
<DropdownMenu>
@@ -324,24 +323,19 @@ const PurchasesControlBar = ({
</Button>
)}
</HStack>
- <Button
- variant="secondary"
- leftIcon={<LuDownload />}
+ <AppBarAction
+ icon={<LuDownload />}
+ label={t`Download`}
onClick={onDownload}
- className="max-md:hidden"
>
- {t`Download`}
- </Button>
- {/* Phones: Download sits in the app bar, not on a row of its own. */}
- <AppBarActions>
- <IconButton
- aria-label={t`Download`}
- variant="ghost"
- size="lg"
- icon={<LuDownload />}
+ <Button
+ variant="secondary"
+ leftIcon={<LuDownload />}
onClick={onDownload}
- />
- </AppBarActions>
+ >
+ {t`Download`}
+ </Button>
+ </AppBarAction>
</div>
);
};
diff --git a/apps/erp/app/modules/accounting/ui/Reports/ReportFilters.tsx b/apps/erp/app/modules/accounting/ui/Reports/ReportFilters.tsx
index d7b6d46ae1..59a0c6f6c3 100644
--- a/apps/erp/app/modules/accounting/ui/Reports/ReportFilters.tsx
+++ b/apps/erp/app/modules/accounting/ui/Reports/ReportFilters.tsx
@@ -10,7 +10,6 @@ import {
DropdownMenuRadioItem,
DropdownMenuTrigger,
HStack,
- IconButton,
Input,
InputGroup,
InputLeftElement
@@ -25,7 +24,7 @@ import {
LuX
} from "react-icons/lu";
import { PeriodSelector } from "~/components";
-import { AppBarActions } from "~/components/Layout/Mobile/ChromeSlots";
+import { AppBarAction } from "~/components/New";
import { useUrlParams } from "~/hooks";
import { financialReportColumns } from "../../accounting.models";
import CompanySelector from "./CompanySelector";
@@ -183,25 +182,19 @@ const ReportFilters = ({
</HStack>
</div>
{onDownload && (
- <>
+ <AppBarAction
+ icon={<LuDownload />}
+ label={t`Download`}
+ onClick={onDownload}
+ >
<Button
variant="secondary"
leftIcon={<LuDownload />}
onClick={onDownload}
- className="max-md:hidden"
>
{t`Download`}
</Button>
- <AppBarActions>
- <IconButton
- aria-label={t`Download`}
- variant="ghost"
- size="lg"
- icon={<LuDownload />}
- onClick={onDownload}
- />
- </AppBarActions>
- </>
+ </AppBarAction>
)}
</div>
);
diff --git a/apps/erp/app/modules/accounting/ui/Reports/TrialBalanceTree.tsx b/apps/erp/app/modules/accounting/ui/Reports/TrialBalanceTree.tsx
index 01515d984f..1430b732c8 100644
--- a/apps/erp/app/modules/accounting/ui/Reports/TrialBalanceTree.tsx
+++ b/apps/erp/app/modules/accounting/ui/Reports/TrialBalanceTree.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 { cn, ScrollArea, useViewport } from "@carbon/react";
+import { cn, ScrollArea } from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { memo, useMemo, useRef } from "react";
import {
@@ -15,7 +15,7 @@ import { useNavigate } from "react-router";
import { LevelLine, TreeView, useTree } from "~/components/TreeView";
import { useRealtime, useUrlParams } from "~/hooks";
import type { Chart } from "../../types";
-import { ColumnStepper, useColumnStep } from "./ColumnStepper";
+import { reportFrameClassName, useReportColumnStep } from "./ColumnStepper";
import {
accountsToFlatTree,
filterAccounts,
@@ -61,8 +61,6 @@ const TrialBalanceTree = memo(
ledgerPath
}: TrialBalanceTreeProps) => {
const { t } = useLingui();
- const { isPhone } = useViewport();
- // Phones: one value column at a time, starting on Ending.
const columnLabels = [
t`Beginning`,
t`Debits`,
@@ -73,7 +71,17 @@ const TrialBalanceTree = memo(
: []),
t`Ratio`
];
- const [columnIndex, setColumnIndex] = useColumnStep(columnLabels.length, 3);
+ // Phones: one value column at a time, starting on Ending.
+ const {
+ isPhone,
+ index: columnIndex,
+ estimatedRowHeight,
+ stepper
+ } = useReportColumnStep({
+ count: columnLabels.length,
+ initial: 3,
+ label: (index) => columnLabels[index]
+ });
useRealtime("journal");
const navigate = useNavigate();
const [params] = useUrlParams();
@@ -112,52 +120,30 @@ const TrialBalanceTree = memo(
} = useTree<TrialBalanceChart, undefined>({
tree,
parentRef,
- estimatedRowHeight: () => (isPhone ? 44 : 36),
+ estimatedRowHeight,
isEager: true
});
return (
- <ScrollArea
- className={cn(
- "h-[calc(100dvh-var(--header-height)-61px)] w-full",
- // Phones: the tree fills what the filter rows leave.
- "max-md:h-auto max-md:min-h-0 max-md:flex-1"
- )}
- >
+ <ScrollArea className={reportFrameClassName}>
{isPhone ? (
- <div className="sticky top-0 z-10">
- <ColumnStepper
- index={columnIndex}
- count={columnLabels.length}
- onChange={setColumnIndex}
- label={columnLabels[columnIndex]}
- />
- </div>
+ <div className="sticky top-0 z-10">{stepper}</div>
) : (
- <div className="sticky top-0 z-10 flex h-11 items-center pr-4 text-sm font-medium text-foreground/80 border-b border-border bg-card max-md:w-max max-md:min-w-full">
- <div className="flex-1 px-4 max-md:sticky max-md:left-0 max-md:z-[2] max-md:w-[150px] max-md:flex-none max-md:truncate max-md:bg-card">
+ <div className="sticky top-0 z-10 flex h-11 items-center pr-4 text-sm font-medium text-foreground/80 border-b border-border bg-card">
+ <div className="flex-1 px-4">
<Trans>Account</Trans>
</div>
- <span className="w-28 text-right px-2">
- <Trans>Beginning</Trans>
- </span>
- <span className="w-28 text-right px-2">
- <Trans>Debits</Trans>
- </span>
- <span className="w-28 text-right px-2">
- <Trans>Credits</Trans>
- </span>
- <span className="w-28 text-right px-2">
- <Trans>Ending</Trans>
- </span>
- {showTranslated && (
- <span className="w-28 text-right px-2">
- {t`Ending (${parentCurrency ?? "Translated"})`}
+ {columnLabels.map((label, index) => (
+ <span
+ key={label}
+ className={cn(
+ index === columnLabels.length - 1 ? "w-20" : "w-28",
+ "text-right px-2"
+ )}
+ >
+ {label}
</span>
- )}
- <span className="w-20 text-right px-2">
- <Trans>Ratio</Trans>
- </span>
+ ))}
</div>
)}
<TreeView<TrialBalanceChart>
diff --git a/apps/erp/app/modules/inventory/ui/StorageUnits/StorageUnitsTable.tsx b/apps/erp/app/modules/inventory/ui/StorageUnits/StorageUnitsTable.tsx
index f10787bd0b..7fd6b48a84 100644
--- a/apps/erp/app/modules/inventory/ui/StorageUnits/StorageUnitsTable.tsx
+++ b/apps/erp/app/modules/inventory/ui/StorageUnits/StorageUnitsTable.tsx
@@ -20,12 +20,11 @@ import {
ModalTitle,
Spinner,
toast,
- useDisclosure,
- useViewport
+ useDisclosure
} from "@carbon/react";
import { async } from "@carbon/utils";
import { Trans, useLingui } from "@lingui/react/macro";
-import type { ColumnDef } from "@tanstack/react-table";
+import type { CellContext, ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
import {
LuBookMarked,
@@ -81,7 +80,6 @@ const StorageUnitsTable = memo(
}: StorageUnitsTableProps) => {
const [params] = useUrlParams();
const { t } = useLingui();
- const { isPhone } = useViewport();
const navigate = useNavigate();
const permissions = usePermissions();
@@ -322,6 +320,76 @@ const StorageUnitsTable = memo(
</HStack>
);
+ const renderName = (
+ { row, table }: CellContext<StorageUnit, unknown>,
+ withTypes: boolean
+ ) => {
+ const depth = Math.max(0, (row.original.depth ?? 1) - 1);
+ const isExpanded = expandedIds.has(row.original.id);
+ const isLoading = loadingIds.has(row.original.id);
+ const hasChildren = hasChildrenSet.has(row.original.id);
+
+ return (
+ <div className="flex flex-1">
+ {Array.from({ length: depth }).map((_, i) => (
+ <div
+ key={i}
+ aria-hidden
+ className="w-5 shrink-0 border-l border-border -my-2 max-md:border-l-0"
+ />
+ ))}
+ <div className="w-5 shrink-0 flex items-center justify-center self-center max-md:self-start max-md:h-[1lh]">
+ {hasChildren ? (
+ isLoading ? (
+ <Spinner className="size-3" />
+ ) : (
+ <button
+ type="button"
+ aria-label={
+ isExpanded ? t`Collapse subtree` : t`Expand subtree`
+ }
+ className="text-muted-foreground hover:text-foreground shrink-0 max-md:hit-area"
+ onClick={(e) => {
+ e.stopPropagation();
+ e.preventDefault();
+ toggleExpand(row.original.id);
+ }}
+ >
+ {isExpanded ? (
+ <LuChevronDown className="size-4" />
+ ) : (
+ <LuChevronRight className="size-4" />
+ )}
+ </button>
+ )
+ ) : null}
+ </div>
+ <div className="flex items-center py-1 max-md:flex-col max-md:items-start max-md:gap-1 max-md:py-0">
+ <Hyperlink
+ to={`${path.to.storageUnit(row.original.id)}?${params}`}
+ >
+ <span
+ className={depth === 0 ? "font-medium" : "text-foreground/90"}
+ >
+ {row.original.name}
+ </span>
+ </Hyperlink>
+ {/* Phones: the context line sits under the name, so it
+ shares the tree indent instead of starting at the gutter. */}
+ {withTypes &&
+ table.getColumn("storageTypeIds")?.getIsVisible() &&
+ row.original.storageTypeIds?.length ? (
+ <div className="text-[13px] font-normal text-muted-foreground">
+ <EnumerableAsText value>
+ {renderStorageTypes(row.original.storageTypeIds)}
+ </EnumerableAsText>
+ </div>
+ ) : null}
+ </div>
+ </div>
+ );
+ };
+
return [
{
// The id "Select" opts into the Table's compact checkbox-column
@@ -356,76 +424,10 @@ const StorageUnitsTable = memo(
{
accessorKey: "name",
header: t`Name`,
- cell: ({ row, table }) => {
- const depth = Math.max(0, (row.original.depth ?? 1) - 1);
- const isExpanded = expandedIds.has(row.original.id);
- const isLoading = loadingIds.has(row.original.id);
- const hasChildren = hasChildrenSet.has(row.original.id);
-
- return (
- <div className="flex flex-1">
- {Array.from({ length: depth }).map((_, i) => (
- <div
- key={i}
- aria-hidden
- className="w-5 shrink-0 border-l border-border -my-2 max-md:border-l-0"
- />
- ))}
- <div className="w-5 shrink-0 flex items-center justify-center self-center max-md:self-start max-md:h-[1lh]">
- {hasChildren ? (
- isLoading ? (
- <Spinner className="size-3" />
- ) : (
- <button
- type="button"
- aria-label={
- isExpanded ? t`Collapse subtree` : t`Expand subtree`
- }
- className="text-muted-foreground hover:text-foreground shrink-0 max-md:hit-area"
- onClick={(e) => {
- e.stopPropagation();
- e.preventDefault();
- toggleExpand(row.original.id);
- }}
- >
- {isExpanded ? (
- <LuChevronDown className="size-4" />
- ) : (
- <LuChevronRight className="size-4" />
- )}
- </button>
- )
- ) : null}
- </div>
- <div className="flex items-center py-1 max-md:flex-col max-md:items-start max-md:gap-1 max-md:py-0">
- <Hyperlink
- to={`${path.to.storageUnit(row.original.id)}?${params}`}
- >
- <span
- className={
- depth === 0 ? "font-medium" : "text-foreground/90"
- }
- >
- {row.original.name}
- </span>
- </Hyperlink>
- {/* Phones: the context line sits under the name, so it
- shares the tree indent instead of starting at the gutter. */}
- {isPhone &&
- table.getColumn("storageTypeIds")?.getIsVisible() &&
- row.original.storageTypeIds?.length ? (
- <div className="text-[13px] font-normal text-muted-foreground">
- <EnumerableAsText value>
- {renderStorageTypes(row.original.storageTypeIds)}
- </EnumerableAsText>
- </div>
- ) : null}
- </div>
- </div>
- );
- },
+ cell: (context) => renderName(context, false),
meta: {
mobile: "P1",
+ mobileCell: (context) => renderName(context, true),
icon: <LuBookMarked />
}
},
@@ -484,7 +486,6 @@ const StorageUnitsTable = memo(
}
];
}, [
- isPhone,
locations,
params,
storageTypes,
diff --git a/apps/erp/app/modules/people/ui/Shifts/ShiftsTable.tsx b/apps/erp/app/modules/people/ui/Shifts/ShiftsTable.tsx
index 768a318c9b..086d688669 100644
--- a/apps/erp/app/modules/people/ui/Shifts/ShiftsTable.tsx
+++ b/apps/erp/app/modules/people/ui/Shifts/ShiftsTable.tsx
@@ -2,13 +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 {
- Badge,
- MENU_ITEM_SHORTCUTS,
- MenuIcon,
- MenuItem,
- useViewport
-} from "@carbon/react";
+import { Badge, MENU_ITEM_SHORTCUTS, MenuIcon, MenuItem } from "@carbon/react";
import { formatTimeOfDay } from "@carbon/utils";
import {
parseTime,
@@ -46,7 +40,6 @@ type ShiftsTableProps = {
const ShiftsTable = memo(({ data, count, locations }: ShiftsTableProps) => {
const { t } = useLingui();
const { locale } = useLocale();
- const { isPhone } = useViewport();
const navigate = useNavigate();
const permissions = usePermissions();
const [params] = useUrlParams();
@@ -125,18 +118,23 @@ const ShiftsTable = memo(({ data, count, locations }: ShiftsTableProps) => {
accessorKey: "startTime",
header: t`Start Time`,
cell: ({ row }) =>
- // Phones: line 2 shows the whole span, start – end.
- isPhone && row.original.endTime ? (
- <>
- {renderShiftTime(row.original.startTime, row.original.locationId)}
- {" – "}
- {renderShiftTime(row.original.endTime, row.original.locationId)}
- </>
- ) : (
- renderShiftTime(row.original.startTime, row.original.locationId)
- ),
+ renderShiftTime(row.original.startTime, row.original.locationId),
meta: {
mobile: "P3",
+ // Phones: line 2 shows the whole span, start – end.
+ mobileCell: ({ row }) =>
+ row.original.endTime ? (
+ <>
+ {renderShiftTime(
+ row.original.startTime,
+ row.original.locationId
+ )}
+ {" – "}
+ {renderShiftTime(row.original.endTime, row.original.locationId)}
+ </>
+ ) : (
+ renderShiftTime(row.original.startTime, row.original.locationId)
+ ),
icon: <LuClock />
}
},
@@ -191,7 +189,7 @@ const ShiftsTable = memo(({ data, count, locations }: ShiftsTableProps) => {
];
return [...defaultColumns, ...customColumns];
- }, [locations, renderDays, renderShiftTime, customColumns, isPhone, t]);
+ }, [locations, renderDays, renderShiftTime, customColumns, t]);
const renderContextMenu = useCallback(
(row: Shift) => {
diff --git a/apps/erp/app/modules/people/ui/Timecards/TimecardsTable.tsx b/apps/erp/app/modules/people/ui/Timecards/TimecardsTable.tsx
index 18b8431a14..53e3c76bec 100644
--- a/apps/erp/app/modules/people/ui/Timecards/TimecardsTable.tsx
+++ b/apps/erp/app/modules/people/ui/Timecards/TimecardsTable.tsx
@@ -9,8 +9,7 @@ import {
MENU_ITEM_SHORTCUTS,
MenuIcon,
MenuItem,
- useInterval,
- useViewport
+ useInterval
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { useLocale } from "@react-aria/i18n";
@@ -69,7 +68,6 @@ function formatDuration(clockInStr: string, clockOutStr: string | null) {
const TimecardsTable = memo(({ data, count }: TimecardsTableProps) => {
const { t } = useLingui();
const { locale } = useLocale();
- const { isPhone } = useViewport();
const navigate = useNavigate();
const permissions = usePermissions();
const [params] = useUrlParams();
@@ -115,31 +113,37 @@ const TimecardsTable = memo(({ data, count }: TimecardsTableProps) => {
header: t`Date`,
cell: ({ row }) =>
row.original.clockIn ? (
- <>
- <DateTime
- value={row.original.clockIn}
- variant="date"
- dateOptions={{ dateStyle: "medium" }}
- />
- {/* Phones: line 2 also carries the clock-in – clock-out span. */}
- {isPhone ? (
- <>
- {" · "}
- <DateTime value={row.original.clockIn} variant="time" />
- {" – "}
- <DateTime
- value={row.original.clockOut}
- variant="time"
- fallback="—"
- />
- </>
- ) : null}
- </>
+ <DateTime
+ value={row.original.clockIn}
+ variant="date"
+ dateOptions={{ dateStyle: "medium" }}
+ />
) : (
"—"
),
meta: {
mobile: "P3",
+ // Phones: line 2 also carries the clock-in – clock-out span.
+ mobileCell: ({ row }) =>
+ row.original.clockIn ? (
+ <>
+ <DateTime
+ value={row.original.clockIn}
+ variant="date"
+ dateOptions={{ dateStyle: "medium" }}
+ />
+ {" · "}
+ <DateTime value={row.original.clockIn} variant="time" />
+ {" – "}
+ <DateTime
+ value={row.original.clockOut}
+ variant="time"
+ fallback="—"
+ />
+ </>
+ ) : (
+ "—"
+ ),
icon: <LuCalendar />
}
},
@@ -224,7 +228,7 @@ const TimecardsTable = memo(({ data, count }: TimecardsTableProps) => {
}
}
];
- }, [locations, t, locale, isPhone]);
+ }, [locations, t, locale]);
const renderContextMenu = useCallback(
(row: TimeCardEntry) => {
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobsTable.tsx b/apps/erp/app/modules/production/ui/Jobs/JobsTable.tsx
index 4c50fb953e..32736f493a 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobsTable.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobsTable.tsx
@@ -18,7 +18,6 @@ import {
MenuItem,
toast,
useDisclosure,
- useViewport,
VStack
} from "@carbon/react";
import { distinctItemText } from "@carbon/utils";
@@ -164,11 +163,33 @@ function useReleasedJobsMessage() {
t`${plural(count, { one: "Released # job", other: "Released # jobs" })}`;
}
+function renderQuantity(job: Job, unit?: string | null) {
+ const quantity = job.quantity;
+ const quantityComplete = job.quantityComplete ?? 0;
+
+ if (["In Progress", "Released", "Paused"].includes(job.status ?? "")) {
+ return (
+ <BarProgress
+ progress={(quantityComplete / (quantity ?? 0)) * 100}
+ value={`${quantityComplete}/${quantity}`}
+ />
+ );
+ }
+ if (unit) {
+ return (
+ <>
+ {quantity}
+ <span className="ml-1 text-[13px] text-muted-foreground">{unit}</span>
+ </>
+ );
+ }
+ return quantity;
+}
+
const JobsTable = memo((props: JobsTableProps) => {
const { data, count, tags, batchesByJobId = {} } = props;
const navigate = useNavigate();
const { t } = useLingui();
- const { isPhone } = useViewport();
const releasedJobsMessage = useReleasedJobsMessage();
const [params] = useUrlParams();
const parts = useParts();
@@ -360,37 +381,12 @@ const JobsTable = memo((props: JobsTableProps) => {
{
accessorKey: "quantity",
header: t`Quantity`,
- cell: ({ row }) => {
- const quantity = row.original.quantity;
- const quantityComplete = row.original.quantityComplete ?? 0;
-
- if (
- ["In Progress", "Released", "Paused"].includes(
- row.original.status ?? ""
- )
- ) {
- return (
- <BarProgress
- progress={(quantityComplete / (quantity ?? 0)) * 100}
- value={`${quantityComplete}/${quantity}`}
- />
- );
- }
- // Phones: no column header, so the number carries its unit.
- if (isPhone && row.original.unitOfMeasureCode) {
- return (
- <>
- {quantity}
- <span className="ml-1 text-[13px] text-muted-foreground">
- {row.original.unitOfMeasureCode}
- </span>
- </>
- );
- }
- return quantity;
- },
+ cell: ({ row }) => renderQuantity(row.original),
meta: {
mobile: "P2",
+ // Phones: no column header, so the number carries its unit.
+ mobileCell: ({ row }) =>
+ renderQuantity(row.original, row.original.unitOfMeasureCode),
icon: <LuHash />,
renderTotal: true
}
@@ -697,7 +693,7 @@ const JobsTable = memo((props: JobsTableProps) => {
}
];
return [...defaultColumns, ...customColumns];
- }, [params, customColumns, trackedEntities, batchesByJobId, isPhone]);
+ }, [params, customColumns, trackedEntities, batchesByJobId]);
const fetcher = useAction<typeof action>({
onError: (data) => {
diff --git a/apps/erp/app/modules/quality/ui/RiskRegister/RiskRegistersTable.tsx b/apps/erp/app/modules/quality/ui/RiskRegister/RiskRegistersTable.tsx
index bd3ead75b3..c1b962d8cc 100644
--- a/apps/erp/app/modules/quality/ui/RiskRegister/RiskRegistersTable.tsx
+++ b/apps/erp/app/modules/quality/ui/RiskRegister/RiskRegistersTable.tsx
@@ -6,8 +6,7 @@ import {
MENU_ITEM_SHORTCUTS,
MenuIcon,
MenuItem,
- useDisclosure,
- useViewport
+ useDisclosure
} from "@carbon/react";
import { getItemById, getItemReadableId } from "@carbon/utils";
import { useLingui } from "@lingui/react/macro";
@@ -69,7 +68,6 @@ const RiskRegistersTable = memo(({ data, count }: RiskRegistersTableProps) => {
const [people] = usePeople();
const { t } = useLingui();
- const { isPhone } = useViewport();
const permissions = usePermissions();
const deleteModal = useDisclosure();
const [selectedRisk, setSelectedRisk] = useState<Risk | null>(null);
@@ -151,17 +149,15 @@ const RiskRegistersTable = memo(({ data, count }: RiskRegistersTableProps) => {
{
accessorKey: "source",
header: t`Source`,
- // Phones: line 2 is muted context, not a second row of pills.
- cell: (item) =>
- isPhone ? (
+ cell: (item) => <Enumerable value={item.getValue<string>()} />,
+ meta: {
+ mobile: "P3",
+ // Phones: line 2 is muted context, not a second row of pills.
+ mobileCell: (item) => (
<span className="text-muted-foreground">
{item.getValue<string>()}
</span>
- ) : (
- <Enumerable value={item.getValue<string>()} />
),
- meta: {
- mobile: "P3",
icon: <LuDna />,
filter: {
type: "static",
@@ -256,7 +252,7 @@ const RiskRegistersTable = memo(({ data, count }: RiskRegistersTableProps) => {
}
];
return defaultColumns;
- }, [people, items, workCenters.options.map, t, isPhone]);
+ }, [people, items, workCenters.options.map, t]);
const renderContextMenu = useCallback<(row: Risk) => JSX.Element>(
(row) => (
diff --git a/apps/erp/app/modules/resources/ui/Locations/LocationsTable.tsx b/apps/erp/app/modules/resources/ui/Locations/LocationsTable.tsx
index fa130041ce..2754decc79 100644
--- a/apps/erp/app/modules/resources/ui/Locations/LocationsTable.tsx
+++ b/apps/erp/app/modules/resources/ui/Locations/LocationsTable.tsx
@@ -2,12 +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 {
- MENU_ITEM_SHORTCUTS,
- MenuIcon,
- MenuItem,
- useViewport
-} from "@carbon/react";
+import { MENU_ITEM_SHORTCUTS, MenuIcon, MenuItem } from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
@@ -38,7 +33,6 @@ type LocationsTableProps = {
const LocationsTable = memo(({ data, count }: LocationsTableProps) => {
const { t } = useLingui();
- const { isPhone } = useViewport();
const navigate = useNavigate();
const permissions = usePermissions();
const [params] = useUrlParams();
@@ -67,19 +61,18 @@ const LocationsTable = memo(({ data, count }: LocationsTableProps) => {
{
accessorKey: "addressLine1",
header: t`Address`,
- cell: (item) =>
- // Phones: line 2 is the joined address (street, city, state).
- isPhone
- ? [
- item.row.original.addressLine1,
- item.row.original.city,
- item.row.original.stateProvince
- ]
- .filter(Boolean)
- .join(", ")
- : item.getValue(),
+ cell: (item) => item.getValue(),
meta: {
mobile: "P3",
+ // Phones: line 2 is the joined address (street, city, state).
+ mobileCell: (item) =>
+ [
+ item.row.original.addressLine1,
+ item.row.original.city,
+ item.row.original.stateProvince
+ ]
+ .filter(Boolean)
+ .join(", "),
icon: <LuHouse />
}
},
@@ -148,7 +141,7 @@ const LocationsTable = memo(({ data, count }: LocationsTableProps) => {
}
];
return [...defaultColumns, ...customColumns];
- }, [people, customColumns, isPhone, t]);
+ }, [people, customColumns, t]);
const renderContextMenu = useCallback(
(row: (typeof data)[number]) => {
diff --git a/apps/erp/app/routes/x+/accounting+/asset-classes.tsx b/apps/erp/app/routes/x+/accounting+/asset-classes.tsx
index 0a31a3dfcc..bef9f5bfee 100644
--- a/apps/erp/app/routes/x+/accounting+/asset-classes.tsx
+++ b/apps/erp/app/routes/x+/accounting+/asset-classes.tsx
@@ -3,13 +3,13 @@
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
import { requirePermissions } from "@carbon/auth/auth.server";
-import { Button, RecordOutlet, useViewport, VStack } from "@carbon/react";
+import { Button, RecordOutlet, VStack } from "@carbon/react";
import { msg } from "@lingui/core/macro";
import { Trans, useLingui } from "@lingui/react/macro";
import { LuCirclePlus } from "react-icons/lu";
import type { LoaderFunctionArgs } from "react-router";
import { useLoaderData, useNavigate } from "react-router";
-import { New } from "~/components";
+import { NewAction } from "~/components/New";
import { usePermissions } from "~/hooks";
import { getFixedAssetClasses } from "~/modules/accounting";
import { AssetClassesTable } from "~/modules/accounting/ui/FixedAssets";
@@ -60,7 +60,6 @@ export default function AssetClassesRoute() {
const { t } = useLingui();
const permissions = usePermissions();
const navigate = useNavigate();
- const { isPhone } = useViewport();
return (
<VStack spacing={0} className="h-full">
@@ -69,19 +68,17 @@ export default function AssetClassesRoute() {
count={count}
taxDepreciationEnabled={taxDepreciationEnabled}
primaryAction={
- permissions.can("create", "accounting") &&
- // Phones: Add becomes the app bar "+" like the other lists.
- (isPhone ? (
- <New label={t`Asset Class`} to={path.to.newAssetClass} />
- ) : (
- <Button
- leftIcon={<LuCirclePlus />}
- variant="primary"
- onClick={() => navigate(path.to.newAssetClass)}
- >
- <Trans>Add Asset Class</Trans>
- </Button>
- ))
+ permissions.can("create", "accounting") && (
+ <NewAction label={t`Add Asset Class`} to={path.to.newAssetClass}>
+ <Button
+ leftIcon={<LuCirclePlus />}
+ variant="primary"
+ onClick={() => navigate(path.to.newAssetClass)}
+ >
+ <Trans>Add Asset Class</Trans>
+ </Button>
+ </NewAction>
+ )
}
/>
<RecordOutlet />
diff --git a/apps/erp/app/routes/x+/accounting+/fixed-assets.tsx b/apps/erp/app/routes/x+/accounting+/fixed-assets.tsx
index 38618c8b9a..6e58366374 100644
--- a/apps/erp/app/routes/x+/accounting+/fixed-assets.tsx
+++ b/apps/erp/app/routes/x+/accounting+/fixed-assets.tsx
@@ -3,13 +3,13 @@
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
import { requirePermissions } from "@carbon/auth/auth.server";
-import { Button, RecordOutlet, useViewport, VStack } from "@carbon/react";
+import { Button, RecordOutlet, VStack } from "@carbon/react";
import { msg } from "@lingui/core/macro";
-import { useLingui } from "@lingui/react/macro";
+import { Trans, useLingui } from "@lingui/react/macro";
import { LuCirclePlus } from "react-icons/lu";
import type { LoaderFunctionArgs } from "react-router";
import { useLoaderData, useNavigate } from "react-router";
-import { New } from "~/components";
+import { NewAction } from "~/components/New";
import { usePermissions } from "~/hooks";
import { getFixedAssetClassesList, getFixedAssets } from "~/modules/accounting";
import { FixedAssetsTable } from "~/modules/accounting/ui/FixedAssets";
@@ -64,7 +64,6 @@ export default function FixedAssetsRoute() {
const { t } = useLingui();
const permissions = usePermissions();
const navigate = useNavigate();
- const { isPhone } = useViewport();
return (
<VStack spacing={0} className="h-full">
@@ -73,19 +72,17 @@ export default function FixedAssetsRoute() {
count={count}
assetClasses={assetClasses}
primaryAction={
- permissions.can("create", "accounting") &&
- // Phones: Add becomes the app bar "+" like the other lists.
- (isPhone ? (
- <New label={t`Fixed Asset`} to={path.to.newFixedAsset} />
- ) : (
- <Button
- leftIcon={<LuCirclePlus />}
- variant="primary"
- onClick={() => navigate(path.to.newFixedAsset)}
- >
- Add Fixed Asset
- </Button>
- ))
+ permissions.can("create", "accounting") && (
+ <NewAction label={t`Add Fixed Asset`} to={path.to.newFixedAsset}>
+ <Button
+ leftIcon={<LuCirclePlus />}
+ variant="primary"
+ onClick={() => navigate(path.to.newFixedAsset)}
+ >
+ <Trans>Add Fixed Asset</Trans>
+ </Button>
+ </NewAction>
+ )
}
/>
<RecordOutlet />
diff --git a/apps/erp/app/routes/x+/people+/departments.tsx b/apps/erp/app/routes/x+/people+/departments.tsx
index 5727c9d190..1db76e2d8f 100644
--- a/apps/erp/app/routes/x+/people+/departments.tsx
+++ b/apps/erp/app/routes/x+/people+/departments.tsx
@@ -20,8 +20,7 @@ import {
Tabs,
TabsContent,
TabsList,
- TabsTrigger,
- useViewport
+ TabsTrigger
} from "@carbon/react";
import { redirect } from "@carbon/utils";
import { msg } from "@lingui/core/macro";
@@ -33,7 +32,7 @@ import type { LoaderFunctionArgs } from "react-router";
import { useLoaderData, useNavigate } from "react-router";
import { New } from "~/components";
import { ImportCSVModal } from "~/components/ImportCSVModal";
-import { AppBarActions } from "~/components/Layout/Mobile";
+import { AppBarAction } from "~/components/New";
import { getDepartmentsTree } from "~/modules/people";
import {
DepartmentsListView,
@@ -75,7 +74,6 @@ export default function Route() {
const { departments } = useLoaderData<typeof loader>();
const navigate = useNavigate();
const { t } = useLingui();
- const { isPhone } = useViewport();
const handleEdit = useCallback(
(id: string) => {
@@ -149,22 +147,12 @@ export default function Route() {
to={path.to.newDepartment}
variant="primary"
/>
- {isPhone ? (
- // Phones: the content ⋮ moves to the app bar ⋯.
- <AppBarActions>
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <IconButton
- aria-label={t`Table actions`}
- variant="ghost"
- size="lg"
- icon={<LuEllipsis />}
- />
- </DropdownMenuTrigger>
- {actionsMenuContent}
- </DropdownMenu>
- </AppBarActions>
- ) : (
+ {/* Phones: the content ⋮ moves to the app bar ⋯. */}
+ <AppBarAction
+ icon={<LuEllipsis />}
+ label={t`Table actions`}
+ menu={actionsMenuContent}
+ >
<DropdownMenu>
<DropdownMenuTrigger asChild>
<IconButton
@@ -175,7 +163,7 @@ export default function Route() {
</DropdownMenuTrigger>
{actionsMenuContent}
</DropdownMenu>
- )}
+ </AppBarAction>
</HStack>
</div>
diff --git a/apps/mes/app/components/AssemblyView.tsx b/apps/mes/app/components/AssemblyView.tsx
index 6c5069877d..6213bcbc22 100644
--- a/apps/mes/app/components/AssemblyView.tsx
+++ b/apps/mes/app/components/AssemblyView.tsx
@@ -1853,13 +1853,11 @@ export function AssemblyView({
<div className="relative flex h-dvh w-full flex-col overflow-hidden bg-background text-foreground">
{/* ── HEADER ── */}
<MesAppBar
- kind="pushed"
title={
operation?.jobReadableId ?? job?.itemReadableIdWithRevision ?? "—"
}
subtitle={origin.label}
back={{ to: origin.to }}
- desktop={null}
actions={headerActions}
/>
{/* Phones use the app bar above; one header mounts so its timers do too. */}
diff --git a/apps/mes/app/components/ConsolePill.tsx b/apps/mes/app/components/ConsolePill.tsx
index 67d9e0686e..b389b55876 100644
--- a/apps/mes/app/components/ConsolePill.tsx
+++ b/apps/mes/app/components/ConsolePill.tsx
@@ -36,7 +36,7 @@ export function ConsolePill({
<button
type="button"
onClick={() => setOpen(true)}
- className="fixed top-3 left-1/2 -translate-x-1/2 z-40 max-md:top-auto max-md:left-4 max-md:translate-x-0 max-md:bottom-[calc(var(--mes-bottom-bar-h,calc(54px+env(safe-area-inset-bottom)))+8px)] flex items-center gap-2 rounded-full border bg-card/90 backdrop-blur-md px-3 py-1.5 shadow-lg transition-[box-shadow,transform] duration-200 hover:shadow-xl active:scale-[0.98] select-none"
+ className="fixed top-3 left-1/2 -translate-x-1/2 z-40 max-md:top-auto max-md:left-4 max-md:translate-x-0 max-md:bottom-[calc(var(--mes-bottom-bar-h,var(--mes-tab-bar-h))+8px)] flex items-center gap-2 rounded-full border bg-card/90 backdrop-blur-md px-3 py-1.5 shadow-lg transition-[box-shadow,transform] duration-200 hover:shadow-xl active:scale-[0.98] select-none"
>
<Avatar size="xs" name={user.name} src={user.avatarUrl ?? undefined} />
<span className="text-xs font-medium max-w-[130px] truncate">
diff --git a/apps/mes/app/components/Inspection/InspectionView.tsx b/apps/mes/app/components/Inspection/InspectionView.tsx
index 52b7c2d5e9..8b1465c9e3 100644
--- a/apps/mes/app/components/Inspection/InspectionView.tsx
+++ b/apps/mes/app/components/Inspection/InspectionView.tsx
@@ -623,11 +623,9 @@ export function InspectionView({
<div className="relative flex h-dvh w-full flex-col overflow-hidden bg-background text-foreground">
{/* ── HEADER ── */}
<MesAppBar
- kind="pushed"
title={inspection.inspectionId}
subtitle={origin.label}
back={{ to: origin.to }}
- desktop={null}
actions={
<>
{workTypes.map((wt) => (
@@ -934,60 +932,62 @@ export function InspectionView({
</div>
{/* Phones: the lot actions as labelled 48px buttons in thumb reach. */}
- <div
- ref={bottomBarRef}
- data-mes-bottom-bar
- className="flex shrink-0 flex-wrap gap-2 border-t border-border bg-card px-4 pt-2 pb-[max(0.5rem,env(safe-area-inset-bottom))] md:hidden [&>button]:min-w-0 [&>button]:flex-1"
- >
- {/* Its label carries a count, so it takes a row of its own. */}
- {showCompletePassed ? (
- <div className="basis-full [&>*]:w-full">
- <CompletePassedButton
- inspectionId={inspection.id}
- operationId={operationId}
- count={completablePassed}
- eventIds={eventIds}
- variant="bar"
- />
- </div>
- ) : null}
- <Button
- size="lg"
- variant="secondary"
- leftIcon={<LuX />}
- isDisabled={!canReject}
- onClick={rejectDisclosure.onOpen}
- className="h-12 text-red-600 dark:text-red-400"
+ {isPhone && (
+ <div
+ ref={bottomBarRef}
+ data-mes-bottom-bar
+ className="flex shrink-0 flex-wrap gap-2 border-t border-border bg-card px-4 pt-2 pb-[max(0.5rem,env(safe-area-inset-bottom))] md:hidden [&>button]:min-w-0 [&>button]:flex-1"
>
- <span className="truncate">
- <Trans>Reject</Trans>
- </span>
- </Button>
- {canPartial ? (
+ {/* Its label carries a count, so it takes a row of its own. */}
+ {showCompletePassed ? (
+ <div className="basis-full [&>*]:w-full">
+ <CompletePassedButton
+ inspectionId={inspection.id}
+ operationId={operationId}
+ count={completablePassed}
+ eventIds={eventIds}
+ variant="bar"
+ />
+ </div>
+ ) : null}
<Button
size="lg"
variant="secondary"
- leftIcon={<LuContrast />}
- onClick={partialDisclosure.onOpen}
- className="h-12 text-amber-600 dark:text-amber-400"
+ leftIcon={<LuX />}
+ isDisabled={!canReject}
+ onClick={rejectDisclosure.onOpen}
+ className="h-12 text-red-600 dark:text-red-400"
>
<span className="truncate">
- <Trans>Partial</Trans>
+ <Trans>Reject</Trans>
</span>
</Button>
- ) : null}
- <Button
- size="lg"
- leftIcon={<LuCheck />}
- isDisabled={!canAccept}
- onClick={acceptDisclosure.onOpen}
- className="h-12"
- >
- <span className="truncate">
- <Trans>Accept</Trans>
- </span>
- </Button>
- </div>
+ {canPartial ? (
+ <Button
+ size="lg"
+ variant="secondary"
+ leftIcon={<LuContrast />}
+ onClick={partialDisclosure.onOpen}
+ className="h-12 text-amber-600 dark:text-amber-400"
+ >
+ <span className="truncate">
+ <Trans>Partial</Trans>
+ </span>
+ </Button>
+ ) : null}
+ <Button
+ size="lg"
+ leftIcon={<LuCheck />}
+ isDisabled={!canAccept}
+ onClick={acceptDisclosure.onOpen}
+ className="h-12"
+ >
+ <span className="truncate">
+ <Trans>Accept</Trans>
+ </span>
+ </Button>
+ </div>
+ )}
{/* ── MODALS ── */}
{scannerDisclosure.isOpen && (
diff --git a/apps/mes/app/components/JobOperation/JobOperation.tsx b/apps/mes/app/components/JobOperation/JobOperation.tsx
index 7a9039de97..2f29acf090 100644
--- a/apps/mes/app/components/JobOperation/JobOperation.tsx
+++ b/apps/mes/app/components/JobOperation/JobOperation.tsx
@@ -511,6 +511,8 @@ export const JobOperation = ({
// Chat is one job's thread, so a Chat tab left open in the job scope falls
// back to Details on the batch.
const tab = scope === "batch" && activeTab === "chat" ? "details" : activeTab;
+ // Phones on Details show the context row and meters in the scrolling pane.
+ const contextInPane = isPhone && tab === "details";
const showControls = !["chat", "procedure"].includes(tab);
// Read after mount (never during render) so SSR and the first client
// render agree; storage can throw in private/locked-down browsers.
@@ -1145,7 +1147,6 @@ export const JobOperation = ({
>
<div className="[grid-area:header] flex min-w-0 flex-col">
<MesAppBar
- kind="pushed"
title={
scope === "batch" && batch
? batch.readableId
@@ -1154,7 +1155,6 @@ export const JobOperation = ({
subtitle={origin.label}
back={{ to: origin.to }}
actions={renderJobMenu({ size: "lg", align: "end" })}
- desktop={null}
/>
<header className="flex h-[var(--header-height)] shrink-0 items-center gap-2 border-b px-2 max-md:h-auto max-md:py-0">
<HStack className="w-full justify-between max-md:flex-wrap max-md:gap-y-1">
@@ -1195,25 +1195,24 @@ export const JobOperation = ({
</header>
</div>
- {renderContextRow(
- cn("[grid-area:context]", tab === "details" && "max-md:hidden")
+ {!contextInPane && (
+ <>
+ {renderContextRow("[grid-area:context]")}
+ <Separator className="[grid-area:sep]" />
+ </>
)}
- <Separator
- className={cn(
- "[grid-area:sep]",
- tab === "details" && "max-md:hidden"
- )}
- />
<TabsContent
value="details"
className="[grid-area:main] mt-0 h-full min-h-0 overflow-y-auto scroll-fade scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent"
>
<div className="w-full min-w-0">
- {renderContextRow("md:hidden border-b border-border")}
- <div className="border-b border-border px-4 py-3 md:hidden">
- {meters}
- </div>
+ {contextInPane && (
+ <>
+ {renderContextRow("border-b border-border")}
+ <div className="border-b border-border px-4 py-3">{meters}</div>
+ </>
+ )}
{isCompleting && (
<div className="px-4 pt-4 lg:px-6">
<Card>
@@ -2724,15 +2723,8 @@ export const JobOperation = ({
</div>
</Controls>
)}
- {!["chat"].includes(activeTab) && (
- <Times
- className={cn(
- "[grid-area:status]",
- tab === "details" && "max-md:hidden"
- )}
- >
- {meters}
- </Times>
+ {!["chat"].includes(activeTab) && !contextInPane && (
+ <Times className="[grid-area:status]">{meters}</Times>
)}
</Tabs>
<BottomSheet
diff --git a/apps/mes/app/components/MesAppBar.tsx b/apps/mes/app/components/MesAppBar.tsx
index a08c28027d..e87256e046 100644
--- a/apps/mes/app/components/MesAppBar.tsx
+++ b/apps/mes/app/components/MesAppBar.tsx
@@ -16,117 +16,105 @@ import { LuChevronDown, LuChevronLeft } from "react-icons/lu";
import { Link } from "react-router";
type MesAppBarProps = {
- kind: "root" | "pushed";
title: ReactNode;
/** Pushed pages: the parent page name, under the title. */
subtitle?: ReactNode;
- /** Pushed pages: where Back goes. */
- back?: { to: string };
- /** Phones: at most 2 icon actions, each 44×44. */
- actions?: ReactNode;
- /** The default md+ header's title when it differs from the phone one. */
- desktopTitle?: ReactNode;
/**
- * The md+ header. Omit it for today's queue header (trigger + h4 title).
- * Pass `null` when the page renders its own md+ header, or none.
+ * Pushed pages: where Back goes. Without it the page is a root page and
+ * the title ▾ opens the queue list.
*/
- desktop?: ReactNode;
- /** Extra classes for the default md+ header. */
- desktopClassName?: string;
+ back?: { to: string };
+ /** At most 2 icon actions, each 44×44. */
+ actions?: ReactNode;
};
/**
- * The MES page header. Below md: one 52px bar with Back (pushed pages), a
+ * The MES page header on phones: one 52px bar with Back (pushed pages), a
* 17px title and up to 2 actions; on root pages the title ▾ opens the queue
- * list, like the ERP's section switcher. From md: the header each page had
- * before.
+ * list, like the ERP's section switcher. From md it renders nothing: pages
+ * render their own md+ header, or `MesQueueHeader`.
*/
-export function MesAppBar({
- kind,
- title,
- subtitle,
- back,
- actions,
- desktopTitle,
- desktop,
- desktopClassName
-}: MesAppBarProps) {
+export function MesAppBar({ title, subtitle, back, actions }: MesAppBarProps) {
const { t } = useLingui();
const { isPhone } = useViewport();
const { openMobile, setOpenMobile } = useSidebar();
- const desktopHeader =
- desktop === undefined ? (
- <header
- className={cn(
- "sticky top-0 z-10 flex h-[var(--header-height)] shrink-0 items-center gap-2 border-b bg-card max-md:hidden",
- desktopClassName
- )}
- >
- <div className="flex items-center gap-2 px-2">
- <SidebarTrigger />
- <Heading size="h4">{desktopTitle ?? title}</Heading>
- </div>
- </header>
- ) : (
- desktop
- );
-
- // One header mounts at a time, so page actions (timers, menus) mount once.
- if (!isPhone) return <>{desktopHeader}</>;
+ if (!isPhone) return null;
return (
- <>
- <header className="md:hidden sticky top-0 z-20 flex h-[calc(52px+env(safe-area-inset-top))] shrink-0 items-center gap-1 border-b border-border bg-card px-1 pt-safe">
- {kind === "pushed" && back ? (
- <Button
- asChild
- isIcon
- variant="ghost"
- size="lg"
- aria-label={t`Back`}
- className="shrink-0"
+ <header className="md:hidden sticky top-0 z-20 flex h-[calc(52px+env(safe-area-inset-top))] shrink-0 items-center gap-1 border-b border-border bg-card px-1 pt-safe">
+ {back ? (
+ <Button
+ asChild
+ isIcon
+ variant="ghost"
+ size="lg"
+ aria-label={t`Back`}
+ className="shrink-0"
+ >
+ <Link to={back.to}>
+ <LuChevronLeft className="size-6" />
+ </Link>
+ </Button>
+ ) : (
+ <span className="w-2 shrink-0" />
+ )}
+ {back ? (
+ <div className="flex min-w-0 flex-1 flex-col justify-center">
+ <span className="truncate text-[17px] font-semibold leading-tight text-foreground">
+ {title}
+ </span>
+ {subtitle ? (
+ <span className="truncate text-xs text-muted-foreground">
+ {subtitle}
+ </span>
+ ) : null}
+ </div>
+ ) : (
+ <div className="flex min-w-0 flex-1 items-center">
+ <button
+ type="button"
+ onClick={() => setOpenMobile(true)}
+ aria-haspopup="dialog"
+ aria-expanded={openMobile}
+ className="flex min-h-11 min-w-0 items-center gap-1 rounded-lg px-1 text-foreground outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"
>
- <Link to={back.to}>
- <LuChevronLeft className="size-6" />
- </Link>
- </Button>
- ) : (
- <span className="w-2 shrink-0" />
- )}
- {kind === "root" ? (
- <div className="flex min-w-0 flex-1 items-center">
- <button
- type="button"
- onClick={() => setOpenMobile(true)}
- aria-haspopup="dialog"
- aria-expanded={openMobile}
- className="flex min-h-11 min-w-0 items-center gap-1 rounded-lg px-1 text-foreground outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"
- >
- <span className="min-w-0 truncate text-[17px] font-semibold leading-tight">
- {title}
- </span>
- <LuChevronDown className="size-5 shrink-0 text-muted-foreground" />
- </button>
- </div>
- ) : (
- <div className="flex min-w-0 flex-1 flex-col justify-center">
- <span className="truncate text-[17px] font-semibold leading-tight text-foreground">
+ <span className="min-w-0 truncate text-[17px] font-semibold leading-tight">
{title}
</span>
- {subtitle ? (
- <span className="truncate text-xs text-muted-foreground">
- {subtitle}
- </span>
- ) : null}
- </div>
- )}
- {actions ? (
- <div className="flex shrink-0 items-center self-stretch">
- {actions}
- </div>
- ) : null}
- </header>
- </>
+ <LuChevronDown className="size-5 shrink-0 text-muted-foreground" />
+ </button>
+ </div>
+ )}
+ {actions ? (
+ <div className="flex shrink-0 items-center self-stretch">{actions}</div>
+ ) : null}
+ </header>
+ );
+}
+
+/** A root (queue) page's md+ header: the sidebar trigger and an h4 title. */
+export function MesQueueHeader({
+ title,
+ className
+}: {
+ title: ReactNode;
+ className?: string;
+}) {
+ const { isPhone } = useViewport();
+ if (isPhone) return null;
+
+ return (
+ <header
+ className={cn(
+ "sticky top-0 z-10 flex h-[var(--header-height)] shrink-0 items-center gap-2 border-b bg-card max-md:hidden",
+ className
+ )}
+ >
+ <div className="flex items-center gap-2 px-2">
+ <SidebarTrigger />
+ <Heading size="h4">{title}</Heading>
+ </div>
+ </header>
);
}
diff --git a/apps/mes/app/components/MesTabBar.tsx b/apps/mes/app/components/MesTabBar.tsx
index affd582e28..6037a655ce 100644
--- a/apps/mes/app/components/MesTabBar.tsx
+++ b/apps/mes/app/components/MesTabBar.tsx
@@ -91,7 +91,7 @@ export function MesTabBar({
data-mes-tab-bar=""
data-visible={isTyping ? "false" : "true"}
className={cn(
- "fixed inset-x-0 bottom-0 z-30 min-h-[calc(54px+env(safe-area-inset-bottom))]",
+ "fixed inset-x-0 bottom-0 z-30 min-h-[var(--mes-tab-bar-h)]",
isTyping && "hidden"
)}
>
diff --git a/apps/mes/app/routes/x+/_layout.tsx b/apps/mes/app/routes/x+/_layout.tsx
index fc99b01ca9..a94c00944f 100644
--- a/apps/mes/app/routes/x+/_layout.tsx
+++ b/apps/mes/app/routes/x+/_layout.tsx
@@ -540,8 +540,7 @@ export default function AuthenticatedRoute() {
<div
className={cn(
"flex flex-1 flex-col min-w-0 overflow-hidden bg-card md:mt-2 md:mr-2 md:mb-2 md:rounded-2xl md:border md:border-border lg:max-h-[calc(100dvh-1rem)]",
- showTabBar &&
- "max-md:pb-[calc(54px+env(safe-area-inset-bottom))]"
+ showTabBar && "max-md:pb-[var(--mes-tab-bar-h)]"
)}
>
{/* A company switch stays on the same page. Without the key the page
diff --git a/apps/mes/app/routes/x+/active.tsx b/apps/mes/app/routes/x+/active.tsx
index 92e8400d61..9fe1117a34 100644
--- a/apps/mes/app/routes/x+/active.tsx
+++ b/apps/mes/app/routes/x+/active.tsx
@@ -11,7 +11,7 @@ import type { ImperativePanelHandle } from "react-resizable-panels";
import type { LoaderFunctionArgs } from "react-router";
import { useLoaderData, useParams } from "react-router";
import { OperationsList } from "~/components";
-import { MesAppBar } from "~/components/MesAppBar";
+import { MesAppBar, MesQueueHeader } from "~/components/MesAppBar";
import { MesEmptyState } from "~/components/MesEmptyState";
import { getActiveJobOperationsByEmployee } from "~/services/operations.service";
import { makeDurations } from "~/utils/durations";
@@ -67,7 +67,8 @@ export default function ActiveRoute() {
return (
<div className="flex flex-col flex-1 min-h-0">
- <MesAppBar kind="root" title={<Trans>Active</Trans>} />
+ <MesAppBar title={<Trans>Active</Trans>} />
+ <MesQueueHeader title={<Trans>Active</Trans>} />
<main className="flex-1 min-h-0 w-full overflow-y-auto scrollbar-thin scrollbar-thumb-accent scrollbar-track-transparent">
<div className="w-full p-4 h-[var(--header-height)] max-md:h-auto max-md:pb-0">
diff --git a/apps/mes/app/routes/x+/assigned.tsx b/apps/mes/app/routes/x+/assigned.tsx
index 076979a50f..48784a222f 100644
--- a/apps/mes/app/routes/x+/assigned.tsx
+++ b/apps/mes/app/routes/x+/assigned.tsx
@@ -35,7 +35,7 @@ import { useLoaderData } from "react-router";
import { OperationsList } from "~/components";
import type { Column, DisplaySettings, Item } from "~/components/Kanban";
import { Kanban } from "~/components/Kanban";
-import { MesAppBar } from "~/components/MesAppBar";
+import { MesAppBar, MesQueueHeader } from "~/components/MesAppBar";
import { userContext } from "~/context";
import {
getJobOperationsAssignedToEmployee,
@@ -296,12 +296,9 @@ export default function AssignedRoute() {
return (
// Phones: the page takes the screen above the tab bar, so the list and
// the board scroll inside it (see Schedule).
- <div className="flex flex-col flex-1 min-h-0 min-w-0 max-md:h-[calc(100dvh-54px-env(safe-area-inset-bottom))] max-md:flex-none">
+ <div className="flex flex-col flex-1 min-h-0 min-w-0 max-md:h-[calc(100dvh-var(--mes-tab-bar-h))] max-md:flex-none">
<MesAppBar
- kind="root"
title={<Trans>Assigned</Trans>}
- desktopTitle={<Trans>Assigned to Me</Trans>}
- desktopClassName="overflow-y-scroll scrollbar-thin scrollbar-thumb-accent scrollbar-track-transparent"
actions={
<>
{view === "board" && (
@@ -327,6 +324,10 @@ export default function AssignedRoute() {
</>
}
/>
+ <MesQueueHeader
+ title={<Trans>Assigned to Me</Trans>}
+ className="overflow-y-scroll scrollbar-thin scrollbar-thumb-accent scrollbar-track-transparent"
+ />
{/* Phones: a column so the board fills what the toolbar leaves and
each column scrolls under its header (see Schedule). */}
diff --git a/apps/mes/app/routes/x+/dispatch.$dispatchId.tsx b/apps/mes/app/routes/x+/dispatch.$dispatchId.tsx
index ec3aca9f22..eb0638bab2 100644
--- a/apps/mes/app/routes/x+/dispatch.$dispatchId.tsx
+++ b/apps/mes/app/routes/x+/dispatch.$dispatchId.tsx
@@ -29,6 +29,7 @@ import {
SidebarTrigger,
Status,
useDisclosure,
+ useViewport,
VStack
} from "@carbon/react";
import { groupBy } from "@carbon/utils";
@@ -218,6 +219,7 @@ export default function MaintenanceDetailRoute() {
const addPartModal = useDisclosure();
const [confirmComplete, setConfirmComplete] = useState(false);
const [allItems] = useItems();
+ const { isPhone } = useViewport();
// Create item options for the combobox
const itemOptions = useMemo(() => {
@@ -260,31 +262,31 @@ export default function MaintenanceDetailRoute() {
return (
<div className="flex flex-col flex-1">
<MesAppBar
- kind="pushed"
title={dispatch.maintenanceDispatchId}
subtitle={<Trans>Maintenance</Trans>}
back={{ to: path.to.maintenance }}
- desktop={null}
/>
- <header className="sticky top-0 z-10 flex h-[var(--header-height)] shrink-0 items-center gap-2 border-b bg-card max-md:hidden">
- <div className="flex items-center gap-2 px-2 w-full justify-between">
- <HStack>
- <SidebarTrigger />
- <Link to={path.to.maintenance}>
- <Button variant="ghost" size="sm">
- <LuArrowLeft className="h-4 w-4" />
- </Button>
- </Link>
- <Heading size="h4">{dispatch.maintenanceDispatchId}</Heading>
- <MaintenanceStatus status={dispatch.status} />
- </HStack>
- <HStack>
- {getPriorityIcon(
- dispatch.priority as (typeof maintenanceDispatchPriority)[number]
- )}
- </HStack>
- </div>
- </header>
+ {!isPhone && (
+ <header className="sticky top-0 z-10 flex h-[var(--header-height)] shrink-0 items-center gap-2 border-b bg-card max-md:hidden">
+ <div className="flex items-center gap-2 px-2 w-full justify-between">
+ <HStack>
+ <SidebarTrigger />
+ <Link to={path.to.maintenance}>
+ <Button variant="ghost" size="sm">
+ <LuArrowLeft className="h-4 w-4" />
+ </Button>
+ </Link>
+ <Heading size="h4">{dispatch.maintenanceDispatchId}</Heading>
+ <MaintenanceStatus status={dispatch.status} />
+ </HStack>
+ <HStack>
+ {getPriorityIcon(
+ dispatch.priority as (typeof maintenanceDispatchPriority)[number]
+ )}
+ </HStack>
+ </div>
+ </header>
+ )}
<main className="flex-1 min-h-0 w-full overflow-y-auto scrollbar-thin scrollbar-thumb-accent scrollbar-track-transparent p-4">
<VStack spacing={4} className="max-w-2xl mx-auto">
diff --git a/apps/mes/app/routes/x+/job.$jobId.tsx b/apps/mes/app/routes/x+/job.$jobId.tsx
index c0f7b6bc8d..d128132ac9 100644
--- a/apps/mes/app/routes/x+/job.$jobId.tsx
+++ b/apps/mes/app/routes/x+/job.$jobId.tsx
@@ -5,7 +5,7 @@
import { requirePermissions } from "@carbon/auth/auth.server";
import { getCarbonServiceRole } from "@carbon/auth/client.server";
import { getLogger } from "@carbon/logger";
-import { Heading, SidebarTrigger } from "@carbon/react";
+import { Heading, SidebarTrigger, useViewport } from "@carbon/react";
import { redirect } from "@carbon/utils";
import { Trans } from "@lingui/react/macro";
import { LuArrowLeft } from "react-icons/lu";
@@ -68,28 +68,29 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
export default function JobDagRoute() {
const { readableId, operations, dependencies } =
useLoaderData<typeof loader>();
+ const { isPhone } = useViewport();
return (
<div className="flex flex-col flex-1">
<MesAppBar
- kind="pushed"
title={readableId}
subtitle={<Trans>Jobs</Trans>}
back={{ to: path.to.jobs }}
- desktop={null}
/>
- <header className="sticky top-0 z-10 flex h-[var(--header-height)] shrink-0 items-center gap-2 border-b bg-card max-md:hidden">
- <div className="flex items-center gap-2 px-2">
- <SidebarTrigger />
- <Link
- to={path.to.jobs}
- className="flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors"
- >
- <LuArrowLeft className="w-4 h-4" />
- </Link>
- <Heading size="h4">{readableId}</Heading>
- </div>
- </header>
+ {!isPhone && (
+ <header className="sticky top-0 z-10 flex h-[var(--header-height)] shrink-0 items-center gap-2 border-b bg-card max-md:hidden">
+ <div className="flex items-center gap-2 px-2">
+ <SidebarTrigger />
+ <Link
+ to={path.to.jobs}
+ className="flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors"
+ >
+ <LuArrowLeft className="w-4 h-4" />
+ </Link>
+ <Heading size="h4">{readableId}</Heading>
+ </div>
+ </header>
+ )}
<main className="flex-1 overflow-hidden">
<JobDag operations={operations} dependencies={dependencies} />
diff --git a/apps/mes/app/routes/x+/jobs.tsx b/apps/mes/app/routes/x+/jobs.tsx
index 052903f10c..f5820d1d09 100644
--- a/apps/mes/app/routes/x+/jobs.tsx
+++ b/apps/mes/app/routes/x+/jobs.tsx
@@ -25,7 +25,7 @@ import type { LoaderFunctionArgs } from "react-router";
import { Link, useLoaderData } from "react-router";
import { DateTime } from "~/components";
import EmployeeAvatar from "~/components/EmployeeAvatar";
-import { MesAppBar } from "~/components/MesAppBar";
+import { MesAppBar, MesQueueHeader } from "~/components/MesAppBar";
import { MesEmptyState } from "~/components/MesEmptyState";
import { userContext } from "~/context";
import {
@@ -124,11 +124,8 @@ export default function JobsRoute() {
return (
<div className="flex flex-col flex-1 min-h-0">
- <MesAppBar
- kind="root"
- title={<Trans>Jobs</Trans>}
- desktopTitle={<Trans>Open Jobs</Trans>}
- />
+ <MesAppBar title={<Trans>Jobs</Trans>} />
+ <MesQueueHeader title={<Trans>Open Jobs</Trans>} />
<main className="flex-1 overflow-y-auto scrollbar-thin scrollbar-thumb-accent scrollbar-track-transparent">
<div className="p-4">
diff --git a/apps/mes/app/routes/x+/maintenance.tsx b/apps/mes/app/routes/x+/maintenance.tsx
index 724bdd503e..c91f805065 100644
--- a/apps/mes/app/routes/x+/maintenance.tsx
+++ b/apps/mes/app/routes/x+/maintenance.tsx
@@ -29,7 +29,7 @@ import { MediumPriorityIcon } from "~/assets/icons/MediumPriorityIcon";
import EmployeeAvatar from "~/components/EmployeeAvatar";
import type { ColumnFilter } from "~/components/Filter";
import { ActiveFilters, Filter, useFilters } from "~/components/Filter";
-import { MesAppBar } from "~/components/MesAppBar";
+import { MesAppBar, MesQueueHeader } from "~/components/MesAppBar";
import { MesEmptyState } from "~/components/MesEmptyState";
import SearchFilter from "~/components/SearchFilter";
import { userContext } from "~/context";
@@ -425,7 +425,8 @@ export default function MaintenanceRoute() {
return (
<div className="flex flex-col flex-1 min-h-0">
- <MesAppBar kind="root" title={<Trans>Maintenance</Trans>} />
+ <MesAppBar title={<Trans>Maintenance</Trans>} />
+ <MesQueueHeader title={<Trans>Maintenance</Trans>} />
<main className="flex-1 min-h-0 w-full overflow-y-auto scrollbar-thin scrollbar-thumb-accent scrollbar-track-transparent">
<div className="w-full p-4">
diff --git a/apps/mes/app/routes/x+/operations.tsx b/apps/mes/app/routes/x+/operations.tsx
index 97f1b8eab8..e27048a37f 100644
--- a/apps/mes/app/routes/x+/operations.tsx
+++ b/apps/mes/app/routes/x+/operations.tsx
@@ -43,7 +43,7 @@ import type { ColumnFilter } from "~/components/Filter";
import { ActiveFilters, Filter, useFilters } from "~/components/Filter";
import type { Column, DisplaySettings, Item } from "~/components/Kanban";
import { Kanban } from "~/components/Kanban";
-import { MesAppBar } from "~/components/MesAppBar";
+import { MesAppBar, MesQueueHeader } from "~/components/MesAppBar";
import { MesEmptyState } from "~/components/MesEmptyState";
import SearchFilter from "~/components/SearchFilter";
import { userContext } from "~/context";
@@ -686,9 +686,8 @@ function KanbanSchedule() {
return (
// Phones: the shell grows with its content, so the page takes the screen
// above the tab bar itself; each column then scrolls under its header.
- <div className="flex flex-col flex-1 min-h-0 w-full max-md:h-[calc(100dvh-54px-env(safe-area-inset-bottom))] max-md:flex-none">
+ <div className="flex flex-col flex-1 min-h-0 w-full max-md:h-[calc(100dvh-var(--mes-tab-bar-h))] max-md:flex-none">
<MesAppBar
- kind="root"
title={<Trans>Schedule</Trans>}
actions={
<Popover>
@@ -704,6 +703,7 @@ function KanbanSchedule() {
</Popover>
}
/>
+ <MesQueueHeader title={<Trans>Schedule</Trans>} />
<div className="flex flex-col flex-1 min-h-0 overflow-auto relative">
<HStack className="px-4 py-2 justify-between bg-card border-b border-border max-md:gap-2 max-md:space-x-0 max-md:pt-3">
<HStack className="max-md:min-w-0 max-md:flex-1 max-md:space-x-0 max-md:gap-2">
diff --git a/apps/mes/app/routes/x+/picking.$pickingListId.tsx b/apps/mes/app/routes/x+/picking.$pickingListId.tsx
index b07cee0999..485afaa542 100644
--- a/apps/mes/app/routes/x+/picking.$pickingListId.tsx
+++ b/apps/mes/app/routes/x+/picking.$pickingListId.tsx
@@ -39,6 +39,7 @@ import {
TooltipTrigger,
TrackedEntityPicker,
toast,
+ useViewport,
VStack
} from "@carbon/react";
import { Trans } from "@lingui/react/macro";
@@ -125,6 +126,7 @@ type RecommendationsPromise = Promise<
export default function PickingExecutionRoute() {
const bottomBarRef = useMesBottomBar();
+ const { isPhone } = useViewport();
const { pickingList, recommendations } = useLoaderData<typeof loader>();
const lines = pickingList.lines ?? [];
@@ -161,28 +163,28 @@ export default function PickingExecutionRoute() {
return (
<div className="flex flex-col flex-1">
<MesAppBar
- kind="pushed"
title={pickingList.pickingListId}
subtitle={<Trans>Picking</Trans>}
back={{ to: path.to.picking }}
- desktop={null}
/>
- <header className="sticky top-0 z-10 flex h-[var(--header-height)] shrink-0 items-center justify-between gap-2 border-b bg-card max-md:hidden">
- <div className="flex items-center gap-2 px-2">
- <SidebarTrigger />
- <Heading size="h4">{pickingList.pickingListId}</Heading>
- <PickingListStatus status={pickingList.status} />
- </div>
- <div className="flex items-center gap-3 px-3">
- <span className="text-sm text-muted-foreground tabular-nums whitespace-nowrap">
- {completedCount}/{lines.length} <Trans>lines</Trans>
- </span>
- <PickingListControls
- pickingListId={pickingList.id}
- status={pickingList.status}
- />
- </div>
- </header>
+ {!isPhone && (
+ <header className="sticky top-0 z-10 flex h-[var(--header-height)] shrink-0 items-center justify-between gap-2 border-b bg-card max-md:hidden">
+ <div className="flex items-center gap-2 px-2">
+ <SidebarTrigger />
+ <Heading size="h4">{pickingList.pickingListId}</Heading>
+ <PickingListStatus status={pickingList.status} />
+ </div>
+ <div className="flex items-center gap-3 px-3">
+ <span className="text-sm text-muted-foreground tabular-nums whitespace-nowrap">
+ {completedCount}/{lines.length} <Trans>lines</Trans>
+ </span>
+ <PickingListControls
+ pickingListId={pickingList.id}
+ status={pickingList.status}
+ />
+ </div>
+ </header>
+ )}
<main className="flex-1 min-h-0 w-full overflow-y-auto scrollbar-thin scrollbar-thumb-accent scrollbar-track-transparent p-4 max-md:pb-28">
<div className="w-full max-w-5xl mx-auto pb-16">
@@ -200,22 +202,24 @@ export default function PickingExecutionRoute() {
</VStack>
</div>
</main>
- <div
- ref={bottomBarRef}
- data-mes-bottom-bar
- className="fixed inset-x-0 bottom-0 z-20 flex items-center gap-3 border-t border-border bg-card px-4 pt-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] md:hidden"
- >
- <span className="shrink-0 whitespace-nowrap text-sm text-muted-foreground tabular-nums">
- {completedCount}/{lines.length} <Trans>lines</Trans>
- </span>
- <PickingListControls
- pickingListId={pickingList.id}
- status={pickingList.status}
- size="lg"
- finishVariant="primary"
- className="min-w-0 flex-1 [&_button]:w-full [&_button]:h-12"
- />
- </div>
+ {isPhone && (
+ <div
+ ref={bottomBarRef}
+ data-mes-bottom-bar
+ className="fixed inset-x-0 bottom-0 z-20 flex items-center gap-3 border-t border-border bg-card px-4 pt-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] md:hidden"
+ >
+ <span className="shrink-0 whitespace-nowrap text-sm text-muted-foreground tabular-nums">
+ {completedCount}/{lines.length} <Trans>lines</Trans>
+ </span>
+ <PickingListControls
+ pickingListId={pickingList.id}
+ status={pickingList.status}
+ size="lg"
+ finishVariant="primary"
+ className="min-w-0 flex-1 [&_button]:w-full [&_button]:h-12"
+ />
+ </div>
+ )}
</div>
);
}
diff --git a/apps/mes/app/routes/x+/picking._index.tsx b/apps/mes/app/routes/x+/picking._index.tsx
index aa5fbe67b6..e85a5acd49 100644
--- a/apps/mes/app/routes/x+/picking._index.tsx
+++ b/apps/mes/app/routes/x+/picking._index.tsx
@@ -15,7 +15,7 @@ import { Trans } from "@lingui/react/macro";
import type { LoaderFunctionArgs } from "react-router";
import { Link, useLoaderData } from "react-router";
import { DateTime } from "~/components";
-import { MesAppBar } from "~/components/MesAppBar";
+import { MesAppBar, MesQueueHeader } from "~/components/MesAppBar";
import { MesEmptyState } from "~/components/MesEmptyState";
import { PickingListStatus } from "~/components/PickingListStatus";
import { userContext } from "~/context";
@@ -43,7 +43,8 @@ export default function PickingIndexRoute() {
return (
<div className="flex flex-col flex-1 min-h-0">
- <MesAppBar kind="root" title={<Trans>Picking</Trans>} />
+ <MesAppBar title={<Trans>Picking</Trans>} />
+ <MesQueueHeader title={<Trans>Picking</Trans>} />
<main className="flex-1 min-h-0 w-full overflow-y-auto scrollbar-thin scrollbar-thumb-accent scrollbar-track-transparent">
{pickingLists.length > 0 ? (
diff --git a/apps/mes/app/routes/x+/recent.tsx b/apps/mes/app/routes/x+/recent.tsx
index 0f826bcc94..18126091ab 100644
--- a/apps/mes/app/routes/x+/recent.tsx
+++ b/apps/mes/app/routes/x+/recent.tsx
@@ -11,7 +11,7 @@ import type { ImperativePanelHandle } from "react-resizable-panels";
import type { LoaderFunctionArgs } from "react-router";
import { useLoaderData, useParams } from "react-router";
import { OperationsList } from "~/components";
-import { MesAppBar } from "~/components/MesAppBar";
+import { MesAppBar, MesQueueHeader } from "~/components/MesAppBar";
import { getRecentJobOperationsByEmployee } from "~/services/operations.service";
import { makeDurations } from "~/utils/durations";
import type { Handle } from "~/utils/handle";
@@ -66,7 +66,8 @@ export default function ActiveRoute() {
return (
<div className="flex flex-col flex-1 min-h-0">
- <MesAppBar kind="root" title={<Trans>Recent</Trans>} />
+ <MesAppBar title={<Trans>Recent</Trans>} />
+ <MesQueueHeader title={<Trans>Recent</Trans>} />
<main className="flex-1 min-h-0 w-full overflow-y-auto scrollbar-thin scrollbar-thumb-accent scrollbar-track-transparent">
<div className="w-full p-4 h-[var(--header-height)] max-md:h-auto max-md:pb-0">
diff --git a/apps/mes/app/routes/x+/timecard.tsx b/apps/mes/app/routes/x+/timecard.tsx
index f5d7819a85..a692a8240e 100644
--- a/apps/mes/app/routes/x+/timecard.tsx
+++ b/apps/mes/app/routes/x+/timecard.tsx
@@ -317,7 +317,7 @@ export default function MESTimecardPage() {
return (
<>
- <MesAppBar kind="root" title={<Trans>My Hours</Trans>} desktop={null} />
+ <MesAppBar title={<Trans>My Hours</Trans>} />
<div className="flex flex-col h-full w-full overflow-y-auto p-4 md:p-6 max-md:h-auto max-md:overflow-visible max-md:pb-24">
<div className="max-w-[60rem] mx-auto w-full">
<Card className="overflow-hidden">
@@ -326,9 +326,11 @@ export default function MESTimecardPage() {
<CardTitle className="max-md:hidden">
<Trans>My Hours</Trans>
</CardTitle>
- <HStack className="gap-1 max-md:hidden">
- {renderClockForm("md")}
- </HStack>
+ {!isPhone && (
+ <HStack className="gap-1 max-md:hidden">
+ {renderClockForm("md")}
+ </HStack>
+ )}
</HStack>
{openEntry && (
<Badge variant="green" className="w-fit">
@@ -656,13 +658,15 @@ export default function MESTimecardPage() {
</Modal>
)}
</div>
- <div
- ref={bottomBarRef}
- data-mes-bottom-bar
- className="fixed inset-x-0 bottom-[calc(54px+env(safe-area-inset-bottom))] z-20 border-t border-border bg-card px-4 py-3 md:hidden"
- >
- {renderClockForm("lg", "w-full h-12")}
- </div>
+ {isPhone && (
+ <div
+ ref={bottomBarRef}
+ data-mes-bottom-bar
+ className="fixed inset-x-0 bottom-[var(--mes-tab-bar-h)] z-20 border-t border-border bg-card px-4 py-3 md:hidden"
+ >
+ {renderClockForm("lg", "w-full h-12")}
+ </div>
+ )}
</>
);
}
diff --git a/apps/mes/app/styles/tailwind.css b/apps/mes/app/styles/tailwind.css
index 6e1dcc4778..8cf0c1d883 100644
--- a/apps/mes/app/styles/tailwind.css
+++ b/apps/mes/app/styles/tailwind.css
@@ -24,6 +24,8 @@
:root {
--header-height: 50px;
+ /* Phones: the MES tab bar, safe area included. */
+ --mes-tab-bar-h: calc(54px + env(safe-area-inset-bottom));
--filters-height: 38px;
/* Side control panel; only in play at lg+ (below that it stacks inline). */
--controls-width: 220px;
@@ -170,7 +172,7 @@ p.is-editor-empty:first-child:before {
:has([data-mes-bottom-bar])
)
[data-sonner-toaster][data-y-position="bottom"] {
- bottom: calc(54px + env(safe-area-inset-bottom) + 16px);
+ bottom: calc(var(--mes-tab-bar-h) + 16px);
}
body:has([data-mes-bottom-bar])
diff --git a/packages/locale/locales/de/erp.po b/packages/locale/locales/de/erp.po
index e4b52bd504..221f8bcd61 100644
--- a/packages/locale/locales/de/erp.po
+++ b/packages/locale/locales/de/erp.po
@@ -1768,6 +1768,9 @@ msgstr "Mitarbeiter hinzufügen"
msgid "Add Entry"
msgstr "Eintrag hinzufügen"
+msgid "Add Fixed Asset"
+msgstr ""
+
msgid "Add from library…"
msgstr "Aus Bibliothek hinzufügen…"
diff --git a/packages/locale/locales/en/erp.po b/packages/locale/locales/en/erp.po
index 99676a8d22..7083389d06 100644
--- a/packages/locale/locales/en/erp.po
+++ b/packages/locale/locales/en/erp.po
@@ -1768,6 +1768,9 @@ msgstr "Add Employee"
msgid "Add Entry"
msgstr "Add Entry"
+msgid "Add Fixed Asset"
+msgstr "Add Fixed Asset"
+
msgid "Add from library…"
msgstr "Add from library…"
diff --git a/packages/locale/locales/es/erp.po b/packages/locale/locales/es/erp.po
index 94f397abd8..5fc4efef6f 100644
--- a/packages/locale/locales/es/erp.po
+++ b/packages/locale/locales/es/erp.po
@@ -1768,6 +1768,9 @@ msgstr "Agregar empleado"
msgid "Add Entry"
msgstr "Agregar entrada"
+msgid "Add Fixed Asset"
+msgstr ""
+
msgid "Add from library…"
msgstr "Agregar de la biblioteca…"
diff --git a/packages/locale/locales/fr/erp.po b/packages/locale/locales/fr/erp.po
index f234e1fac2..24622d1187 100644
--- a/packages/locale/locales/fr/erp.po
+++ b/packages/locale/locales/fr/erp.po
@@ -1768,6 +1768,9 @@ msgstr "Ajouter un employé"
msgid "Add Entry"
msgstr "Ajouter une entrée"
+msgid "Add Fixed Asset"
+msgstr ""
+
msgid "Add from library…"
msgstr "Ajouter à partir de la bibliothèque…"
diff --git a/packages/locale/locales/hi/erp.po b/packages/locale/locales/hi/erp.po
index efc4157658..807000f1f0 100644
--- a/packages/locale/locales/hi/erp.po
+++ b/packages/locale/locales/hi/erp.po
@@ -1768,6 +1768,9 @@ msgstr "कर्मचारी जोड़ें"
msgid "Add Entry"
msgstr "प्रविष्टि जोड़ें"
+msgid "Add Fixed Asset"
+msgstr ""
+
msgid "Add from library…"
msgstr "लाइब्रेरी से जोड़ें…"
diff --git a/packages/locale/locales/it/erp.po b/packages/locale/locales/it/erp.po
index ec36bc209c..f306e11b4f 100644
--- a/packages/locale/locales/it/erp.po
+++ b/packages/locale/locales/it/erp.po
@@ -1768,6 +1768,9 @@ msgstr "Aggiungi Dipendente"
msgid "Add Entry"
msgstr "Aggiungi Voce"
+msgid "Add Fixed Asset"
+msgstr ""
+
msgid "Add from library…"
msgstr "Aggiungi dalla libreria…"
diff --git a/packages/locale/locales/ja/erp.po b/packages/locale/locales/ja/erp.po
index 839dfc963c..2c0de47f92 100644
--- a/packages/locale/locales/ja/erp.po
+++ b/packages/locale/locales/ja/erp.po
@@ -1768,6 +1768,9 @@ msgstr "従業員を追加"
msgid "Add Entry"
msgstr "エントリを追加"
+msgid "Add Fixed Asset"
+msgstr ""
+
msgid "Add from library…"
msgstr "ライブラリから追加…"
diff --git a/packages/locale/locales/ko/erp.po b/packages/locale/locales/ko/erp.po
index 7a47a353cd..bca7a0492b 100644
--- a/packages/locale/locales/ko/erp.po
+++ b/packages/locale/locales/ko/erp.po
@@ -1768,6 +1768,9 @@ msgstr "직원 추가"
msgid "Add Entry"
msgstr "항목 추가"
+msgid "Add Fixed Asset"
+msgstr ""
+
msgid "Add from library…"
msgstr "라이브러리에서 추가…"
diff --git a/packages/locale/locales/pl/erp.po b/packages/locale/locales/pl/erp.po
index 7a08048720..a4d88112a3 100644
--- a/packages/locale/locales/pl/erp.po
+++ b/packages/locale/locales/pl/erp.po
@@ -1768,6 +1768,9 @@ msgstr "Dodaj Pracownika"
msgid "Add Entry"
msgstr "Dodaj wpis"
+msgid "Add Fixed Asset"
+msgstr ""
+
msgid "Add from library…"
msgstr "Dodaj z biblioteki…"
diff --git a/packages/locale/locales/pt/erp.po b/packages/locale/locales/pt/erp.po
index ae8f140fa4..5fb12b6c82 100644
--- a/packages/locale/locales/pt/erp.po
+++ b/packages/locale/locales/pt/erp.po
@@ -1768,6 +1768,9 @@ msgstr "Adicionar Funcionário"
msgid "Add Entry"
msgstr "Adicionar Entrada"
+msgid "Add Fixed Asset"
+msgstr ""
+
msgid "Add from library…"
msgstr "Adicionar da biblioteca…"
diff --git a/packages/locale/locales/ru/erp.po b/packages/locale/locales/ru/erp.po
index 1fc896713d..dd8b3fb2ed 100644
--- a/packages/locale/locales/ru/erp.po
+++ b/packages/locale/locales/ru/erp.po
@@ -1768,6 +1768,9 @@ msgstr "Добавить сотрудника"
msgid "Add Entry"
msgstr "Добавить запись"
+msgid "Add Fixed Asset"
+msgstr ""
+
msgid "Add from library…"
msgstr "Добавить из библиотеки…"
diff --git a/packages/locale/locales/tr/erp.po b/packages/locale/locales/tr/erp.po
index 0b081dd846..07097485cf 100644
--- a/packages/locale/locales/tr/erp.po
+++ b/packages/locale/locales/tr/erp.po
@@ -1768,6 +1768,9 @@ msgstr "Çalışan Ekle"
msgid "Add Entry"
msgstr "Giri Ekle"
+msgid "Add Fixed Asset"
+msgstr ""
+
msgid "Add from library…"
msgstr "Kütüphaneden ekle…"
diff --git a/packages/locale/locales/zh/erp.po b/packages/locale/locales/zh/erp.po
index 308c4f5384..09523985ea 100644
--- a/packages/locale/locales/zh/erp.po
+++ b/packages/locale/locales/zh/erp.po
@@ -1768,6 +1768,9 @@ msgstr "添加员工"
msgid "Add Entry"
msgstr "添加条目"
+msgid "Add Fixed Asset"
+msgstr ""
+
msgid "Add from library…"
msgstr "从库中添加…"