Files
lichtkasten/Sources/Lichtkasten/Views/Theme.swift
T
Lichtkasten DevandClaude Opus 5.5 93ecdf03fc Gesendet-Status, Agentur-Check, Rückgängig und Spieltag-Assistent
- Gesendet-Status pro Bild: Upload-Historie (FTP + Immich) mit Ziel und Zeit, grünes Abzeichen im Kontaktabzug,
  Anzeige in Lupe und IPTC-Fenster, Filter Gesendet/Nicht gesendet, bereits gesendete beim Upload überspringen,
  'Als nicht gesendet markieren'
- Agentur-Check vor dem FTP-Upload: Pflichtfelder, offene Variablen und Codes, Datum aus alter Vorlage,
  IIM-Längen, offene Trikot-Vorschläge, Mindestgröße; Prüffenster mit Bearbeiten/Erneut prüfen/
  Nur fehlerfreie senden; Einstellungsseite und Schalter pro Server
- Rückgängig/Wiederholen (⌘Z/⇧⌘Z) für Sterne, Farben, Tags, IPTC und Vorlagen, Schreibvorgänge serialisiert,
  in Textfeldern bleibt ⌘Z beim Text
- Spieltag-Assistent (⌘⇧N, auch im Ingest und in der Matchday-Ansicht): Teams, Wettbewerbe und Muster werden
  gespeichert; erzeugt Vorlage im Aufbau der Basis-Vorlage, Ingest-Ordner, Trikot-Teams und aktive Code-Teams;
  Trikotfarben aus der Erkennung fließen ins Team zurück; Matchday nimmt die Teams aus dem Ereignis des Bildes
- Tests für Spieltag-Generator, Agentur-Check und Gesendet-Log, README ergänzt

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012bGzgsxrmbBhDzeMV2L57D
2026-11-05 00:23:03 +00:00

207 lines
7.5 KiB
Swift

import SwiftUI
import LichtkastenCore
/// "Leuchttisch" design language: warm graphite ground, amber light as the single accent.
enum LK {
static func hex(_ v: UInt32) -> Color {
Color(red: Double((v >> 16) & 0xFF) / 255, green: Double((v >> 8) & 0xFF) / 255, blue: Double(v & 0xFF) / 255)
}
// grounds (dark → light)
static let deep = hex(0x120F0B) // inputs, wells
static let ground = hex(0x16130E) // window / contact sheet
static let panel = hex(0x1A1610) // sidebar, side panels
static let bar = hex(0x1C1812) // header bars
static let card = hex(0x1E1A14) // thumbnail cards
static let raised = hex(0x221D16) // buttons, boxes
static let selected = hex(0x2A2318) // selected card / row
static let border = hex(0x2A241B)
static let borderStrong = hex(0x2E271D)
// text
static let text = hex(0xEDE6DA)
static let text2 = hex(0xB8AE9E)
static let muted = hex(0x8C8272)
static let faint = hex(0x4A4235)
// accent: the light of the light table
static let amber = hex(0xF2B544)
static let amberSoft = hex(0xF2B544).opacity(0.18)
static let onAmber = hex(0x16130E)
static let green = hex(0x5DBB63)
static let red = hex(0xE0645A)
static let mono = Font.system(size: 12, design: .monospaced)
static func mono(_ size: CGFloat, _ weight: Font.Weight = .regular) -> Font { .system(size: size, weight: weight, design: .monospaced) }
}
extension ColorLabel {
/// Color classes in the Leuchttisch palette (same order as PM: 1 red … 8 gray).
var lkColor: Color {
switch self {
case .red: return LK.hex(0xE0645A)
case .yellow: return LK.hex(0xE4B34C)
case .green: return LK.hex(0x5DBB63)
case .blue: return LK.hex(0x4F8FE0)
case .purple: return LK.hex(0xC467D6)
case .cyan: return LK.hex(0x45BFC9)
case .orange: return LK.hex(0xE58A3B)
case .gray: return LK.hex(0x7A7166)
}
}
}
extension KitColor {
var swiftUI: Color { Color(red: r, green: g, blue: b) }
}
/// Small uppercase section label ("FAVORITEN").
struct LKSectionLabel: View {
let title: String
var body: some View {
Text(title.uppercased())
.font(.system(size: 11, weight: .bold))
.tracking(1.2)
.foregroundStyle(LK.muted)
}
}
/// Primary action (amber) and secondary (raised) buttons.
struct LKButtonStyle: ButtonStyle {
var primary = false
var compact = false
func makeBody(configuration: Configuration) -> some View {
configuration.label
.font(.system(size: compact ? 12 : 13, weight: primary ? .bold : .semibold))
.foregroundStyle(primary ? LK.onAmber : LK.text)
.padding(.horizontal, compact ? 10 : 14)
.frame(minHeight: compact ? 26 : 32)
.background(
RoundedRectangle(cornerRadius: compact ? 7 : 9)
.fill(primary ? LK.amber : LK.raised)
)
.overlay(
RoundedRectangle(cornerRadius: compact ? 7 : 9)
.stroke(primary ? Color.clear : LK.borderStrong, lineWidth: 1)
)
.opacity(configuration.isPressed ? 0.75 : 1)
.contentShape(Rectangle())
}
}
/// Segmented pill control ("Alle | Getaggt | Vorschläge").
struct LKSegmented<T: Hashable>: View {
let options: [(T, String)]
@Binding var selection: T
var body: some View {
HStack(spacing: 0) {
ForEach(options.indices, id: \.self) { i in
let opt = options[i]
let on = opt.0 == selection
Button { selection = opt.0 } label: {
Text(opt.1)
.font(.system(size: 12, weight: on ? .bold : .semibold))
.foregroundStyle(on ? LK.amber : LK.text2)
.padding(.horizontal, 12)
.frame(height: 26)
.background(RoundedRectangle(cornerRadius: 7).fill(on ? LK.selected : Color.clear))
.contentShape(Rectangle())
}
.buttonStyle(.plain)
}
}
.padding(3)
.background(RoundedRectangle(cornerRadius: 10).fill(LK.deep))
.overlay(RoundedRectangle(cornerRadius: 10).stroke(LK.border))
}
}
/// Text field look used in the Leuchttisch panels.
struct LKFieldBackground: ViewModifier {
func body(content: Content) -> some View {
content
.padding(.horizontal, 8)
.padding(.vertical, 6)
.background(RoundedRectangle(cornerRadius: 8).fill(LK.deep))
.overlay(RoundedRectangle(cornerRadius: 8).stroke(LK.borderStrong))
}
}
extension View {
func lkField() -> some View { modifier(LKFieldBackground()) }
/// Every window: dark Leuchttisch ground, warm title bar, amber accent, Leuchttisch group boxes.
func lkWindow() -> some View {
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: 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 {
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).
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)
}
}
/// "Gesendet an … am …" / "Noch nicht gesendet" (loupe panel, IPTC window).
struct SentStatusLine: View {
let summary: SentSummary?
var body: some View {
HStack(alignment: .top, spacing: 6) {
Image(systemName: summary == nil ? "paperplane" : "paperplane.fill").font(.system(size: 11))
Text(summary?.tooltip ?? "Noch nicht gesendet").lineLimit(2)
}
.font(.system(size: 11, weight: .medium))
.foregroundStyle(summary == nil ? LK.muted : LK.green)
.frame(maxWidth: .infinity, alignment: .leading)
}
}