Refactor Dashboard

This commit is contained in:
世界
2025-11-26 22:25:51 +08:00
parent 2e2fc223bf
commit f6d14dbb8a
27 changed files with 773 additions and 742 deletions
+12 -1
View File
@@ -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])
}
}
}