component search
This commit is contained in:
@@ -2,27 +2,8 @@ import SwiftUI
|
||||
import SwiftData
|
||||
|
||||
struct ContentView: View {
|
||||
@EnvironmentObject var unitSettings: UnitSystemSettings
|
||||
@State private var selection = 1
|
||||
|
||||
var body: some View {
|
||||
TabView(selection: $selection) {
|
||||
SystemsView()
|
||||
.tabItem {
|
||||
Label("Systems", systemImage: "building.2")
|
||||
}
|
||||
.tag(1)
|
||||
SystemView()
|
||||
.tabItem {
|
||||
Label("System", systemImage: "square.grid.3x2")
|
||||
}
|
||||
.tag(2)
|
||||
SettingsView()
|
||||
.tabItem {
|
||||
Label("Settings", systemImage: "gearshape")
|
||||
}
|
||||
.tag(3)
|
||||
}
|
||||
SystemsView()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +13,7 @@ struct SystemsView: View {
|
||||
@Query(sort: \ElectricalSystem.timestamp, order: .reverse) private var systems: [ElectricalSystem]
|
||||
@State private var systemNavigationTarget: SystemNavigationTarget?
|
||||
@State private var showingComponentLibrary = false
|
||||
@State private var showingSettings = false
|
||||
|
||||
private struct SystemNavigationTarget: Identifiable, Hashable {
|
||||
let id = UUID()
|
||||
@@ -94,6 +76,13 @@ struct SystemsView: View {
|
||||
}
|
||||
.navigationTitle("Systems")
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigationBarLeading) {
|
||||
Button {
|
||||
showingSettings = true
|
||||
} label: {
|
||||
Image(systemName: "gearshape")
|
||||
}
|
||||
}
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
HStack {
|
||||
Button(action: {
|
||||
@@ -118,6 +107,10 @@ struct SystemsView: View {
|
||||
addComponentFromLibrary(item)
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: $showingSettings) {
|
||||
SettingsView()
|
||||
.environmentObject(unitSettings)
|
||||
}
|
||||
}
|
||||
|
||||
private var systemsEmptyState: some View {
|
||||
|
||||
Reference in New Issue
Block a user