From 54f5742a602c9838a18569b6ce0c7b1b42afe439 Mon Sep 17 00:00:00 2001 From: Lichtkasten Dev Date: Wed, 4 Nov 2026 16:10:24 +0000 Subject: [PATCH] =?UTF-8?q?Einheitliches=20Leuchttisch-Design=20auch=20f?= =?UTF-8?q?=C3=BCr=20Einstellungen=20(eigene=20Navigation=20statt=20blauer?= =?UTF-8?q?=20System-Tabs),=20Formulare,=20GroupBoxen,=20Listen,=20Titelle?= =?UTF-8?q?iste=20und=20Fensterhintergrund?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bGzgsxrmbBhDzeMV2L57D --- Sources/Lichtkasten/LichtkastenApp.swift | 1 + Sources/Lichtkasten/Views/CodesWindow.swift | 4 +- Sources/Lichtkasten/Views/IngestView.swift | 4 +- Sources/Lichtkasten/Views/SettingsView.swift | 75 +++++++++++++++---- Sources/Lichtkasten/Views/TasksWindow.swift | 4 +- Sources/Lichtkasten/Views/TemplateViews.swift | 4 +- Sources/Lichtkasten/Views/Theme.swift | 58 +++++++++++++- Sources/Lichtkasten/Views/UploadWindow.swift | 2 +- 8 files changed, 127 insertions(+), 25 deletions(-) diff --git a/Sources/Lichtkasten/LichtkastenApp.swift b/Sources/Lichtkasten/LichtkastenApp.swift index c9af607..99f7ef4 100644 --- a/Sources/Lichtkasten/LichtkastenApp.swift +++ b/Sources/Lichtkasten/LichtkastenApp.swift @@ -23,6 +23,7 @@ struct LichtkastenApp: App { .environmentObject(state) .environmentObject(state.uploads) .environmentObject(state.tasks) + .lkWindow() .frame(minWidth: 1100, minHeight: 680) } .commands { AppCommands(state: state) } diff --git a/Sources/Lichtkasten/Views/CodesWindow.swift b/Sources/Lichtkasten/Views/CodesWindow.swift index 25eb8fc..5c19764 100644 --- a/Sources/Lichtkasten/Views/CodesWindow.swift +++ b/Sources/Lichtkasten/Views/CodesWindow.swift @@ -57,7 +57,7 @@ struct CodesWindow: View { } } .onMove { state.codeLibrary.sets.move(fromOffsets: $0, toOffset: $1) } - } + }.scrollContentBackground(.hidden).background(LK.deep) HStack(spacing: 6) { Button("Hinzufügen …") { state.importCodeFiles() } .help("TXT-Dateien als Teams importieren (wie PM „Add…“)") @@ -104,7 +104,7 @@ struct CodesWindow: View { .tag(e.id) } } - } + }.scrollContentBackground(.hidden).background(LK.deep) // Quick add (e.g. a new player during the game) HStack { TextField("w23", text: $newCode).frame(width: 90).textFieldStyle(.roundedBorder) diff --git a/Sources/Lichtkasten/Views/IngestView.swift b/Sources/Lichtkasten/Views/IngestView.swift index 94bff33..e807d58 100644 --- a/Sources/Lichtkasten/Views/IngestView.swift +++ b/Sources/Lichtkasten/Views/IngestView.swift @@ -80,7 +80,7 @@ struct IngestView: View { Text(c.used).foregroundStyle(.secondary) } .tag(c.dcim) - } + }.scrollContentBackground(.hidden).background(LK.deep) .frame(height: 150) HStack { Button("Neu suchen") { rescan() } @@ -91,7 +91,7 @@ struct IngestView: View { .disabled(selectedCards.isEmpty) } case .folders: - List(folders, id: \.self) { Text($0.path).lineLimit(1).truncationMode(.middle) }.frame(height: 150) + List(folders, id: \.self) { Text($0.path).lineLimit(1).truncationMode(.middle) }.scrollContentBackground(.hidden).background(LK.deep).frame(height: 150) HStack { Button("Ordner hinzufügen …") { pickFolders() } Button("Leeren") { folders = [] }.disabled(folders.isEmpty) diff --git a/Sources/Lichtkasten/Views/SettingsView.swift b/Sources/Lichtkasten/Views/SettingsView.swift index 05a6dd5..0efe370 100644 --- a/Sources/Lichtkasten/Views/SettingsView.swift +++ b/Sources/Lichtkasten/Views/SettingsView.swift @@ -1,16 +1,63 @@ import SwiftUI import LichtkastenCore +/// Own settings navigation (Apple's settings tab bar always uses the system accent color). struct SettingsView: View { - var body: some View { - TabView { - GeneralSettings().tabItem { Label("Allgemein", systemImage: "gearshape") } - FTPSettings().tabItem { Label("FTP", systemImage: "server.rack") } - ImmichSettingsView().tabItem { Label("Immich", systemImage: "photo.stack") } - LightroomSettingsView().tabItem { Label("Lightroom", systemImage: "camera.aperture") } - CodesSettings().tabItem { Label("Codes", systemImage: "character.textbox") } + enum Page: String, CaseIterable, Identifiable { + case general = "Allgemein", ftp = "FTP", immich = "Immich", lightroom = "Lightroom", codes = "Codes" + var id: String { rawValue } + var icon: String { + switch self { + case .general: return "gearshape" + case .ftp: return "server.rack" + case .immich: return "photo.stack" + case .lightroom: return "camera.aperture" + case .codes: return "character.textbox" + } } - .padding(16) + } + + @AppStorage("settingsPage") private var page: Page = .general + + var body: some View { + HStack(spacing: 0) { + VStack(alignment: .leading, spacing: 4) { + LKSectionLabel(title: "Einstellungen").padding(.horizontal, 10).padding(.bottom, 8) + ForEach(Page.allCases) { p in + let on = p == page + Button { page = p } label: { + HStack(spacing: 10) { + Image(systemName: p.icon).frame(width: 18) + Text(p.rawValue).font(.system(size: 13, weight: on ? .bold : .medium)) + Spacer() + } + .foregroundStyle(on ? LK.amber : LK.text) + .padding(.horizontal, 10) + .frame(height: 32) + .background(RoundedRectangle(cornerRadius: 8).fill(on ? LK.selected : Color.clear)) + .contentShape(Rectangle()) + } + .buttonStyle(.plain) + } + Spacer() + } + .padding(14) + .frame(width: 190) + .background(LK.panel) + Rectangle().fill(LK.border).frame(width: 1) + Group { + switch page { + case .general: GeneralSettings() + case .ftp: FTPSettings() + case .immich: ImmichSettingsView() + case .lightroom: LightroomSettingsView() + case .codes: CodesSettings() + } + } + .frame(maxWidth: .infinity, maxHeight: .infinity) + } + .background(LK.ground) + .navigationTitle(page.rawValue) } } @@ -64,7 +111,7 @@ struct GeneralSettings: View { .font(.caption).foregroundStyle(.secondary) } } - .formStyle(.grouped) + .lkForm() } } @@ -82,7 +129,7 @@ struct FTPSettings: View { VStack(spacing: 0) { List(selection: $selected) { ForEach(state.settings.ftpDestinations) { d in Text(d.name).tag(d.id) } - } + }.scrollContentBackground(.hidden).background(LK.deep) HStack { Button { let d = FTPDestination(); state.settings.ftpDestinations.append(d); selected = d.id } label: { Image(systemName: "plus") } Button { @@ -129,7 +176,7 @@ struct FTPSettings: View { Text(testResult).font(.caption).lineLimit(3) } } - .formStyle(.grouped) + .lkForm() .onAppear { password = Keychain.get(state.settings.ftpDestinations[i].keychainAccount) ?? "" } .onChange(of: selected) { _, _ in testResult = "" @@ -183,7 +230,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) } - .formStyle(.grouped) + .lkForm() .onAppear { apiKey = Keychain.get(ImmichSettings.keychainAccount) ?? "" } .onChange(of: state.settings.immich) { _, _ in state.uploads.resetImmich() } } @@ -262,7 +309,7 @@ struct LightroomSettingsView: View { Toggle("Immich", isOn: uploadBinding("immich")).disabled(!state.settings.immich.enabled) } } - .formStyle(.grouped) + .lkForm() } private func uploadBinding(_ id: String) -> Binding { @@ -295,6 +342,6 @@ struct CodesSettings: View { Button("Code-Ersetzungen öffnen … (⌘⇧K)") { state.openWindow("codes") } } } - .formStyle(.grouped) + .lkForm() } } diff --git a/Sources/Lichtkasten/Views/TasksWindow.swift b/Sources/Lichtkasten/Views/TasksWindow.swift index c14b669..a34bc0d 100644 --- a/Sources/Lichtkasten/Views/TasksWindow.swift +++ b/Sources/Lichtkasten/Views/TasksWindow.swift @@ -12,8 +12,8 @@ struct TasksWindow: View { if tasks.tasks.isEmpty { Text("Keine Aufgaben").foregroundStyle(.secondary).frame(maxWidth: .infinity, maxHeight: .infinity) } else { - List(tasks.tasks) { t in TaskRow(task: t) } - .listStyle(.inset(alternatesRowBackgrounds: true)) + List(tasks.tasks) { t in TaskRow(task: t) }.scrollContentBackground(.hidden).background(LK.deep) + .listStyle(.inset) } if showFiles { Divider() diff --git a/Sources/Lichtkasten/Views/TemplateViews.swift b/Sources/Lichtkasten/Views/TemplateViews.swift index ec40873..4614db4 100644 --- a/Sources/Lichtkasten/Views/TemplateViews.swift +++ b/Sources/Lichtkasten/Views/TemplateViews.swift @@ -24,7 +24,7 @@ struct TemplatePickerSheet: View { Text(summary(t)).font(.caption).foregroundStyle(.secondary).lineLimit(1) } .tag(t.id) - } + }.scrollContentBackground(.hidden).background(LK.deep) .frame(minHeight: 260) HStack { Button("Vorlagen verwalten …") { dismiss(); state.showTemplateManager = true } @@ -68,7 +68,7 @@ struct TemplateManagerView: View { List(selection: $selected) { ForEach(state.templates) { t in Text(t.name).tag(t.id) } .onMove { state.templates.move(fromOffsets: $0, toOffset: $1) } - } + }.scrollContentBackground(.hidden).background(LK.deep) Divider() HStack(spacing: 6) { Button { addNew() } label: { Image(systemName: "plus") }.help("Neue Vorlage") diff --git a/Sources/Lichtkasten/Views/Theme.swift b/Sources/Lichtkasten/Views/Theme.swift index ce220d6..185a497 100644 --- a/Sources/Lichtkasten/Views/Theme.swift +++ b/Sources/Lichtkasten/Views/Theme.swift @@ -133,8 +133,62 @@ struct LKFieldBackground: ViewModifier { extension View { func lkField() -> some View { modifier(LKFieldBackground()) } - /// Every window: dark Leuchttisch ground and amber accent. + /// Every window: dark Leuchttisch ground, warm title bar, amber accent, Leuchttisch group boxes. func lkWindow() -> some View { - self.preferredColorScheme(.dark).tint(LK.amber).background(LK.ground) + self.preferredColorScheme(.dark) + .tint(LK.amber) + .groupBoxStyle(LKGroupBoxStyle()) + .toolbarBackground(LK.bar, for: .windowToolbar) + .toolbarBackground(.visible, for: .windowToolbar) + .background(LK.ground) + .background(LKWindowStyler()) + } + + /// Settings-like forms without Apple's gray boxes: two columns (label | control) on the Leuchttisch + /// ground, scrollable. + 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) + } +} + +/// GroupBox as a Leuchttisch card (instead of Apple's gray box). +struct LKGroupBoxStyle: GroupBoxStyle { + func makeBody(configuration: Configuration) -> some View { + VStack(alignment: .leading, spacing: 10) { + configuration.label + .font(.system(size: 11, weight: .bold)) + .textCase(.uppercase) + .tracking(1.2) + .foregroundStyle(LK.amber) + configuration.content + } + .padding(14) + .frame(maxWidth: .infinity, alignment: .leading) + .background(RoundedRectangle(cornerRadius: 12).fill(LK.card)) + .overlay(RoundedRectangle(cornerRadius: 12).stroke(LK.border)) + } +} + +/// Paints the NSWindow itself warm (title bar area, behind transparent views). +struct LKWindowStyler: NSViewRepresentable { + func makeNSView(context: Context) -> NSView { + let v = NSView() + DispatchQueue.main.async { apply(v.window) } + return v + } + func updateNSView(_ nsView: NSView, context: Context) { DispatchQueue.main.async { apply(nsView.window) } } + + private func apply(_ w: NSWindow?) { + guard let w else { return } + w.backgroundColor = NSColor(red: 0x16 / 255, green: 0x13 / 255, blue: 0x0E / 255, alpha: 1) + w.appearance = NSAppearance(named: .darkAqua) } } diff --git a/Sources/Lichtkasten/Views/UploadWindow.swift b/Sources/Lichtkasten/Views/UploadWindow.swift index 82811cf..32a021c 100644 --- a/Sources/Lichtkasten/Views/UploadWindow.swift +++ b/Sources/Lichtkasten/Views/UploadWindow.swift @@ -49,7 +49,7 @@ struct UploadWindow: View { .font(.caption).foregroundStyle(.orange) } } - .formStyle(.grouped) + .lkForm() HStack { SettingsLink { Text("Server verwalten …") } Spacer()