Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions SwiftCode/Views/Collaboration/PRCreateView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,11 @@ struct PRCreateView: View {
}

Section("Commits Included") {
let commits = manager.commits.commits(for: sourceBranchID)
if commits.isEmpty {
if sourceBranchCommits.isEmpty {
Text("No commits on source branch.")
.foregroundStyle(.secondary)
}
ForEach(commits) { commit in
ForEach(sourceBranchCommits) { commit in
PRCommitSelectionRow(title: commit.message, subtitle: "\(commit.authorID)", isSelected: selectedCommitIDs.contains(commit.id)) {
if selectedCommitIDs.contains(commit.id) {
selectedCommitIDs.remove(commit.id)
Expand Down Expand Up @@ -135,6 +134,10 @@ struct PRCreateView: View {
errorMessage = "Select at least one commit or enable Empty Pull Request."
}
}

private var sourceBranchCommits: [CollaborationCommit] {
manager.commits.commits(for: sourceBranchID)
}
}

private struct PRCommitSelectionRow: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ struct DeploymentDebugView: View {
}

Section("Deployment History") {
let logs = logger.logs.filter { $0.category == .deployments }
if logs.isEmpty {
if deploymentLogs.isEmpty {
Text("No deployment logs").foregroundColor(.secondary)
} else {
ForEach(logs) { log in
ForEach(deploymentLogs) { log in
VStack(alignment: .leading) {
Text(log.message)
.font(.caption)
Expand All @@ -33,4 +32,8 @@ struct DeploymentDebugView: View {
}
.navigationTitle("Deployment Debug")
}

private var deploymentLogs: [LogEntry] {
logger.logs.filter { $0.category == .deployments }
}
}
9 changes: 5 additions & 4 deletions SwiftCode/Views/Utilities/FilePreviewView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,11 @@ struct FilePreviewView: View {
}
}
Section("Content") {
let size = rawText.count
infoRow(label: "Characters", value: "\(size)")
infoRow(label: "Lines", value: "\(rawText.components(separatedBy: "\n").count)")
infoRow(label: "Words", value: "\(rawText.components(separatedBy: .whitespacesAndNewlines).filter { !$0.isEmpty }.count)")
Group {
infoRow(label: "Characters", value: "\(rawText.count)")
infoRow(label: "Lines", value: "\(rawText.components(separatedBy: "\n").count)")
infoRow(label: "Words", value: "\(rawText.components(separatedBy: .whitespacesAndNewlines).filter { !$0.isEmpty }.count)")
}
}
}
.listStyle(.insetGrouped)
Expand Down