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
@@ -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()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user