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