Design-Fixes: Einstellungen nicht mehr abgeschnitten (gruppierte Formulare, warme Zeilen), Ingest-Kartenliste als Karten mit Leerzustand, Upload-Fenster neu (Ziel-Karten, Optionen, Zusammenfassung)
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
54f5742a60
commit
22b2611228
4 files changed
+245
-76
No files matched your search
@@ -40,21 +40,24 @@ struct IngestView: View {
|
||||
}
|
||||
pathPreview
|
||||
HStack {
|
||||
Button("Variablen …") { state.openWindow("codes") }
|
||||
Button("Variablen …") { state.openWindow("codes") }.buttonStyle(LKButtonStyle())
|
||||
Spacer()
|
||||
Button("Abbrechen") { state.pendingIngestSources = []; dismiss() }.keyboardShortcut(.cancelAction)
|
||||
Button("Abbrechen") { state.pendingIngestSources = []; dismiss() }
|
||||
.buttonStyle(LKButtonStyle())
|
||||
.keyboardShortcut(.cancelAction)
|
||||
Button("Ingest") {
|
||||
state.startIngest(sources: sources, fromCards: mode == .disks)
|
||||
state.pendingIngestSources = []
|
||||
dismiss()
|
||||
}
|
||||
.keyboardShortcut(.defaultAction)
|
||||
.buttonStyle(.borderedProminent)
|
||||
.buttonStyle(LKButtonStyle(primary: true))
|
||||
.disabled(sources.isEmpty || state.settings.ingest.primaryDestination.isEmpty || state.ingestRunning)
|
||||
}
|
||||
}
|
||||
.padding(18)
|
||||
.frame(width: 980)
|
||||
.background(LK.ground)
|
||||
.onAppear(perform: setup)
|
||||
}
|
||||
|
||||
@@ -72,26 +75,33 @@ struct IngestView: View {
|
||||
|
||||
switch mode {
|
||||
case .disks:
|
||||
List(cards, selection: $selectedCards) { c in
|
||||
HStack {
|
||||
Image(systemName: "sdcard")
|
||||
Text(c.name)
|
||||
Spacer()
|
||||
Text(c.used).foregroundStyle(.secondary)
|
||||
}
|
||||
.tag(c.dcim)
|
||||
}.scrollContentBackground(.hidden).background(LK.deep)
|
||||
.frame(height: 150)
|
||||
cardList
|
||||
HStack {
|
||||
Button("Neu suchen") { rescan() }
|
||||
Button("Neu suchen") { rescan() }.buttonStyle(LKButtonStyle(compact: true))
|
||||
Button("Auswerfen") {
|
||||
for c in cards where selectedCards.contains(c.dcim) { try? NSWorkspace.shared.unmountAndEjectDevice(at: c.volume) }
|
||||
rescan()
|
||||
}
|
||||
.buttonStyle(LKButtonStyle(compact: true))
|
||||
.disabled(selectedCards.isEmpty)
|
||||
}
|
||||
case .folders:
|
||||
List(folders, id: \.self) { Text($0.path).lineLimit(1).truncationMode(.middle) }.scrollContentBackground(.hidden).background(LK.deep).frame(height: 150)
|
||||
VStack(alignment: .leading, spacing: 6) {
|
||||
if folders.isEmpty {
|
||||
emptyBox(icon: "folder.badge.plus", text: "Noch keine Ordner – „Ordner hinzufügen …“")
|
||||
}
|
||||
ForEach(folders, id: \.self) { f in
|
||||
HStack {
|
||||
Image(systemName: "folder.fill").foregroundStyle(LK.amber)
|
||||
Text(f.path).font(LK.mono(12)).lineLimit(1).truncationMode(.middle)
|
||||
Spacer()
|
||||
Button { folders.removeAll { $0 == f } } label: { Image(systemName: "xmark") }.buttonStyle(.plain).foregroundStyle(LK.muted)
|
||||
}
|
||||
.padding(10)
|
||||
.background(RoundedRectangle(cornerRadius: 9).fill(LK.raised))
|
||||
}
|
||||
}
|
||||
.frame(minHeight: 150, alignment: .top)
|
||||
HStack {
|
||||
Button("Ordner hinzufügen …") { pickFolders() }
|
||||
Button("Leeren") { folders = [] }.disabled(folders.isEmpty)
|
||||
@@ -131,13 +141,13 @@ struct IngestView: View {
|
||||
GroupBox("Zielordner") {
|
||||
VStack(alignment: .leading, spacing: 6) {
|
||||
HStack {
|
||||
Text("Primär:").frame(width: 80, alignment: .leading)
|
||||
Text("Primär:").frame(width: 96, alignment: .leading)
|
||||
Button("Primäres Ziel …") { pick(ingest.primaryDestination) }
|
||||
}
|
||||
Text(state.settings.ingest.primaryDestination.isEmpty ? "–" : state.settings.ingest.primaryDestination)
|
||||
.font(.caption).foregroundStyle(.secondary).lineLimit(1).truncationMode(.middle)
|
||||
HStack {
|
||||
Toggle("Sekundär:", isOn: ingest.secondaryEnabled).frame(width: 80, alignment: .leading)
|
||||
Toggle("Sekundär:", isOn: ingest.secondaryEnabled).fixedSize()
|
||||
Button("Sekundäres Ziel …") { pick(ingest.backupDestination) }
|
||||
.disabled(!state.settings.ingest.secondaryEnabled)
|
||||
}
|
||||
@@ -217,6 +227,52 @@ struct IngestView: View {
|
||||
|
||||
// MARK: Helpers
|
||||
|
||||
/// Memory cards as selectable rows (instead of a black system list).
|
||||
@ViewBuilder
|
||||
private var cardList: some View {
|
||||
VStack(alignment: .leading, spacing: 6) {
|
||||
if cards.isEmpty {
|
||||
emptyBox(icon: "sdcard", text: "Keine Speicherkarte gefunden – Karte einstecken oder „Neu suchen“")
|
||||
}
|
||||
ForEach(cards) { c in
|
||||
let on = selectedCards.contains(c.dcim)
|
||||
Button {
|
||||
if on { selectedCards.remove(c.dcim) } else { selectedCards.insert(c.dcim) }
|
||||
} label: {
|
||||
HStack(spacing: 12) {
|
||||
Image(systemName: "sdcard.fill")
|
||||
.font(.system(size: 16))
|
||||
.foregroundStyle(on ? LK.onAmber : LK.text2)
|
||||
.frame(width: 32, height: 32)
|
||||
.background(RoundedRectangle(cornerRadius: 8).fill(on ? LK.amber : LK.deep))
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text(c.name).font(.system(size: 14, weight: .bold)).foregroundStyle(LK.text)
|
||||
Text(c.used).font(LK.mono(11)).foregroundStyle(LK.muted)
|
||||
}
|
||||
Spacer()
|
||||
Image(systemName: on ? "checkmark.circle.fill" : "circle")
|
||||
.font(.system(size: 18)).foregroundStyle(on ? LK.amber : LK.faint)
|
||||
}
|
||||
.padding(10)
|
||||
.background(RoundedRectangle(cornerRadius: 10).fill(on ? LK.selected : LK.raised))
|
||||
.overlay(RoundedRectangle(cornerRadius: 10).stroke(on ? LK.amber : LK.border, lineWidth: on ? 2 : 1))
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
}
|
||||
.frame(minHeight: 150, alignment: .top)
|
||||
}
|
||||
|
||||
private func emptyBox(icon: String, text: String) -> some View {
|
||||
VStack(spacing: 10) {
|
||||
Image(systemName: icon).font(.system(size: 28)).foregroundStyle(LK.faint)
|
||||
Text(text).font(.system(size: 12)).foregroundStyle(LK.muted).multilineTextAlignment(.center)
|
||||
}
|
||||
.frame(maxWidth: .infinity, minHeight: 140)
|
||||
.background(RoundedRectangle(cornerRadius: 10).strokeBorder(LK.borderStrong, style: StrokeStyle(lineWidth: 1, dash: [5, 4])))
|
||||
}
|
||||
|
||||
private func setup() {
|
||||
rescan()
|
||||
if !state.pendingIngestSources.isEmpty {
|
||||
|
||||
@@ -73,7 +73,7 @@ struct GeneralSettings: View {
|
||||
Toggle("Nach Bewertung/Tag automatisch zum nächsten Bild", isOn: $state.settings.autoAdvance)
|
||||
Text("1–8 = Farbklasse · 0 = keine · ⌥1–5 = Sterne · T = Tag · I = IPTC-Info · ⌘I = IPTC für Auswahl · ⌘U = Hochladen · ⌘E = Lightroom · ⌘⌥S = INPUT ⇄ SENT")
|
||||
.font(.caption).foregroundStyle(.secondary)
|
||||
}
|
||||
}.lkRow()
|
||||
Section("Zoom") {
|
||||
Picker("Maximaler Zoom in der Vorschau", selection: $state.settings.maxZoom) {
|
||||
Text("100 %").tag(1.0); Text("200 %").tag(2.0); Text("400 %").tag(4.0); Text("800 %").tag(8.0); Text("1600 %").tag(16.0)
|
||||
@@ -82,18 +82,18 @@ struct GeneralSettings: View {
|
||||
Text("Größte Vorschaubilder: \(Int(state.settings.maxThumbnailSize)) px")
|
||||
}
|
||||
Text("Vorschau: Z = Einpassen/100 %, + / − oder Trackpad zum Zoomen.").font(.caption).foregroundStyle(.secondary)
|
||||
}
|
||||
}.lkRow()
|
||||
Section("Ansicht") {
|
||||
Toggle("Matchday-Ansicht (Teamleiste, Spieler:innen-Liste, Teamfarben)", isOn: $state.settings.jersey.matchday)
|
||||
if state.settings.jersey.matchday && state.settings.jersey.teams.count < 2 {
|
||||
Text("Braucht zwei Teams in Bild → Trikot-Erkennung einrichten.").font(.caption).foregroundStyle(.secondary)
|
||||
}
|
||||
Toggle("IPTC-Panel neben der Vorschau", isOn: $state.settings.loupePanel)
|
||||
}
|
||||
}.lkRow()
|
||||
Section("Ingest") {
|
||||
Toggle("Ingest-Fenster öffnen, wenn eine Speicherkarte erkannt wird", isOn: $state.settings.autoIngestOnCardMount)
|
||||
Toggle("Karte nach dem Ingest automatisch auswerfen", isOn: $state.settings.ingest.unmountAfter)
|
||||
}
|
||||
}.lkRow()
|
||||
Section("exiftool") {
|
||||
HStack {
|
||||
TextField("Pfad (leer = automatisch)", text: $state.settings.exiftoolPath)
|
||||
@@ -104,12 +104,12 @@ struct GeneralSettings: View {
|
||||
} else {
|
||||
Label("Nicht gefunden – Terminal: brew install exiftool", systemImage: "xmark.octagon.fill").foregroundStyle(.red)
|
||||
}
|
||||
}
|
||||
}.lkRow()
|
||||
Section("Variablen") {
|
||||
TextField("Datumsformat für {date}", text: $state.settings.dateFormat)
|
||||
Text("z. B. dd.MM.yyyy → 03.11.2026 · d. MMMM yyyy → 3. November 2026")
|
||||
.font(.caption).foregroundStyle(.secondary)
|
||||
}
|
||||
}.lkRow()
|
||||
}
|
||||
.lkForm()
|
||||
}
|
||||
@@ -144,6 +144,7 @@ struct FTPSettings: View {
|
||||
|
||||
if let i = index {
|
||||
Form {
|
||||
Section("Server") {
|
||||
TextField("Name", text: $state.settings.ftpDestinations[i].name)
|
||||
Picker("Protokoll", selection: Binding(
|
||||
get: { state.settings.ftpDestinations[i].proto },
|
||||
@@ -175,6 +176,7 @@ struct FTPSettings: View {
|
||||
if testing { ProgressView().controlSize(.small) }
|
||||
Text(testResult).font(.caption).lineLimit(3)
|
||||
}
|
||||
}.lkRow()
|
||||
}
|
||||
.lkForm()
|
||||
.onAppear { password = Keychain.get(state.settings.ftpDestinations[i].keychainAccount) ?? "" }
|
||||
@@ -208,6 +210,7 @@ struct ImmichSettingsView: View {
|
||||
|
||||
var body: some View {
|
||||
Form {
|
||||
Section("Immich") {
|
||||
Toggle("Immich-Upload aktivieren", isOn: $state.settings.immich.enabled)
|
||||
TextField("Server-URL", text: $state.settings.immich.serverURL, prompt: Text("https://immich.example.de"))
|
||||
SecureField("API-Schlüssel (Schlüsselbund)", text: $apiKey)
|
||||
@@ -229,6 +232,7 @@ struct ImmichSettingsView: View {
|
||||
}
|
||||
Text("API-Schlüssel in Immich: Konto-Einstellungen → API-Schlüssel. Benötigte Rechte: asset.upload, album.read, album.create, albumAsset.create.")
|
||||
.font(.caption).foregroundStyle(.secondary)
|
||||
}.lkRow()
|
||||
}
|
||||
.lkForm()
|
||||
.onAppear { apiKey = Keychain.get(ImmichSettings.keychainAccount) ?? "" }
|
||||
@@ -267,16 +271,16 @@ struct LightroomSettingsView: View {
|
||||
if !pluginMessage.isEmpty { Text(pluginMessage).font(.caption) }
|
||||
Text("Ohne Plugin öffnet ⌘⇧L den normalen Importdialog von Lightroom.")
|
||||
.font(.caption).foregroundStyle(.secondary)
|
||||
}
|
||||
}.lkRow()
|
||||
Section("Import") {
|
||||
TextField("Entwicklungsvorgabe (exakter Name, optional „Ordner/Name“)", text: $state.settings.lightroom.developPreset)
|
||||
TextField("Sammlung (leer = keine)", text: $state.settings.lightroom.collection)
|
||||
}
|
||||
}.lkRow()
|
||||
Section("Bearbeiten (⌘E)") {
|
||||
Toggle("Entwicklungsvorgabe auch bei ⌘E anwenden", isOn: $state.settings.lightroom.presetOnEdit)
|
||||
Text("⌘E importiert die Auswahl in den offenen Katalog und öffnet das Entwickeln-Modul.")
|
||||
.font(.caption).foregroundStyle(.secondary)
|
||||
}
|
||||
}.lkRow()
|
||||
Section("JPEG-Export (⌘⌥L) → SENT") {
|
||||
Picker("Exportziel", selection: $state.settings.lightroom.exportTarget) {
|
||||
ForEach(ExportTarget.allCases, id: \.self) { Text($0.title).tag($0) }
|
||||
@@ -301,13 +305,13 @@ struct LightroomSettingsView: View {
|
||||
Text("sRGB").tag("sRGB"); Text("Adobe RGB").tag("AdobeRGB")
|
||||
}
|
||||
Toggle("Original-IPTC nach Export erneut schreiben (PM-identischer Aufbau)", isOn: $state.settings.lightroom.rewriteIPTCAfterExport)
|
||||
}
|
||||
}.lkRow()
|
||||
Section("Nach dem Export automatisch hochladen") {
|
||||
ForEach(state.settings.ftpDestinations) { d in
|
||||
Toggle("FTP: \(d.name)", isOn: uploadBinding(d.id.uuidString))
|
||||
}
|
||||
Toggle("Immich", isOn: uploadBinding("immich")).disabled(!state.settings.immich.enabled)
|
||||
}
|
||||
}.lkRow()
|
||||
}
|
||||
.lkForm()
|
||||
}
|
||||
@@ -340,7 +344,7 @@ struct CodesSettings: View {
|
||||
Section("Code-Ersetzung") {
|
||||
Text("\(state.codeLibrary.sets.filter(\.enabled).count) von \(state.codeLibrary.sets.count) Teams aktiv · \(state.codes.table.count) Codes")
|
||||
Button("Code-Ersetzungen öffnen … (⌘⇧K)") { state.openWindow("codes") }
|
||||
}
|
||||
}.lkRow()
|
||||
}
|
||||
.lkForm()
|
||||
}
|
||||
|
||||
@@ -144,19 +144,16 @@ extension View {
|
||||
.background(LKWindowStyler())
|
||||
}
|
||||
|
||||
/// Settings-like forms without Apple's gray boxes: two columns (label | control) on the Leuchttisch
|
||||
/// ground, scrollable.
|
||||
/// Settings-like forms: Apple's grouped layout (labels left, controls right, wraps correctly),
|
||||
/// but on the Leuchttisch ground with warm cards (rows get `.lkRow()`).
|
||||
func lkForm() -> some View {
|
||||
ScrollView {
|
||||
self.formStyle(.columns)
|
||||
.scrollContentBackground(.hidden)
|
||||
.padding(.horizontal, 28)
|
||||
.padding(.vertical, 22)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(LK.ground)
|
||||
self.formStyle(.grouped)
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(LK.ground)
|
||||
}
|
||||
|
||||
/// Row/section background inside an `lkForm()`.
|
||||
func lkRow() -> some View { self.listRowBackground(LK.card) }
|
||||
}
|
||||
|
||||
/// GroupBox as a Leuchttisch card (instead of Apple's gray box).
|
||||
|
||||
@@ -1,73 +1,185 @@
|
||||
import SwiftUI
|
||||
import LichtkastenCore
|
||||
|
||||
/// ⌘U – PM "Upload Photos" dialog for the selected images.
|
||||
/// ⌘U – upload dialog in the Leuchttisch look: destinations as cards, options of the chosen one, summary.
|
||||
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 destIndex: Int? { state.settings.ftpDestinations.firstIndex { $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) } }
|
||||
private var totalBytes: Int64 {
|
||||
files.reduce(0) { sum, f in sum + (((try? FileManager.default.attributesOfItem(atPath: f.path)[.size]) as? NSNumber)?.int64Value ?? 0) }
|
||||
}
|
||||
|
||||
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") }
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
// header
|
||||
HStack(spacing: 14) {
|
||||
Image(systemName: "icloud.and.arrow.up")
|
||||
.font(.system(size: 20, weight: .semibold))
|
||||
.foregroundStyle(LK.onAmber)
|
||||
.frame(width: 42, height: 42)
|
||||
.background(RoundedRectangle(cornerRadius: 11).fill(LK.amber))
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text("Bilder hochladen").font(.system(size: 18, weight: .bold)).foregroundStyle(LK.text)
|
||||
Text(summary).font(LK.mono(12)).foregroundStyle(LK.text2)
|
||||
}
|
||||
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) }
|
||||
Spacer()
|
||||
}
|
||||
.padding(22)
|
||||
|
||||
Rectangle().fill(LK.border).frame(height: 1)
|
||||
|
||||
ScrollView {
|
||||
VStack(alignment: .leading, spacing: 18) {
|
||||
LKSectionLabel(title: "Ziel")
|
||||
LazyVGrid(columns: [GridItem(.adaptive(minimum: 220), spacing: 12)], spacing: 12) {
|
||||
ForEach(state.settings.ftpDestinations) { d in
|
||||
destinationCard(id: d.id.uuidString, icon: "server.rack", title: d.name,
|
||||
subtitle: d.host.isEmpty ? "Server fehlt" : d.host,
|
||||
detail: d.remoteDirectory, warning: credentialsMissing(d))
|
||||
}
|
||||
if state.settings.immich.enabled {
|
||||
destinationCard(id: "immich", icon: "photo.stack", title: "Immich",
|
||||
subtitle: URL(string: state.settings.immich.serverURL)?.host ?? state.settings.immich.serverURL,
|
||||
detail: albumPreview, warning: false)
|
||||
}
|
||||
}
|
||||
if d.username.isEmpty || Keychain.get(d.keychainAccount) == nil {
|
||||
Label("Benutzer/Passwort fehlen – Einstellungen → FTP", systemImage: "exclamationmark.triangle.fill")
|
||||
.foregroundStyle(.orange)
|
||||
|
||||
if let i = destIndex {
|
||||
LKSectionLabel(title: "Optionen").padding(.top, 4)
|
||||
VStack(spacing: 0) {
|
||||
optionRow("Zielordner") {
|
||||
TextField("/", text: $state.settings.ftpDestinations[i].remoteDirectory).textFieldStyle(.plain).lkField()
|
||||
}
|
||||
divider
|
||||
optionRow("Umbenennen") {
|
||||
TextField("leer = Originalname, z. B. {isodate}_{filenamebase}", text: $state.settings.ftpDestinations[i].renamePattern)
|
||||
.textFieldStyle(.plain).lkField()
|
||||
}
|
||||
divider
|
||||
optionRow("Dateien") {
|
||||
LKSegmented(options: UploadVariant.allCases.map { ($0, $0.rawValue) },
|
||||
selection: $state.settings.ftpDestinations[i].variant)
|
||||
}
|
||||
}
|
||||
.background(RoundedRectangle(cornerRadius: 12).fill(LK.card))
|
||||
.overlay(RoundedRectangle(cornerRadius: 12).stroke(LK.border))
|
||||
} else if target == "immich" {
|
||||
LKSectionLabel(title: "Optionen").padding(.top, 4)
|
||||
VStack(spacing: 0) {
|
||||
optionRow("Album-Muster") {
|
||||
TextField("{event}", text: $state.settings.immich.albumName).textFieldStyle(.plain).lkField()
|
||||
}
|
||||
divider
|
||||
optionRow("Dateien") {
|
||||
LKSegmented(options: UploadVariant.allCases.map { ($0, $0.rawValue) }, selection: $state.settings.immich.variant)
|
||||
}
|
||||
}
|
||||
.background(RoundedRectangle(cornerRadius: 12).fill(LK.card))
|
||||
.overlay(RoundedRectangle(cornerRadius: 12).stroke(LK.border))
|
||||
}
|
||||
|
||||
if files.count < state.selectedItems.count {
|
||||
Label("\(state.selectedItems.count - files.count) Bild(er) ohne JPEG – zuerst in Lightroom exportieren (⌘⌥L).",
|
||||
systemImage: "exclamationmark.triangle.fill")
|
||||
.font(.system(size: 12)).foregroundStyle(LK.amber)
|
||||
}
|
||||
if let d = destination, credentialsMissing(d) {
|
||||
Label("Benutzer oder Passwort fehlen – „Server verwalten …“", systemImage: "key.fill")
|
||||
.font(.system(size: 12)).foregroundStyle(LK.red)
|
||||
}
|
||||
} else if target == "immich" {
|
||||
LabeledContent("Server", value: state.settings.immich.serverURL)
|
||||
let albums = Set(state.selectedItems.map { state.immichAlbum(for: $0) }.filter { !$0.isEmpty })
|
||||
LabeledContent("Album", value: albums.isEmpty ? "– kein Album –" : albums.sorted().joined(separator: ", "))
|
||||
TextField("Album-Muster", text: $state.settings.immich.albumName, prompt: Text("{event}"))
|
||||
}
|
||||
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)
|
||||
}
|
||||
.padding(22)
|
||||
}
|
||||
.lkForm()
|
||||
|
||||
Rectangle().fill(LK.border).frame(height: 1)
|
||||
HStack {
|
||||
SettingsLink { Text("Server verwalten …") }
|
||||
SettingsLink { Text("Server verwalten …") }.buttonStyle(LKButtonStyle())
|
||||
Spacer()
|
||||
Button("Abbrechen") { dismissWindow(id: "upload") }.keyboardShortcut(.cancelAction)
|
||||
Button("Hochladen") {
|
||||
Button("Abbrechen") { dismissWindow(id: "upload") }
|
||||
.buttonStyle(LKButtonStyle())
|
||||
.keyboardShortcut(.cancelAction)
|
||||
Button("\(files.count) Datei(en) hochladen") {
|
||||
state.upload(to: target)
|
||||
state.openWindow("tasks")
|
||||
dismissWindow(id: "upload")
|
||||
}
|
||||
.buttonStyle(LKButtonStyle(primary: true))
|
||||
.keyboardShortcut(.defaultAction)
|
||||
.buttonStyle(.borderedProminent)
|
||||
.disabled(target.isEmpty || files.isEmpty)
|
||||
}
|
||||
.padding(18)
|
||||
}
|
||||
.padding(18)
|
||||
.frame(width: 560)
|
||||
.frame(width: 620)
|
||||
.frame(minHeight: 460)
|
||||
.background(LK.ground)
|
||||
.onAppear {
|
||||
if target.isEmpty, let first = state.settings.ftpDestinations.first { target = first.id.uuidString }
|
||||
if target.isEmpty || (destination == nil && target != "immich"),
|
||||
let first = state.settings.ftpDestinations.first { target = first.id.uuidString }
|
||||
}
|
||||
}
|
||||
|
||||
private var summary: String {
|
||||
let n = state.selectedItems.count
|
||||
let size = ByteCountFormatter.string(fromByteCount: totalBytes, countStyle: .file)
|
||||
return "\(n) Bild\(n == 1 ? "" : "er") ausgewählt · \(files.count) Datei(en) · \(size)"
|
||||
}
|
||||
|
||||
private var albumPreview: String {
|
||||
let albums = Set(state.selectedItems.map { state.immichAlbum(for: $0) }.filter { !$0.isEmpty })
|
||||
return albums.isEmpty ? "kein Album" : "Album: " + albums.sorted().joined(separator: ", ")
|
||||
}
|
||||
|
||||
private func credentialsMissing(_ d: FTPDestination) -> Bool {
|
||||
d.username.isEmpty || Keychain.get(d.keychainAccount) == nil
|
||||
}
|
||||
|
||||
private var divider: some View { Rectangle().fill(LK.border).frame(height: 1).padding(.leading, 14) }
|
||||
|
||||
private func optionRow<C: View>(_ label: String, @ViewBuilder content: () -> C) -> some View {
|
||||
HStack(spacing: 14) {
|
||||
Text(label).font(.system(size: 13)).foregroundStyle(LK.text2).frame(width: 110, alignment: .leading)
|
||||
content()
|
||||
}
|
||||
.padding(.horizontal, 14)
|
||||
.padding(.vertical, 10)
|
||||
}
|
||||
|
||||
private func destinationCard(id: String, icon: String, title: String, subtitle: String, detail: String, warning: Bool) -> some View {
|
||||
let on = target == id
|
||||
return Button { target = id } label: {
|
||||
HStack(alignment: .top, spacing: 12) {
|
||||
Image(systemName: icon)
|
||||
.font(.system(size: 16, weight: .semibold))
|
||||
.foregroundStyle(on ? LK.onAmber : LK.text2)
|
||||
.frame(width: 34, height: 34)
|
||||
.background(RoundedRectangle(cornerRadius: 9).fill(on ? LK.amber : LK.raised))
|
||||
VStack(alignment: .leading, spacing: 3) {
|
||||
HStack(spacing: 6) {
|
||||
Text(title).font(.system(size: 14, weight: .bold)).foregroundStyle(LK.text).lineLimit(1)
|
||||
if warning { Image(systemName: "key.fill").font(.system(size: 10)).foregroundStyle(LK.red) }
|
||||
}
|
||||
Text(subtitle).font(LK.mono(11)).foregroundStyle(LK.muted).lineLimit(1).truncationMode(.middle)
|
||||
Text(detail).font(LK.mono(11)).foregroundStyle(on ? LK.amber : LK.text2).lineLimit(1).truncationMode(.middle)
|
||||
}
|
||||
Spacer(minLength: 0)
|
||||
if on { Image(systemName: "checkmark.circle.fill").foregroundStyle(LK.amber) }
|
||||
}
|
||||
.padding(12)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.background(RoundedRectangle(cornerRadius: 12).fill(on ? LK.selected : LK.card))
|
||||
.overlay(RoundedRectangle(cornerRadius: 12).stroke(on ? LK.amber : LK.border, lineWidth: on ? 2 : 1))
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user