Ablage und AirDrop teilen sich eine Kachel
Zwei eigene Kacheln waren zu viel des Guten: beide zeigen im Ruhezustand nichts als eine leere Fläche mit einem Satz darin, und zusammen nahmen sie ein Drittel des Panels. Jetzt übereinander in einer Kachel — oben die Ablegefläche fürs Senden, darunter die Ablage mit ihrer Liste. AirDrop steht dabei nebeneinander statt übereinander: in 52 Punkten Höhe ist für Symbol über Text kein Platz. Das eigenständige AirDrop-Widget entfällt. Gespeicherte Layouts, die es noch nennen, verlieren den Eintrag beim Laden — dafür ist der Filter da. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,21 +31,47 @@ public enum AirDrop {
|
||||
|
||||
/// Eine Fläche, auf die man Dateien fallen lässt, um sie zu verschicken.
|
||||
public struct AirDropView: View {
|
||||
/// Schmal, wenn sie sich die Kachel mit der Ablage teilt.
|
||||
private let compact: Bool
|
||||
@State private var isTargeted = false
|
||||
@State private var failed = false
|
||||
|
||||
public init() {}
|
||||
public init(compact: Bool = false) {
|
||||
self.compact = compact
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
VStack(spacing: 6) {
|
||||
Image(systemName: "shareplay")
|
||||
.font(.system(size: 20, weight: .light))
|
||||
.foregroundStyle(isTargeted ? Onyx.Color.accent : Onyx.Color.textTertiary)
|
||||
Text(failed ? "airdrop.unavailable" : "airdrop.hint", bundle: .module)
|
||||
.font(Onyx.Font.caption)
|
||||
.foregroundStyle(failed ? Onyx.Color.warning : Onyx.Color.textSecondary)
|
||||
.multilineTextAlignment(.center)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
Group {
|
||||
if compact {
|
||||
// Nebeneinander statt übereinander: in 52 Punkten Höhe ist für
|
||||
// Symbol über Text kein Platz.
|
||||
HStack(spacing: 8) {
|
||||
Image(systemName: "shareplay")
|
||||
.font(.system(size: 15, weight: .light))
|
||||
.foregroundStyle(isTargeted ? Onyx.Color.accent
|
||||
: Onyx.Color.textTertiary)
|
||||
Text(failed ? "airdrop.unavailable" : "airdrop.hint", bundle: .module)
|
||||
.font(Onyx.Font.caption)
|
||||
.foregroundStyle(failed ? Onyx.Color.warning
|
||||
: Onyx.Color.textSecondary)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
Spacer(minLength: 0)
|
||||
}
|
||||
.padding(.horizontal, 8)
|
||||
} else {
|
||||
VStack(spacing: 6) {
|
||||
Image(systemName: "shareplay")
|
||||
.font(.system(size: 20, weight: .light))
|
||||
.foregroundStyle(isTargeted ? Onyx.Color.accent
|
||||
: Onyx.Color.textTertiary)
|
||||
Text(failed ? "airdrop.unavailable" : "airdrop.hint", bundle: .module)
|
||||
.font(Onyx.Font.caption)
|
||||
.foregroundStyle(failed ? Onyx.Color.warning
|
||||
: Onyx.Color.textSecondary)
|
||||
.multilineTextAlignment(.center)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.background {
|
||||
@@ -60,17 +86,3 @@ public struct AirDropView: View {
|
||||
.animation(Onyx.Motion.value, value: isTargeted)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Widget
|
||||
|
||||
public struct AirDropWidget: OnyxWidget {
|
||||
public let id = "airdrop"
|
||||
public var displayName: String { String(localized: "airdrop.name", bundle: .module) }
|
||||
public let symbolName = "shareplay"
|
||||
|
||||
public init() {}
|
||||
|
||||
public func makeView() -> AnyView {
|
||||
AnyView(AirDropView())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user