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.
Mobile chrome structure — implementation plan
Spec / source: .ai/specs/2026-10-07-mobile-chrome-structure.md
Status: approved
Research: .ai/research/2026-10-07-record-header-catalogue.md
Branch: feat/mobile-redesign (uncommitted working tree, /Users/aashu/work/carbon/carbon-feat-mobile-redesign). Never commit.
Progress
- Task 1: Single compact query in
@carbon/utils - Task 2: One compact store in
@carbon/react - Task 3: ERP callers of
useIsMobile - Task 4: Slot primitives
- Task 5: App bar actions and bottom bar on portal slots
- Task 6: App bar override on a value slot;
NewRecordPagedeclares Back - Task 7: Audit full-page
/newroutes - Task 8: Record tabs on value slots
- Task 9: Action presentation context in
@carbon/react - Task 10:
RecordHeader,RecordAction,RecordPhoneChrome,RecordHeroTarget - Task 11:
DocumentHeadercard variant - Task 12: Migrate shell-A headers (11)
- Task 13: Migrate shell-B headers (14)
- Task 14: Migrate other topbar headers and company cards (4)
- Task 15: Migrate card forms, actions-only pages, fixed asset (9)
- Task 16: Delete leftovers; Lingui extract
- Task 17: End-to-end verification (static checks done; browser checks need the go-ahead)
Dependencies
- Tasks 1 → 2 → 3, in order.
- Task 4 has no dependencies. Tasks 5, 6 and 8 need Task 4. Task 7 needs Task 6.
- Task 9 has no dependencies. Task 10 needs Tasks 4 and 9, and Task 11 needs Task 10.
- Tasks 12–15 need Tasks 10 and 11; they are independent of each other but share files, so run them sequentially. Task 13 needs Task 8 (the item headers' DetailsTopbar).
- Task 16 needs Tasks 12–15. Task 17 needs everything.
Commands used below (all confirmed in package.json):
cd apps/erp && npx tsgo --noEmitis the erp typecheck (typecheckscript =react-router typegen && tsgo --noEmit).cd packages/react && npx tsgo --noEmit, and the same inpackages/utils.pnpm exec biome check <files>from the repo root.cd <pkg> && pnpm exec vitest run <paths>.pnpm lingui:extract && pnpm lingui:cleanfrom the repo root.
Task 1: Single compact query in @carbon/utils
Depends on: none Files:
- Modify:
packages/utils/src/viewport.ts— deleteCOMPACT_MAX_WIDTHand makeCOMPACT_QUERY = "(width < 48rem)". Update the doc comment to "Compact means below Tailwindmd(48rem), the same query theme.css uses." - Modify:
packages/utils/src/viewport.test.ts— change the"max-width: 767px"expectation to"width < 48rem".
Verify:
cd packages/utils && pnpm exec vitest run src/viewport.test.ts && npx tsgo --noEmit
# Expected: tests pass, no type errors
Out of scope: the inline script's logic (it already uses COMPACT_QUERY).
Task 2: One compact store in @carbon/react
Depends on: 1 Files:
- Modify:
packages/react/src/Compact.tsx - Modify:
packages/react/src/hooks/useIsMobile.ts— turn it into a re-export:export { useIsMobile as default } from "../Compact"; - Modify:
apps/erp/app/root.tsx—<CompactProvider initialCompact=…>. Add a comment next todata-compact-ui="": "With CompactProvider below, the two halves of the compact opt-in (CSS and JS)."
Steps:
- In
Compact.tsx:- Drop the
enabledfield and prop. The context becomes{ initialCompact: boolean } | null. useCompact()returnscontext !== null && matches, with server snapshotcontext?.initialCompact ?? false.- Add
export function useIsMobile(): boolean | undefined, which uses the samesubscribe/getSnapshotwith server snapshot() => context ? context.initialCompact : undefined. Doc: "Viewport below md, regardless of the compact opt-in;undefineduntil hydrated when no CompactProvider seeds it." - Delete
useCompactSeed.
- Drop the
rg "useCompactSeed|enabled=" packages apps --glob '*.tsx'must not show any compact-related hits.
Verify:
cd packages/react && npx tsgo --noEmit && pnpm exec vitest run
cd ../../apps/erp && npx tsgo --noEmit
# Expected: both typecheck clean, react tests pass
Out of scope: the MES/starter callers (their API is unchanged).
Task 3: ERP callers of useIsMobile
Depends on: 2 Files:
- Modify:
apps/erp/app/components/Layout/Panels.tsx:PanelProvider:useIsMobile()becomesuseCompact()(same value in the ERP). Keep the effect body.ResizablePanels: delete theisMobilevariable, the pathname collapse effect, and the wholeif (isMobile) { …Drawer… }branch. Remove theDrawer*imports anduseIsMobileif they are unused.
- Modify:
apps/erp/app/components/Layout/Navigation/CollapsibleSidebar.tsx—useIsMobilebecomesuseCompact. RenameisMobile/wasMobiletoisCompact/wasCompact. Keep the effect: it still restores the desktop sidebar after a phone visit. - Modify:
apps/erp/app/components/Layout/Topbar/Breadcrumbs.tsx— deleteconst isMobile = useIsMobile()and render<CompanyBreadcrumb />unconditionally. Breadcrumbs only renders insideTopbar, which returns null when compact (Topbar.tsx:21-22).
Verify:
rg "useIsMobile" apps/erp
# Expected: no output
cd apps/erp && npx tsgo --noEmit
Out of scope: packages/react/src/Sidebar.tsx and FunnelChart.tsx (shared, unchanged API).
Task 4: Slot primitives
Depends on: none Files:
- Create:
apps/erp/app/components/Layout/Mobile/slots.tsx. Precedent:useAppBarOverride.ts(the stack store) andChromeSlots.tsx(the portal).
Steps:
- Write:
// SPDX header (copy from a sibling file)
import { useCompact } from "@carbon/react";
import type { ComponentProps, ReactNode } from "react";
import { useEffect, useId } from "react";
import { createPortal } from "react-dom";
import { create } from "zustand";
/**
* A place in the shell that pages render into. The filler's React context
* (forms, menus, route data) is kept, since it renders through a portal.
* Phones only: on desktop `Fill` renders nothing and the caller keeps its
* in-place copy.
*/
export function createPortalSlot() {
const useStore = create<{
target: HTMLElement | null;
count: number;
setTarget: (el: HTMLElement | null) => void;
add: (delta: 1 | -1) => void;
}>()((set) => ({
target: null,
count: 0,
setTarget: (target) => set((s) => (s.target === target ? s : { target })),
add: (delta) => set((s) => ({ count: Math.max(0, s.count + delta) }))
}));
// Stable, so React never detaches and re-attaches the target.
const ref = (el: HTMLElement | null) => useStore.getState().setTarget(el);
function Target(props: ComponentProps<"div">) {
return <div {...props} ref={ref} />;
}
function Fill({ children }: { children: ReactNode }) {
const isCompact = useCompact();
const target = useStore((s) => s.target);
const add = useStore((s) => s.add);
useEffect(() => {
if (!isCompact) return;
add(1);
return () => add(-1);
}, [isCompact, add]);
return isCompact && target ? createPortal(children, target) : null;
}
const useFilled = () => useStore((s) => s.count > 0);
return { Target, Fill, useFilled };
}
/**
* Data a page hands the shell. The newest provider wins; unmounting removes
* only its own entry. Callers memoize `value`: a new object re-provides it.
*/
export function createValueSlot<T>() {
const useStore = create<{
entries: { id: string; value: T }[];
put: (id: string, value: T) => void;
remove: (id: string) => void;
}>()((set) => ({
entries: [],
put: (id, value) =>
set((s) => ({ entries: [...s.entries.filter((e) => e.id !== id), { id, value }] })),
remove: (id) => set((s) => ({ entries: s.entries.filter((e) => e.id !== id) }))
}));
function useProvide(value: T | null) {
const id = useId();
const put = useStore((s) => s.put);
const remove = useStore((s) => s.remove);
useEffect(() => {
if (value === null) return;
put(id, value);
return () => remove(id);
}, [id, value, put, remove]);
}
const useValue = () => useStore((s) => s.entries.at(-1)?.value ?? null);
return { useProvide, useValue };
}
Verify:
cd apps/erp && npx tsgo --noEmit && cd ../.. && pnpm exec biome check apps/erp/app/components/Layout/Mobile/slots.tsx
# Expected: clean
Out of scope: migrating callers (Tasks 5, 6, 8, 10).
Task 5: App bar actions and bottom bar on portal slots
Depends on: 4 Files:
- Modify:
apps/erp/app/components/Layout/Mobile/ChromeSlots.tsx:- Replace the context, provider,
useChromeSlotTargetsand the BottomBar count store withconst appBarActionsSlot = createPortalSlot(); const bottomBarSlot = createPortalSlot();. AppBarActionskeeps its dev-only 2-child warning and returns<appBarActionsSlot.Fill>{children}</appBarActionsSlot.Fill>.BottomBar = bottomBarSlot.Fill;useBottomBarActive = bottomBarSlot.useFilled.- Export
AppBarActionsTarget = appBarActionsSlot.Target. MobileBottomChromerenders<bottomBarSlot.Target className="empty:hidden" />.- Keep
useCompactCssVarunchanged.
- Replace the context, provider,
- Modify:
Mobile/MobileAppBar.tsx— replace theref={appBarActionsRef}div with<AppBarActionsTarget className={…same classes…} />. DropuseChromeSlotTargets. - Modify:
Mobile/index.ts— remove theChromeSlotsProviderexport. - Modify:
apps/erp/app/routes/x+/_layout.tsx— delete the<ChromeSlotsProvider>wrapper and its import, keeping the children.
Verify:
rg "ChromeSlotsProvider|useChromeSlotTargets" apps/erp
# Expected: no output
cd apps/erp && npx tsgo --noEmit
Out of scope: useCompactCssVar (review section C).
Task 6: App bar override on a value slot; NewRecordPage declares Back
Depends on: 4 Files:
- Modify:
Mobile/appBar.ts:AppBarState.kindbecomes"root" | "pushed" | "selection".- Add
export type AppBarOverride = Partial<AppBarState> & { trailing?: ReactNode }. - Add
export function mergeAppBar(base: AppBarState, override: AppBarOverride | null): AppBarState & { trailing?: ReactNode }, which spreads the override over the base (an override withkind: "pushed"and nosubtitleclears the subtitle).
- Modify:
Mobile/useAppBarOverride.ts— rebuild oncreateValueSlot<AppBarOverride>(). ExportuseAppBarOverride = slot.useValueanduseSetAppBarOverride = slot.useProvide. Delete the hand-written stack. - Modify:
Mobile/useAppBar.ts:- Delete the
/newblock and theuseLocationimport. - Return
mergeAppBar(state, override)withtitle(the company name on Home),moduleTitle, andSidebaronly when the merged kind is"root".
- Delete the
- Modify:
Mobile/MobileAppBar.tsx:- Read everything from
useAppBar(), without a separate override. - Back renders when
kind === "pushed" && backTo. canSwitch = kind === "root" && Sidebar.- Actions are hidden when
kind === "selection", and the subtitle only shows whenkind === "pushed". trailingrenders after the actions.
- Read everything from
- Modify:
Mobile/MobileTabBar.tsx— replace itsuseAppBarOverride()hide rule withuseAppBar().kind !== "root". Read the current rule first and keep its result for every case: selection hides, pushed hides. - Modify:
components/Table/components/Compact/CompactList.tsx— the override becomes{ kind: "selection", title, trailing }. - Modify:
routes/x+/inventory+/quantities+/$itemId.tsxandroutes/x+/issue-workflow+/new.tsx— the override becomes{ kind: "pushed", title, backTo }. Delete the copied Back Button JSX and the unused imports (LuChevronLeft,Link,Button). - Modify:
components/NewRecordPage.tsx:- Call
useSetAppBarOverride(useMemo(() => (listTo ? { kind: "pushed", backTo: listTo } : null), [listTo])), wherelistTo = useBreadcrumbs().at(-1)?.to. - Import
useBreadcrumbsfrom~/components/Layout/Topbar/Breadcrumbs. - If
listTo === pathname, provide null (a create page whose last crumb is itself).
- Call
- Modify:
Mobile/appBar.test.ts— add cases formergeAppBar: a pushed override over a root base gives kind pushed with the override's backTo; a selection override keeps the base title when it has none; a null override returns the base.
Verify:
cd apps/erp && pnpm exec vitest run app/components/Layout && npx tsgo --noEmit
rg 'endsWith\("/new"\)' app/components/Layout
# Expected: tests pass, typecheck clean, rg prints nothing
Out of scope: the breadcrumb-derived root/pushed rules in deriveAppBar.
Task 7: Audit full-page /new routes
Depends on: 6
Files: apps/erp/app/routes/**/*new*.tsx (read); modify only the ones found.
Steps:
- For every route file whose path ends in
new.tsxand that has a default export rendering UI, classify it:- (a) It renders
NewRecordPage: done. - (b) It renders a Drawer/Modal/ModalCard or a form with
type="modal"/"drawer"over a parent route: the list keeps its bar, so nothing changes. - (c) It is a full page without
NewRecordPage: wrap its root in<NewRecordPage>, or move its existing wrapper's classes intoclassName, keeping desktop layout identical.
- (a) It renders
- Write the classification to
.ai/runs/2026-10-07-new-route-audit.txt. - If a (c) route's layout can't be kept identical inside
NewRecordPage, calluseSetAppBarOverridethere directly with the same value instead.
Verify:
cd apps/erp && npx tsgo --noEmit
# Expected: clean; audit file lists every *new*.tsx route with a class
Out of scope: changing the forms themselves.
Task 8: Record tabs on value slots
Depends on: 4 Files:
- Modify:
components/Layout/Panels.tsx:- Remove
recordTabs/setRecordTabsfromPanelContextTypeand its default, theinertprop,CompactPanelProviderand theRecordTabtype. - Add
export const recordTabsSlot = createValueSlot<CompactTabItem[]>(); export const recordFrameSlot = createValueSlot<true>();. CompactRecordTabscallsrecordFrameSlot.useProvide(true), readsrecordTabsSlot.useValue(), and maps each item to{ ...item, active: panel === "content" && item.active, onClick: showContent }.
- Remove
- Modify:
components/Layout/Navigation/DetailsTopbar.tsx:- Build
items: CompactTabItem[]in auseMemoover[links, location.pathname, paramString, preserveParams], withactivecomputed as the compact branch already does. - Phones:
recordTabsSlot.useProvide(isCompact ? items : null). - If
recordFrameSlot.useValue()is set, return null; otherwise render<CompactTabRow items={items} />. - Delete
linksKeyand its effect. linksis a new array on every render: memoizeitemson a key string ofname|to|count|activejoined, so the provider doesn't re-put on every render. Comment: "Keyed on what the tabs show."
- Build
- Modify:
components/Layout/index.ts— drop theCompactPanelProviderexport if present. - Modify:
routes/x+/{part,material,tool,consumable,service}+/$itemId.tsx— restore theHEADcomponent shape: inline the*RouteBodyfunction back into the default export and dropCompactPanelProvider. Keep this branch's other changes, such asexplorerLabel. Diff each againstgit show HEAD:<path>to confirm the only remaining delta is non-provider changes.
Verify:
rg "CompactPanelProvider|setRecordTabs|linksKey" apps/erp
# Expected: no output
cd apps/erp && npx tsgo --noEmit
Out of scope: the --header-height override in CompactRecordTabs.
Task 9: Action presentation context in @carbon/react
Depends on: none Files:
- Create:
packages/react/src/ActionPresentation.tsx - Modify:
packages/react/src/Button.tsx,packages/react/src/SplitButton.tsx,packages/react/src/index.tsx(exportActionPresentationProvider).
Steps:
ActionPresentation.tsx:
export type ActionPresentation =
| { kind: "bar"; emphasis: "primary" | "secondary" }
| { kind: "row"; onSelect: () => void };
const Context = createContext<ActionPresentation | null>(null);
export const ActionPresentationProvider = Context.Provider;
export const useActionPresentation = () => useContext(Context);
Button: readconst presentation = useActionPresentation().bar: overridevariantwithpresentation.emphasisandsizewith"lg", and addw-full min-w-0.row:- Use
variant="ghost",size="lg"and the classesh-12 w-full min-w-0 justify-start rounded-sm px-3 text-[15px] font-normal text-foreground shadow-none, plustext-destructivewhen the given variant wasdestructive. - Wrap
onClickso it calls the original and then, unlessprops["aria-haspopup"]is set or the event was default-prevented, callssetTimeout(presentation.onSelect, 0). - Comment: "Next task, so a submit button's form is still mounted when the browser submits it."
- Use
- With no provider, behaviour is unchanged.
SplitButton: read the presentation. Inbarorrow, the chevron Button getsw-11 shrink-0 justify-center px-0and the main Buttonmin-w-0 flex-1. The chevron's Radix trigger already hasaria-haspopup, so it won't close the sheet.
Verify:
cd packages/react && npx tsgo --noEmit && pnpm exec vitest run
# Expected: clean, tests pass
Out of scope: buttonVariants itself; Assignee's raw button.
Task 10: RecordHeader, RecordAction, RecordPhoneChrome, RecordHeroTarget
Depends on: 4, 9 Files:
- Create:
apps/erp/app/components/Layout/RecordHeader.tsx. Precedent:components/Layout/RecordChrome.tsx, which this replaces (copy its hero, app-bar ⋯ and bottom-bar markup), and the shell-A desktop markup inmodules/sales/ui/SalesOrder/SalesOrderHeader.tsx:390-417. - Delete:
apps/erp/app/components/Layout/RecordChrome.tsx, after Tasks 12–15 move its callers. Until then, keep it re-exporting the new parts so callers compile:export { RecordAction } from "./RecordHeader", andRecordChromeimplemented viaRecordPhoneChrome.
Steps:
- Slots:
recordPrimarySlot,recordSecondarySlot,recordOverflowSlot,recordHeroSlot=createPortalSlot(). RecordAction({ slot, children }):- Desktop:
<>{children}</>. - Phones: wrap the children in the matching slot's
Fill, inside<ActionPresentationProvider>:{kind: "bar", emphasis: "primary"}for primary;{kind: "bar", emphasis: "secondary"}for secondary;{kind: "row", onSelect: closeOverflow}for overflow, wherecloseOverflowcomes from a module zustanduseOverflowSheetstore{ open, setOpen }.
- Desktop:
RecordPhoneChrome({ menu?, copyValue? }), which renders nothing on desktop:- the app-bar ⋯ (copy RecordChrome's
AppBarActionsblock); <BottomBar>with<recordPrimarySlot.Target className={cellClassName} />,<recordSecondarySlot.Target className={cellClassName} />, and the ⋯ IconButton shown whenrecordOverflowSlot.useFilled(). UsecellClassName = "flex min-w-0 flex-1 empty:hidden [&>*]:min-w-0 [&>*]:w-full": layout only, no button reach-in. The bar is rendered when any of the three slots is filled.- the overflow
BottomSheetwithopenfromuseOverflowSheet, itsBottomSheetContent forceMountgivendata-[state=closed]:hidden, and<recordOverflowSlot.Target className="flex flex-col [&>*]:w-full" />. IfBottomSheetContentdoesn't forwardforceMountto RadixContentandPortal, add that pass-through inpackages/react/src/BottomSheet.tsx.
- the app-bar ⋯ (copy RecordChrome's
RecordHero({ title, subtitle, status, bleed }):- Copy RecordChrome's hero div.
- Phones only. It keeps the empty hidden div so
--header-height/--hero-heightresolve to 0, usinguseCompactCssVar.
RecordHeroTarget({ bleed })renders<recordHeroSlot.Target className={cn(bleed && "-mx-4 -mt-4")} />on phones.RecordHeader(props), with props as in the spec:- Desktop shell:
divclassflex flex-shrink-0 items-center justify-between gap-x-4 py-2 bg-card border-b border-border h-[var(--header-height)] overflow-x-auto scrollbar-hide compact:hidden.- Padding:
pl-2with an explorer toggle, elsepl-4;pr-2with a properties toggle, elsepr-4. - Left
HStack: explorer IconButton (copy SalesOrderHeader), the title (on desktop only:titleTo ? <Link to><Heading size="h4" className="flex items-center gap-2">{title}</Heading></Link> : <Heading size="h4" …>),{copyValue && <Copy text={copyValue} />}, the ⋯ DropdownMenu whenmenu, then{status}. - Right
HStack:{aside}{actions}, then the properties IconButton.
- Phones:
<RecordHero title={isCompact ? title : undefined} subtitle status />and<RecordPhoneChrome menu copyValue />. The desktop shell stays mounted (compact:hidden), buttitleis not rendered inside it while compact. - If
subtitleis given, the desktop shell shows it as<p className="text-sm text-muted-foreground">under the heading only when the caller passesshowSubtitleOnDesktop.- Inspection is the only caller with a desktop subtitle line today; see Task 14.
- If the catalogue shows another caller needs it, STOP and report.
- Desktop shell:
- Export
RecordHeader,RecordAction,RecordPhoneChrome,RecordHero,RecordHeroTarget,recordHeroSlot.
Verify:
cd apps/erp && npx tsgo --noEmit && cd ../.. && pnpm exec biome check apps/erp/app/components/Layout/RecordHeader.tsx apps/erp/app/components/Layout/RecordChrome.tsx
# Expected: clean
Out of scope: call-site migration.
Task 11: DocumentHeader card variant
Depends on: 10 Files:
- Modify:
apps/erp/app/components/DocumentHeader.tsx:- Props:
{ title: string; subtitle?; status?; menuItems?; actions?; copyValue? = title; className? }. - Desktop: the existing
CardHeader, pluscompact:hidden(always). - Phones:
<recordHeroSlot.Fill><RecordHero status={status} subtitle={subtitle} /></recordHeroSlot.Fill>and<RecordPhoneChrome menu={menuItems} copyValue={copyValue} />. - The
actionsnode keeps itsRecordActionwrappers from the callers. - Translate the hard-coded
aria-label="More options"witht.
- Props:
Verify:
cd apps/erp && npx tsgo --noEmit
Out of scope: callers (Task 15).
Task 12: Migrate shell-A headers (11)
Depends on: 10, 11
Files: modules/sales/ui/SalesOrder/SalesOrderHeader.tsx, modules/sales/ui/Quotes/QuoteHeader.tsx, modules/sales/ui/SalesRFQ/SalesRFQHeader.tsx, modules/sales/ui/SalesReturnOrders/SalesReturnOrderHeader.tsx, modules/purchasing/ui/PurchaseOrder/PurchaseOrderHeader.tsx, modules/purchasing/ui/PurchaseReturnOrders/PurchaseReturnOrderHeader.tsx, modules/purchasing/ui/PurchasingRfq/PurchasingRFQHeader.tsx, modules/purchasing/ui/SupplierQuote/SupplierQuoteHeader.tsx, modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceHeader.tsx, modules/invoicing/ui/SalesInvoice/SalesInvoiceHeader.tsx, modules/production/ui/Jobs/JobHeader.tsx.
Steps (per file):
- Replace
<RecordChrome …/>plus thecompact:hiddenshell with one<RecordHeader>:title: the id node. For Quote and PO,<span className="flex items-center gap-0"><span>{id}</span><RevisionSuffix …/></span>(and dropsubtitle).titleTo: the existing Linkto.copyValue,menu,status: the existing variables.onToggleExplorer={toggleExplorer}andonToggleProperties={toggleProperties}.actions: the existing right-hand HStack children, minus the properties toggle.
- Modals, disclosures and dialogs that were inside the shell move to right after
<RecordHeader>. They portal anyway, so the position is irrelevant to the DOM. - Where a slot and a variant restate one condition, name it once (
const isDraft = …) and use it in both. Do not change any variant's resulting value. - PO: delete the
isCompactterm frominvoiceVariant, anduseCompactif unused. - Remove the now-unused imports.
Verify:
cd apps/erp && npx tsgo --noEmit && cd ../.. && pnpm exec biome check <the 11 files>
# Expected: clean
Out of scope: action logic, permissions, fetchers.
Task 13: Migrate shell-B headers (14)
Depends on: 8, 10, 11
Files: modules/items/ui/{Materials/MaterialHeader,Parts/PartHeader,Tools/ToolHeader,Services/ServiceHeader,Consumables/ConsumableHeader}.tsx, modules/items/ui/ChangeNotice/ChangeNoticeHeader.tsx, modules/quality/ui/Issue/IssueHeader.tsx, modules/resources/ui/Maintenance/MaintenanceDispatchHeader.tsx, modules/inventory/ui/PickingLists/PickingListHeader.tsx, modules/inventory/ui/StockTransfers/StockTransferHeader.tsx, modules/production/ui/Procedures/ProcedureHeader.tsx, modules/resources/ui/Training/TrainingHeader.tsx, modules/quality/ui/Documents/QualityDocumentHeader.tsx, modules/production/ui/Assemblies/AssemblyInstructionHeader.tsx.
Steps: these are the same as Task 12, with these specifics:
- Item headers:
aside={<DetailsTopbar links={…} />}. Order becomes title · Copy · ⋯ · status (spec-approved). - ChangeNotice / Issue / Maintenance: the status moves after the ⋯ (spec-approved). ChangeNotice keeps its
line-throughspan around the status. - PickingList / StockTransfer / Procedure / Training / QualityDocument: no
titleTo.- The badges that sat inside the Heading become
status. - The title is the live
displayNamewhere the file uses it. - StockTransfer's inline
ViolationModals move after the header.
- The badges that sat inside the Heading become
- Assembly:
title={nameInput}and nocopyValue.status={<>{statusBadge}{versionBadge}</>}.- The "edited by" span goes at the end of
statuswith itshidden lg:inlineclass. - Delete
{!isCompact && nameInput}anduseCompact.
Verify:
cd apps/erp && npx tsgo --noEmit && cd ../.. && pnpm exec biome check <the 14 files>
Out of scope: DetailsTopbar internals (Task 8).
Task 14: Migrate other topbar headers and company cards (4)
Depends on: 10, 11
Files: modules/quality/ui/Inspections/InspectionView.tsx, modules/workflows/ui/Builder/BuilderHeader.tsx, modules/sales/ui/Customer/CustomerHeader.tsx, modules/purchasing/ui/Supplier/SupplierHeader.tsx.
Steps:
- InspectionView: keep its own desktop shell. Its markup (a raw
h1with a wrapping meta line) doesn't matchRecordHeader's shell. Replace<RecordChrome hero=…/>with<RecordHero subtitle={metaLine} status={statusBadge} />+<RecordPhoneChrome />. It still passes its data once to each layout. - BuilderHeader: keep its
<header>shell (topbar height, SaveMarker).- Replace
RecordChromewith<RecordHero title={isCompact ? <WorkflowTitle …/> : undefined} status={…} />+<RecordPhoneChrome />. - The desktop renders
{!isCompact && <WorkflowTitle …/>}, unchanged: the render-once rule is now expressed throughRecordHero'stitle, the same as RecordHeader. - Keep
inHeroonly if its styling is still needed in the hero. Check thatWorkflowTitlerenders correctly in the hero without it, and delete it if so.
- Replace
- Customer / Supplier: keep their Card markup. Replace
<RecordChrome menu copyValue/>with<RecordPhoneChrome menu={menuItems} copyValue={id} />.
Verify:
cd apps/erp && npx tsgo --noEmit && cd ../.. && pnpm exec biome check <the 4 files>
Out of scope: WorkflowTitle's rename logic.
Task 15: Migrate card forms, actions-only pages, fixed asset (9)
Depends on: 10, 11
Files: modules/inventory/ui/Receipts/ReceiptForm/ReceiptForm.tsx, modules/inventory/ui/Shipments/ShipmentForm/ShipmentForm.tsx, modules/inventory/ui/WarehouseTransfers/WarehouseTransferForm.tsx, modules/invoicing/ui/Payment/PaymentForm.tsx (+ PaymentForm.test.tsx mocks), modules/invoicing/ui/Memo/MemoForm.tsx, modules/accounting/ui/JournalEntries/JournalEntryForm.tsx, routes/x+/fixed-asset+/$fixedAssetId.tsx, modules/inventory/ui/InventoryCount/InventoryCount.tsx, routes/x+/reimbursements+/$reimbursementId._index.tsx.
Steps:
- DocumentHeader callers:
- Replace
<RecordChrome hero menu copyValue bleed />with<RecordHeroTarget bleed />at the same spot. WarehouseTransfer: nobleed, at its current spot inside the Card. - Pass
status/menuItemsstraight toDocumentHeader. - Drop
className="compact:hidden": DocumentHeader now owns it. - Inline the hoisted
statusNode/menuItemsvariables back if they are used once.
- Replace
- JournalEntryForm:
- Replace the hand-rolled CardHeader with
<DocumentHeader title={displayId} status={…} menuItems={isDraft || isPosted ? menuItems : undefined} actions={…} />+<RecordHeroTarget bleed />. - The desktop markup is the same: h3 heading, Copy, ⋯ and status. Check that the ⋯ IconButton's
type="button"is preserved: DocumentHeader's IconButton defaults totype="button"through Button.
- Replace the hand-rolled CardHeader with
- InventoryCount / Reimbursement:
<RecordChrome …/>becomes<RecordHero status={…} />(InventoryCount) or nothing (Reimbursement), plus<RecordPhoneChrome />. - PaymentForm.test.tsx: update its mocks from
~/components/Layout/RecordChrometo~/components/Layout/RecordHeader.
Verify:
cd apps/erp && npx tsgo --noEmit && pnpm exec vitest run app/modules/invoicing && cd ../.. && pnpm exec biome check <the 9 files>
# Expected: clean, tests pass
Out of scope: form validation and actions.
Task 16: Delete leftovers; Lingui extract
Depends on: 12–15 Steps:
- Delete
apps/erp/app/components/Layout/RecordChrome.tsxandapps/erp/app/modules/sales/ui/Quotes/RevisionSubtitle.tsx. - Run the grep below and fix every hit.
- Run
pnpm lingui:extract && pnpm lingui:clean.
Verify:
rg "RecordChrome|ChromeSlotsProvider|useChromeSlotTargets|useCompactSeed|CompactPanelProvider|COMPACT_MAX_WIDTH|RevisionSubtitle" apps packages --glob '!*.md' --glob '!*.po'
rg "\[&_button\]|\[&_\.bg-destructive\]" apps/erp/app/components/Layout
# Expected: both print nothing
Task 17: End-to-end verification
Depends on: all Steps:
- Run:
Expected: all pass. Record any failure verbatim in the final report.cd packages/utils && npx tsgo --noEmit && pnpm exec vitest run cd ../react && npx tsgo --noEmit && pnpm exec vitest run cd ../../apps/erp && npx tsgo --noEmit && pnpm exec vitest run app/components app/modules/invoicing cd ../mes && npx tsgo --noEmit cd ../starter && npx tsgo --noEmit cd ../.. && pnpm exec biome check $(git diff HEAD --name-only -- '*.ts' '*.tsx'; git ls-files --others --exclude-standard -- '*.ts' '*.tsx') - Browser checks: the spec's acceptance criteria at 390px and at desktop width. These need the user's go-ahead to drive the browser; ask before starting.
- Tick the spec's acceptance criteria and add a Changelog line.