mirror of
https://github.com/yattee/yattee.git
synced 2026-07-20 14:22:02 +00:00
The NavigationStack-level background wasn't enough: macOS draws its own translucent material behind pushed navigation pages, and Form/List containers draw a translucent scroll background on top of anything placed behind them, so several pages kept the wallpaper-tinted look. Bake the opaque background into SettingsFormContainer (covers all pages built on it, pushed or not) and add opaqueSettingsFormBackground(), which hides the container's scroll background before applying the opaque one, to every macOS-reachable Form/List settings page: player controls and its sub-editors, sidebar settings, edit source, legacy data import, subscription/playlist import, customize home and its shortcut style page, and the log viewer. Contributors, translators and the remote control device page get the plain opaque background. Claude-Session: https://claude.ai/code/session_0154KH8RAVAvm6iVanhmoW8o
117 lines
3.4 KiB
Swift
117 lines
3.4 KiB
Swift
//
|
|
// TranslationContributorsView.swift
|
|
// Yattee
|
|
//
|
|
// Displays Weblate translation contributors.
|
|
//
|
|
|
|
import NukeUI
|
|
import SwiftUI
|
|
|
|
struct TranslationContributorsView: View {
|
|
@State private var contributors: [TranslationContributor] = []
|
|
|
|
var body: some View {
|
|
content
|
|
.opaqueWindowBackground()
|
|
.navigationTitle(String(localized: "settings.translators.title"))
|
|
#if os(iOS)
|
|
.navigationBarTitleDisplayMode(.inline)
|
|
#endif
|
|
.task {
|
|
contributors = TranslationContributorsLoader.load()
|
|
}
|
|
}
|
|
|
|
// MARK: - Content
|
|
|
|
@ViewBuilder
|
|
private var content: some View {
|
|
if contributors.isEmpty {
|
|
ContentUnavailableView {
|
|
Label(String(localized: "settings.translators.empty"), systemImage: "globe")
|
|
}
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
} else {
|
|
contributorsList
|
|
}
|
|
}
|
|
|
|
private var contributorsList: some View {
|
|
SettingsFormContainer {
|
|
SettingsFormSection(footer: "settings.translators.section.footer") {
|
|
ForEach(contributors) { contributor in
|
|
contributorRow(contributor)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private func contributorRow(_ contributor: TranslationContributor) -> some View {
|
|
#if os(tvOS)
|
|
Button {} label: {
|
|
contributorRowContent(contributor)
|
|
}
|
|
#else
|
|
contributorRowContent(contributor)
|
|
#endif
|
|
}
|
|
|
|
private func contributorRowContent(_ contributor: TranslationContributor) -> some View {
|
|
HStack(spacing: 12) {
|
|
// Avatar
|
|
LazyImage(url: contributor.gravatarURL) { state in
|
|
ZStack {
|
|
Circle()
|
|
.fill(.quaternary)
|
|
.overlay {
|
|
if state.image == nil {
|
|
Text(String(contributor.displayName.prefix(1).uppercased()))
|
|
.font(.subheadline)
|
|
.fontWeight(.medium)
|
|
.foregroundStyle(.secondary)
|
|
}
|
|
}
|
|
|
|
if let image = state.image {
|
|
image
|
|
.resizable()
|
|
.aspectRatio(contentMode: .fill)
|
|
}
|
|
}
|
|
}
|
|
.frame(width: 40, height: 40)
|
|
.clipShape(Circle())
|
|
|
|
// Name and languages
|
|
VStack(alignment: .leading, spacing: 2) {
|
|
Text(contributor.displayName)
|
|
.font(.body)
|
|
.fontWeight(.semibold)
|
|
|
|
Text(contributor.languageSummary())
|
|
.font(.caption)
|
|
.foregroundStyle(.secondary)
|
|
.lineLimit(2)
|
|
}
|
|
|
|
Spacer()
|
|
|
|
// Total contributions badge
|
|
Text("\(contributor.totalContributions)")
|
|
.font(.caption)
|
|
.fontWeight(.medium)
|
|
.foregroundStyle(.secondary)
|
|
.padding(.horizontal, 8)
|
|
.padding(.vertical, 4)
|
|
.background(.quaternary, in: Capsule())
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
NavigationStack {
|
|
TranslationContributorsView()
|
|
}
|
|
}
|