58 lines
1.4 KiB
Swift
58 lines
1.4 KiB
Swift
|
|
import SwiftUI
|
||
|
|
|
||
|
|
struct ContentView: View {
|
||
|
|
@Bindable var settings: SettingsStore
|
||
|
|
|
||
|
|
#if !os(macOS)
|
||
|
|
@State private var showSettings = false
|
||
|
|
#endif
|
||
|
|
|
||
|
|
var body: some View {
|
||
|
|
NavigationStack {
|
||
|
|
EmbeddedWebAppView(settings: settings)
|
||
|
|
.toolbar {
|
||
|
|
#if os(macOS)
|
||
|
|
ToolbarItem(placement: .primaryAction) {
|
||
|
|
SettingsLink {
|
||
|
|
Image(systemName: "gearshape")
|
||
|
|
}
|
||
|
|
}
|
||
|
|
#else
|
||
|
|
ToolbarItem(placement: .topBarTrailing) {
|
||
|
|
Button {
|
||
|
|
showSettings = true
|
||
|
|
} label: {
|
||
|
|
Image(systemName: "gearshape")
|
||
|
|
}
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
}
|
||
|
|
.overlay(alignment: .bottom) {
|
||
|
|
if let user = settings.currentUser {
|
||
|
|
Text("Signed in as \(user.displayName)")
|
||
|
|
.font(.footnote)
|
||
|
|
.padding(.horizontal, 12)
|
||
|
|
.padding(.vertical, 8)
|
||
|
|
.background(.ultraThinMaterial, in: Capsule())
|
||
|
|
.padding(.bottom, 16)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
#if !os(macOS)
|
||
|
|
.sheet(isPresented: $showSettings) {
|
||
|
|
NavigationStack {
|
||
|
|
SettingsView(settings: settings)
|
||
|
|
.toolbar {
|
||
|
|
ToolbarItem(placement: .topBarTrailing) {
|
||
|
|
Button("Done") {
|
||
|
|
showSettings = false
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|