Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more
feat(overlay): redesign delivery failure card
altic-dev8a8200227579
diff --git a/Sources/Fluid/Views/BottomOverlayView.swift b/Sources/Fluid/Views/BottomOverlayView.swiftindex 292f9f2a..c956eac2 100644--- a/Sources/Fluid/Views/BottomOverlayView.swift+++ b/Sources/Fluid/Views/BottomOverlayView.swift@@ -3320,45 +3320,17 @@ struct BottomOverlayView: View {private var textDeliveryFailureView: some View {let message = self.contentState.textDeliveryFailureMessage- let detail = TextDeliveryFailure.userFacingDetail(forMessage: message)- return HStack(alignment: .center, spacing: 8) {- Image(systemName: "info.circle.fill")- .font(.fluidSystem(size: self.layout.transFontSize + 2, weight: .semibold))- .foregroundStyle(Color.accentColor)- .accessibilityHidden(true)-- VStack(alignment: .leading, spacing: 2) {- Text(message)- .font(.fluidSystem(size: self.layout.transFontSize, weight: .semibold))- .foregroundStyle(.white.opacity(0.95))- .lineLimit(1)- .truncationMode(.tail)- if let detail {- Text(detail)- .font(.fluidSystem(size: max(self.layout.transFontSize - 2, 10), weight: .regular))- .foregroundStyle(.white.opacity(0.7))- .lineLimit(2)- .truncationMode(.tail)- .fixedSize(horizontal: false, vertical: true)- }- }-- Spacer(minLength: 4)-- self.failureIconButton(systemName: "doc.on.doc", help: "Copy transcript") {- _ = ClipboardService.copyToClipboard(self.contentState.textDeliveryFailureTranscript)- }- self.failureIconButton(systemName: "arrow.down.doc", help: "Paste last transcript") {- let transcript = self.contentState.textDeliveryFailureTranscript- self.contentState.clearTextDeliveryFailure()- self.contentState.onRetryTextDeliveryRequested?(transcript)- }- self.failureIconButton(systemName: "xmark", help: "Dismiss") {- self.contentState.clearTextDeliveryFailure()- NotchOverlayManager.shared.hide()- }+ return DeliveryFailureCard(+ title: message,+ detail: TextDeliveryFailure.userFacingDetail(forMessage: message),+ transcript: self.contentState.textDeliveryFailureTranscript,+ fontSize: self.layout.transFontSize,+ compact: self.layout.usesFixedCanvas,+ maxWidth: self.previewMaxWidth+ ) {+ self.contentState.clearTextDeliveryFailure()+ NotchOverlayManager.shared.hide()}- .frame(maxWidth: self.previewMaxWidth, alignment: .leading)}private func scrollablePreviewText(_ previewText: String) -> some View {diff --git a/Sources/Fluid/Views/DeliveryFailureCard.swift b/Sources/Fluid/Views/DeliveryFailureCard.swiftnew file mode 100644index 00000000..e2cec0d9--- /dev/null+++ b/Sources/Fluid/Views/DeliveryFailureCard.swift@@ -0,0 +1,121 @@+import SwiftUI++/// Overlay card shown when a transcript could not be delivered. Copy is the+/// single primary action; the card dismisses itself after `autoDismissDelay`.+struct DeliveryFailureCard: View {+ let title: String+ let detail: String?+ let transcript: String+ let fontSize: CGFloat+ let compact: Bool+ let maxWidth: CGFloat+ let onDismiss: () -> Void++ static let autoDismissDelay: TimeInterval = 10++ @State private var didCopy = false+ @State private var autoDismissWorkItem: DispatchWorkItem?++ var body: some View {+ VStack(alignment: .leading, spacing: self.compact ? 0 : 10) {+ HStack(alignment: .top, spacing: 10) {+ self.glyph+ VStack(alignment: .leading, spacing: 2) {+ Text(self.title)+ .font(.fluidSystem(size: self.fontSize, weight: .semibold))+ .foregroundStyle(.white.opacity(0.95))+ .lineLimit(1)+ .truncationMode(.tail)+ if let detail {+ Text(detail)+ .font(.fluidSystem(size: max(self.fontSize - 2, 10), weight: .regular))+ .foregroundStyle(.white.opacity(0.58))+ .lineLimit(self.compact ? 1 : 2)+ .truncationMode(.tail)+ .fixedSize(horizontal: false, vertical: !self.compact)+ }+ }+ Spacer(minLength: 6)+ if self.compact {+ self.copyButton(fullWidth: false)+ }+ self.closeButton+ }+ if !self.compact {+ self.copyButton(fullWidth: true)+ }+ }+ .frame(maxWidth: self.maxWidth, alignment: .leading)+ .onAppear(perform: self.scheduleAutoDismiss)+ .onDisappear(perform: self.cancelAutoDismiss)+ }++ private var glyph: some View {+ Image(systemName: "text.cursor")+ .font(.fluidSystem(size: max(self.fontSize - 1, 10), weight: .semibold))+ .foregroundStyle(Color.orange.opacity(0.95))+ .frame(width: 26, height: 26)+ .background(Circle().fill(Color.orange.opacity(0.16)))+ .accessibilityHidden(true)+ }++ private var closeButton: some View {+ Button(action: self.dismiss) {+ Image(systemName: "xmark")+ .font(.fluidSystem(size: max(self.fontSize - 3, 9), weight: .bold))+ .foregroundStyle(.white.opacity(0.55))+ .frame(width: 22, height: 22)+ .background(Circle().fill(Color.white.opacity(0.08)))+ }+ .buttonStyle(.plain)+ .help("Dismiss")+ }++ private func copyButton(fullWidth: Bool) -> some View {+ Button(action: self.copy) {+ HStack(spacing: 6) {+ Image(systemName: self.didCopy ? "checkmark" : "doc.on.doc")+ .font(.fluidSystem(size: max(self.fontSize - 2, 10), weight: .semibold))+ Text(self.didCopy ? "Copied" : "Copy transcript")+ .font(.fluidSystem(size: max(self.fontSize - 1, 10), weight: .semibold))+ }+ .foregroundStyle(self.didCopy ? Color.black.opacity(0.85) : Color.white.opacity(0.92))+ .padding(.horizontal, 14)+ .frame(maxWidth: fullWidth ? .infinity : nil)+ .frame(height: 30)+ .background(Capsule().fill(self.didCopy ? Color.white.opacity(0.92) : Color.white.opacity(0.13)))+ .overlay(Capsule().strokeBorder(Color.white.opacity(0.10), lineWidth: 1))+ .contentShape(Capsule())+ }+ .buttonStyle(.plain)+ .help("Copy transcript")+ }++ private func copy() {+ guard !self.didCopy else { return }+ _ = ClipboardService.copyToClipboard(self.transcript)+ withAnimation(.easeOut(duration: 0.18)) { self.didCopy = true }+ self.cancelAutoDismiss()+ DispatchQueue.main.asyncAfter(deadline: .now() + 1.1) {+ guard self.didCopy else { return }+ self.dismiss()+ }+ }++ private func dismiss() {+ self.cancelAutoDismiss()+ self.onDismiss()+ }++ private func scheduleAutoDismiss() {+ self.cancelAutoDismiss()+ let workItem = DispatchWorkItem { self.onDismiss() }+ self.autoDismissWorkItem = workItem+ DispatchQueue.main.asyncAfter(deadline: .now() + Self.autoDismissDelay, execute: workItem)+ }++ private func cancelAutoDismiss() {+ self.autoDismissWorkItem?.cancel()+ self.autoDismissWorkItem = nil+ }+}