Einheitliches Leuchttisch-Design auch für Einstellungen (eigene Navigation statt blauer System-Tabs), Formulare, GroupBoxen, Listen, Titelleiste und Fensterhintergrund
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
82ab591e7a
commit
54f5742a60
8 files changed
+127
-25
No files matched your search
@@ -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) }
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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<Bool> {
|
||||
@@ -295,6 +342,6 @@ struct CodesSettings: View {
|
||||
Button("Code-Ersetzungen öffnen … (⌘⇧K)") { state.openWindow("codes") }
|
||||
}
|
||||
}
|
||||
.formStyle(.grouped)
|
||||
.lkForm()
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@ struct UploadWindow: View {
|
||||
.font(.caption).foregroundStyle(.orange)
|
||||
}
|
||||
}
|
||||
.formStyle(.grouped)
|
||||
.lkForm()
|
||||
HStack {
|
||||
SettingsLink { Text("Server verwalten …") }
|
||||
Spacer()
|
||||
|
||||
Reference in new issue
Block a user