import React, { useState, useMemo } from 'react'; import { PotRulerIcon } from '../components/icons'; type Units = 'cm' | 'in'; type BonsaiStyle = 'Upright' | 'Cascade' | 'Forest' | 'Literati'; const PotCalculatorView: React.FC = () => { const [units, setUnits] = useState('cm'); const [height, setHeight] = useState(30); const [trunkDiameter, setTrunkDiameter] = useState(3); const [style, setStyle] = useState('Upright'); const conversionFactor = units === 'in' ? 2.54 : 1; const results = useMemo(() => { let length, width, depth, rationale; const h = height; const d = trunkDiameter; switch (style) { case 'Cascade': length = h * 0.5; depth = h * 0.6; width = length; rationale = "Cascade pots are tall and often square or hexagonal to visually balance the downward-flowing trunk. The depth and stability are crucial."; break; case 'Forest': length = h * 1.5; depth = d * 0.75; width = length * 0.6; rationale = "Forest plantings require wide, very shallow oval or rectangular trays to create a sense of a landscape and accommodate many root systems."; break; case 'Literati': length = d * 3; depth = d * 1.5; width = length; rationale = "Literati pots are typically small, simple, and often round or unusually shaped. They are understated to emphasize the elegant, sparse trunk line."; break; case 'Upright': default: length = h * 0.66; depth = d; width = length * 0.8; rationale = "For upright styles, the pot length is typically 2/3 of the tree's height. The pot's depth should be equal to the trunk's diameter to provide visual stability."; break; } const format = (val: number) => { const converted = val / conversionFactor; return converted.toFixed(1); } return { length: format(length), width: format(width), depth: format(depth), rationale, }; }, [height, trunkDiameter, style, units, conversionFactor]); return (

Pot Ratio Calculator

Find the perfect pot size for your bonsai based on traditional aesthetic guidelines.

setHeight(Number(e.target.value))} className="w-full h-2 bg-stone-200 rounded-lg appearance-none cursor-pointer accent-amber-700" /> setHeight(Number(e.target.value) * conversionFactor)} className="w-20 p-2 border rounded-md" />
setTrunkDiameter(Number(e.target.value))} className="w-full h-2 bg-stone-200 rounded-lg appearance-none cursor-pointer accent-amber-700" /> setTrunkDiameter(Number(e.target.value) * conversionFactor)} className="w-20 p-2 border rounded-md" />

Recommended Pot Size

{results.length}

Length ({units})

{results.width}

Width ({units})

{results.depth}

Depth ({units})

Rationale

{results.rationale}

); }; export default PotCalculatorView;