mirror of
https://github.com/kkebo/DNSecure.git
synced 2026-03-11 08:54:36 +00:00
Merge pull request #106 from kkebo/refine-layouts
This commit is contained in:
commit
89c35e840e
2 changed files with 38 additions and 32 deletions
|
|
@ -186,11 +186,11 @@ extension ContentView: View {
|
|||
}
|
||||
} detail: {
|
||||
if self.selection == -1 {
|
||||
HowToActivateView(isSheet: false)
|
||||
HowToActivateView()
|
||||
} else if let i = self.selection {
|
||||
self.detailView(at: i)
|
||||
} else if !self.isEnabled {
|
||||
HowToActivateView(isSheet: false)
|
||||
HowToActivateView()
|
||||
} else {
|
||||
Text("Select a server on the sidebar")
|
||||
.navigationBarHidden(true)
|
||||
|
|
@ -223,7 +223,7 @@ extension ContentView: View {
|
|||
tag: -1,
|
||||
selection: self.$selection
|
||||
) {
|
||||
HowToActivateView(isSheet: false)
|
||||
HowToActivateView()
|
||||
}
|
||||
} else {
|
||||
// Workaround for iOS 15
|
||||
|
|
@ -263,11 +263,11 @@ extension ContentView: View {
|
|||
}
|
||||
|
||||
if self.selection == -1 {
|
||||
HowToActivateView(isSheet: false)
|
||||
HowToActivateView()
|
||||
} else if let i = self.selection {
|
||||
self.detailView(at: i)
|
||||
} else if !self.isEnabled {
|
||||
HowToActivateView(isSheet: false)
|
||||
HowToActivateView()
|
||||
} else {
|
||||
Text("Select a server on the sidebar")
|
||||
.navigationBarHidden(true)
|
||||
|
|
@ -310,27 +310,49 @@ extension ContentView: View {
|
|||
EditButton()
|
||||
}
|
||||
ToolbarItem(placement: .status) {
|
||||
VStack {
|
||||
VStack(spacing: 0) {
|
||||
HStack {
|
||||
Circle()
|
||||
.frame(width: 10, height: 10)
|
||||
.foregroundStyle(self.isEnabled ? .green : .secondary)
|
||||
Text(self.isEnabled ? "Active" : "Inactive")
|
||||
#if targetEnvironment(macCatalyst)
|
||||
Text("-")
|
||||
Button("Refresh", action: self.updateStatus)
|
||||
#endif
|
||||
}
|
||||
if !self.isEnabled {
|
||||
Button("How to Activate") {
|
||||
Button {
|
||||
self.guideIsPresented = true
|
||||
} label: {
|
||||
Label("How to Activate", systemImage: "questionmark.circle")
|
||||
}
|
||||
.labelStyle(.titleAndIcon)
|
||||
.font(.caption)
|
||||
.sheet(isPresented: self.$guideIsPresented) {
|
||||
HowToActivateView(isSheet: true)
|
||||
NavigationView {
|
||||
HowToActivateView()
|
||||
.safeAreaInset(edge: .bottom) {
|
||||
Button("Dismiss") {
|
||||
self.guideIsPresented = false
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
.controlSize(.large)
|
||||
.hoverEffect()
|
||||
.padding()
|
||||
.frame(maxWidth: .infinity)
|
||||
.background(Color(.systemBackground))
|
||||
}
|
||||
}
|
||||
.navigationViewStyle(.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#if targetEnvironment(macCatalyst)
|
||||
ToolbarItemGroup(placement: .bottomBar) {
|
||||
Spacer()
|
||||
Button(action: self.updateStatus) {
|
||||
Label("Refresh", systemImage: "arrow.clockwise")
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private func sidebarRow(at i: Int) -> some View {
|
||||
|
|
|
|||
|
|
@ -13,20 +13,13 @@ private enum MacOSVersion {
|
|||
}
|
||||
|
||||
struct HowToActivateView {
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
@State private var macOSVersion: MacOSVersion = .venturaOrLater
|
||||
let isSheet: Bool
|
||||
}
|
||||
|
||||
extension HowToActivateView: View {
|
||||
var body: some View {
|
||||
VStack {
|
||||
if self.isSheet {
|
||||
Text("How to Activate")
|
||||
.font(.title)
|
||||
Spacer()
|
||||
}
|
||||
ScrollView {
|
||||
ScrollView {
|
||||
VStack {
|
||||
#if targetEnvironment(macCatalyst)
|
||||
Picker("", selection: self.$macOSVersion) {
|
||||
Text("macOS 13 or later").tag(MacOSVersion.venturaOrLater)
|
||||
|
|
@ -160,21 +153,12 @@ extension HowToActivateView: View {
|
|||
#endif
|
||||
}
|
||||
}
|
||||
if self.isSheet {
|
||||
Spacer()
|
||||
Button("Dismiss") {
|
||||
self.dismiss()
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
.controlSize(.large)
|
||||
.hoverEffect()
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
.padding()
|
||||
.navigationTitle("How to Activate")
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
HowToActivateView(isSheet: true)
|
||||
HowToActivateView()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue