From 9b5b891744cf71795b7613de54493596c6037e5b Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Wed, 14 Jan 2026 19:02:10 -0500 Subject: [PATCH] feat: Adds footer with copyright info. --- Public/css/output.css | 26 +++++++ Sources/ViewController/Live.swift | 11 ++- .../Views/DuctSizing/DuctSizingView.swift | 4 +- Sources/ViewController/Views/MainPage.swift | 32 ++++++++- .../Views/Project/ProjectView.swift | 1 - .../Views/Rooms/RoomsView.swift | 68 +++++++++---------- 6 files changed, 102 insertions(+), 40 deletions(-) diff --git a/Public/css/output.css b/Public/css/output.css index 38f68ab..abe72ab 100644 --- a/Public/css/output.css +++ b/Public/css/output.css @@ -6457,6 +6457,9 @@ .min-h-full { min-height: 100%; } + .min-h-screen { + min-height: 100vh; + } .btn-wide { @layer daisyui.l1.l2 { width: 100%; @@ -6594,6 +6597,9 @@ .min-w-\[220px\] { min-width: 220px; } + .min-w-full { + min-width: 100%; + } .flex-1 { flex: 1; } @@ -7164,6 +7170,10 @@ border-style: var(--tw-border-style); border-width: 1px; } + .border-t { + border-top-style: var(--tw-border-style); + border-top-width: 1px; + } .border-b { border-bottom-style: var(--tw-border-style); border-bottom-width: 1px; @@ -7281,6 +7291,9 @@ border-color: currentColor; } } + .border-base-100 { + border-color: var(--color-base-100); + } .border-error { border-color: var(--color-error); } @@ -7441,6 +7454,9 @@ .bg-base-100 { background-color: var(--color-base-100); } + .bg-base-200 { + background-color: var(--color-base-200); + } .bg-base-300 { background-color: var(--color-base-300); } @@ -9481,6 +9497,16 @@ color: var(--color-white); } } + .sm\:footer-horizontal { + @media (width >= 40rem) { + @layer daisyui.l1.l2 { + grid-auto-flow: column; + &.footer-center { + grid-auto-flow: row dense; + } + } + } + } .md\:grid-cols-2 { @media (width >= 48rem) { grid-template-columns: repeat(2, minmax(0, 1fr)); diff --git a/Sources/ViewController/Live.swift b/Sources/ViewController/Live.swift index 16f6149..7972b8c 100644 --- a/Sources/ViewController/Live.swift +++ b/Sources/ViewController/Live.swift @@ -86,7 +86,7 @@ extension ViewController.Request { let inner = await inner() let theme = await self.theme - return MainPage(theme: theme) { + return MainPage(displayFooter: displayFooter, theme: theme) { inner } } @@ -98,6 +98,15 @@ extension ViewController.Request { return try? await database.userProfile.fetch(user.id)?.theme } } + + var displayFooter: Bool { + switch route { + case .login, .signup: + return false + default: + return true + } + } } extension SiteRoute.View.ProjectRoute { diff --git a/Sources/ViewController/Views/DuctSizing/DuctSizingView.swift b/Sources/ViewController/Views/DuctSizing/DuctSizingView.swift index 466fbe9..ee11d7f 100644 --- a/Sources/ViewController/Views/DuctSizing/DuctSizingView.swift +++ b/Sources/ViewController/Views/DuctSizing/DuctSizingView.swift @@ -26,7 +26,9 @@ struct DuctSizingView: HTML, Sendable { } Row { - h2(.class("text-2xl font-bold")) { "Trunk Sizes" } + h2(.class("text-2xl font-bold")) { + "Trunk / Runout Sizes" + } PlusButton() .attributes( diff --git a/Sources/ViewController/Views/MainPage.swift b/Sources/ViewController/Views/MainPage.swift index 1a5ea40..5abae10 100644 --- a/Sources/ViewController/Views/MainPage.swift +++ b/Sources/ViewController/Views/MainPage.swift @@ -1,5 +1,6 @@ import Elementary import ElementaryHTMX +import Foundation import ManualDCore import Styleguide @@ -10,11 +11,14 @@ public struct MainPage: SendableHTMLDocument where Inner: Sendable let inner: Inner let theme: Theme? + let displayFooter: Bool init( + displayFooter: Bool = true, theme: Theme? = nil, _ inner: () -> Inner ) { + self.displayFooter = displayFooter self.theme = theme self.inner = inner() } @@ -25,6 +29,12 @@ public struct MainPage: SendableHTMLDocument where Inner: Sendable """ } + private var keywords: String { + """ + duct, hvac, duct-design, duct design, manual-d, manual d, design + """ + } + public var head: some HTML { meta(.charset(.utf8)) meta(.name(.viewport), .content("width=device-width, initial-scale=1.0")) @@ -38,6 +48,7 @@ public struct MainPage: SendableHTMLDocument where Inner: Sendable meta(.content("summary_large_image"), .name("twitter:card")) meta(.content("1536"), .name("og:image:width")) meta(.content("1024"), .name("og:image:height")) + meta(.content(keywords), .name(.keywords)) script(.src("https://unpkg.com/htmx.org@2.0.8")) {} script(.src("/js/main.js")) {} link(.rel(.stylesheet), .href("/css/output.css")) @@ -70,10 +81,27 @@ public struct MainPage: SendableHTMLDocument where Inner: Sendable } public var body: some HTML { - div(.class("h-screen w-full")) { - div(.class("overflow-auto")) { + div(.class("flex flex-col min-h-screen min-w-full")) { + main(.class("overflow-auto grow")) { inner } + + if displayFooter { + footer( + .class( + """ + footer sm: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" + } + } + } + } } .attributes(.data("theme", value: theme?.rawValue ?? "default"), when: theme != nil) } diff --git a/Sources/ViewController/Views/Project/ProjectView.swift b/Sources/ViewController/Views/Project/ProjectView.swift index 571f69d..adc7925 100644 --- a/Sources/ViewController/Views/Project/ProjectView.swift +++ b/Sources/ViewController/Views/Project/ProjectView.swift @@ -82,7 +82,6 @@ extension ProjectView { ul(.class("w-full")) { - li(.class("flex w-full")) { row( title: "Project", diff --git a/Sources/ViewController/Views/Rooms/RoomsView.swift b/Sources/ViewController/Views/Rooms/RoomsView.swift index 89ff533..a150d2e 100644 --- a/Sources/ViewController/Views/Rooms/RoomsView.swift +++ b/Sources/ViewController/Views/Rooms/RoomsView.swift @@ -72,49 +72,47 @@ struct RoomsView: HTML, Sendable { SHRForm(projectID: projectID, sensibleHeatRatio: sensibleHeatRatio) - div(.class("overflow-x-auto")) { - table(.class("table table-zebra text-lg"), .id("roomsTable")) { - thead { - tr(.class("text-lg font-bold")) { - th { "Name" } - th { - div(.class("flex justify-center")) { - "Heating Load" - } + table(.class("table table-zebra text-lg"), .id("roomsTable")) { + thead { + tr(.class("text-lg font-bold")) { + th { "Name" } + th { + div(.class("flex justify-center")) { + "Heating Load" } - th { - div(.class("flex justify-center")) { - "Cooling Total" - } + } + th { + div(.class("flex justify-center")) { + "Cooling Total" } - th { - div(.class("flex justify-center")) { - "Cooling Sensible" - } + } + th { + div(.class("flex justify-center")) { + "Cooling Sensible" } - th { - div(.class("flex justify-center")) { - "Register Count" - } + } + th { + div(.class("flex justify-center")) { + "Register Count" } - th { - div(.class("flex justify-end me-2")) { - Tooltip("Add Room") { - PlusButton() - .attributes( - .class("btn-ghost mx-auto"), - .showModal(id: RoomForm.id()) - ) - .attributes(.class("tooltip-left")) - } + } + th { + div(.class("flex justify-end me-2")) { + Tooltip("Add Room") { + PlusButton() + .attributes( + .class("btn-ghost mx-auto"), + .showModal(id: RoomForm.id()) + ) + .attributes(.class("tooltip-left")) } } } } - tbody { - for room in rooms { - RoomRow(room: room, shr: sensibleHeatRatio) - } + } + tbody { + for room in rooms { + RoomRow(room: room, shr: sensibleHeatRatio) } } }