Minor fixes

This commit is contained in:
世界
2024-09-17 18:49:49 +08:00
parent 479bd593af
commit 8b5ad1928f
7 changed files with 86 additions and 33 deletions
+26 -2
View File
@@ -9,14 +9,16 @@ public struct SidebarView: View {
public init() {}
public var body: some View {
VStack {
if environments.extensionProfileLoading {
if ApplicationLibrary.inPreview {
SidebarViewPreview()
} else if environments.extensionProfileLoading {
ProgressView()
} else if let profile = environments.extensionProfile {
SidebarView0().environmentObject(profile)
} else {
SidebarView1()
}
}.frame(minWidth: 150)
}
}
struct SidebarView0: View {
@@ -69,4 +71,26 @@ public struct SidebarView: View {
}
}
}
struct SidebarViewPreview: View {
@Environment(\.selection) private var selection
var body: some View {
VStack {
List(selection: selection) {
Section(NavigationPage.dashboard.title) {
Label("Overview", systemImage: "text.and.command.macwindow")
.tint(.textColor)
.tag(NavigationPage.dashboard)
NavigationPage.groups.label.tag(NavigationPage.groups)
}
Divider()
ForEach(NavigationPage.macosDefaultPages, id: \.self) { it in
it.label
}
}
.listStyle(.sidebar)
.scrollDisabled(true)
}
}
}
}