feat: disable PR view for mirrored repos

This commit is contained in:
Stefan Hausotte 2026-03-27 13:33:15 +01:00
parent 5aa65525cf
commit 25de1be2d9

View file

@ -27,7 +27,7 @@ struct RepositoryDetailView: View {
_selectedBranch = State(initialValue: repository.defaultBranch ?? "main")
}
enum DetailTab: String, CaseIterable {
enum DetailTab: String {
case code = "Code"
case issues = "Issues"
case pulls = "Pull Requests"
@ -41,6 +41,17 @@ struct RepositoryDetailView: View {
}
}
private var availableTabs: [DetailTab] {
var tabs: [DetailTab] = [.code]
if repository.hasIssues != false {
tabs.append(.issues)
}
if repository.hasPullRequests != false {
tabs.append(.pulls)
}
return tabs
}
var body: some View {
VStack(spacing: 0) {
// Repository header
@ -99,7 +110,7 @@ struct RepositoryDetailView: View {
// Tab selector
Picker("View", selection: $selectedTab) {
ForEach(DetailTab.allCases, id: \.self) { tab in
ForEach(availableTabs, id: \.self) { tab in
Label(tab.rawValue, systemImage: tab.icon)
.tag(tab)
}