Commit f302d0123a

f302d0123aef85506c2261b85643efdb5d7db1e9

parent: c1243198e4

Verified · cmc

cmc <hello@cleberg.net> · 2026-09-30 02:11 UTC

Badge the Dashboard tab with unread; push settings below the inbox

Layout: unified · split

gitbay/ContentView.swift +3 −1
@@ -10,6 +10,7 @@ struct ContentView: View {
1010
1111 @State private var selectedTab = Tabs.dashboard
1212 @State private var dashboardPath = NavigationPath()
13 @State private var unread = 0
1314
1415 /// whoami's admin flag, read on the My Profile tab, decides whether
1516 /// the account menu offers Admin.
@@ -29,10 +30,11 @@ struct ContentView: View {
2930 TabView(selection: $selectedTab) {
3031 Tab("Dashboard", systemImage: "square.grid.2x2", value: Tabs.dashboard) {
3132 NavigationStack(path: $dashboardPath) {
32 DashboardView(client: client)
33 DashboardView(client: client, unread: $unread)
3334 .navigationDestinations(client: client)
3435 }
3536 }
37 .badge(unread)
3638 Tab("Feed", systemImage: "bolt", value: Tabs.feed) {
3739 NavigationStack {
3840 FeedView(client: client)
gitbay/Views/Account/NotificationsView.swift +2 −2
@@ -17,8 +17,6 @@ struct NotificationsView: View {
1717
1818 var body: some View {
1919 List {
20 pushSection
21
2220 Picker("Filter", selection: Bindable(model).showAll) {
2321 Text("Unread").tag(false)
2422 Text("All").tag(true)
@@ -43,6 +41,8 @@ struct NotificationsView: View {
4341 }
4442 }
4543 PageFooter(list: model.list)
44
45 pushSection
4646 }
4747 .overlay { LoadStateOverlay(state: model.state) }
4848 .navigationTitle("Notifications")
gitbay/Views/Dashboard/DashboardView.swift +7 −1
@@ -8,8 +8,11 @@ struct DashboardView: View {
88 @State private var model: DashboardViewModel
99 @State private var createModel: RepoCreateViewModel
1010 @State private var composing = false
11 /// The unread count, for the Dashboard tab's badge.
12 @Binding var unread: Int
1113
12 init(client: GitbayClient) {
14 init(client: GitbayClient, unread: Binding<Int>) {
15 _unread = unread
1316 _model = State(initialValue: DashboardViewModel(client: client))
1417 _createModel = State(initialValue: RepoCreateViewModel(client: client))
1518 }
@@ -78,6 +81,9 @@ struct DashboardView: View {
7881 }
7982 .task { await model.load() }
8083 .refreshable { await model.load() }
84 .onChange(of: model.state.value?.unread) { _, count in
85 if let count { unread = count }
86 }
8187 }
8288
8389 private var bellLabel: String {