feat: Removes unused form routes.

This commit is contained in:
2026-01-12 11:32:38 -05:00
parent 6aaf39f63c
commit 6416b29627
5 changed files with 4 additions and 285 deletions

View File

@@ -48,54 +48,4 @@ struct ProjectDetail: HTML, Sendable {
}
}
// var body: some HTML {
// div(
// .class(
// """
// space-y-4 p-4 m-4
// """
// )
// ) {
// Row {
// h1(.class("text-2xl font-bold")) { "Project" }
// EditButton()
// .attributes(
// .class("btn-ghost"),
// .on(.click, "projectForm.showModal()")
// )
// }
//
// Row {
// Label("Name")
// span { project.name }
// }
// .attributes(.class("border-b border-gray-200"))
//
// Row {
// Label("Address")
// span { project.streetAddress }
// }
// .attributes(.class("border-b border-gray-200"))
//
// Row {
// Label("City")
// span { project.city }
// }
// .attributes(.class("border-b border-gray-200"))
//
// Row {
// Label("State")
// span { project.state }
// }
// .attributes(.class("border-b border-gray-200"))
//
// Row {
// Label("Zip")
// span { project.zipCode }
// }
// }
//
// ProjectForm(dismiss: true, project: project)
// }
}

View File

@@ -41,70 +41,6 @@ struct ProjectView<Inner: HTML>: HTML, Sendable where Inner: Sendable {
div(.class("p-4")) {
inner
.environment(ProjectViewValue.$projectID, projectID)
// switch self.activeTab {
// case .project:
// await resultView(projectID) {
// guard let project = try await database.projects.get(projectID) else {
// throw NotFoundError()
// }
// return project
// } onSuccess: { project in
// ProjectDetail(project: project)
// }
// case .equipment:
// await resultView(projectID) {
// try await database.equipment.fetch(projectID)
// } onSuccess: { equipment in
// EquipmentInfoView(equipmentInfo: equipment, projectID: projectID)
// }
// // FIX:
// // div { "Fix Me" }
// case .rooms:
// await resultView(projectID) {
// try await (
// database.rooms.fetch(projectID),
// database.projects.getSensibleHeatRatio(projectID)
// )
// } onSuccess: { (rooms, shr) in
// RoomsView(rooms: rooms, sensibleHeatRatio: shr)
// }
//
// case .equivalentLength:
// await resultView(projectID) {
// try await database.effectiveLength.fetch(projectID)
// } onSuccess: {
// EffectiveLengthsView(effectiveLengths: $0)
// }
// case .frictionRate:
//
// await resultView(projectID) {
//
// let equipmentInfo = try await database.equipment.fetch(projectID)
// let componentLosses = try await database.componentLoss.fetch(projectID)
// let equivalentLengths = try await database.effectiveLength.fetchMax(projectID)
// let frictionRateResponse = try await manualD.frictionRate(
// equipmentInfo: equipmentInfo,
// componentLosses: componentLosses,
// effectiveLength: equivalentLengths
// )
// return (
// equipmentInfo, componentLosses, equivalentLengths, frictionRateResponse
// )
// } onSuccess: {
// FrictionRateView(
// equipmentInfo: $0.0,
// componentLosses: $0.1,
// equivalentLengths: $0.2,
// frictionRateResponse: $0.3
// )
// }
// case .ductSizing:
// await resultView(projectID) {
// try await database.calculateDuctSizes(projectID: projectID)
// } onSuccess: {
// DuctSizingView(rooms: $0)
// }
// }
}
}
@@ -117,41 +53,6 @@ struct ProjectView<Inner: HTML>: HTML, Sendable where Inner: Sendable {
}
}
// func resultView<V: Sendable, E: Error, ValueView: HTML>(
// _ projectID: Project.ID,
// catching: @escaping @Sendable () async throws(E) -> V,
// onSuccess: @escaping @Sendable (V) -> ValueView
// ) async -> ResultView<V, E, _ModifiedTaskLocal<Project.ID, ValueView>, ErrorView<E>>
// where
// ValueView: Sendable, E: Sendable
// {
// await .init(
// result: .init(catching: catching),
// onSuccess: { result in
// onSuccess(result)
// .environment(ProjectViewValue.$projectID, projectID)
// }
// )
// }
}
// TODO: Remove
extension ProjectView where Inner == EmptyHTML {
init(
projectID: Project.ID,
activeTab: SiteRoute.View.ProjectRoute.DetailRoute.Tab,
completedSteps: Project.CompletedSteps = .init(
equipmentInfo: false,
rooms: false,
equivalentLength: false,
frictionRate: false
)
) {
self.projectID = projectID
self.activeTab = activeTab
self.inner = EmptyHTML()
self.completedSteps = completedSteps
}
}
extension ProjectView {
@@ -193,7 +94,7 @@ extension ProjectView {
row(
title: "Project",
icon: .mapPin,
route: .project(.detail(projectID, .index(tab: .project))),
route: .project(.detail(projectID, .index)),
isComplete: true
)
.attributes(.data("active", value: "true"), when: active == .project)

View File

@@ -88,7 +88,7 @@ extension ProjectsTable {
Tooltip("View project", position: tooltipPosition(n)) {
a(
.class("join-item btn btn-success btn-ghost"),
.href(route: .project(.detail(project.id, .index())))
.href(route: .project(.detail(project.id, .rooms(.index))))
) {
SVG(.chevronRight)
}