Restructure PR detail: remove Commits tab, bottom icon tab bar, toolbar actions, markdown overview; bump to 1.9
Build iOS App / Build .ipa and publish source (push) Successful in 21s

- Remove the Commits tab (not useful).
- Move the section switcher to a bottom tab bar with icons (Overview /
  Conversation / Files / Checks) instead of a top segmented control.
- Move Review (menu) and Merge into the navigation toolbar, removing the
  bottom action bar.
- Add an Overview tab that renders the PR body as markdown via SwiftUI's
  built-in AttributedString(markdown:) (no third-party dependency).
- Bump to 1.9.
This commit is contained in:
Hermes committed 2026-08-12 22:28:18 +00:00
1 parent de9729b898
commit fce0385708
3 files changed
+100 -66

No files matched your search

+60 -42
View File
@@ -2,8 +2,7 @@ import SwiftUI
struct PRDetailView: View {
@StateObject private var vm: PRDetailViewModel
@State private var selectedTab: DetailTab = .conversation
@State private var showActionSheet = false
@State private var selectedTab: DetailTab = .overview
@State private var showCommentSheet = false
@State private var showMergeSheet = false
@State private var showCloseConfirm = false
@@ -11,11 +10,21 @@ struct PRDetailView: View {
@State private var requestChangesMode = false
enum DetailTab: String, CaseIterable, Identifiable {
case overview = "Overview"
case conversation = "Conversation"
case files = "Files"
case commits = "Commits"
case checks = "Checks"
var id: String { rawValue }
var icon: String {
switch self {
case .overview: return "doc.text"
case .conversation: return "bubble.left.and.bubble.right"
case .files: return "doc.plaintext"
case .checks: return "checkmark.circle"
}
}
}
init(repo: Repository, prNumber: Int) {
@@ -47,17 +56,6 @@ struct PRDetailView: View {
Button("OK", role: .cancel) {}
} message: { Text(vm.errorMessage ?? "") }
.overlay { if vm.busyMessage != nil { busyOverlay } }
.confirmationDialog("Actions", isPresented: $showActionSheet, titleVisibility: .visible) {
Button("Comment") { showCommentSheet = true }
Button("Approve") { Task { await vm.submitReview(state: "approved", comment: nil) } }
Button("Request changes") { requestChangesMode = true; showCommentSheet = true }
Button("Merge") { showMergeSheet = true }
if prIsOpen {
Button("Close", role: .destructive) { showCloseConfirm = true }
} else {
Button("Reopen") { Task { await vm.setState("open") } }
}
}
.confirmationDialog("Close this PR?", isPresented: $showCloseConfirm, titleVisibility: .visible) {
Button("Close", role: .destructive) { Task { await vm.setState("closed") } }
Button("Cancel", role: .cancel) {}
@@ -89,28 +87,24 @@ struct PRDetailView: View {
private func content(_ pr: PullRequest) -> some View {
VStack(spacing: 0) {
header(pr)
Picker("Tab", selection: $selectedTab) {
ForEach(DetailTab.allCases) { t in Text(t.rawValue).tag(t) }
}
.pickerStyle(.segmented)
.padding(.horizontal)
.padding(.bottom, 8)
ScrollView {
switch selectedTab {
case .overview: OverviewTab(pr: pr)
case .conversation: ConversationTab(vm: vm)
case .files: FilesTab(vm: vm)
case .commits: CommitsTab(commits: vm.commits)
case .checks: ChecksTab(vm: vm, onRerun: { showRerunConfirm = $0 })
}
}
if prIsOpen {
actionBar(pr)
}
bottomTabBar
}
.toolbar {
ToolbarItem(placement: .primaryAction) { reloadButton }
if prIsOpen {
ToolbarItem(placement: .primaryAction) { mergeButton }
ToolbarItem(placement: .primaryAction) { reviewMenu }
}
}
}
@@ -131,36 +125,60 @@ struct PRDetailView: View {
Text("Draft").font(.caption2).foregroundColor(.secondary)
}
}
if let body = pr.body, !body.isEmpty {
Text(body)
.font(.callout)
.frame(maxWidth: .infinity, alignment: .leading)
}
}
.padding()
.frame(maxWidth: .infinity, alignment: .leading)
.background(Color(.secondarySystemBackground))
}
@ViewBuilder
private func actionBar(_ pr: PullRequest) -> some View {
/// Bottom tab bar: icon-only navigation between the PR's sections.
private var bottomTabBar: some View {
HStack {
Button { showActionSheet = true } label: {
Label("Review", systemImage: "checkmark.bubble")
ForEach(DetailTab.allCases) { tab in
Button {
selectedTab = tab
} label: {
VStack(spacing: 2) {
Image(systemName: tab.icon)
.font(.system(size: 20))
Text(tab.rawValue)
.font(.caption2)
}
.foregroundColor(selectedTab == tab ? .accentColor : .secondary)
.frame(maxWidth: .infinity)
}
}
.buttonStyle(.borderedProminent)
Button("Merge") { showMergeSheet = true }
.buttonStyle(.bordered)
.disabled(vm.ciStatus == .failure &&
SettingsStore.shared.mergeGateMode == .block)
Spacer()
}
.padding()
.padding(.vertical, 6)
.background(.bar)
}
private var reviewMenu: some View {
Menu {
Button("Comment") { requestChangesMode = false; showCommentSheet = true }
Button("Approve") { Task { await vm.submitReview(state: "approved", comment: nil) } }
Button("Request changes") { requestChangesMode = true; showCommentSheet = true }
Divider()
if prIsOpen {
Button("Close", role: .destructive) { showCloseConfirm = true }
} else {
Button("Reopen") { Task { await vm.setState("open") } }
}
} label: {
Image(systemName: "checkmark.bubble")
}
}
private var mergeButton: some View {
Button {
showMergeSheet = true
} label: {
Image(systemName: "arrow.down.circle")
}
.disabled(vm.ciStatus == .failure &&
SettingsStore.shared.mergeGateMode == .block)
}
private var prIsOpen: Bool {
(vm.pr?.state.lowercased() ?? "") == "open"
}