diff --git a/Onyx/OnyxApp.swift b/Onyx/OnyxApp.swift index 150c377..f42e556 100644 --- a/Onyx/OnyxApp.swift +++ b/Onyx/OnyxApp.swift @@ -229,8 +229,9 @@ final class AppDelegate: NSObject, NSApplicationDelegate { let shelfStore = ShelfStore() self.shelfStore = shelfStore + // AirDrop steckt in der Ablage-Kachel — zwei eigene Kacheln für je + // eine leere Ablegefläche waren ein Drittel des Panels. WidgetRegistry.shared.register(ShelfWidget(store: shelfStore)) - WidgetRegistry.shared.register(AirDropWidget()) } private func applyContentSize() { diff --git a/Packages/OnyxKit/Sources/ShelfProvider/AirDropWidget.swift b/Packages/OnyxKit/Sources/ShelfProvider/AirDropWidget.swift index d7cf18c..74b3546 100644 --- a/Packages/OnyxKit/Sources/ShelfProvider/AirDropWidget.swift +++ b/Packages/OnyxKit/Sources/ShelfProvider/AirDropWidget.swift @@ -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()) - } -} diff --git a/Packages/OnyxKit/Sources/ShelfProvider/Localizable.xcstrings b/Packages/OnyxKit/Sources/ShelfProvider/Localizable.xcstrings index fdcdfec..c59cc7f 100644 --- a/Packages/OnyxKit/Sources/ShelfProvider/Localizable.xcstrings +++ b/Packages/OnyxKit/Sources/ShelfProvider/Localizable.xcstrings @@ -6,13 +6,13 @@ "de": { "stringUnit": { "state": "translated", - "value": "Dateien zum Senden ablegen" + "value": "Zum Senden ablegen" } }, "en": { "stringUnit": { "state": "translated", - "value": "Drop files to send" + "value": "Drop to send" } } } @@ -118,13 +118,13 @@ "de": { "stringUnit": { "state": "translated", - "value": "Ablage" + "value": "Ablage & AirDrop" } }, "en": { "stringUnit": { "state": "translated", - "value": "Shelf" + "value": "Shelf & AirDrop" } } } diff --git a/Packages/OnyxKit/Sources/ShelfProvider/ShelfWidget.swift b/Packages/OnyxKit/Sources/ShelfProvider/ShelfWidget.swift index 4c489c0..c9c7e67 100644 --- a/Packages/OnyxKit/Sources/ShelfProvider/ShelfWidget.swift +++ b/Packages/OnyxKit/Sources/ShelfProvider/ShelfWidget.swift @@ -187,6 +187,12 @@ private struct ShelfRow: View { // MARK: - Widget +/// Ablage und AirDrop in **einer** 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. Übereinander in einer Kachel bleibt beides +/// erreichbar und kostet halb so viel Platz. public struct ShelfWidget: OnyxWidget { public let id = "shelf" public var displayName: String { String(localized: "shelf.name", bundle: .module) } @@ -197,6 +203,17 @@ public struct ShelfWidget: OnyxWidget { public init(store: ShelfStore) { self.store = store } public func makeView() -> AnyView { - AnyView(ShelfView(store: store)) + AnyView( + VStack(spacing: 8) { + // AirDrop oben und schmal: es ist eine reine Ablegefläche ohne + // Zustand, die Ablage darunter braucht den Platz für ihre Liste. + AirDropView(compact: true) + .frame(height: 52) + + Divider().overlay(Onyx.Color.hairline) + + ShelfView(store: store) + } + ) } }