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(stats): surface Fluid Intelligence fixes and keystrokes
altic-dev0bc4b8d94207
diff --git a/Sources/Fluid/UI/DashboardView.swift b/Sources/Fluid/UI/DashboardView.swiftindex 1db9f069..52de5382 100644--- a/Sources/Fluid/UI/DashboardView.swift+++ b/Sources/Fluid/UI/DashboardView.swift@@ -19,6 +19,9 @@ struct DashboardView: View {@Environment(\.accessibilityReduceTransparency) private var reduceTransparency@State private var statsOwner = UUID()@State private var greeting = "Welcome back."+ @State private var statisticsHovered = false+ @FocusState private var statisticsFocused: Bool+ @Environment(\.accessibilityReduceMotion) private var reduceMotionprivate var busy: Bool { self.asr.isRunning || self.asr.isStarting || self.contentState.isProcessing }private var shortcut: String { self.settings.primaryDictationShortcutDisplayString }@@ -76,15 +79,42 @@ struct DashboardView: View {private var statistics: some View {let today = self.history.todaySummarylet streak = self.stats.snapshot?.usingWeekdays(self.settings.weekendsDontBreakStreak).currentStreak- return HStack(alignment: .top, spacing: 20) {- self.stat("Today", value: today.words.formatted(), detail: "words dictated")- Divider()- self.stat("Time saved", value: today.words == 0 ? "0m" : today.formattedTimeSaved(typingWPM: self.settings.userTypingWPM), detail: "estimated today")- Divider()- self.stat("Streak", value: streak.map { "\($0) \($0 == 1 ? "day" : "days")" } ?? "—", detail: "keep it going")+ return Button { self.selectedSidebarItem = .stats } label: {+ HStack(alignment: .top, spacing: 20) {+ self.stat("Today", value: today.words.formatted(), detail: "words dictated")+ Divider()+ self.stat("Time saved", value: today.words == 0 ? "0m" : today.formattedTimeSaved(typingWPM: self.settings.userTypingWPM), detail: "estimated today")+ Divider()+ self.stat("Streak", value: streak.map { "\($0) \($0 == 1 ? "day" : "days")" } ?? "—", detail: "keep it going")+ // Quiet proof that Smart mode earns its keep; absent until it has fixed something.+ if let fixed = self.stats.snapshot?.fluidFixedWords, fixed > 0 {+ Divider()+ self.stat("Fluid Intelligence", value: fixed.formatted(), detail: "words fixed for you")+ }+ }+ .fixedSize(horizontal: false, vertical: true)+ .overlay(alignment: .topTrailing) {+ HStack(spacing: 4) {+ Text("View stats")+ Image(systemName: "chevron.right").font(.fluidSystem(size: 9, weight: .semibold))+ }+ .font(self.theme.typography.captionStrong)+ .foregroundStyle(self.theme.palette.accent)+ .opacity(self.statisticsHovered ? 1 : 0)+ .offset(x: self.statisticsHovered || self.reduceMotion ? 0 : -4)+ }+ // Keyboard focus reuses the hover border instead of the heavy system ring,+ // which otherwise lands on this card every time the dashboard opens.+ .dashboardTile(hovered: self.statisticsHovered || self.statisticsFocused, horizontalPadding: 20, verticalPadding: 18, cornerRadius: 18)}- .fixedSize(horizontal: false, vertical: true)- .padding(.vertical, 16)+ .buttonStyle(.plain)+ .focused(self.$statisticsFocused)+ .focusEffectDisabled()+ .disabled(self.busy)+ .onHover { self.statisticsHovered = $0 && !self.busy }+ .animation(self.reduceMotion ? nil : .easeOut(duration: 0.15), value: self.statisticsHovered)+ .help("Open your full stats")+ .accessibilityHint("Opens the Stats page")}private func stat(_ title: String, value: String, detail: String) -> some View {@@ -399,13 +429,16 @@ private struct DashboardIconTile: View {private struct DashboardTileModifier: ViewModifier {let hovered: Bool+ let horizontalPadding: CGFloat+ let verticalPadding: CGFloat+ let cornerRadius: CGFloat@Environment(\.theme) private var themefunc body(content: Content) -> some View {- let shape = RoundedRectangle(cornerRadius: 14, style: .continuous)+ let shape = RoundedRectangle(cornerRadius: self.cornerRadius, style: .continuous)content- .padding(.horizontal, 12)- .padding(.vertical, 11)+ .padding(.horizontal, self.horizontalPadding)+ .padding(.vertical, self.verticalPadding).background(self.theme.palette.cardBackground, in: shape).overlay(shape.fill(Color.primary.opacity(self.hovered ? 0.04 : 0))).overlay(shape.strokeBorder(self.theme.palette.cardBorder.opacity(self.hovered ? 0.9 : 0.45), lineWidth: 1))@@ -415,7 +448,17 @@ private struct DashboardTileModifier: ViewModifier {private extension View {/// One surface for every small dashboard card so they hover and read as a set.- func dashboardTile(hovered: Bool) -> some View {- modifier(DashboardTileModifier(hovered: hovered))+ func dashboardTile(+ hovered: Bool,+ horizontalPadding: CGFloat = 12,+ verticalPadding: CGFloat = 11,+ cornerRadius: CGFloat = 14+ ) -> some View {+ modifier(DashboardTileModifier(+ hovered: hovered,+ horizontalPadding: horizontalPadding,+ verticalPadding: verticalPadding,+ cornerRadius: cornerRadius+ ))}}diff --git a/Sources/Fluid/UI/StatsSnapshot.swift b/Sources/Fluid/UI/StatsSnapshot.swiftindex 5215172d..462779c3 100644--- a/Sources/Fluid/UI/StatsSnapshot.swift+++ b/Sources/Fluid/UI/StatsSnapshot.swift@@ -5,6 +5,8 @@ nonisolated struct StatsSnapshot: Sendable {var totalWords = 0var totalTranscriptions = 0var totalCharacters = 0+ /// Words Fluid Intelligence changed, dropped or added compared with the raw transcript.+ var fluidFixedWords = 0/// Words and recording time from entries that carry a real audio length.var timedWords = 0var timedMilliseconds = 0@@ -105,6 +107,9 @@ nonisolated struct StatsSnapshot: Sendable {}result.longestTranscriptionWords = max(result.longestTranscriptionWords, words)if entry.wasAIProcessed { result.aiProcessedCount += 1 }+ if entry.wasAIProcessed, entry.processingModel?.lowercased().hasPrefix("fluid-1") == true {+ result.fluidFixedWords += Self.changedWordCount(raw: entry.rawText, processed: entry.processedText)+ }}try Task.checkCancellation()result.mostWordsInDay = dayWords.values.max() ?? 0@@ -132,6 +137,25 @@ nonisolated struct StatsSnapshot: Sendable {return result}+ /// Order-free word difference: cheap enough for the whole history, and blind to+ /// punctuation and capitalization so it never overstates what was fixed.+ static func changedWordCount(raw: String, processed: String) -> Int {+ func counts(_ text: String) -> [Substring: Int] {+ var result: [Substring: Int] = [:]+ for word in text.lowercased().split(whereSeparator: { !($0.isLetter || $0.isNumber || $0 == "'") }) {+ result[word, default: 0] += 1+ }+ return result+ }+ let before = counts(raw)+ let after = counts(processed)+ var removed = 0+ var added = 0+ for (word, count) in before { removed += max(0, count - (after[word] ?? 0)) }+ for (word, count) in after { added += max(0, count - (before[word] ?? 0)) }+ return max(removed, added)+ }+private static func previousDay(_ day: Date, calendar: Calendar, weekdays: Bool) -> Date? {var date = dayfor _ in 0..<7 {diff --git a/Sources/Fluid/UI/StatsView.swift b/Sources/Fluid/UI/StatsView.swiftindex a06aa5b9..c402c620 100644--- a/Sources/Fluid/UI/StatsView.swift+++ b/Sources/Fluid/UI/StatsView.swift@@ -55,6 +55,12 @@ struct StatsView: View {self.transcriptionsCard}+ // Third row: Fluid Intelligence + Keystrokes+ HStack(spacing: 16) {+ self.fluidIntelligenceCard+ self.keystrokesCard+ }+// Activity Chartself.activityChartCard@@ -328,6 +334,34 @@ struct StatsView: View {// MARK: - Transcriptions Card+ private var fluidIntelligenceCard: some View {+ StatCard(title: "FLUID INTELLIGENCE", icon: "sparkles") {+ VStack(alignment: .leading, spacing: 8) {+ Text(self.formatNumber(self.stats.fluidFixedWords))+ .font(.fluidSystem(size: 32, weight: .bold, design: .rounded))+ .foregroundStyle(.primary)++ Text(self.stats.fluidFixedWords == 0 ? "Words fixed by Smart mode show up here" : "words fixed for you by Smart mode")+ .font(.fluidSystem(size: 11))+ .foregroundStyle(.secondary)+ }+ }+ }++ private var keystrokesCard: some View {+ StatCard(title: "KEYSTROKES SAVED", icon: "keyboard") {+ VStack(alignment: .leading, spacing: 8) {+ Text(self.formatNumber(self.stats.totalCharacters))+ .font(.fluidSystem(size: 32, weight: .bold, design: .rounded))+ .foregroundStyle(.primary)++ Text("keys you never had to press")+ .font(.fluidSystem(size: 11))+ .foregroundStyle(.secondary)+ }+ }+ }+private var transcriptionsCard: some View {StatCard(title: "TRANSCRIPTIONS", icon: "doc.text.fill") {VStack(alignment: .leading, spacing: 8) {