WIP: Mostly done with pdf client, need to add tests.

This commit is contained in:
2026-01-28 15:47:56 -05:00
parent 458b3bd644
commit c82f20bb60
15 changed files with 211 additions and 76 deletions

View File

@@ -195,7 +195,9 @@ extension SiteRoute.View.ProjectRoute {
case .pdf:
// FIX: This should return a pdf to download or be wrapped in a
// result view.
return try! await projectClient.toHTML(projectID)
// return try! await projectClient.toHTML(projectID)
// This get's handled elsewhere because it returns a response, not a view.
fatalError()
case .rooms(let route):
return await route.renderView(on: request, projectID: projectID)
}

View File

@@ -24,11 +24,20 @@ struct DuctSizingView: HTML, Sendable {
.attributes(.class("text-error font-bold italic mt-4"))
}
a(
.class("btn btn-primary"),
.href(route: .project(.detail(projectID, .pdf)))
) {
"PDF"
div {
button(
.class("btn btn-primary"),
.hx.get(route: .project(.detail(projectID, .pdf))),
.hx.ext("htmx-download"),
.hx.swap(.none),
.hx.indicator()
) {
span { "PDF" }
Indicator()
}
// div {
// Indicator()
// }
}
}

View File

@@ -50,8 +50,10 @@ public struct MainPage<Inner: HTML>: SendableHTMLDocument where Inner: Sendable
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/htmx-download.js")) {}
script(.src("/js/main.js")) {}
link(.rel(.stylesheet), .href("/css/output.css"))
link(.rel(.stylesheet), .href("/css/htmx.css"))
link(
.rel(.icon),
.href("/images/favicon.ico"),