Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

Commit 3a04fd4

Browse files
authored
Refactor ProStore to use a sidebar navigation
1 parent d0e8400 commit 3a04fd4

1 file changed

Lines changed: 44 additions & 30 deletions

File tree

Sources/prostore/prostore.swift

Lines changed: 44 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,57 @@ import SwiftUI
44
struct ProStore: App {
55
var body: some Scene {
66
WindowGroup {
7-
MainTabView()
7+
MainSidebarView()
88
}
99
}
1010
}
1111

12-
struct MainTabView: View {
13-
var body: some View {
14-
TabView {
15-
NavigationStack {
16-
SignerView()
17-
.navigationTitle("ProStore - Signer")
18-
.navigationBarTitleDisplayMode(.large)
19-
}
20-
.tabItem {
21-
Image(systemName: "hammer")
22-
Text("Signer")
23-
}
12+
struct MainSidebarView: View {
13+
@State private var selected: SidebarItem? = .signer
2414

25-
NavigationStack {
26-
CertificateView()
27-
.navigationTitle("ProStore - Certificates")
28-
.navigationBarTitleDisplayMode(.large)
29-
}
30-
.tabItem {
31-
Image(systemName: "key")
32-
Text("Certificates")
33-
}
34-
35-
NavigationStack {
36-
AboutView()
37-
.navigationTitle("ProStore - About")
38-
.navigationBarTitleDisplayMode(.large)
15+
var body: some View {
16+
NavigationSplitView {
17+
List(selection: $selected) {
18+
NavigationLink(value: SidebarItem.signer) {
19+
Label("Signer", systemImage: "hammer")
20+
}
21+
NavigationLink(value: SidebarItem.certificates) {
22+
Label("Certificates", systemImage: "key")
23+
}
24+
NavigationLink(value: SidebarItem.about) {
25+
Label("About", systemImage: "info.circle")
26+
}
3927
}
40-
.tabItem {
41-
Image(systemName: "info.circle")
42-
Text("About")
28+
.navigationTitle("ProStore")
29+
} detail: {
30+
switch selected {
31+
case .signer:
32+
NavigationStack {
33+
SignerView()
34+
.navigationTitle("ProStore - Signer")
35+
.navigationBarTitleDisplayMode(.large)
36+
}
37+
case .certificates:
38+
NavigationStack {
39+
CertificateView()
40+
.navigationTitle("ProStore - Certificates")
41+
.navigationBarTitleDisplayMode(.large)
42+
}
43+
case .about:
44+
NavigationStack {
45+
AboutView()
46+
.navigationTitle("ProStore - About")
47+
.navigationBarTitleDisplayMode(.large)
48+
}
49+
case nil:
50+
Text("Select a section!")
4351
}
4452
}
4553
}
4654
}
55+
56+
enum SidebarItem: Hashable {
57+
case signer
58+
case certificates
59+
case about
60+
}

0 commit comments

Comments
 (0)