feat: Updates button styles.
This commit is contained in:
@@ -92,7 +92,6 @@ extension SiteRoute.View.ProjectRoute {
|
|||||||
|
|
||||||
func renderView(on request: ViewController.Request) async -> AnySendableHTML {
|
func renderView(on request: ViewController.Request) async -> AnySendableHTML {
|
||||||
@Dependency(\.database) var database
|
@Dependency(\.database) var database
|
||||||
// let user = try request.currentUser()
|
|
||||||
|
|
||||||
switch self {
|
switch self {
|
||||||
case .index:
|
case .index:
|
||||||
|
|||||||
@@ -29,7 +29,10 @@ struct EffectiveLengthsView: HTML, Sendable {
|
|||||||
Row {
|
Row {
|
||||||
h1(.class("text-2xl font-bold")) { "Equivalent Lengths" }
|
h1(.class("text-2xl font-bold")) { "Equivalent Lengths" }
|
||||||
PlusButton()
|
PlusButton()
|
||||||
.attributes(.showModal(id: EffectiveLengthForm.id(nil)))
|
.attributes(
|
||||||
|
.class("btn-ghost"),
|
||||||
|
.showModal(id: EffectiveLengthForm.id(nil))
|
||||||
|
)
|
||||||
}
|
}
|
||||||
.attributes(.class("pb-6"))
|
.attributes(.class("pb-6"))
|
||||||
|
|
||||||
@@ -131,7 +134,7 @@ struct EffectiveLengthsView: HTML, Sendable {
|
|||||||
div(.class("join")) {
|
div(.class("join")) {
|
||||||
TrashButton()
|
TrashButton()
|
||||||
.attributes(
|
.attributes(
|
||||||
.class("join-item"),
|
.class("join-item btn-ghost"),
|
||||||
.hx.delete(
|
.hx.delete(
|
||||||
route: .project(
|
route: .project(
|
||||||
.detail(
|
.detail(
|
||||||
@@ -146,7 +149,7 @@ struct EffectiveLengthsView: HTML, Sendable {
|
|||||||
)
|
)
|
||||||
EditButton()
|
EditButton()
|
||||||
.attributes(
|
.attributes(
|
||||||
.class("join-item"),
|
.class("join-item btn-ghost"),
|
||||||
.showModal(id: EffectiveLengthForm.id(effectiveLength))
|
.showModal(id: EffectiveLengthForm.id(effectiveLength))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,12 +19,10 @@ struct ProjectsTable: HTML, Sendable {
|
|||||||
div(.class("m-6")) {
|
div(.class("m-6")) {
|
||||||
Row {
|
Row {
|
||||||
h1(.class("text-2xl font-bold")) { "Projects" }
|
h1(.class("text-2xl font-bold")) { "Projects" }
|
||||||
div(
|
Tooltip("Add project") {
|
||||||
.class("tooltip tooltip-left"),
|
|
||||||
.data("tip", value: "Add project")
|
|
||||||
) {
|
|
||||||
PlusButton()
|
PlusButton()
|
||||||
.attributes(
|
.attributes(
|
||||||
|
.class("btn-ghost"),
|
||||||
.showModal(id: ProjectForm.id)
|
.showModal(id: ProjectForm.id)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -56,22 +54,37 @@ extension ProjectsTable {
|
|||||||
struct Rows: HTML, Sendable {
|
struct Rows: HTML, Sendable {
|
||||||
let projects: Page<Project>
|
let projects: Page<Project>
|
||||||
|
|
||||||
|
func tooltipPosition(_ n: Int) -> TooltipPosition {
|
||||||
|
if projects.metadata.page == 1 && projects.items.count == 1 {
|
||||||
|
return .left
|
||||||
|
} else if n == (projects.items.count - 1) {
|
||||||
|
return .left
|
||||||
|
} else {
|
||||||
|
return .bottom
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var body: some HTML {
|
var body: some HTML {
|
||||||
for project in projects.items {
|
for (n, project) in projects.items.enumerated() {
|
||||||
tr(.id("\(project.id)")) {
|
tr(.id("\(project.id)")) {
|
||||||
td { DateView(project.createdAt) }
|
td { DateView(project.createdAt) }
|
||||||
td { "\(project.name)" }
|
td { "\(project.name)" }
|
||||||
td { "\(project.streetAddress)" }
|
td { "\(project.streetAddress)" }
|
||||||
td {
|
td {
|
||||||
div(.class("flex justify-end space-x-6")) {
|
div(.class("flex justify-end space-x-6")) {
|
||||||
|
div(.class("join")) {
|
||||||
|
Tooltip("Delete project", position: tooltipPosition(n)) {
|
||||||
TrashButton()
|
TrashButton()
|
||||||
.attributes(
|
.attributes(
|
||||||
|
.class("join-item btn-ghost"),
|
||||||
.hx.delete(route: .project(.delete(id: project.id))),
|
.hx.delete(route: .project(.delete(id: project.id))),
|
||||||
.hx.confirm("Are you sure?"),
|
.hx.confirm("Are you sure?"),
|
||||||
.hx.target("closest tr")
|
.hx.target("closest tr")
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
Tooltip("View project", position: tooltipPosition(n)) {
|
||||||
a(
|
a(
|
||||||
.class("btn btn-success btn-circle dark:text-white"),
|
.class("join-item btn btn-success btn-ghost"),
|
||||||
.href(route: .project(.detail(project.id, .index())))
|
.href(route: .project(.detail(project.id, .index())))
|
||||||
) {
|
) {
|
||||||
SVG(.chevronRight)
|
SVG(.chevronRight)
|
||||||
@@ -80,6 +93,8 @@ extension ProjectsTable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// Have a row that when revealed fetches the next page,
|
// Have a row that when revealed fetches the next page,
|
||||||
// if there are more pages left.
|
// if there are more pages left.
|
||||||
if projects.metadata.pageCount > projects.metadata.page {
|
if projects.metadata.pageCount > projects.metadata.page {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ struct RoomsView: HTML, Sendable {
|
|||||||
|
|
||||||
Tooltip("Edit SHR") {
|
Tooltip("Edit SHR") {
|
||||||
EditButton()
|
EditButton()
|
||||||
.attributes(.showModal(id: SHRForm.id))
|
.attributes(.class("btn-ghost"), .showModal(id: SHRForm.id))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.attributes(.class("m-4"))
|
.attributes(.class("m-4"))
|
||||||
@@ -55,7 +55,7 @@ struct RoomsView: HTML, Sendable {
|
|||||||
Tooltip("Add Room") {
|
Tooltip("Add Room") {
|
||||||
PlusButton()
|
PlusButton()
|
||||||
.attributes(
|
.attributes(
|
||||||
.class("mx-auto"),
|
.class("btn-ghost mx-auto"),
|
||||||
.showModal(id: RoomForm.id())
|
.showModal(id: RoomForm.id())
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user