feat: Adds level field to rooms, updates urls to point to public mirror of the project.
Some checks failed
CI / Linux Tests (push) Failing after 15s

This commit is contained in:
2026-02-10 12:07:44 -05:00
parent 980d99e40b
commit dc9f51c04f
28 changed files with 464 additions and 104 deletions

View File

@@ -68,6 +68,21 @@ struct RoomForm: HTML, Sendable {
.value(room?.name)
)
LabeledInput(
"Level",
.name("level"),
.type(.number),
.placeholder("1 (Optional)"),
.value(room?.level?.rawValue),
.min("-1"),
.step("1")
)
div(.class("text-sm italic -mt-2")) {
span(.class("text-primary")) {
"Use -1 or 0 for a basement"
}
}
LabeledInput(
"Heating Load",
.name("heatingLoad"),
@@ -78,8 +93,6 @@ struct RoomForm: HTML, Sendable {
.value(room?.heatingLoad)
)
// TODO: Add description that only one is required (cooling total or sensible)
LabeledInput(
"Cooling Total",
.name("coolingTotal"),
@@ -97,6 +110,14 @@ struct RoomForm: HTML, Sendable {
.min("0"),
.value(room?.coolingLoad.sensible)
)
div(.class("text-primary text-sm italic -mt-2")) {
p {
"Should enter at least one of the cooling loads."
}
p {
"Both are also acceptable."
}
}
LabeledInput(
"Registers",

View File

@@ -15,6 +15,14 @@ struct RoomsView: HTML, Sendable {
.appendingPath("csv")
}
// Sort the rooms based on level, they should already be sorted by name,
// so this puts lower level rooms towards the top in alphabetical order.
//
// If rooms do not have a level we shove those all the way to the bottom.
private var sortedRooms: [Room] {
rooms.sorted { ($0.level?.rawValue ?? 20) < ($1.level?.rawValue ?? 20) }
}
var body: some HTML {
div(.class("flex w-full flex-col")) {
PageTitleRow {
@@ -133,7 +141,7 @@ struct RoomsView: HTML, Sendable {
}
}
tbody {
for room in rooms {
for room in sortedRooms {
RoomRow(room: room, shr: sensibleHeatRatio, rooms: rooms)
}
}
@@ -166,7 +174,13 @@ struct RoomsView: HTML, Sendable {
public var body: some HTML {
tr(.id("roomRow_\(room.id.idString)")) {
td { room.name }
td {
if let level = room.level {
"\(level.label) - \(room.name)"
} else {
room.name
}
}
td {
div(.class("flex justify-center")) {
Number(room.heatingLoad, digits: 0)