feat: Removes register-id in favor of using the room name with register number in duct sizing forms / tables.

This commit is contained in:
2026-01-15 15:18:42 -05:00
parent 4ecd4dba7b
commit 9709eaaf8e
6 changed files with 26 additions and 64 deletions

View File

@@ -44,7 +44,6 @@ public struct ManualDClient: Sendable {
logger: Logger? = nil logger: Logger? = nil
) async throws -> [DuctSizing.RoomContainer] { ) async throws -> [DuctSizing.RoomContainer] {
var registerIDCount = 1
var retval: [DuctSizing.RoomContainer] = [] var retval: [DuctSizing.RoomContainer] = []
let totalHeatingLoad = rooms.totalHeatingLoad let totalHeatingLoad = rooms.totalHeatingLoad
let totalCoolingSensible = rooms.totalCoolingSensible(shr: projectSHR) let totalCoolingSensible = rooms.totalCoolingSensible(shr: projectSHR)
@@ -76,7 +75,6 @@ public struct ManualDClient: Sendable {
retval.append( retval.append(
.init( .init(
registerID: "SR-\(registerIDCount)",
roomID: room.id, roomID: room.id,
roomName: "\(room.name)-\(n)", roomName: "\(room.name)-\(n)",
roomRegister: n, roomRegister: n,
@@ -93,7 +91,6 @@ public struct ManualDClient: Sendable {
rectangularWidth: rectangularWidth rectangularWidth: rectangularWidth
) )
) )
registerIDCount += 1
} }
} }

View File

@@ -50,12 +50,10 @@ public enum DuctSizing {
} }
} }
// TODO: Remove registerID and just use the roomName
// TODO: Uses SizeContainer // TODO: Uses SizeContainer
public struct RoomContainer: Codable, Equatable, Sendable { public struct RoomContainer: Codable, Equatable, Sendable {
public let registerID: String
public let roomID: Room.ID public let roomID: Room.ID
public let roomName: String public let roomName: String
public let roomRegister: Int public let roomRegister: Int
@@ -72,7 +70,6 @@ public enum DuctSizing {
public let rectangularWidth: Int? public let rectangularWidth: Int?
public init( public init(
registerID: String,
roomID: Room.ID, roomID: Room.ID,
roomName: String, roomName: String,
roomRegister: Int, roomRegister: Int,
@@ -88,7 +85,6 @@ public enum DuctSizing {
rectangularSize: RectangularDuct? = nil, rectangularSize: RectangularDuct? = nil,
rectangularWidth: Int? = nil rectangularWidth: Int? = nil
) { ) {
self.registerID = registerID
self.roomID = roomID self.roomID = roomID
self.roomName = roomName self.roomName = roomName
self.roomRegister = roomRegister self.roomRegister = roomRegister

View File

@@ -7,7 +7,7 @@ struct RectangularSizeForm: HTML, Sendable {
static func id(_ room: DuctSizing.RoomContainer) -> String { static func id(_ room: DuctSizing.RoomContainer) -> String {
let base = "rectangularSize" let base = "rectangularSize"
return "\(base)_\(room.registerID.idString)" return "\(base)_\(room.roomName.idString)"
} }
@Environment(ProjectViewValue.$projectID) var projectID @Environment(ProjectViewValue.$projectID) var projectID

View File

@@ -16,7 +16,6 @@ extension DuctSizingView {
table(.class("table table-zebra text-lg")) { table(.class("table table-zebra text-lg")) {
thead { thead {
tr(.class("text-lg")) { tr(.class("text-lg")) {
th { "ID" }
th { "Name" } th { "Name" }
th { "BTU" } th { "BTU" }
th { "CFM" } th { "CFM" }
@@ -36,7 +35,7 @@ extension DuctSizingView {
struct RoomRow: HTML, Sendable { struct RoomRow: HTML, Sendable {
static func id(_ room: DuctSizing.RoomContainer) -> String { static func id(_ room: DuctSizing.RoomContainer) -> String {
"roomRow_\(room.registerID.idString)" "roomRow_\(room.roomName.idString)"
} }
@Environment(ProjectViewValue.$projectID) var projectID @Environment(ProjectViewValue.$projectID) var projectID
@@ -65,10 +64,9 @@ extension DuctSizingView {
var body: some HTML<HTMLTag.tr> { var body: some HTML<HTMLTag.tr> {
tr(.class("text-lg"), .id(rowID)) { tr(.class("text-lg"), .id(rowID)) {
td { room.registerID }
td { room.roomName } td { room.roomName }
td { td {
div(.class("grid grid-cols-2 gap-2")) { div(.class("flex flex-wrap grid grid-cols-2 gap-2")) {
span(.class("label")) { "Heating" } span(.class("label")) { "Heating" }
Number(room.heatingLoad, digits: 0) Number(room.heatingLoad, digits: 0)
@@ -78,7 +76,7 @@ extension DuctSizingView {
} }
td { td {
div(.class("grid grid-cols-2 gap-2")) { div(.class("flex flex-wrap grid grid-cols-2 gap-2")) {
span(.class("label")) { "Design" } span(.class("label")) { "Design" }
div(.class("flex justify-center")) { div(.class("flex justify-center")) {

View File

@@ -24,31 +24,29 @@ struct Navbar: HTML, Sendable {
) { ) {
div(.class("flex flex-1 space-x-4 items-center")) { div(.class("flex flex-1 space-x-4 items-center")) {
if sidebarToggle { if sidebarToggle {
Tooltip("Open sidebar", position: .right) { label(
label( .for("my-drawer-1"),
.for("my-drawer-1"), .class("size-7"),
.class("size-7"), .init(name: "aria-label", value: "open sidebar")
.init(name: "aria-label", value: "open sidebar")
) {
SVG(.sidebarToggle)
}
.navButton()
}
}
Tooltip("Home", position: .right) {
a(
.class("flex w-fit h-fit text-xl items-end px-4 py-2"),
.href(route: .project(.index))
) { ) {
img( SVG(.sidebarToggle)
.src("/images/mand_logo_sm.webp"),
)
span { "Duct Calc" }
} }
.navButton() .navButton()
.tooltip("Open sidebar", position: .right)
} }
a(
.class("flex w-fit h-fit text-xl items-end px-4 py-2"),
.href(route: .project(.index))
) {
img(
.src("/images/mand_logo_sm.webp"),
)
span { "Duct Calc" }
}
.navButton()
.tooltip("Home", position: .right)
} }
if userProfile { if userProfile {
// TODO: Make dropdown // TODO: Make dropdown
@@ -59,34 +57,7 @@ struct Navbar: HTML, Sendable {
SVG(.circleUser) SVG(.circleUser)
} }
.navButton() .navButton()
// details(.class("dropdown dropdown-left dropdown-bottom")) { .tooltip("Profile")
// summary(.class("btn w-fit px-4 py-2")) {
// SVG(.circleUser)
// }
// .navButton()
//
// ul(
// .class(
// """
// menu dropdown-content bg-base-100
// rounded-box z-1 w-fit p-2 shadow-sm
// """
// )
// ) {
// li(.class("w-full")) {
// // TODO: Save theme to user profile ??
// div(.class("flex justify-between p-4 space-x-6")) {
// Label("Theme")
// input(.type(.checkbox), .class("toggle theme-controller"), .value("light"))
// }
// }
// }
//
// // button(.class("w-fit px-4 py-2")) {
// // SVG(.circleUser)
// // }
// // .navButton()
// }
} }
} }
} }

View File

@@ -19,12 +19,12 @@ struct ProjectsTable: HTML, Sendable {
div { div {
Navbar(sidebarToggle: false) Navbar(sidebarToggle: false)
div(.class("m-6")) { div(.class("m-6")) {
Row { PageTitleRow {
PageTitle { "Projects" } PageTitle { "Projects" }
Tooltip("Add project") { Tooltip("Add project") {
PlusButton() PlusButton()
.attributes( .attributes(
.class("btn-ghost"), .class("btn-primary"),
.showModal(id: ProjectForm.id) .showModal(id: ProjectForm.id)
) )
} }