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
+3 -10
View File
@@ -14,15 +14,8 @@ public struct MainView: View {
@State private var alert: Alert?
public init() {}
public var body: some View {
if ApplicationLibrary.inPreview {
body1.frame(width: 1280, height: 750, alignment: .topLeading)
} else {
body1
}
}
private var body1: some View {
public var body: some View {
NavigationSplitView {
SidebarView()
.navigationSplitViewColumnWidth(150)
@@ -31,9 +24,9 @@ public struct MainView: View {
selection.contentView
.navigationTitle(selection.title)
}
.navigationSplitViewColumnWidth(600)
.navigationSplitViewColumnWidth(650)
}
.frame(minHeight: 470)
.frame(minHeight: 500)
.onAppear {
environments.postReload()
#if !DEBUG
+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)
}
}
}
}