feat: Adds grid / nav links to home page.

This commit is contained in:
2025-03-01 23:06:09 -05:00
parent 0ff7d6666c
commit d6d400b6ec
11 changed files with 124 additions and 27 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,9 @@
public enum AtticVentilation {
public static let description = """
Calculate attic ventilation requirements and assess current conditions.
"""
public struct Request: Codable, Equatable, Sendable {
public let pressureDifferential: Double

View File

@@ -1,5 +1,9 @@
public enum Capacitor {
public static let description = """
Calculate run capacitor values based on electrical measurements.
"""
public enum Mode: String, CaseIterable, Codable, Equatable, Sendable {
case size
case test

View File

@@ -2,6 +2,10 @@ import Foundation
public enum DehumidifierSize {
public static let description = """
Calculate dehumidifier size based on latent load and performance data.
"""
/// Represents the request for determining dehumidifier size based on
/// latent load and indoor conditions.
public struct Request: Codable, Equatable, Sendable {

View File

@@ -1,5 +1,9 @@
public enum FilterPressureDrop {
public static let description = """
Calculate filter pressure drop and sizing based on system requirements.
"""
public enum Request: Codable, Equatable, Sendable {
case basic(Basic)
case fanLaw(FanLaw)

View File

@@ -3,6 +3,10 @@ import PsychrometricClient
public enum HVACSystemPerformance {
public static let description = """
Analyze HVAC system performance and capacity.
"""
public struct Request: Codable, Equatable, Sendable {
public let altitude: Double?

View File

@@ -2,6 +2,11 @@ import Foundation
import PsychrometricClient
public enum MoldRisk {
public static let description = """
Assess mold risk based on indoor conditions.
"""
public struct Request: Codable, Equatable, Sendable {
public let temperature: Double

View File

@@ -1,5 +1,9 @@
public enum RoomPressure {
public static let description = """
Calculate return grille and duct sizing for room pressure balancing.
"""
public enum Mode: String, CaseIterable, Codable, Equatable, Sendable {
case knownAirflow
case measuredPressure

View File

@@ -0,0 +1,73 @@
import Elementary
import ElementaryHTMX
import Routes
import Styleguide
struct HomePage: HTML, Sendable {
var content: some HTML {
div(.class("grid grid-cols-2 gap-4 justify-items-start")) {
group(
label: "Mold Risk",
description: MoldRisk.description,
svg: .thermometer,
route: .moldRisk(.index)
)
group(
label: "Dehumdifier Sizing",
description: DehumidifierSize.description,
svg: .droplets,
route: .dehumidifierSize(.index)
)
group(
label: "Attic Ventilation",
description: AtticVentilation.description,
svg: .wind,
route: .atticVentilation(.index)
)
group(
label: "HVAC System Performance",
description: HVACSystemPerformance.description,
svg: .thermometerSun,
route: .hvacSystemPerformance(.index)
)
group(
label: "Room Pressure",
description: RoomPressure.description,
svg: .leftRightArrow,
route: .roomPressure(.index)
)
group(
label: "Capacitor Calculator",
description: Capacitor.description,
svg: .zap,
route: .capacitor(.index)
)
}
}
private func group(
label: String,
description: String,
svg: SVGType,
route: SiteRoute.View
) -> some HTML {
button(
.hx.get(route: route),
.hx.target("#content"),
.class("""
w-full rounded-xl shadow-lg border border-blue-600 justify-items-start
hover:bg-blue-600 hover:border-yellow-300 hover:text-yellow-300 transition-colors
""")
) {
div(.class("p-4 content-start")) {
div(.class("flex mb-6")) {
SVG(svg, color: .blue)
.attributes(.class("pe-2"))
h2(.class("font-bold text-2xl")) { label }
}
p { description }
}
}
}
}

View File

@@ -53,26 +53,21 @@ extension ViewController: DependencyKey {
return MainPage {
div(.class("space-y-6")) {
div(.class("pb-8")) {
p(.class("dark:text-gray-200")) {
"Professional calculators for HVAC system design and troubleshooting."
h1(.class("font-extrabold text-4xl dark:text-gray-200")) {
"Professional Calculators"
}
p(.class("text-blue-500 font-bold")) {
"""
Professional calculators for HVAC system design and troublshooting.
"""
}
}
WarningBox(
"This site is still under construction, not all it's functionality is working.",
"This page needs updated to display a grid of calculators.",
"Below are the SVG's used on the site, for making sure they work."
"This site is still under construction, not all it's functionality is working."
)
div {
p(.class("font-2xl dark:text-gray-200 pb-6")) {
"SVG's"
}
div(.class("grid lg:grid-cols-8 gap-4")) {
for svg in SVGType.allCases {
SVG(svg, color: .blue)
}
}
}
HomePage()
}
}

View File

@@ -59,17 +59,17 @@ private struct Header: HTML {
.attributes(.class("group-hover:text-blue-600"))
}
}
nav(.class("flex flex-row gap-2 p-2 mt-2")) {
// TODO: Add class active, to button that is the active route.
ul(.class("flex flex-wrap gap-x-2 lg:gap-x-5 \(text: .yellow) font-bold")) {
navLink(label: "Mold-Risk", route: .moldRisk(.index))
navLink(label: "Dehumidifier-Sizing", route: .dehumidifierSize(.index))
navLink(label: "HVAC-System-Performance", route: .hvacSystemPerformance(.index))
navLink(label: "Room-Pressure", route: .roomPressure(.index))
navLink(label: "Capcitor-Calculator", route: .capacitor(.index))
navLink(label: "Attic-Ventilation", route: .atticVentilation(.index))
}
}
// nav(.class("flex flex-row gap-2 p-2 mt-2")) {
// // TODO: Add class active, to button that is the active route.
// ul(.class("flex flex-wrap gap-x-2 lg:gap-x-5 \(text: .yellow) font-bold")) {
// navLink(label: "Mold-Risk", route: .moldRisk(.index))
// navLink(label: "Dehumidifier-Sizing", route: .dehumidifierSize(.index))
// navLink(label: "HVAC-System-Performance", route: .hvacSystemPerformance(.index))
// navLink(label: "Room-Pressure", route: .roomPressure(.index))
// navLink(label: "Capcitor-Calculator", route: .capacitor(.index))
// navLink(label: "Attic-Ventilation", route: .atticVentilation(.index))
// }
// }
}
}