Fix connection card background on iOS
This commit is contained in:
@@ -16,13 +16,13 @@ public struct ConnectionListView: View {
|
|||||||
Text("Empty connections")
|
Text("Empty connections")
|
||||||
} else {
|
} else {
|
||||||
ScrollView {
|
ScrollView {
|
||||||
LazyVGrid(columns: [GridItem(.flexible())], alignment: .leading) {
|
VStack {
|
||||||
ForEach(viewModel.filteredConnections(), id: \.id) { it in
|
ForEach(viewModel.filteredConnections(), id: \.id) { it in
|
||||||
ConnectionView(it)
|
ConnectionView(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.padding()
|
||||||
}
|
}
|
||||||
.padding()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,71 +19,67 @@ public struct ConnectionView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@State private var alert: AlertState?
|
@State private var alert: AlertState?
|
||||||
|
@State private var showDetails = false
|
||||||
|
|
||||||
public var body: some View {
|
public var body: some View {
|
||||||
FormNavigationLink {
|
Button {
|
||||||
ConnectionDetailsView(connection)
|
showDetails = true
|
||||||
} label: {
|
} label: {
|
||||||
VStack {
|
HStack {
|
||||||
HStack {
|
VStack(alignment: .leading) {
|
||||||
VStack(alignment: .leading) {
|
HStack(alignment: .center) {
|
||||||
HStack(alignment: .center) {
|
Text("\(connection.network.uppercased()) \(connection.displayDestination)")
|
||||||
Text("\(connection.network.uppercased()) \(connection.displayDestination)")
|
Spacer()
|
||||||
Spacer()
|
if connection.closedAt == nil {
|
||||||
if connection.closedAt == nil {
|
Text("Active").foregroundStyle(.green)
|
||||||
Text("Active").foregroundStyle(.green)
|
} else {
|
||||||
} else {
|
Text("Closed").foregroundStyle(.red)
|
||||||
Text("Closed").foregroundStyle(.red)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.font(.caption2.monospaced().bold())
|
|
||||||
.padding([.bottom], 4)
|
|
||||||
HStack {
|
|
||||||
if let closedAt = connection.closedAt {
|
|
||||||
VStack(alignment: .leading) {
|
|
||||||
Text("↑ \(LibboxFormatBytes(connection.uploadTotal))")
|
|
||||||
Text("↓ \(LibboxFormatBytes(connection.downloadTotal))")
|
|
||||||
}
|
|
||||||
.font(.caption2)
|
|
||||||
VStack(alignment: .leading) {
|
|
||||||
Text(format(connection.createdAt))
|
|
||||||
Text(formatInterval(connection.createdAt, closedAt))
|
|
||||||
}
|
|
||||||
Spacer()
|
|
||||||
VStack(alignment: .trailing) {
|
|
||||||
Text(connection.inboundType + "/" + connection.inbound)
|
|
||||||
Text(connection.chain.reversed().joined(separator: "/"))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
VStack(alignment: .leading) {
|
|
||||||
Text("↑ \(LibboxFormatBytes(connection.upload))/s")
|
|
||||||
Text("↓ \(LibboxFormatBytes(connection.download))/s")
|
|
||||||
}
|
|
||||||
.font(.caption2)
|
|
||||||
VStack(alignment: .leading) {
|
|
||||||
Text(LibboxFormatBytes(connection.uploadTotal))
|
|
||||||
Text(LibboxFormatBytes(connection.downloadTotal))
|
|
||||||
}
|
|
||||||
Spacer()
|
|
||||||
VStack(alignment: .trailing) {
|
|
||||||
Text(connection.inboundType + "/" + connection.inbound)
|
|
||||||
Text(connection.chain[0])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.font(.caption2.monospaced())
|
|
||||||
}
|
}
|
||||||
|
.font(.caption2.monospaced().bold())
|
||||||
|
.padding([.bottom], 4)
|
||||||
|
HStack {
|
||||||
|
if let closedAt = connection.closedAt {
|
||||||
|
VStack(alignment: .leading) {
|
||||||
|
Text("↑ \(LibboxFormatBytes(connection.uploadTotal))")
|
||||||
|
Text("↓ \(LibboxFormatBytes(connection.downloadTotal))")
|
||||||
|
}
|
||||||
|
.font(.caption2)
|
||||||
|
VStack(alignment: .leading) {
|
||||||
|
Text(format(connection.createdAt))
|
||||||
|
Text(formatInterval(connection.createdAt, closedAt))
|
||||||
|
}
|
||||||
|
Spacer()
|
||||||
|
VStack(alignment: .trailing) {
|
||||||
|
Text(connection.inboundType + "/" + connection.inbound)
|
||||||
|
Text(connection.chain.reversed().joined(separator: "/"))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
VStack(alignment: .leading) {
|
||||||
|
Text("↑ \(LibboxFormatBytes(connection.upload))/s")
|
||||||
|
Text("↓ \(LibboxFormatBytes(connection.download))/s")
|
||||||
|
}
|
||||||
|
.font(.caption2)
|
||||||
|
VStack(alignment: .leading) {
|
||||||
|
Text(LibboxFormatBytes(connection.uploadTotal))
|
||||||
|
Text(LibboxFormatBytes(connection.downloadTotal))
|
||||||
|
}
|
||||||
|
Spacer()
|
||||||
|
VStack(alignment: .trailing) {
|
||||||
|
Text(connection.inboundType + "/" + connection.inbound)
|
||||||
|
Text(connection.chain[0])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.font(.caption2.monospaced())
|
||||||
}
|
}
|
||||||
.foregroundColor(.textColor)
|
|
||||||
#if !os(tvOS)
|
|
||||||
.padding(16)
|
|
||||||
.cardStyle()
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
.background(.clear)
|
.foregroundColor(.textColor)
|
||||||
}
|
}
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
.buttonStyle(.borderless)
|
.buttonStyle(.plain)
|
||||||
|
.padding(16)
|
||||||
|
.cardStyle()
|
||||||
#endif
|
#endif
|
||||||
.alert($alert)
|
.alert($alert)
|
||||||
.contextMenu {
|
.contextMenu {
|
||||||
@@ -96,6 +92,14 @@ public struct ConnectionView: View {
|
|||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.background {
|
||||||
|
NavigationLink(isActive: $showDetails) {
|
||||||
|
ConnectionDetailsView(connection)
|
||||||
|
} label: {
|
||||||
|
EmptyView()
|
||||||
|
}
|
||||||
|
.opacity(0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private nonisolated func closeConnection() async {
|
private nonisolated func closeConnection() async {
|
||||||
|
|||||||
Reference in New Issue
Block a user