mirror of
https://github.com/yJason/ClashX-Dashboard.git
synced 2026-03-01 00:35:19 +08:00
feat: toolbar items
This commit is contained in:
@@ -15,50 +15,19 @@ struct SidebarView: View {
|
||||
|
||||
@State private var sidebarSelectionName: String? = "Overview"
|
||||
|
||||
@State private var sidebarItems = [
|
||||
SidebarItem(name: "Overview",
|
||||
icon: "chart.bar.xaxis",
|
||||
view: AnyView(OverviewView())),
|
||||
|
||||
SidebarItem(name: "Proxies",
|
||||
icon: "globe.asia.australia",
|
||||
view: AnyView(ProxiesView())),
|
||||
|
||||
SidebarItem(name: "Providers",
|
||||
icon: "link.icloud",
|
||||
view: AnyView(ProvidersView())),
|
||||
|
||||
SidebarItem(name: "Rules",
|
||||
icon: "waveform.and.magnifyingglass",
|
||||
view: AnyView(RulesView())),
|
||||
|
||||
SidebarItem(name: "Conns",
|
||||
icon: "app.connected.to.app.below.fill",
|
||||
view: AnyView(ConnectionsView())),
|
||||
|
||||
SidebarItem(name: "Config",
|
||||
icon: "slider.horizontal.3",
|
||||
view: AnyView(ConfigView())),
|
||||
|
||||
SidebarItem(name: "Logs",
|
||||
icon: "wand.and.stars.inverse",
|
||||
view: AnyView(LogsView()))
|
||||
]
|
||||
|
||||
var body: some View {
|
||||
ScrollViewReader { scrollViewProxy in
|
||||
List(sidebarItems, id: \.id) { item in
|
||||
SidebarItemView(item: item, selectionName: $sidebarSelectionName)
|
||||
}
|
||||
.listStyle(.sidebar)
|
||||
SidebarListView(selectionName: $sidebarSelectionName)
|
||||
}
|
||||
.environmentObject(clashApiDatasStorage.overviewData)
|
||||
.environmentObject(clashApiDatasStorage.logStorage)
|
||||
.environmentObject(clashApiDatasStorage.connsStorage)
|
||||
.onAppear {
|
||||
ConfigManager.selectLoggingApiLevel = .debug
|
||||
clashApiDatasStorage.resetStreamApi()
|
||||
if ConfigManager.selectLoggingApiLevel == .unknow {
|
||||
ConfigManager.selectLoggingApiLevel = .info
|
||||
}
|
||||
|
||||
clashApiDatasStorage.resetStreamApi()
|
||||
connsQueue.sync {
|
||||
clashApiDatasStorage.connsStorage.conns
|
||||
.removeAll()
|
||||
|
||||
Reference in New Issue
Block a user