import SwiftUI import Bedrock /// Success state shown after the contact has been saved. struct ClipSuccessView: View { @State private var showCheckmark = false var body: some View { VStack(spacing: ClipDesign.Spacing.xLarge) { // Animated checkmark Image(systemName: "checkmark.circle.fill") .resizable() .scaledToFit() .frame(width: ClipDesign.Size.avatarLarge, height: ClipDesign.Size.avatarLarge) .foregroundStyle(Color.Clip.success) .scaleEffect(showCheckmark ? 1 : 0.5) .opacity(showCheckmark ? 1 : 0) .animation(.spring(response: 0.5, dampingFraction: 0.6), value: showCheckmark) VStack(spacing: ClipDesign.Spacing.small) { Text(String(localized: "Contact Saved!")) .styled(.title2) .foregroundStyle(Color.Clip.text) Text(String(localized: "You can find this contact in your Contacts app.")) .styled(.subheading) .foregroundStyle(Color.Clip.secondaryText) .multilineTextAlignment(.center) } // Open Contacts button ClipPrimaryButton( title: String(localized: "Open Contacts"), systemImage: "person.crop.circle", action: openContacts ) .padding(.horizontal, ClipDesign.Spacing.xLarge) .padding(.top, ClipDesign.Spacing.large) } .padding(ClipDesign.Spacing.xLarge) .onAppear { showCheckmark = true } .accessibilityElement(children: .combine) .accessibilityLabel(Text(String(localized: "Contact saved successfully"))) } private func openContacts() { if let url = URL(string: ClipDesign.URL.contactsScheme) { UIApplication.shared.open(url) } } } #Preview { ZStack { Color.Clip.background .ignoresSafeArea() ClipSuccessView() } }