mirror of
https://codeberg.org/secana/Forji.git
synced 2026-06-16 05:13:55 -07:00
feat: disable PR view for mirrored repos
This commit is contained in:
parent
5aa65525cf
commit
25de1be2d9
1 changed files with 13 additions and 2 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue