feat: Style updates, renames some files.

This commit is contained in:
2025-02-25 21:44:01 -05:00
parent 493154f4f1
commit 30cfde9f30
14 changed files with 112 additions and 43 deletions

View File

@@ -1,5 +1,5 @@
{
"originHash" : "7bfd85488959c4351b9e6b5e80ddac60588c9f2d6eed6e53cd1a4fe1f047b570",
"originHash" : "7efd57cbec8a157adddec3ffcc6ff2b58e602f8762df879e933220d7070945f7",
"pins" : [
{
"identity" : "async-http-client",
@@ -276,8 +276,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/swift-psychrometrics/swift-psychrometrics.git",
"state" : {
"revision" : "6a457f3cefd9477f7aa76b2fb8ad557988c447bd",
"version" : "0.2.3"
"revision" : "df8b764b06b52386948b2ddcd99cdf000db666ec",
"version" : "0.2.4"
}
},
{

View File

@@ -27,7 +27,7 @@ let package = Package(
.package(url: "https://github.com/pointfreeco/vapor-routing.git", from: "0.1.3"),
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing.git", from: "1.17.7"),
.package(url: "https://github.com/pointfreeco/swift-case-paths.git", from: "1.6.0"),
.package(url: "https://github.com/swift-psychrometrics/swift-psychrometrics.git", from: "0.2.3")
.package(url: "https://github.com/swift-psychrometrics/swift-psychrometrics.git", from: "0.2.4")
],
targets: [
.executableTarget(

19
Public/images/toolbox.svg Normal file
View File

@@ -0,0 +1,19 @@
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Transformed by: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="-102.4 -102.4 1228.80 1228.80" class="icon" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="#1E2938" stroke="#1E2938" stroke-width="15.36">
<g id="SVGRepo_bgCarrier" stroke-width="0" transform="translate(97.27999999999997,97.27999999999997), scale(0.81)">
<rect x="-102.4" y="-102.4" width="1228.80" height="1228.80" rx="0" fill="#FFDE5A" strokewidth="0"/>
</g>
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round" stroke="#CCCCCC" stroke-width="38.912">
<path d="M619.52 194.56h35.84V128c0-5.632-4.608-10.24-10.24-10.24H378.88c-5.632 0-10.24 4.608-10.24 10.24v66.56h35.84v-30.72c0-5.632 4.608-10.24 10.24-10.24h194.56c5.632 0 10.24 4.608 10.24 10.24v30.72z" fill="#2C7FFF"/>
<path d="M184.32 209.92v20.48h655.36v-20.48H184.32z m-5.12-15.36h665.6c5.632 0 10.24 4.608 10.24 10.24v30.72c0 5.632-4.608 10.24-10.24 10.24H179.2c-5.632 0-10.24-4.608-10.24-10.24v-30.72c0-5.632 4.608-10.24 10.24-10.24zM240.64 890.88h51.2v-10.24H240.64v10.24z m-5.12-25.6h61.44c5.632 0 10.24 4.608 10.24 10.24v20.48c0 5.632-4.608 10.24-10.24 10.24H235.52c-5.632 0-10.24-4.608-10.24-10.24v-20.48c0-5.632 4.608-10.24 10.24-10.24zM737.28 890.88h51.2v-10.24h-51.2v10.24z m-5.12-25.6h61.44c5.632 0 10.24 4.608 10.24 10.24v20.48c0 5.632-4.608 10.24-10.24 10.24h-61.44c-5.632 0-10.24-4.608-10.24-10.24v-20.48c0-5.632 4.608-10.24 10.24-10.24z" fill=""/>
<path d="M199.68 343.04h122.88c5.632 0 10.24 4.608 10.24 10.24v81.92c0 5.632-4.608 10.24-10.24 10.24H199.68c-5.632 0-10.24-4.608-10.24-10.24V353.28c0-5.632 4.608-10.24 10.24-10.24zM701.44 343.04h122.88c5.632 0 10.24 4.608 10.24 10.24v81.92c0 5.632-4.608 10.24-10.24 10.24h-122.88c-5.632 0-10.24-4.608-10.24-10.24V353.28c0-5.632 4.608-10.24 10.24-10.24z" fill="#2C7FFF"/>

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@@ -30,3 +30,7 @@ body {
-ms-box-sizing: border-box;
box-sizing: border-box;
}
nav a:active {
@apply border-yellow-300 text-white;
}

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
@_exported import ApiController
import Dependencies
import Logging
@preconcurrency import PsychrometricClient
import PsychrometricClient
import Routes
extension ApiController: DependencyKey {

View File

@@ -1,6 +1,6 @@
import ApiControllerLive
import Dependencies
@preconcurrency import PsychrometricClientLive
import PsychrometricClientLive
import Vapor
import ViewControllerLive

View File

@@ -1,31 +1,32 @@
import Vapor
import Logging
import NIOCore
import NIOPosix
import Vapor
@main
enum Entrypoint {
static func main() async throws {
var env = try Environment.detect()
try LoggingSystem.bootstrap(from: &env)
let app = try await Application.make(env)
static func main() async throws {
var env = try Environment.detect()
try LoggingSystem.bootstrap(from: &env)
// This attempts to install NIO as the Swift Concurrency global executor.
// You can enable it if you'd like to reduce the amount of context switching between NIO and Swift Concurrency.
// Note: this has caused issues with some libraries that use `.wait()` and cleanly shutting down.
// If enabled, you should be careful about calling async functions before this point as it can cause assertion failures.
// let executorTakeoverSuccess = NIOSingletons.unsafeTryInstallSingletonPosixEventLoopGroupAsConcurrencyGlobalExecutor()
// app.logger.debug("Tried to install SwiftNIO's EventLoopGroup as Swift's global concurrency executor", metadata: ["success": .stringConvertible(executorTakeoverSuccess)])
do {
try await configure(app)
try await app.execute()
} catch {
app.logger.report(error: error)
try? await app.asyncShutdown()
throw error
}
try await app.asyncShutdown()
let app = try await Application.make(env)
// This attempts to install NIO as the Swift Concurrency global executor.
// You can enable it if you'd like to reduce the amount of context switching between NIO and Swift Concurrency.
// Note: this has caused issues with some libraries that use `.wait()` and cleanly shutting down.
// If enabled, you should be careful about calling async functions before this point as it can cause assertion failures.
// let executorTakeoverSuccess = NIOSingletons.unsafeTryInstallSingletonPosixEventLoopGroupAsConcurrencyGlobalExecutor()
// app.logger.debug("Tried to install SwiftNIO's EventLoopGroup as Swift's global concurrency executor", metadata: ["success": .stringConvertible(executorTakeoverSuccess)])
do {
try await configure(app)
} catch {
app.logger.report(error: error)
try? await app.asyncShutdown()
throw error
}
try await app.execute()
try await app.asyncShutdown()
}
}

View File

@@ -0,0 +1,13 @@
import Elementary
extension HTMLAttribute where Tag == HTMLTag.input {
static func min(_ value: String) -> Self {
.init(name: "min", value: value)
}
static func step(_ value: String) -> Self {
.init(name: "step", value: value)
}
}

View File

@@ -0,0 +1,9 @@
import Elementary
import Routes
import URLRouting
extension HTMLAttribute where Tag: HTMLTrait.Attributes.href {
static func href(route: SiteRoute.View) -> Self {
.href(SiteRoute.View.router.path(for: route))
}
}

View File

@@ -33,9 +33,7 @@ struct MainPage<Inner: HTML>: SendableHTMLDocument where Inner: Sendable {
main(.class("bg-white dark:bg-gray-800")) {
div(.class("min-h-screen")) {
Header()
// div(.class("container")) {
inner()
// }
}
}
}
@@ -44,15 +42,32 @@ struct MainPage<Inner: HTML>: SendableHTMLDocument where Inner: Sendable {
struct Header: HTML {
var content: some HTML {
header(.class("bg-blue-500")) {
a(.href("/")) {
div(.class("flex flex-row gap-2 p-2 mb-8")) {
img(.src("/favicon-32x32.png"))
h2(.class("text-2xl text-white font-extrabold")) { "HVAC-Toolbox" }
// img(.class("text-yellow-300"), .src("/images/wind.svg"))
header(.class("bg-blue-500 mb-8 flex flex-row gap-2 border-b border-yellow-300")) {
a(
.href(route: .index),
.class("flex flex-row gap-2 bg-yellow-300 pe-2 rounded-e-lg text-blue-500 [&:hover]:text-blue-600")
) {
img(.src("/images/toolbox.svg"), .width(40), .height(40), .class("py-1"))
div(.class("flex flex-row mt-2")) {
h2(.class("text-2xl font-extrabold")) { "HVAC-Toolbox" }
SVG.wind
}
}
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-300 font-bold")) {
li {
a(.href(route: .moldRisk(.index)), .class("[&:hover]:border-b border-yellow-300")) {
"Mold-Risk"
}
}
li {
a(.href("#"), .class("[&:hover]:border-b border-yellow-300")) {
"Dehumidifier-Sizing"
}
}
}
}
}
}
}

View File

@@ -18,22 +18,21 @@ struct MoldRiskForm: HTML {
"Indoor Temperature"
}
input(
.type(.number), .id("temperature"), .placeholder("Dry bulb temperature"),
.init(name: "step", value: "0.1"),
.type(.number), .id("temperature"), .placeholder("Dry bulb temperature"), .required,
.step("0.1"), .min("0.1"),
.class("""
w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-yellow-800
focus:border-yellow-800 text-gray-700 dark:text-white
""")
)
}
div {
label(.for("humidity"), .class("block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2")) {
"Indoor Humidity (%)"
}
input(
.type(.number), .id("humidity"), .placeholder("Relative humidity"),
.init(name: "step", value: "0.1"),
.type(.number), .id("humidity"), .name("humidity"), .placeholder("Relative humidity"), .required,
.step("0.1"), .min("0.1"),
.class("""
w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-yellow-800
focus:border-yellow-800 text-gray-700 dark:text-white

View File

@@ -4,7 +4,7 @@ enum SVG {
static let wind = HTMLRaw("""
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
class="w-8 h-8 text-yellow-300">
class="w-8 h-8">
<path d="M17.7 7.7a2.5 2.5 0 1 1 1.8 4.3H2"></path>
<path d="M9.6 4.6A2 2 0 1 1 11 8H2"></path>
<path d="M12.6 19.4A2 2 0 1 0 14 16H2"></path>
@@ -34,4 +34,13 @@ enum SVG {
<path d="M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z"></path>
</svg>
""")
static let menu = HTMLRaw("""
<svg class="block h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor"
viewBox="0 0 24 24" x="0" y="0" id="menu-icon">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
</svg>
""")
}