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

@@ -49,7 +49,7 @@ struct HomeView: HTML, Sendable {
header
a(
.class("btn btn-ghost text-md text-primary font-bold italic"),
.href("https://git.housh.dev/michael/swift-duct-calc"),
.href("https://github.com/m-housh/swift-duct-calc"),
.target(.blank)
) {
"Open source residential duct design program"

View File

@@ -94,22 +94,36 @@ public struct MainPage<Inner: HTML>: SendableHTMLDocument where Inner: Sendable
footer(
.class(
"""
footer sm:footer-horizontal footer-center
footer footer-horizontal footer-center
bg-base-300 text-base-content p-4
"""
)
) {
aside {
p {
"Copyright © \(Date().description.prefix(4)) - All rights reserved by Michael Housh"
aside(
.class("grid-flow-row items-center")
) {
div(.class("flex mx-auto")) {
a(
.class("btn btn-ghost"),
.href("mailto:support@ductcalc.pro")
) {
SVG(.email)
span { "support@ductcalc.pro" }
}
}
a(
.class("btn btn-ghost"),
.href("https://git.housh.dev/michael/swift-duct-calc/src/branch/main/LICENSE"),
.class("btn btn-ghost mx-auto"),
.href("https://github.com/m-housh/swift-duct-calc/src/branch/main/LICENSE"),
.target(.blank)
) {
"Openly licensed via CC-BY-NC-SA 4.0"
}
p(.class("")) {
"Copyright © \(Date().description.prefix(4)) - All rights reserved by Michael Housh"
}
}
}
}

View File

@@ -34,12 +34,12 @@ struct Navbar: HTML, Sendable {
label(
.for("my-drawer-1"),
.class("size-7"),
.init(name: "aria-label", value: "open sidebar")
.init(name: "aria-label", value: "open / close sidebar")
) {
SVG(.sidebarToggle)
}
.navButton()
.tooltip("Open sidebar", position: .right)
.tooltip("Open / close sidebar", position: .right)
}
a(

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)

View File

@@ -1,5 +1,6 @@
import Elementary
import ElementaryHTMX
import ManualDCore
import Styleguide
struct LoginForm: HTML, Sendable {
@@ -12,6 +13,13 @@ struct LoginForm: HTML, Sendable {
self.next = next
}
private var route: SiteRoute.View {
if style == .login {
return .login(.index(next: next))
}
return .signup(.index)
}
var body: some HTML {
ModalForm(id: "loginForm", closeButton: false, dismiss: false) {
h1(.class("text-2xl font-bold mb-6")) { style.title }

View File

@@ -150,6 +150,10 @@ struct UserProfileForm: HTML, Sendable {
.attributes(.class("btn-block"))
}
.attributes(
.hx.pushURL("/projects"),
when: signup == true
)
}
}
}