import Elementary import ElementaryHTMX import Routes import Styleguide struct DehumidifierSizeForm: HTML { var content: some HTML { FormHeader(label: "Dehumidifier Sizing Calculator", svg: .droplets) form( // Using index to get the correct path, but really uses the `submit` end-point. .hx.post(route: .dehumidifierSize(.index)), .hx.target("#result") ) { div(.class("space-y-6")) { LabeledContent(label: "Latent Load (BTU/h)") { Input(id: "latentLoad", placeholder: "Latent load from Manual-J") .attributes(.type(.number), .step("0.1"), .min("0.1"), .autofocus, .required) } LabeledContent(label: "Indoor Temperature (°F)") { Input(id: "temperature", placeholder: "Indoor dry bulb temperature") .attributes(.type(.number), .step("0.1"), .min("0.1"), .required) } LabeledContent(label: "Indoor Humdity (%)") { Input(id: "humidity", placeholder: "Relative humidity") .attributes(.type(.number), .step("0.1"), .min("0.1"), .required) } div { SubmitButton(label: "Calculate Dehumidifier Size") } } } div(.id("result")) {} } } struct DehumidifierSizeResult: HTML { let response: DehumidifierSize.Response var content: some HTML { ResultContainer(reset: .dehumidifierSize(.index)) { div(.class(""" p-2 rounded-lg shadow-lg bg-blue-500 """ )) { p { "Recommended Size: \(response.recommendedSize)" } } // Display warnings, if applicable if response.warnings.count > 0 { div(.class("w-full mt-8 p-4 rounded-lg shadow-lg text-amber-500 bg-amber-200 border border-amber-500")) { span(.class("font-semibold mb-4 border-b")) { "Warning\(response.warnings.count > 1 ? "s:" : ":")" } ul(.class("list-disc mx-10")) { for warning in response.warnings { li { warning } } } } } Note { """ Sizing is based on continuous operation at rated conditions. Actual performance will vary based on operating conditions. Consider Energy Star rated units for better efficiency. For whole-house applications, ensure proper air distribution and drainage. """ } } } } //
//

// //

//
// // { result.recommendedSize.size } PPD // //

// Click to view available models → //

//
//
// //
//
// //