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
+249
-80
No files matched your search
@@ -40,21 +40,24 @@ struct IngestView: View {
|
|||||||
}
|
}
|
||||||
pathPreview
|
pathPreview
|
||||||
HStack {
|
HStack {
|
||||||
Button("Variablen …") { state.openWindow("codes") }
|
Button("Variablen …") { state.openWindow("codes") }.buttonStyle(LKButtonStyle())
|
||||||
Spacer()
|
Spacer()
|
||||||
Button("Abbrechen") { state.pendingIngestSources = []; dismiss() }.keyboardShortcut(.cancelAction)
|
Button("Abbrechen") { state.pendingIngestSources = []; dismiss() }
|
||||||
|
.buttonStyle(LKButtonStyle())
|
||||||
|
.keyboardShortcut(.cancelAction)
|
||||||
Button("Ingest") {
|
Button("Ingest") {
|
||||||
state.startIngest(sources: sources, fromCards: mode == .disks)
|
state.startIngest(sources: sources, fromCards: mode == .disks)
|
||||||
state.pendingIngestSources = []
|
state.pendingIngestSources = []
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
.keyboardShortcut(.defaultAction)
|
.keyboardShortcut(.defaultAction)
|
||||||
.buttonStyle(.borderedProminent)
|
.buttonStyle(LKButtonStyle(primary: true))
|
||||||
.disabled(sources.isEmpty || state.settings.ingest.primaryDestination.isEmpty || state.ingestRunning)
|
.disabled(sources.isEmpty || state.settings.ingest.primaryDestination.isEmpty || state.ingestRunning)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(18)
|
.padding(18)
|
||||||
.frame(width: 980)
|
.frame(width: 980)
|
||||||
|
.background(LK.ground)
|
||||||
.onAppear(perform: setup)
|
.onAppear(perform: setup)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,26 +75,33 @@ struct IngestView: View {
|
|||||||
|
|
||||||
switch mode {
|
switch mode {
|
||||||
case .disks:
|
case .disks:
|
||||||
List(cards, selection: $selectedCards) { c in
|
cardList
|
||||||
HStack {
|
HStack {
|
||||||
Image(systemName: "sdcard")
|
Button("Neu suchen") { rescan() }.buttonStyle(LKButtonStyle(compact: true))
|
||||||
Text(c.name)
|
|
||||||
Spacer()
|
|
||||||
Text(c.used).foregroundStyle(.secondary)
|
|
||||||
}
|
|
||||||
.tag(c.dcim)
|
|
||||||
}.scrollContentBackground(.hidden).background(LK.deep)
|
|
||||||
.frame(height: 150)
|
|
||||||
HStack {
|
|
||||||
Button("Neu suchen") { rescan() }
|
|
||||||
Button("Auswerfen") {
|
Button("Auswerfen") {
|
||||||
for c in cards where selectedCards.contains(c.dcim) { try? NSWorkspace.shared.unmountAndEjectDevice(at: c.volume) }
|
for c in cards where selectedCards.contains(c.dcim) { try? NSWorkspace.shared.unmountAndEjectDevice(at: c.volume) }
|
||||||
rescan()
|
rescan()
|
||||||
}
|
}
|
||||||
|
.buttonStyle(LKButtonStyle(compact: true))
|
||||||
.disabled(selectedCards.isEmpty)
|
.disabled(selectedCards.isEmpty)
|
||||||
}
|
}
|
||||||
case .folders:
|
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 {
|
HStack {
|
||||||
Button("Ordner hinzufügen …") { pickFolders() }
|
Button("Ordner hinzufügen …") { pickFolders() }
|
||||||
Button("Leeren") { folders = [] }.disabled(folders.isEmpty)
|
Button("Leeren") { folders = [] }.disabled(folders.isEmpty)
|
||||||
@@ -131,13 +141,13 @@ struct IngestView: View {
|
|||||||
GroupBox("Zielordner") {
|
GroupBox("Zielordner") {
|
||||||
VStack(alignment: .leading, spacing: 6) {
|
VStack(alignment: .leading, spacing: 6) {
|
||||||
HStack {
|
HStack {
|
||||||
Text("Primär:").frame(width: 80, alignment: .leading)
|
Text("Primär:").frame(width: 96, alignment: .leading)
|
||||||
Button("Primäres Ziel …") { pick(ingest.primaryDestination) }
|
Button("Primäres Ziel …") { pick(ingest.primaryDestination) }
|
||||||
}
|
}
|
||||||
Text(state.settings.ingest.primaryDestination.isEmpty ? "–" : state.settings.ingest.primaryDestination)
|
Text(state.settings.ingest.primaryDestination.isEmpty ? "–" : state.settings.ingest.primaryDestination)
|
||||||
.font(.caption).foregroundStyle(.secondary).lineLimit(1).truncationMode(.middle)
|
.font(.caption).foregroundStyle(.secondary).lineLimit(1).truncationMode(.middle)
|
||||||
HStack {
|
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) }
|
Button("Sekundäres Ziel …") { pick(ingest.backupDestination) }
|
||||||
.disabled(!state.settings.ingest.secondaryEnabled)
|
.disabled(!state.settings.ingest.secondaryEnabled)
|
||||||
}
|
}
|
||||||
@@ -217,6 +227,52 @@ struct IngestView: View {
|
|||||||
|
|
||||||
// MARK: Helpers
|
// 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() {
|
private func setup() {
|
||||||
rescan()
|
rescan()
|
||||||
if !state.pendingIngestSources.isEmpty {
|
if !state.pendingIngestSources.isEmpty {
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ struct GeneralSettings: View {
|
|||||||
Toggle("Nach Bewertung/Tag automatisch zum nächsten Bild", isOn: $state.settings.autoAdvance)
|
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")
|
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)
|
.font(.caption).foregroundStyle(.secondary)
|
||||||
}
|
}.lkRow()
|
||||||
Section("Zoom") {
|
Section("Zoom") {
|
||||||
Picker("Maximaler Zoom in der Vorschau", selection: $state.settings.maxZoom) {
|
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)
|
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("Größte Vorschaubilder: \(Int(state.settings.maxThumbnailSize)) px")
|
||||||
}
|
}
|
||||||
Text("Vorschau: Z = Einpassen/100 %, + / − oder Trackpad zum Zoomen.").font(.caption).foregroundStyle(.secondary)
|
Text("Vorschau: Z = Einpassen/100 %, + / − oder Trackpad zum Zoomen.").font(.caption).foregroundStyle(.secondary)
|
||||||
}
|
}.lkRow()
|
||||||
Section("Ansicht") {
|
Section("Ansicht") {
|
||||||
Toggle("Matchday-Ansicht (Teamleiste, Spieler:innen-Liste, Teamfarben)", isOn: $state.settings.jersey.matchday)
|
Toggle("Matchday-Ansicht (Teamleiste, Spieler:innen-Liste, Teamfarben)", isOn: $state.settings.jersey.matchday)
|
||||||
if state.settings.jersey.matchday && state.settings.jersey.teams.count < 2 {
|
if state.settings.jersey.matchday && state.settings.jersey.teams.count < 2 {
|
||||||
Text("Braucht zwei Teams in Bild → Trikot-Erkennung einrichten.").font(.caption).foregroundStyle(.secondary)
|
Text("Braucht zwei Teams in Bild → Trikot-Erkennung einrichten.").font(.caption).foregroundStyle(.secondary)
|
||||||
}
|
}
|
||||||
Toggle("IPTC-Panel neben der Vorschau", isOn: $state.settings.loupePanel)
|
Toggle("IPTC-Panel neben der Vorschau", isOn: $state.settings.loupePanel)
|
||||||
}
|
}.lkRow()
|
||||||
Section("Ingest") {
|
Section("Ingest") {
|
||||||
Toggle("Ingest-Fenster öffnen, wenn eine Speicherkarte erkannt wird", isOn: $state.settings.autoIngestOnCardMount)
|
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)
|
Toggle("Karte nach dem Ingest automatisch auswerfen", isOn: $state.settings.ingest.unmountAfter)
|
||||||
}
|
}.lkRow()
|
||||||
Section("exiftool") {
|
Section("exiftool") {
|
||||||
HStack {
|
HStack {
|
||||||
TextField("Pfad (leer = automatisch)", text: $state.settings.exiftoolPath)
|
TextField("Pfad (leer = automatisch)", text: $state.settings.exiftoolPath)
|
||||||
@@ -104,12 +104,12 @@ struct GeneralSettings: View {
|
|||||||
} else {
|
} else {
|
||||||
Label("Nicht gefunden – Terminal: brew install exiftool", systemImage: "xmark.octagon.fill").foregroundStyle(.red)
|
Label("Nicht gefunden – Terminal: brew install exiftool", systemImage: "xmark.octagon.fill").foregroundStyle(.red)
|
||||||
}
|
}
|
||||||
}
|
}.lkRow()
|
||||||
Section("Variablen") {
|
Section("Variablen") {
|
||||||
TextField("Datumsformat für {date}", text: $state.settings.dateFormat)
|
TextField("Datumsformat für {date}", text: $state.settings.dateFormat)
|
||||||
Text("z. B. dd.MM.yyyy → 03.11.2026 · d. MMMM yyyy → 3. November 2026")
|
Text("z. B. dd.MM.yyyy → 03.11.2026 · d. MMMM yyyy → 3. November 2026")
|
||||||
.font(.caption).foregroundStyle(.secondary)
|
.font(.caption).foregroundStyle(.secondary)
|
||||||
}
|
}.lkRow()
|
||||||
}
|
}
|
||||||
.lkForm()
|
.lkForm()
|
||||||
}
|
}
|
||||||
@@ -144,6 +144,7 @@ struct FTPSettings: View {
|
|||||||
|
|
||||||
if let i = index {
|
if let i = index {
|
||||||
Form {
|
Form {
|
||||||
|
Section("Server") {
|
||||||
TextField("Name", text: $state.settings.ftpDestinations[i].name)
|
TextField("Name", text: $state.settings.ftpDestinations[i].name)
|
||||||
Picker("Protokoll", selection: Binding(
|
Picker("Protokoll", selection: Binding(
|
||||||
get: { state.settings.ftpDestinations[i].proto },
|
get: { state.settings.ftpDestinations[i].proto },
|
||||||
@@ -175,6 +176,7 @@ struct FTPSettings: View {
|
|||||||
if testing { ProgressView().controlSize(.small) }
|
if testing { ProgressView().controlSize(.small) }
|
||||||
Text(testResult).font(.caption).lineLimit(3)
|
Text(testResult).font(.caption).lineLimit(3)
|
||||||
}
|
}
|
||||||
|
}.lkRow()
|
||||||
}
|
}
|
||||||
.lkForm()
|
.lkForm()
|
||||||
.onAppear { password = Keychain.get(state.settings.ftpDestinations[i].keychainAccount) ?? "" }
|
.onAppear { password = Keychain.get(state.settings.ftpDestinations[i].keychainAccount) ?? "" }
|
||||||
@@ -208,6 +210,7 @@ struct ImmichSettingsView: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Form {
|
Form {
|
||||||
|
Section("Immich") {
|
||||||
Toggle("Immich-Upload aktivieren", isOn: $state.settings.immich.enabled)
|
Toggle("Immich-Upload aktivieren", isOn: $state.settings.immich.enabled)
|
||||||
TextField("Server-URL", text: $state.settings.immich.serverURL, prompt: Text("https://immich.example.de"))
|
TextField("Server-URL", text: $state.settings.immich.serverURL, prompt: Text("https://immich.example.de"))
|
||||||
SecureField("API-Schlüssel (Schlüsselbund)", text: $apiKey)
|
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.")
|
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)
|
.font(.caption).foregroundStyle(.secondary)
|
||||||
|
}.lkRow()
|
||||||
}
|
}
|
||||||
.lkForm()
|
.lkForm()
|
||||||
.onAppear { apiKey = Keychain.get(ImmichSettings.keychainAccount) ?? "" }
|
.onAppear { apiKey = Keychain.get(ImmichSettings.keychainAccount) ?? "" }
|
||||||
@@ -267,16 +271,16 @@ struct LightroomSettingsView: View {
|
|||||||
if !pluginMessage.isEmpty { Text(pluginMessage).font(.caption) }
|
if !pluginMessage.isEmpty { Text(pluginMessage).font(.caption) }
|
||||||
Text("Ohne Plugin öffnet ⌘⇧L den normalen Importdialog von Lightroom.")
|
Text("Ohne Plugin öffnet ⌘⇧L den normalen Importdialog von Lightroom.")
|
||||||
.font(.caption).foregroundStyle(.secondary)
|
.font(.caption).foregroundStyle(.secondary)
|
||||||
}
|
}.lkRow()
|
||||||
Section("Import") {
|
Section("Import") {
|
||||||
TextField("Entwicklungsvorgabe (exakter Name, optional „Ordner/Name“)", text: $state.settings.lightroom.developPreset)
|
TextField("Entwicklungsvorgabe (exakter Name, optional „Ordner/Name“)", text: $state.settings.lightroom.developPreset)
|
||||||
TextField("Sammlung (leer = keine)", text: $state.settings.lightroom.collection)
|
TextField("Sammlung (leer = keine)", text: $state.settings.lightroom.collection)
|
||||||
}
|
}.lkRow()
|
||||||
Section("Bearbeiten (⌘E)") {
|
Section("Bearbeiten (⌘E)") {
|
||||||
Toggle("Entwicklungsvorgabe auch bei ⌘E anwenden", isOn: $state.settings.lightroom.presetOnEdit)
|
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.")
|
Text("⌘E importiert die Auswahl in den offenen Katalog und öffnet das Entwickeln-Modul.")
|
||||||
.font(.caption).foregroundStyle(.secondary)
|
.font(.caption).foregroundStyle(.secondary)
|
||||||
}
|
}.lkRow()
|
||||||
Section("JPEG-Export (⌘⌥L) → SENT") {
|
Section("JPEG-Export (⌘⌥L) → SENT") {
|
||||||
Picker("Exportziel", selection: $state.settings.lightroom.exportTarget) {
|
Picker("Exportziel", selection: $state.settings.lightroom.exportTarget) {
|
||||||
ForEach(ExportTarget.allCases, id: \.self) { Text($0.title).tag($0) }
|
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")
|
Text("sRGB").tag("sRGB"); Text("Adobe RGB").tag("AdobeRGB")
|
||||||
}
|
}
|
||||||
Toggle("Original-IPTC nach Export erneut schreiben (PM-identischer Aufbau)", isOn: $state.settings.lightroom.rewriteIPTCAfterExport)
|
Toggle("Original-IPTC nach Export erneut schreiben (PM-identischer Aufbau)", isOn: $state.settings.lightroom.rewriteIPTCAfterExport)
|
||||||
}
|
}.lkRow()
|
||||||
Section("Nach dem Export automatisch hochladen") {
|
Section("Nach dem Export automatisch hochladen") {
|
||||||
ForEach(state.settings.ftpDestinations) { d in
|
ForEach(state.settings.ftpDestinations) { d in
|
||||||
Toggle("FTP: \(d.name)", isOn: uploadBinding(d.id.uuidString))
|
Toggle("FTP: \(d.name)", isOn: uploadBinding(d.id.uuidString))
|
||||||
}
|
}
|
||||||
Toggle("Immich", isOn: uploadBinding("immich")).disabled(!state.settings.immich.enabled)
|
Toggle("Immich", isOn: uploadBinding("immich")).disabled(!state.settings.immich.enabled)
|
||||||
}
|
}.lkRow()
|
||||||
}
|
}
|
||||||
.lkForm()
|
.lkForm()
|
||||||
}
|
}
|
||||||
@@ -340,7 +344,7 @@ struct CodesSettings: View {
|
|||||||
Section("Code-Ersetzung") {
|
Section("Code-Ersetzung") {
|
||||||
Text("\(state.codeLibrary.sets.filter(\.enabled).count) von \(state.codeLibrary.sets.count) Teams aktiv · \(state.codes.table.count) Codes")
|
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") }
|
Button("Code-Ersetzungen öffnen … (⌘⇧K)") { state.openWindow("codes") }
|
||||||
}
|
}.lkRow()
|
||||||
}
|
}
|
||||||
.lkForm()
|
.lkForm()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,19 +144,16 @@ extension View {
|
|||||||
.background(LKWindowStyler())
|
.background(LKWindowStyler())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Settings-like forms without Apple's gray boxes: two columns (label | control) on the Leuchttisch
|
/// Settings-like forms: Apple's grouped layout (labels left, controls right, wraps correctly),
|
||||||
/// ground, scrollable.
|
/// but on the Leuchttisch ground with warm cards (rows get `.lkRow()`).
|
||||||
func lkForm() -> some View {
|
func lkForm() -> some View {
|
||||||
ScrollView {
|
self.formStyle(.grouped)
|
||||||
self.formStyle(.columns)
|
|
||||||
.scrollContentBackground(.hidden)
|
|
||||||
.padding(.horizontal, 28)
|
|
||||||
.padding(.vertical, 22)
|
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
|
||||||
}
|
|
||||||
.scrollContentBackground(.hidden)
|
.scrollContentBackground(.hidden)
|
||||||
.background(LK.ground)
|
.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).
|
/// GroupBox as a Leuchttisch card (instead of Apple's gray box).
|
||||||
|
|||||||
@@ -1,73 +1,185 @@
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
import LichtkastenCore
|
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 {
|
struct UploadWindow: View {
|
||||||
@EnvironmentObject var state: AppState
|
@EnvironmentObject var state: AppState
|
||||||
@Environment(\.dismissWindow) private var dismissWindow
|
@Environment(\.dismissWindow) private var dismissWindow
|
||||||
@AppStorage("lastUploadTarget") private var target = ""
|
@AppStorage("lastUploadTarget") private var target = ""
|
||||||
|
|
||||||
private var destination: FTPDestination? { state.settings.ftpDestinations.first { $0.id.uuidString == 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 {
|
private var variant: UploadVariant {
|
||||||
target == "immich" ? state.settings.immich.variant : destination?.variant ?? .jpeg
|
target == "immich" ? state.settings.immich.variant : destination?.variant ?? .jpeg
|
||||||
}
|
}
|
||||||
|
|
||||||
private var files: [URL] { state.selectedItems.flatMap { state.uploadFiles(for: $0, variant: variant) } }
|
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 {
|
var body: some View {
|
||||||
VStack(alignment: .leading, spacing: 14) {
|
VStack(alignment: .leading, spacing: 0) {
|
||||||
Text("Bilder hochladen").font(.title3.bold())
|
// header
|
||||||
Form {
|
HStack(spacing: 14) {
|
||||||
Picker("Ziel", selection: $target) {
|
Image(systemName: "icloud.and.arrow.up")
|
||||||
Text("– bitte wählen –").tag("")
|
.font(.system(size: 20, weight: .semibold))
|
||||||
ForEach(state.settings.ftpDestinations) { d in Text(d.name).tag(d.id.uuidString) }
|
.foregroundStyle(LK.onAmber)
|
||||||
if state.settings.immich.enabled { Text("Immich").tag("immich") }
|
.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) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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)
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.lkForm()
|
|
||||||
HStack {
|
|
||||||
SettingsLink { Text("Server verwalten …") }
|
|
||||||
Spacer()
|
Spacer()
|
||||||
Button("Abbrechen") { dismissWindow(id: "upload") }.keyboardShortcut(.cancelAction)
|
}
|
||||||
Button("Hochladen") {
|
.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 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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(22)
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle().fill(LK.border).frame(height: 1)
|
||||||
|
HStack {
|
||||||
|
SettingsLink { Text("Server verwalten …") }.buttonStyle(LKButtonStyle())
|
||||||
|
Spacer()
|
||||||
|
Button("Abbrechen") { dismissWindow(id: "upload") }
|
||||||
|
.buttonStyle(LKButtonStyle())
|
||||||
|
.keyboardShortcut(.cancelAction)
|
||||||
|
Button("\(files.count) Datei(en) hochladen") {
|
||||||
state.upload(to: target)
|
state.upload(to: target)
|
||||||
state.openWindow("tasks")
|
state.openWindow("tasks")
|
||||||
dismissWindow(id: "upload")
|
dismissWindow(id: "upload")
|
||||||
}
|
}
|
||||||
|
.buttonStyle(LKButtonStyle(primary: true))
|
||||||
.keyboardShortcut(.defaultAction)
|
.keyboardShortcut(.defaultAction)
|
||||||
.buttonStyle(.borderedProminent)
|
|
||||||
.disabled(target.isEmpty || files.isEmpty)
|
.disabled(target.isEmpty || files.isEmpty)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
.padding(18)
|
.padding(18)
|
||||||
.frame(width: 560)
|
}
|
||||||
|
.frame(width: 620)
|
||||||
|
.frame(minHeight: 460)
|
||||||
|
.background(LK.ground)
|
||||||
.onAppear {
|
.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