ui: reuse compact remote card in General and hide voice wake forwarder
parent
5cfda2803d
commit
d7281286ba
|
|
@ -9,6 +9,7 @@ struct GeneralSettings: View {
|
||||||
@State private var cliInstalled = false
|
@State private var cliInstalled = false
|
||||||
@State private var cliInstallLocation: String?
|
@State private var cliInstallLocation: String?
|
||||||
@State private var remoteStatus: RemoteStatus = .idle
|
@State private var remoteStatus: RemoteStatus = .idle
|
||||||
|
@State private var showRemoteAdvanced = false
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ScrollView(.vertical) {
|
ScrollView(.vertical) {
|
||||||
|
|
@ -105,23 +106,39 @@ var body: some View {
|
||||||
.frame(width: 320)
|
.frame(width: 320)
|
||||||
|
|
||||||
if self.state.connectionMode == .remote {
|
if self.state.connectionMode == .remote {
|
||||||
|
self.remoteCard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var remoteCard: some View {
|
||||||
VStack(alignment: .leading, spacing: 10) {
|
VStack(alignment: .leading, spacing: 10) {
|
||||||
LabeledContent("SSH target") {
|
HStack(alignment: .center, spacing: 10) {
|
||||||
|
Text("SSH")
|
||||||
|
.font(.callout.weight(.semibold))
|
||||||
|
.frame(width: 44, alignment: .leading)
|
||||||
TextField("user@host[:22]", text: self.$state.remoteTarget)
|
TextField("user@host[:22]", text: self.$state.remoteTarget)
|
||||||
.textFieldStyle(.roundedBorder)
|
.textFieldStyle(.roundedBorder)
|
||||||
.frame(width: 260)
|
.frame(width: 260)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DisclosureGroup(isExpanded: self.$showRemoteAdvanced) {
|
||||||
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
LabeledContent("Identity file") {
|
LabeledContent("Identity file") {
|
||||||
TextField("/Users/you/.ssh/id_ed25519", text: self.$state.remoteIdentity)
|
TextField("/Users/you/.ssh/id_ed25519", text: self.$state.remoteIdentity)
|
||||||
.textFieldStyle(.roundedBorder)
|
.textFieldStyle(.roundedBorder)
|
||||||
.frame(width: 260)
|
.frame(width: 260)
|
||||||
}
|
}
|
||||||
|
|
||||||
LabeledContent("Project root") {
|
LabeledContent("Project root") {
|
||||||
TextField("/home/you/Projects/clawdis", text: self.$state.remoteProjectRoot)
|
TextField("/home/you/Projects/clawdis", text: self.$state.remoteProjectRoot)
|
||||||
.textFieldStyle(.roundedBorder)
|
.textFieldStyle(.roundedBorder)
|
||||||
.frame(width: 320)
|
.frame(width: 260)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(.top, 4)
|
||||||
|
} label: {
|
||||||
|
Text("Advanced")
|
||||||
|
.font(.callout.weight(.semibold))
|
||||||
}
|
}
|
||||||
|
|
||||||
HStack(spacing: 10) {
|
HStack(spacing: 10) {
|
||||||
|
|
@ -134,6 +151,7 @@ var body: some View {
|
||||||
Text("Test remote")
|
Text("Test remote")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.buttonStyle(.borderedProminent)
|
||||||
.disabled(self.remoteStatus == .checking || self.state.remoteTarget.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)
|
.disabled(self.remoteStatus == .checking || self.state.remoteTarget.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)
|
||||||
|
|
||||||
switch self.remoteStatus {
|
switch self.remoteStatus {
|
||||||
|
|
@ -163,8 +181,6 @@ var body: some View {
|
||||||
.cornerRadius(10)
|
.cornerRadius(10)
|
||||||
.transition(.opacity)
|
.transition(.opacity)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private var cliInstaller: some View {
|
private var cliInstaller: some View {
|
||||||
VStack(alignment: .leading, spacing: 8) {
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue