Refactor Dashboard
This commit is contained in:
@@ -7,6 +7,8 @@ public struct MainView: View {
|
||||
@Environment(\.controlActiveState) private var controlActiveState
|
||||
@EnvironmentObject private var environments: ExtensionEnvironments
|
||||
@StateObject private var viewModel = MainViewModel()
|
||||
@State private var showCardManagement = false
|
||||
@State private var cardConfigurationVersion = 0
|
||||
|
||||
public init() {}
|
||||
|
||||
@@ -19,6 +21,7 @@ public struct MainView: View {
|
||||
viewModel.selection.contentView
|
||||
.navigationTitle(viewModel.selection.title)
|
||||
}
|
||||
.environment(\.cardConfigurationVersion, cardConfigurationVersion)
|
||||
.navigationSplitViewColumnWidth(650)
|
||||
}
|
||||
.frame(minHeight: 500)
|
||||
@@ -32,7 +35,11 @@ public struct MainView: View {
|
||||
}
|
||||
if viewModel.selection == .dashboard {
|
||||
ToolbarItem(placement: .automatic) {
|
||||
DashboardMenu()
|
||||
Button {
|
||||
showCardManagement = true
|
||||
} label: {
|
||||
Label("Dashboard Items", systemImage: "square.grid.2x2")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,5 +57,9 @@ public struct MainView: View {
|
||||
.environment(\.importRemoteProfile, $viewModel.importRemoteProfile)
|
||||
.handlesExternalEvents(preferring: [], allowing: ["*"])
|
||||
.onOpenURL(perform: viewModel.openURL)
|
||||
.sheet(isPresented: $showCardManagement) {
|
||||
CardManagementSheet(configurationVersion: $cardConfigurationVersion)
|
||||
.presentationDetents([.medium, .large])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user