feat: add "mirror" badge for mirrored repos #8

This commit is contained in:
Stefan Hausotte 2026-03-09 20:41:34 +01:00
parent 79742e761d
commit 26bba7d7ee
4 changed files with 33 additions and 36 deletions

View file

@ -0,0 +1,15 @@
import SwiftUI
struct RepoBadge: View {
let title: String
let systemImage: String
var body: some View {
Label(title, systemImage: systemImage)
.font(.caption2)
.fontWeight(.medium)
.padding(.horizontal, 8)
.padding(.vertical, 3)
.glassEffect(.regular)
}
}

View file

@ -61,21 +61,15 @@ struct RepositoryDetailView: View {
Spacer()
if repository.private ?? false {
Label("Private", systemImage: "lock.fill")
.font(.caption2)
.fontWeight(.medium)
.padding(.horizontal, 8)
.padding(.vertical, 3)
.glassEffect(.regular)
RepoBadge(title: "Private", systemImage: "lock.fill")
}
if repository.archived ?? false {
Label("Archived", systemImage: "archivebox.fill")
.font(.caption2)
.fontWeight(.medium)
.padding(.horizontal, 8)
.padding(.vertical, 3)
.glassEffect(.regular)
RepoBadge(title: "Archived", systemImage: "archivebox.fill")
}
if repository.mirror ?? false {
RepoBadge(title: "Mirror", systemImage: "arrow.triangle.2.circlepath")
}
}

View file

@ -279,21 +279,15 @@ struct RepositoryRow: View {
Spacer()
if repository.private ?? false {
Label("Private", systemImage: "lock.fill")
.font(.caption2)
.fontWeight(.medium)
.padding(.horizontal, 8)
.padding(.vertical, 3)
.glassEffect(.regular)
RepoBadge(title: "Private", systemImage: "lock.fill")
}
if repository.archived ?? false {
Label("Archived", systemImage: "archivebox.fill")
.font(.caption2)
.fontWeight(.medium)
.padding(.horizontal, 8)
.padding(.vertical, 3)
.glassEffect(.regular)
RepoBadge(title: "Archived", systemImage: "archivebox.fill")
}
if repository.mirror ?? false {
RepoBadge(title: "Mirror", systemImage: "arrow.triangle.2.circlepath")
}
Button {

View file

@ -164,21 +164,15 @@ private struct RepositoryPickerRow: View {
Spacer()
if repository.private ?? false {
Label("Private", systemImage: "lock.fill")
.font(.caption2)
.fontWeight(.medium)
.padding(.horizontal, 8)
.padding(.vertical, 3)
.glassEffect(.regular)
RepoBadge(title: "Private", systemImage: "lock.fill")
}
if repository.archived ?? false {
Label("Archived", systemImage: "archivebox.fill")
.font(.caption2)
.fontWeight(.medium)
.padding(.horizontal, 8)
.padding(.vertical, 3)
.glassEffect(.regular)
RepoBadge(title: "Archived", systemImage: "archivebox.fill")
}
if repository.mirror ?? false {
RepoBadge(title: "Mirror", systemImage: "arrow.triangle.2.circlepath")
}
}
.padding(.vertical, 2)