Commit 77cd5ece16
Verified · cmc
Layout: unified · split
gitbay/Views/Repos/RepoView.swift +34 −10
| @@ -160,18 +160,35 @@ struct RepoView: View { | ||
| 160 | 160 | } |
| 161 | 161 | Divider() |
| 162 | 162 | Section { |
| 163 | Button { | |
| 164 | Task { await actionsModel.watch() } | |
| 165 | } label: { | |
| 166 | Label("Watch this repository", systemImage: "eye") | |
| 163 | let watchState = WatchState(detail.watch) | |
| 164 | switch watchState { | |
| 165 | case .watching: | |
| 166 | Label("Watching", systemImage: "eye") | |
| 167 | case .muted: | |
| 168 | Label("Muted", systemImage: "bell.slash") | |
| 169 | case .default: | |
| 170 | EmptyView() | |
| 167 | 171 | } |
| 168 | Button { | |
| 169 | Task { await actionsModel.unwatch() } | |
| 170 | } label: { | |
| 171 | Label("Mute this repository", systemImage: "bell.slash") | |
| 172 | if watchState.available.contains(.watch) { | |
| 173 | Button { | |
| 174 | Task { | |
| 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 | 193 | Divider() |
| 177 | 194 | Button { |
| @@ -235,6 +252,13 @@ struct RepoView: View { | ||
| 235 | 252 | } |
| 236 | 253 | .font(.gbSans(.caption)) |
| 237 | 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 | 263 | .padding(.vertical, 4) |
| 240 | 264 | } |