fix(mac): hide sessions header when disconnected
parent
4ca6591045
commit
0b70aa0c56
|
|
@ -200,6 +200,21 @@ struct MenuContent: View {
|
||||||
|
|
||||||
private var sessionsSection: some View {
|
private var sessionsSection: some View {
|
||||||
Group {
|
Group {
|
||||||
|
if !self.isGatewayConnected {
|
||||||
|
MenuHostedItem(
|
||||||
|
width: self.sessionMenuItemWidth,
|
||||||
|
rootView: AnyView(
|
||||||
|
Label("No connection to gateway", systemImage: "wifi.slash")
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
.lineLimit(1)
|
||||||
|
.truncationMode(.tail)
|
||||||
|
.padding(.leading, 20)
|
||||||
|
.padding(.trailing, 10)
|
||||||
|
.padding(.vertical, 6)
|
||||||
|
.frame(minWidth: 300, alignment: .leading)))
|
||||||
|
.disabled(true)
|
||||||
|
} else {
|
||||||
MenuHostedItem(
|
MenuHostedItem(
|
||||||
width: self.sessionMenuItemWidth,
|
width: self.sessionMenuItemWidth,
|
||||||
rootView: AnyView(MenuSessionsHeaderView(
|
rootView: AnyView(MenuSessionsHeaderView(
|
||||||
|
|
@ -245,9 +260,15 @@ struct MenuContent: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var isGatewayConnected: Bool {
|
||||||
|
if case .connected = self.controlChannel.state { return true }
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
private func sessionSubmenu(for row: SessionRow) -> some View {
|
private func sessionSubmenu(for row: SessionRow) -> some View {
|
||||||
Menu("Syncing") {
|
Menu("Syncing") {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue