Commit b451bbe7a6
Verified · cmc
Layout: unified · split
gitbay/Views/MRs/MRView.swift +3 −30
| @@ -347,7 +347,9 @@ struct MRView: View { | ||
| 347 | 347 | |
| 348 | 348 | private func reviewersSection(_ mr: MRDetail) -> some View { |
| 349 | 349 | Section("Reviewers") { |
| 350 | reviewerFlow(mr.reviewRequests) | |
| 350 | RemovableChips(items: mr.reviewRequests, idPrefix: "mr-reviewer", | |
| 351 | disabled: model.working, | |
| 352 | remove: { user in Task { await model.removeReviewRequest(user) } }) | |
| 351 | 353 | HStack { |
| 352 | 354 | TextField("Request review", text: $editingReviewer) |
| 353 | 355 | .autocorrectionDisabled() |
| @@ -364,35 +366,6 @@ struct MRView: View { | ||
| 364 | 366 | } |
| 365 | 367 | } |
| 366 | 368 | |
| 367 | /// The same add/remove chip shape `IssueView` uses for labels and | |
| 368 | /// assignees. | |
| 369 | @ViewBuilder | |
| 370 | private func reviewerFlow(_ items: [String]) -> some View { | |
| 371 | if !items.isEmpty { | |
| 372 | ScrollView(.horizontal, showsIndicators: false) { | |
| 373 | HStack(spacing: 6) { | |
| 374 | ForEach(items, id: \.self) { item in | |
| 375 | HStack(spacing: 3) { | |
| 376 | Text(item) | |
| 377 | Button { | |
| 378 | Task { await model.removeReviewRequest(item) } | |
| 379 | } label: { | |
| 380 | Image(systemName: "xmark.circle.fill") | |
| 381 | .foregroundStyle(.tertiary) | |
| 382 | } | |
| 383 | .disabled(model.working) | |
| 384 | } | |
| 385 | .font(.gbSans(.caption)) | |
| 386 | .padding(.horizontal, 8) | |
| 387 | .padding(.vertical, 3) | |
| 388 | .background(Color.secondary.opacity(0.07), in: gbChipShape) | |
| 389 | .overlay(gbChipShape.stroke(Color.secondary.opacity(0.35), lineWidth: 1)) | |
| 390 | } | |
| 391 | } | |
| 392 | } | |
| 393 | } | |
| 394 | } | |
| 395 | ||
| 396 | 369 | private var diffSection: some View { |
| 397 | 370 | Section { |
| 398 | 371 | NavigationLink(value: MRRoute.diff(repo: model.repoPath, number: model.number)) { |