WIP: Begins friction rate views.
This commit is contained in:
@@ -9,6 +9,7 @@ extension SiteRoute {
|
|||||||
public enum View: Equatable, Sendable {
|
public enum View: Equatable, Sendable {
|
||||||
case project(ProjectRoute)
|
case project(ProjectRoute)
|
||||||
case room(RoomRoute)
|
case room(RoomRoute)
|
||||||
|
case frictionRate(FrictionRateRoute)
|
||||||
|
|
||||||
public static let router = OneOf {
|
public static let router = OneOf {
|
||||||
Route(.case(Self.project)) {
|
Route(.case(Self.project)) {
|
||||||
@@ -17,6 +18,9 @@ extension SiteRoute {
|
|||||||
Route(.case(Self.room)) {
|
Route(.case(Self.room)) {
|
||||||
SiteRoute.View.RoomRoute.router
|
SiteRoute.View.RoomRoute.router
|
||||||
}
|
}
|
||||||
|
Route(.case(Self.frictionRate)) {
|
||||||
|
SiteRoute.View.FrictionRateRoute.router
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,3 +85,26 @@ extension SiteRoute.View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension SiteRoute.View {
|
||||||
|
public enum FrictionRateRoute: Equatable, Sendable {
|
||||||
|
case index
|
||||||
|
case form
|
||||||
|
|
||||||
|
static let rootPath = "friction-rate"
|
||||||
|
|
||||||
|
public static let router = OneOf {
|
||||||
|
Route(.case(Self.index)) {
|
||||||
|
Path { rootPath }
|
||||||
|
Method.get
|
||||||
|
}
|
||||||
|
Route(.case(Self.form)) {
|
||||||
|
Path {
|
||||||
|
rootPath
|
||||||
|
"create"
|
||||||
|
}
|
||||||
|
Method.get
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ extension ViewController.Request {
|
|||||||
return try await route.renderView(isHtmxRequest: isHtmxRequest)
|
return try await route.renderView(isHtmxRequest: isHtmxRequest)
|
||||||
case .room(let route):
|
case .room(let route):
|
||||||
return try await route.renderView(isHtmxRequest: isHtmxRequest)
|
return try await route.renderView(isHtmxRequest: isHtmxRequest)
|
||||||
|
case .frictionRate(let route):
|
||||||
|
return try await route.renderView(isHtmxRequest: isHtmxRequest)
|
||||||
default:
|
default:
|
||||||
// FIX: FIX
|
// FIX: FIX
|
||||||
return mainPage
|
return mainPage
|
||||||
@@ -49,6 +51,22 @@ extension SiteRoute.View.RoomRoute {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension SiteRoute.View.FrictionRateRoute {
|
||||||
|
func renderView(isHtmxRequest: Bool) async throws -> AnySendableHTML {
|
||||||
|
switch self {
|
||||||
|
case .index:
|
||||||
|
return MainPage {
|
||||||
|
FrictionRateView()
|
||||||
|
}
|
||||||
|
// FIX:
|
||||||
|
default:
|
||||||
|
return MainPage {
|
||||||
|
FrictionRateView()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private let mainPage: AnySendableHTML = {
|
private let mainPage: AnySendableHTML = {
|
||||||
MainPage {
|
MainPage {
|
||||||
div {
|
div {
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import Elementary
|
||||||
|
import ManualDCore
|
||||||
|
import Styleguide
|
||||||
|
|
||||||
|
struct EquipmentForm: HTML, Sendable {
|
||||||
|
|
||||||
|
var body: some HTML {
|
||||||
|
div(.id("equipmentForm")) {
|
||||||
|
h1(.class("text-3xl font-bold pb-6")) { "Equipment Info" }
|
||||||
|
form {
|
||||||
|
div {
|
||||||
|
label(.for("staticPressure")) { "Static Pressure" }
|
||||||
|
Input(id: "staticPressure", placeholder: "Static pressure")
|
||||||
|
.attributes(.type(.number), .value("0.5"), .min("0"), .max("1.0"), .step("0.1"))
|
||||||
|
}
|
||||||
|
div {
|
||||||
|
label(.for("heatingCFM")) { "Heating CFM" }
|
||||||
|
Input(id: "heatingCFM", placeholder: "CFM")
|
||||||
|
.attributes(.type(.number), .min("0"))
|
||||||
|
}
|
||||||
|
div {
|
||||||
|
label(.for("coolingCFM")) { "Cooling CFM" }
|
||||||
|
Input(id: "coolingCFM", placeholder: "CFM")
|
||||||
|
.attributes(.type(.number), .min("0"))
|
||||||
|
}
|
||||||
|
Row {
|
||||||
|
div {}
|
||||||
|
div(.class("space-x-4")) {
|
||||||
|
SubmitButton(title: "Save")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import Elementary
|
||||||
|
import ManualDCore
|
||||||
|
import Styleguide
|
||||||
|
|
||||||
|
struct FrictionRateView: HTML, Sendable {
|
||||||
|
|
||||||
|
var body: some HTML {
|
||||||
|
div {
|
||||||
|
EquipmentForm()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ struct Sidebar: HTML {
|
|||||||
row(title: "Project", icon: .mapPin, href: "/projects")
|
row(title: "Project", icon: .mapPin, href: "/projects")
|
||||||
row(title: "Rooms", icon: .doorClosed, href: "/rooms")
|
row(title: "Rooms", icon: .doorClosed, href: "/rooms")
|
||||||
row(title: "Equivalent Lengths", icon: .rulerDimensionLine, href: "#")
|
row(title: "Equivalent Lengths", icon: .rulerDimensionLine, href: "#")
|
||||||
row(title: "Friction Rate", icon: .squareFunction, href: "#")
|
row(title: "Friction Rate", icon: .squareFunction, href: "/friction-rate")
|
||||||
row(title: "Duct Sizes", icon: .wind, href: "#")
|
row(title: "Duct Sizes", icon: .wind, href: "#")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user