Commit 77cd5ece16
Verified · cmc
Layout: unified · split
gitbay/Views/Repos/RepoView.swift +34 −10
| @@ -160,18 +160,35 @@ struct RepoView: View { | |||
| 160 | } | 160 | } |
| 161 | Divider() | 161 | Divider() |
| 162 | Section { | 162 | Section { |
| 163 | Button { | 163 | let watchState = WatchState(detail.watch) |
| 164 | Task { await actionsModel.watch() } | 164 | switch watchState { |
| 165 | } label: { | 165 | case .watching: |
| 166 | Label("Watch this repository", systemImage: "eye") | 166 | Label("Watching", systemImage: "eye") |
| 167 | case .muted: | ||
| 168 | Label("Muted", systemImage: "bell.slash") | ||
| 169 | case .default: | ||
| 170 | EmptyView() | ||
| 167 | } | 171 | } |
| 168 | Button { | 172 | if watchState.available.contains(.watch) { |
| 169 | Task { await actionsModel.unwatch() } | 173 | Button { |
| 170 | } label: { | 174 | Task { |
| 171 | Label("Mute this repository", systemImage: "bell.slash") | 175 | await actionsModel.watch() |
| 176 | await model.load() | ||
| 177 | } | ||
| 178 | } label: { | ||
| 179 | Label("Watch this repository", systemImage: "eye") | ||
| 180 | } | ||
| 181 | } | ||
| 182 | if watchState.available.contains(.mute) { | ||
| 183 | Button { | ||
| 184 | Task { | ||
| 185 | await actionsModel.unwatch() | ||
| 186 | await model.load() | ||
| 187 | } | ||
| 188 | } label: { | ||
| 189 | Label("Mute this repository", systemImage: "bell.slash") | ||
| 190 | } | ||
| 172 | } | 191 | } |
| 173 | // Nothing reports which of these is current (krz/gitbay#178). | ||
| 174 | Text("The current setting isn't shown.") | ||
| 175 | } | 192 | } |
| 176 | Divider() | 193 | Divider() |
| 177 | Button { | 194 | Button { |
| @@ -235,6 +252,13 @@ struct RepoView: View { | |||
| 235 | } | 252 | } |
| 236 | .font(.gbSans(.caption)) | 253 | .font(.gbSans(.caption)) |
| 237 | .foregroundStyle(.secondary) | 254 | .foregroundStyle(.secondary) |
| 255 | if let forkOf = detail.forkOf { | ||
| 256 | NavigationLink(value: RepoRoute.repo(forkOf)) { | ||
| 257 | Text("Forked from \(forkOf)") | ||
| 258 | } | ||
| 259 | .font(.gbSans(.caption)) | ||
| 260 | .foregroundStyle(.secondary) | ||
| 261 | } | ||
| 238 | } | 262 | } |
| 239 | .padding(.vertical, 4) | 263 | .padding(.vertical, 4) |
| 240 | } | 264 | } |