pageta-native/Sources/Features/HighlightNoteSheet.swift
Till JS d4c0e11d5b Tabs umbenannt: Lese-Liste → Stapel, Markierungen → Marker
User-facing Strings konsistent umgestellt: Tab-Labels + Nav-Titel +
macOS-Sidebar, leere Zustände, Such-Prompt, Feed-Speichern-Aktionen
("Auf den Stapel"), Share-Toast ("Zum Stapel hinzugefügt"), App-Shortcut-
Beschreibung, Konto-Prosa, Marker-Bezüge im Reader (Notiz-Sheet, Zähler,
Löschen-Label, Kopieren). Verb "markieren" + Lese-Status bleiben.
Swift-Typnamen (LeseListeTabView/MarkierungenTabView) unverändert (interne
Identifier). Build grün.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 01:04:14 +02:00

72 lines
1.7 KiB
Swift

import SwiftUI
/// Modaler Editor für die Notiz an einem Highlight.
///
/// Sheet ist bewusst klein gehalten — Notizen sind kurze Gedanken zum
/// Highlight (warum hab ich das markiert?), nicht der Reading-Bereich.
/// Editor + Save + Löschen. Auto-Focus aufs TextField beim Öffnen.
struct HighlightNoteSheet: View {
let highlightText: String
let initialNote: String?
let color: HighlightColor
let onSave: (String?) async -> Void
@Environment(\.dismiss) private var dismiss
@State private var noteText: String = ""
@FocusState private var focused: Bool
var body: some View {
NavigationStack {
Form {
Section {
HStack(alignment: .top, spacing: 10) {
RoundedRectangle(cornerRadius: 2)
.fill(color.swiftUIColor)
.frame(width: 4)
Text(highlightText)
.font(.callout)
.foregroundStyle(PagetaTheme.foreground)
}
.padding(.vertical, 4)
} header: {
Text("Marker")
}
Section {
TextField(
"Was wolltest du dir merken?",
text: $noteText,
axis: .vertical
)
.lineLimit(4 ... 10)
.focused($focused)
} header: {
Text("Notiz")
} footer: {
Text("Sichtbar in der Marker-Liste. Leerlassen, um die Notiz zu entfernen.")
}
}
.navigationTitle("Notiz")
#if os(iOS)
.navigationBarTitleDisplayMode(.inline)
#endif
.toolbar {
ToolbarItem(placement: .cancellationAction) {
Button("Abbrechen") { dismiss() }
}
ToolbarItem(placement: .confirmationAction) {
Button("Speichern") {
Task {
await onSave(noteText.isEmpty ? nil : noteText)
dismiss()
}
}
}
}
.onAppear {
noteText = initialNote ?? ""
focused = true
}
}
}
}