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
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:
1 parent
de9729b898
commit
fce0385708
3 files changed
+100
-66
No files matched your search
+36
-20
@@ -142,28 +142,22 @@ struct FilesTab: View {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Commits
|
||||
// MARK: - Overview
|
||||
|
||||
/// Renders the PR body as markdown. Uses SwiftUI's built-in
|
||||
/// `AttributedString(markdown:)` so headings, bold, italic, links and inline
|
||||
/// code render without a third-party dependency.
|
||||
struct OverviewTab: View {
|
||||
let pr: PullRequest
|
||||
|
||||
struct CommitsTab: View {
|
||||
let commits: [PRCommit]
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 10) {
|
||||
ForEach(commits) { commit in
|
||||
HStack(alignment: .top, spacing: 10) {
|
||||
Text(commit.sha ?? commit.id)
|
||||
.font(.caption2.monospaced())
|
||||
.foregroundColor(.secondary)
|
||||
.frame(width: 60, alignment: .leading)
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text(commit.commit?.message ?? "(no message)")
|
||||
.font(.callout)
|
||||
.lineLimit(3)
|
||||
Text(commit.author?.name ?? "")
|
||||
.font(.caption2)
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
}
|
||||
Divider()
|
||||
VStack(alignment: .leading, spacing: 12) {
|
||||
if let body = pr.body, !body.isEmpty {
|
||||
MarkdownText(body)
|
||||
} else {
|
||||
Text("No description.")
|
||||
.font(.callout)
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
@@ -171,6 +165,28 @@ struct CommitsTab: View {
|
||||
}
|
||||
}
|
||||
|
||||
/// A Text view that renders a markdown string, falling back to plain text if
|
||||
/// the markdown can't be parsed.
|
||||
struct MarkdownText: View {
|
||||
let markdown: String
|
||||
|
||||
init(_ markdown: String) {
|
||||
self.markdown = markdown
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
if let attributed = try? AttributedString(markdown: markdown) {
|
||||
Text(attributed)
|
||||
.font(.callout)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
} else {
|
||||
Text(markdown)
|
||||
.font(.callout)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Checks
|
||||
|
||||
struct ChecksTab: View {
|
||||
|
||||
Reference in new issue
Block a user