feat: Adds quick calculation views, need to add buttons / links in navbar / home page.

This commit is contained in:
2026-02-09 15:34:28 -05:00
parent 88af6f722e
commit 007d13be2f
23 changed files with 584 additions and 490 deletions

View File

@@ -1,6 +1,7 @@
import Dependencies
import Elementary
import Foundation
import ManualDClient
import ManualDCore
import Styleguide
@@ -8,24 +9,77 @@ struct TestPage: HTML, Sendable {
// let ductSizes: DuctSizes
var body: some HTML {
div {}
// div(.class("overflow-auto")) {
// DuctSizingView.TrunkTable(ductSizes: ductSizes)
//
// Row {
// h2(.class("text-2xl font-bold")) { "Trunk Sizes" }
//
// PlusButton()
// .attributes(
// .class("me-6"),
// .showModal(id: TrunkSizeForm.id())
// )
// }
// .attributes(.class("mt-6"))
//
// div(.class("divider -mt-2")) {}
//
// DuctSizingView.TrunkTable(ductSizes: ductSizes)
// }
div {
Navbar(sidebarToggle: false, userProfile: false)
div(.class("flex justify-center items-center px-10")) {
div(
.class(
"""
bg-base-300 rounded-3xl shadow-3xl
p-6 w-full
"""
)
) {
div(.class("flex space-x-6 items-center text-4xl")) {
SVG(.calculator)
h1(.class("text-4xl font-bold me-10")) {
"Duct Size"
}
}
p(.class("text-primary font-bold italic")) {
"Calculate duct size for the given parameters"
}
form(
.class("space-y-4 mt-6"),
.action("#")
) {
LabeledInput(
"CFM",
.required,
.type(.number),
.placeholder("1000"),
.name("cfm")
)
LabeledInput(
"Friction Rate",
.value("0.06"),
.required,
.type(.number),
.name("frictionRate")
)
LabeledInput(
"Height",
.required,
.type(.number),
.placeholder("Height (Optional)"),
.name("frictionRate")
)
SubmitButton()
.attributes(.class("btn-block mt-6"))
}
}
// Populate when submitted
div(.id(Result.id)) {}
}
}
}
struct Result: HTML, Sendable {
static let id = "resultView"
let ductSize: ManualDClient.DuctSize
let rectangularSize: ManualDClient.RectangularSize?
var body: some HTML<HTMLTag.div> {
div(.id(Self.id)) {
}
}
}
}