PM-Oberfläche: Favoriten/Navigator/Aufgaben, Tabs, PM-Filter, PM-Kacheln, IPTC-Layout wie PM, ⌘I Mass-Edit, ⌘U Upload, Code-Ersetzung live, 8 Farbklassen, paralleles + gecachtes Metadaten-Laden, BILDER/INPUT+SENT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012bGzgsxrmbBhDzeMV2L57D
This commit is contained in:
1 parent
d100249c12
commit
c0ee93995f
18 files changed
+1311
-515
No files matched your search
@@ -0,0 +1,71 @@
|
||||
import SwiftUI
|
||||
import LichtkastenCore
|
||||
|
||||
/// ⌘U – PM "Upload Photos" dialog for the selected images.
|
||||
struct UploadWindow: View {
|
||||
@EnvironmentObject var state: AppState
|
||||
@Environment(\.dismissWindow) private var dismissWindow
|
||||
@AppStorage("lastUploadTarget") private var target = ""
|
||||
|
||||
private var destination: FTPDestination? { state.settings.ftpDestinations.first { $0.id.uuidString == target } }
|
||||
|
||||
private var variant: UploadVariant {
|
||||
target == "immich" ? state.settings.immich.variant : destination?.variant ?? .jpeg
|
||||
}
|
||||
|
||||
private var files: [URL] { state.selectedItems.flatMap { state.uploadFiles(for: $0, variant: variant) } }
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 14) {
|
||||
Text("Bilder hochladen").font(.title3.bold())
|
||||
Form {
|
||||
Picker("Ziel", selection: $target) {
|
||||
Text("– bitte wählen –").tag("")
|
||||
ForEach(state.settings.ftpDestinations) { d in Text(d.name).tag(d.id.uuidString) }
|
||||
if state.settings.immich.enabled { Text("Immich").tag("immich") }
|
||||
}
|
||||
if let d = destination {
|
||||
LabeledContent("Server", value: "\(d.proto.rawValue) · \(d.host):\(d.port)")
|
||||
if let i = state.settings.ftpDestinations.firstIndex(where: { $0.id == d.id }) {
|
||||
TextField("Zielordner", text: $state.settings.ftpDestinations[i].remoteDirectory)
|
||||
TextField("Umbenennen (leer = Originalname)", text: $state.settings.ftpDestinations[i].renamePattern)
|
||||
Picker("Dateien", selection: $state.settings.ftpDestinations[i].variant) {
|
||||
ForEach(UploadVariant.allCases, id: \.self) { Text($0.rawValue).tag($0) }
|
||||
}
|
||||
}
|
||||
if d.username.isEmpty || Keychain.get(d.keychainAccount) == nil {
|
||||
Label("Benutzer/Passwort fehlen – Einstellungen → FTP", systemImage: "exclamationmark.triangle.fill")
|
||||
.foregroundStyle(.orange)
|
||||
}
|
||||
} else if target == "immich" {
|
||||
LabeledContent("Server", value: state.settings.immich.serverURL)
|
||||
LabeledContent("Album", value: state.settings.immich.albumName.isEmpty ? "–" : state.settings.immich.albumName)
|
||||
}
|
||||
LabeledContent("Auswahl", value: "\(state.selectedItems.count) Bild(er) → \(files.count) Datei(en)")
|
||||
if files.count < state.selectedItems.count {
|
||||
Text("Einige Bilder haben kein JPEG – zuerst in Lightroom exportieren (⌘⌥L).")
|
||||
.font(.caption).foregroundStyle(.orange)
|
||||
}
|
||||
}
|
||||
.formStyle(.grouped)
|
||||
HStack {
|
||||
SettingsLink { Text("Server verwalten …") }
|
||||
Spacer()
|
||||
Button("Abbrechen") { dismissWindow(id: "upload") }.keyboardShortcut(.cancelAction)
|
||||
Button("Hochladen") {
|
||||
state.upload(to: target)
|
||||
state.openWindow("tasks")
|
||||
dismissWindow(id: "upload")
|
||||
}
|
||||
.keyboardShortcut(.defaultAction)
|
||||
.buttonStyle(.borderedProminent)
|
||||
.disabled(target.isEmpty || files.isEmpty)
|
||||
}
|
||||
}
|
||||
.padding(18)
|
||||
.frame(width: 560)
|
||||
.onAppear {
|
||||
if target.isEmpty, let first = state.settings.ftpDestinations.first { target = first.id.uuidString }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user