import { ArrowRight, ArrowDown } from 'lucide-react'; import type { Project, Room, FlooringSettings, SkirtingSettings } from '../lib/types'; import { NumberField } from './Fields'; import type { FlooringOptions } from '../lib/flooring'; import { mm } from '../lib/format'; interface Props { project: Project; room: Room; flooringOptions: FlooringOptions; setFlooring: (patch: Partial) => void; setSkirting: (patch: Partial) => void; changeRoom: (fn: (r: Room) => Room) => void; } const kerfHelp = 'Width of material removed by the saw blade. A 3 mm blade turns a 1,000 mm board into 600 mm + 397 mm after one cut.'; export function MaterialsEditor({ project, room, flooringOptions, setFlooring, setSkirting, changeRoom, }: Props) { const f = project.flooring; const s = project.skirting; const floor = (key: K, value: FlooringSettings[K]) => setFlooring({ [key]: value }); const skirt = (key: keyof SkirtingSettings, value: number) => setSkirting({ [key]: value }); return ( <>

Materials

Shared across rooms

Floorboards

Use the length and width printed on your flooring pack.

floor('length', n)} /> floor('width', n)} />
Laying pattern

{f.pattern === 'random' ? 'Maximise randomness spreads out joints to avoid H shapes. Minimise cuts can repeat joint positions.' : 'A regular pattern with each row staggered by half a board.'}

{f.pattern === 'random' && (
What matters most? · all rooms
{(['cuts', 'random'] as const).map((priority) => { const plan = flooringOptions[priority]; const valid = !plan.issues.some((issue) => issue.severity === 'error'); const selected = f.optimisation === priority; return ( ); })}
)}
Board direction · {room.name}
floor('gap', n)} hint="Expansion gap between the floorboards and walls. Check your flooring instructions." />
Advanced flooring settings

Adjust the saw blade width, joint spacing and smallest pieces to suit your flooring.

floor('kerf', n)} tooltip={kerfHelp} /> floor('minOffset', n)} /> floor('maxOffset', n)} /> floor('minLength', n)} /> floor('minWidth', n)} />

Skirting boards

Enter one purchased board length. Door openings are left clear automatically.

skirt('stockLength', n)} /> skirt('thickness', n)} />
Advanced skirting settings
skirt('minLength', n)} /> skirt('kerf', n)} tooltip={kerfHelp} />
); }