pageta-native/Sources/Features/HighlightNoteSheet.swift
Till JS 8d6fc1a666 i18n: pageta-native voll über PagetaStrings (Phase 4)
Alle UI-Strings der Feature-/App-Schicht ziehen aus mana/i18n
(Listen/Detail/Marker/Feed/Rückblick/Zusammenfassen/Settings/Account
+ Archiv/Bulk/Note-Sheet/Palette); Interpolation als generierte Funktionen.
Verwaisten-Check grün (0 hartkodierte UI-Strings). Onboarding bleibt
seine eigene SOT (mana/content/onboarding).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 16:06:55 +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(PagetaStrings.markerLabel)
}
Section {
TextField(
PagetaStrings.notePlaceholder,
text: $noteText,
axis: .vertical
)
.lineLimit(4 ... 10)
.focused($focused)
} header: {
Text(PagetaStrings.noteTitle)
} footer: {
Text(PagetaStrings.noteHint)
}
}
.navigationTitle(PagetaStrings.noteTitle)
#if os(iOS)
.navigationBarTitleDisplayMode(.inline)
#endif
.toolbar {
ToolbarItem(placement: .cancellationAction) {
Button(PagetaStrings.actionCancel) { dismiss() }
}
ToolbarItem(placement: .confirmationAction) {
Button(PagetaStrings.actionSave) {
Task {
await onSave(noteText.isEmpty ? nil : noteText)
dismiss()
}
}
}
}
.onAppear {
noteText = initialNote ?? ""
focused = true
}
}
}
}