ContactDraftScreen.swift
82 lignes · 3113 octets
import SwiftUI // Port of ui/ContactDraftScreen.kt — editable draft of the parsed card, raw // OCR text, then: save to carnet / system contact / VCF export / retry. struct ContactDraftScreen: View { let draft: ContactDraftUi let onCardChange: (ContactCard) -> Void let onSaveToCarnet: () -> Void let onRetry: () -> Void var isEditing: Bool = false @State private var showSystemContact = false var body: some View { VStack(alignment: .leading, spacing: 14) { Text("Vérifier le contact") .font(C2VFont.titleLarge) .foregroundColor(C2VColor.encre) Text("Corrigez les champs, enregistrez dans le carnet, ou exportez vers Contacts / VCF.") .font(C2VFont.bodyMedium) .foregroundColor(C2VColor.texteFaible) ScrollView { VStack(alignment: .leading, spacing: 14) { ContactDraftFieldsView(card: Binding( get: { draft.card }, set: { onCardChange($0) } )) Text("Texte OCR brut") .font(C2VFont.bodyMedium) .foregroundColor(C2VColor.encre) Text(draft.rawOcrText) .font(.system(size: 12, design: .monospaced)) .foregroundColor(C2VColor.texteFaible) .textSelection(.enabled) .frame(maxWidth: .infinity, alignment: .leading) .padding(12) .background(C2VColor.surface) .overlay(Rectangle().stroke(C2VColor.bordure, lineWidth: 1)) } } Button(isEditing ? "Mettre à jour" : "Enregistrer", action: onSaveToCarnet) .buttonStyle(C2VPrimaryButtonStyle()) Button("Créer le contact") { showSystemContact = true } .buttonStyle(C2VOutlineButtonStyle()) ShareLink( item: VcfShareFile(card: draft.card), preview: SharePreview(VcfShare.fileName(draft.card)) ) { Text("Exporter VCF") } .buttonStyle(C2VOutlineButtonStyle()) Button("Reprendre la capture", action: onRetry) .buttonStyle(C2VOutlineButtonStyle()) } .padding(.horizontal, 18) .padding(.vertical, 16) .background(C2VColor.fond) .sheet(isPresented: $showSystemContact) { SystemContactView(card: draft.card) { showSystemContact = false } } } } /// Kotlin `ScanProgress`. struct ScanProgressView: View { let message: String var body: some View { VStack(spacing: 16) { ProgressView() .tint(C2VColor.ink) Text(message) .font(C2VFont.bodyMedium) .foregroundColor(C2VColor.texteFaible) } .frame(maxWidth: .infinity, maxHeight: .infinity) .background(C2VColor.fond) } }
GitRust