mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-10 21:10:08 +02:00
🏗️ Investigate event propagation
This commit is contained in:
@@ -26,7 +26,7 @@ struct ServicesView: View {
|
|||||||
view.setFrameSize(
|
view.setFrameSize(
|
||||||
CGSize(width: view.frame.width, height: rootView.height + 30)
|
CGSize(width: view.frame.width, height: rootView.height + 30)
|
||||||
)
|
)
|
||||||
view.layer?.backgroundColor = CGColor.init(red: 255, green: 0, blue: 0, alpha: 1)
|
// view.layer?.backgroundColor = CGColor.init(red: 255, green: 0, blue: 0, alpha: 1)
|
||||||
view.focusRingType = .none
|
view.focusRingType = .none
|
||||||
|
|
||||||
item.view = view
|
item.view = view
|
||||||
@@ -36,8 +36,8 @@ struct ServicesView: View {
|
|||||||
@ObservedObject var manager: ServicesManager
|
@ObservedObject var manager: ServicesManager
|
||||||
var perRow: Int
|
var perRow: Int
|
||||||
var rowCount: Int
|
var rowCount: Int
|
||||||
var rowSpacing: Int = 2
|
var rowSpacing: Int = 5
|
||||||
var rowHeight: Int = 40
|
var rowHeight: Int = 30
|
||||||
var statusHeight: Int = 30
|
var statusHeight: Int = 30
|
||||||
var height: CGFloat
|
var height: CGFloat
|
||||||
|
|
||||||
@@ -97,8 +97,9 @@ struct ServiceView: View {
|
|||||||
.padding(.bottom, 2)
|
.padding(.bottom, 2)
|
||||||
if service.status == .loading {
|
if service.status == .loading {
|
||||||
ProgressView()
|
ProgressView()
|
||||||
.scaleEffect(x: 0.5, y: 0.5, anchor: .center)
|
.scaleEffect(x: 0.4, y: 0.4, anchor: .center)
|
||||||
.frame(minWidth: 70, alignment: .center)
|
.frame(minWidth: 70, alignment: .center)
|
||||||
|
.frame(width: 25, height: 25)
|
||||||
}
|
}
|
||||||
if service.status == .missing {
|
if service.status == .missing {
|
||||||
Button {
|
Button {
|
||||||
@@ -115,18 +116,20 @@ struct ServiceView: View {
|
|||||||
Text("?")
|
Text("?")
|
||||||
}
|
}
|
||||||
.focusable(false)
|
.focusable(false)
|
||||||
.buttonStyle(BlueButton())
|
// .buttonStyle(BlueButton())
|
||||||
.frame(minWidth: 70, alignment: .center)
|
.frame(minWidth: 70, alignment: .center)
|
||||||
}
|
}
|
||||||
if service.status == .active {
|
if service.status == .active {
|
||||||
Button {
|
Button {
|
||||||
// TODO
|
// TODO
|
||||||
|
print("you pressed the button")
|
||||||
} label: {
|
} label: {
|
||||||
Image(systemName: "checkmark")
|
Image(systemName: "checkmark")
|
||||||
.resizable()
|
.resizable()
|
||||||
.frame(width: 12.0, height: 12.0)
|
.frame(width: 12.0, height: 12.0)
|
||||||
.foregroundColor(Color("IconColorGreen"))
|
.foregroundColor(Color("IconColorGreen"))
|
||||||
}
|
}
|
||||||
|
.frame(width: 25, height: 25)
|
||||||
}
|
}
|
||||||
if service.status == .inactive {
|
if service.status == .inactive {
|
||||||
Button {
|
Button {
|
||||||
@@ -145,13 +148,14 @@ struct ServiceView: View {
|
|||||||
public struct BlueButton: ButtonStyle {
|
public struct BlueButton: ButtonStyle {
|
||||||
public func makeBody(configuration: Configuration) -> some View {
|
public func makeBody(configuration: Configuration) -> some View {
|
||||||
configuration.label
|
configuration.label
|
||||||
.frame(width: 30, height: 30)
|
.frame(width: 25, height: 25)
|
||||||
.background(configuration.isPressed
|
.background(configuration.isPressed
|
||||||
? Color(red: 0, green: 0, blue: 0.9)
|
? Color(red: 0, green: 0.5, blue: 0.9)
|
||||||
: Color(red: 0, green: 0, blue: 0.5)
|
: Color(red: 0, green: 0, blue: 0.5)
|
||||||
)
|
)
|
||||||
.foregroundColor(.white)
|
.foregroundColor(.white)
|
||||||
.clipShape(Capsule())
|
.clipShape(Capsule())
|
||||||
|
.contentShape(Rectangle())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,15 +168,21 @@ struct ServicesView_Previews: PreviewProvider {
|
|||||||
.frame(width: 330.0)
|
.frame(width: 330.0)
|
||||||
.previewDisplayName("Loading")
|
.previewDisplayName("Loading")
|
||||||
|
|
||||||
|
ServicesView(manager: FakeServicesManager(
|
||||||
|
formulae: ["php", "nginx", "dnsmasq"],
|
||||||
|
status: .active
|
||||||
|
), perRow: 4)
|
||||||
|
.frame(width: 330.0)
|
||||||
|
.previewDisplayName("Active 1")
|
||||||
|
|
||||||
ServicesView(manager: FakeServicesManager(
|
ServicesView(manager: FakeServicesManager(
|
||||||
formulae: [
|
formulae: [
|
||||||
"php", "nginx", "dnsmasq", "thing1",
|
"php", "nginx", "dnsmasq", "thing1",
|
||||||
"thing2", "thing3", "thing4", "thing5",
|
"thing2", "thing3", "thing4", "thing5"
|
||||||
"thing6", "thing7", "thing8"
|
|
||||||
],
|
],
|
||||||
status: .active
|
status: .active
|
||||||
), perRow: 4)
|
), perRow: 4)
|
||||||
.frame(width: 330.0)
|
.frame(width: 330.0)
|
||||||
.previewDisplayName("Active")
|
.previewDisplayName("Active 2")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user