App info header on watchOS

This commit is contained in:
2025-10-30 21:20:41 +08:00
parent 983ae2a1fc
commit 8ba55eb1be
6 changed files with 65 additions and 23 deletions

View File

@@ -11,37 +11,35 @@ import SwiftUI
struct ContentView: View {
@StateObject private var appState = AppState()
@State private var selection: Panel? = .explore
enum Panel: Hashable {
case explore
case chat
case notifications
case account
}
var body: some View {
NavigationSplitView {
List(selection: $selection) {
Label("Explore", systemImage: "globe").tag(Panel.explore)
Label("Chat", systemImage: "message").tag(Panel.chat)
Label("Notifications", systemImage: "bell").tag(Panel.notifications)
Label("Account", systemImage: "person.circle").tag(Panel.account)
AppInfoHeaderView().listRowBackground(Color.clear)
Label("Explore", systemImage: "globe.fill").tag(Panel.explore)
Label("Chat", systemImage: "message.fill").tag(Panel.chat)
Label("Notifications", systemImage: "bell.fill").tag(Panel.notifications)
Label("Account", systemImage: "person.circle.fill").tag(Panel.account)
}
.listStyle(.automatic)
} detail: {
switch selection {
case .explore:
ExploreView()
.environmentObject(appState)
ExploreView().environmentObject(appState)
case .chat:
ChatView()
.environmentObject(appState)
ChatView().environmentObject(appState)
case .notifications:
NotificationView()
.environmentObject(appState)
NotificationView().environmentObject(appState)
case .account:
AccountView()
.environmentObject(appState)
AccountView().environmentObject(appState)
case .none:
Text("Select a panel")
}