Skip to content

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

Added stats and history tab which updates for every transcription - has not been battle tested yet with many history items. prone to errors - might need a double check later

altic-dev0fc6538aa3b0
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swift
index 1fe9c156..aff7b834 100644
--- a/Sources/Fluid/ContentView.swift
+++ b/Sources/Fluid/ContentView.swift
@@ -20,6 +20,7 @@ enum SidebarItem: Hashable {
case preferences
case meetingTools
case stats
+ case history
case feedback
case commandMode
case rewriteMode
@@ -612,6 +613,11 @@ struct ContentView: View {
.font(.system(size: 15, weight: .medium))
}
+ NavigationLink(value: SidebarItem.history) {
+ Label("History", systemImage: "clock.arrow.circlepath")
+ .font(.system(size: 15, weight: .medium))
+ }
+
NavigationLink(value: SidebarItem.preferences) {
Label("Preferences", systemImage: "gearshape.fill")
.font(.system(size: 15, weight: .medium))
@@ -662,6 +668,8 @@ struct ContentView: View {
commandModeView
case .rewriteMode:
rewriteModeView
+ case .history:
+ TranscriptionHistoryView()
}
}
.transition(.opacity)
@@ -1884,38 +1892,9 @@ struct ContentView: View {
MeetingTranscriptionView(asrService: asr)
}
- // MARK: - Stats View (Coming Soon)
+ // MARK: - Stats View
private var statsView: some View {
- VStack(spacing: 14) {
- Spacer()
-
- Image(systemName: "chart.bar.fill")
- .font(.system(size: 60))
- .foregroundStyle(theme.palette.accent)
-
- Text("Stats")
- .font(.system(size: 28, weight: .bold))
-
- Text("Track your usage, words transcribed, and time saved")
- .font(.system(size: 15))
- .foregroundStyle(.secondary)
- .multilineTextAlignment(.center)
- .padding(.horizontal, 40)
-
- Text("Coming Soon")
- .font(.system(size: 13, weight: .semibold))
- .foregroundStyle(theme.palette.accent)
- .padding(.horizontal, 20)
- .padding(.vertical, 8)
- .background(
- Capsule()
- .fill(theme.palette.accent.opacity(0.15))
- )
-
- Spacer()
- }
- .frame(maxWidth: .infinity, maxHeight: .infinity)
- .padding()
+ StatsView()
}
// MARK: - Feedback View
@@ -2599,6 +2578,15 @@ struct ContentView: View {
}
DebugLogger.shared.info("Transcription finalized (chars: \(finalText.count))", source: "ContentView")
+
+ // Save to transcription history (transcription mode only)
+ let appInfo = recordingAppInfo ?? getCurrentAppInfo()
+ TranscriptionHistoryStore.shared.addEntry(
+ rawText: transcribedText,
+ processedText: finalText,
+ appName: appInfo.name,
+ windowTitle: appInfo.windowTitle
+ )
// Copy to clipboard if enabled (happens before typing as a backup)
if SettingsStore.shared.copyTranscriptionToClipboard {
diff --git a/Sources/Fluid/Persistence/SettingsStore.swift b/Sources/Fluid/Persistence/SettingsStore.swift
index 617a87b5..21732338 100644
--- a/Sources/Fluid/Persistence/SettingsStore.swift
+++ b/Sources/Fluid/Persistence/SettingsStore.swift
@@ -49,6 +49,9 @@ final class SettingsStore: ObservableObject
static let rewriteModeSelectedModel = "RewriteModeSelectedModel"
static let rewriteModeSelectedProviderID = "RewriteModeSelectedProviderID"
static let rewriteModeLinkedToGlobal = "RewriteModeLinkedToGlobal"
+
+ // Stats Keys
+ static let userTypingWPM = "UserTypingWPM"
}
struct SavedProvider: Codable, Identifiable, Hashable
@@ -438,6 +441,21 @@ final class SettingsStore: ObservableObject
defaults.set(newValue, forKey: Keys.rewriteModeLinkedToGlobal)
}
}
+
+ // MARK: - Stats Settings
+
+ /// User's typing speed in words per minute (for time saved calculation)
+ var userTypingWPM: Int
+ {
+ get {
+ let value = defaults.integer(forKey: Keys.userTypingWPM)
+ return value > 0 ? value : 40 // Default to 40 WPM
+ }
+ set {
+ objectWillChange.send()
+ defaults.set(max(1, min(200, newValue)), forKey: Keys.userTypingWPM) // Clamp 1-200
+ }
+ }
// MARK: - Private Methods
diff --git a/Sources/Fluid/Persistence/TranscriptionHistoryStore.swift b/Sources/Fluid/Persistence/TranscriptionHistoryStore.swift
new file mode 100644
index 00000000..55d32682
--- /dev/null
+++ b/Sources/Fluid/Persistence/TranscriptionHistoryStore.swift
@@ -0,0 +1,551 @@
+//
+// TranscriptionHistoryStore.swift
+// Fluid
+//
+// Persistence manager for Transcription Mode history
+//
+
+import Foundation
+import Combine
+
+// MARK: - Transcription History Entry Model
+
+struct TranscriptionHistoryEntry: Codable, Identifiable, Equatable {
+ let id: UUID
+ let timestamp: Date
+ let rawText: String
+ let processedText: String
+ let appName: String
+ let windowTitle: String
+ let characterCount: Int
+ let wasAIProcessed: Bool
+
+ init(
+ id: UUID = UUID(),
+ timestamp: Date = Date(),
+ rawText: String,
+ processedText: String,
+ appName: String,
+ windowTitle: String
+ ) {
+ self.id = id
+ self.timestamp = timestamp
+ self.rawText = rawText
+ self.processedText = processedText
+ self.appName = appName
+ self.windowTitle = windowTitle
+ self.characterCount = processedText.count
+ self.wasAIProcessed = rawText != processedText
+ }
+
+ /// Preview text for list display (first 80 chars)
+ var previewText: String {
+ let text = processedText.trimmingCharacters(in: .whitespacesAndNewlines)
+ if text.count > 80 {
+ return String(text.prefix(77)) + "..."
+ }
+ return text
+ }
+
+ /// Relative time string for display
+ var relativeTimeString: String {
+ let formatter = RelativeDateTimeFormatter()
+ formatter.unitsStyle = .abbreviated
+ return formatter.localizedString(for: timestamp, relativeTo: Date())
+ }
+
+ /// Full formatted date string
+ var fullDateString: String {
+ let formatter = DateFormatter()
+ formatter.dateStyle = .medium
+ formatter.timeStyle = .short
+ return formatter.string(from: timestamp)
+ }
+}
+
+// MARK: - Transcription History Store
+
+@MainActor
+final class TranscriptionHistoryStore: ObservableObject {
+ static let shared = TranscriptionHistoryStore()
+
+ private let defaults = UserDefaults.standard
+ private let maxEntries = 1000
+
+ private enum Keys {
+ static let transcriptionHistory = "TranscriptionHistoryEntries"
+ }
+
+ @Published private(set) var entries: [TranscriptionHistoryEntry] = []
+ @Published var selectedEntryID: UUID?
+
+ private init() {
+ loadEntries()
+ }
+
+ // MARK: - Public Methods
+
+ /// Get selected entry
+ var selectedEntry: TranscriptionHistoryEntry? {
+ guard let id = selectedEntryID else { return nil }
+ return entries.first(where: { $0.id == id })
+ }
+
+ /// Add a new transcription entry
+ func addEntry(
+ rawText: String,
+ processedText: String,
+ appName: String,
+ windowTitle: String
+ ) {
+ // Skip empty transcriptions
+ guard !processedText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { return }
+
+ let entry = TranscriptionHistoryEntry(
+ rawText: rawText,
+ processedText: processedText,
+ appName: appName,
+ windowTitle: windowTitle
+ )
+
+ // Insert at beginning (newest first)
+ entries.insert(entry, at: 0)
+
+ // Trim old entries if over limit
+ trimOldEntries()
+ saveEntries()
+
+ DebugLogger.shared.debug("Added transcription to history (total: \(entries.count))", source: "TranscriptionHistoryStore")
+ }
+
+ /// Delete a specific entry
+ func deleteEntry(id: UUID) {
+ entries.removeAll { $0.id == id }
+
+ // Clear selection if deleted
+ if selectedEntryID == id {
+ selectedEntryID = entries.first?.id
+ }
+
+ saveEntries()
+ }
+
+ /// Delete multiple entries
+ func deleteEntries(ids: Set<UUID>) {
+ entries.removeAll { ids.contains($0.id) }
+
+ if let selected = selectedEntryID, ids.contains(selected) {
+ selectedEntryID = entries.first?.id
+ }
+
+ saveEntries()
+ }
+
+ /// Clear all history
+ func clearAllHistory() {
+ entries.removeAll()
+ selectedEntryID = nil
+ saveEntries()
+
+ DebugLogger.shared.info("Cleared all transcription history", source: "TranscriptionHistoryStore")
+ }
+
+ /// Search entries by text content
+ func search(query: String) -> [TranscriptionHistoryEntry] {
+ guard !query.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else {
+ return entries
+ }
+
+ let lowercased = query.lowercased()
+ return entries.filter { entry in
+ entry.rawText.lowercased().contains(lowercased) ||
+ entry.processedText.lowercased().contains(lowercased) ||
+ entry.appName.lowercased().contains(lowercased) ||
+ entry.windowTitle.lowercased().contains(lowercased)
+ }
+ }
+
+ /// Get entries filtered by date range
+ func entriesInRange(from startDate: Date, to endDate: Date) -> [TranscriptionHistoryEntry] {
+ entries.filter { $0.timestamp >= startDate && $0.timestamp <= endDate }
+ }
+
+ /// Get total character count across all entries
+ var totalCharacterCount: Int {
+ entries.reduce(0) { $0 + $1.characterCount }
+ }
+
+ /// Get count of AI-processed entries
+ var aiProcessedCount: Int {
+ entries.filter { $0.wasAIProcessed }.count
+ }
+
+ // MARK: - Private Methods
+
+ private func loadEntries() {
+ guard let data = defaults.data(forKey: Keys.transcriptionHistory),
+ let decoded = try? JSONDecoder().decode([TranscriptionHistoryEntry].self, from: data) else {
+ entries = []
+ return
+ }
+ entries = decoded
+ }
+
+ private func saveEntries() {
+ if let encoded = try? JSONEncoder().encode(entries) {
+ defaults.set(encoded, forKey: Keys.transcriptionHistory)
+ }
+ objectWillChange.send()
+ }
+
+ private func trimOldEntries() {
+ if entries.count > maxEntries {
+ // Keep most recent entries
+ entries = Array(entries.prefix(maxEntries))
+ }
+ }
+}
+
+// MARK: - Stats Computation Extension
+
+extension TranscriptionHistoryStore {
+
+ // MARK: - Word Counting
+
+ /// Count words in a string (handles multiple spaces, newlines)
+ private func wordCount(in text: String) -> Int {
+ let trimmed = text.trimmingCharacters(in: .whitespacesAndNewlines)
+ guard !trimmed.isEmpty else { return 0 }
+
+ let words = trimmed.components(separatedBy: .whitespacesAndNewlines)
+ .filter { !$0.isEmpty }
+ return words.count
+ }
+
+ /// Total words across all transcriptions
+ var totalWords: Int {
+ entries.reduce(0) { $0 + wordCount(in: $1.processedText) }
+ }
+
+ /// Words transcribed today
+ var wordsToday: Int {
+ let calendar = Calendar.current
+ let today = calendar.startOfDay(for: Date())
+ return entries
+ .filter { calendar.isDate($0.timestamp, inSameDayAs: today) }
+ .reduce(0) { $0 + wordCount(in: $1.processedText) }
+ }
+
+ /// Average words per transcription
+ var averageWordsPerTranscription: Int {
+ guard !entries.isEmpty else { return 0 }
+ return totalWords / entries.count
+ }
+
+ // MARK: - Time Saved Calculation
+
+ /// Calculate time saved in minutes
+ /// - Parameters:
+ /// - typingWPM: User's typing speed (default 40)
+ /// - speakingWPM: Average speaking speed (default 150)
+ func timeSavedMinutes(typingWPM: Int = 40, speakingWPM: Int = 150) -> Double {
+ guard typingWPM > 0 && speakingWPM > 0 else { return 0 }
+
+ let words = Double(totalWords)
+ let typingTime = words / Double(typingWPM) // minutes to type
+ let speakingTime = words / Double(speakingWPM) // minutes to speak
+
+ return max(0, typingTime - speakingTime)
+ }
+
+ /// Formatted time saved string (e.g., "2h 45m" or "45m")
+ func formattedTimeSaved(typingWPM: Int = 40) -> String {
+ let minutes = timeSavedMinutes(typingWPM: typingWPM)
+
+ if minutes < 1 {
+ return "< 1m"
+ } else if minutes < 60 {
+ return "\(Int(minutes))m"
+ } else {
+ let hours = Int(minutes) / 60
+ let mins = Int(minutes) % 60
+ if mins == 0 {
+ return "\(hours)h"
+ }
+ return "\(hours)h \(mins)m"
+ }
+ }
+
+ // MARK: - Streak Calculation
+
+ /// Get unique days with activity (sorted newest first)
+ private var activeDays: [Date] {
+ let calendar = Calendar.current
+ var uniqueDays = Set<Date>()
+
+ for entry in entries {
+ let day = calendar.startOfDay(for: entry.timestamp)
+ uniqueDays.insert(day)
+ }
+
+ return uniqueDays.sorted(by: >) // newest first
+ }
+
+ /// Current streak (consecutive days including today or yesterday)
+ var currentStreak: Int {
+ let calendar = Calendar.current
+ let days = activeDays
+
+ guard !days.isEmpty else { return 0 }
+
+ let today = calendar.startOfDay(for: Date())
+ let yesterday = calendar.date(byAdding: .day, value: -1, to: today)!
+
+ // Must have activity today or yesterday to have an active streak
+ guard let firstActiveDay = days.first,
+ firstActiveDay == today || firstActiveDay == yesterday else {
+ return 0
+ }
+
+ var streak = 1
+ var previousDay = firstActiveDay
+
+ for day in days.dropFirst() {
+ let expectedPrevious = calendar.date(byAdding: .day, value: -1, to: previousDay)!
+
+ if day == expectedPrevious {
+ streak += 1
+ previousDay = day
+ } else {
+ break
+ }
+ }
+
+ return streak
+ }
+
+ /// Best streak ever achieved
+ var bestStreak: Int {
+ let calendar = Calendar.current
+ let days = activeDays.sorted() // oldest first for this calculation
+
+ guard !days.isEmpty else { return 0 }
+
+ var maxStreak = 1
+ var currentStreakCount = 1
+ var previousDay = days[0]
+
+ for day in days.dropFirst() {
+ let expectedNext = calendar.date(byAdding: .day, value: 1, to: previousDay)!
+
+ if day == expectedNext {
+ currentStreakCount += 1
+ maxStreak = max(maxStreak, currentStreakCount)
+ } else {
+ currentStreakCount = 1
+ }
+ previousDay = day
+ }
+
+ return maxStreak
+ }
+
+ // MARK: - Daily Activity Data (for charts)
+
+ /// Daily word counts for the last N days
+ func dailyWordCounts(days: Int) -> [(date: Date, words: Int)] {
+ let calendar = Calendar.current
+ let today = calendar.startOfDay(for: Date())
+
+ var result: [(date: Date, words: Int)] = []
+
+ for dayOffset in 0..<days {
+ guard let date = calendar.date(byAdding: .day, value: -dayOffset, to: today) else { continue }
+
+ let dayEntries = entries.filter { calendar.isDate($0.timestamp, inSameDayAs: date) }
+ let words = dayEntries.reduce(0) { $0 + wordCount(in: $1.processedText) }
+
+ result.append((date: date, words: words))
+ }
+
+ return result.reversed() // oldest to newest for chart display
+ }
+
+ /// Daily transcription counts for the last N days
+ func dailyTranscriptionCounts(days: Int) -> [(date: Date, count: Int)] {
+ let calendar = Calendar.current
+ let today = calendar.startOfDay(for: Date())
+
+ var result: [(date: Date, count: Int)] = []
+
+ for dayOffset in 0..<days {
+ guard let date = calendar.date(byAdding: .day, value: -dayOffset, to: today) else { continue }
+
+ let count = entries.filter { calendar.isDate($0.timestamp, inSameDayAs: date) }.count
+ result.append((date: date, count: count))
+ }
+
+ return result.reversed()
+ }
+
+ // MARK: - Top Apps
+
+ /// Most used apps (sorted by usage count)
+ var topApps: [(app: String, count: Int)] {
+ var appCounts: [String: Int] = [:]
+
+ for entry in entries {
+ let app = entry.appName.isEmpty ? "Unknown" : entry.appName
+ appCounts[app, default: 0] += 1
+ }
+
+ return appCounts
+ .map { (app: $0.key, count: $0.value) }
+ .sorted { $0.count > $1.count }
+ }
+
+ /// Top N apps formatted for display
+ func topAppsFormatted(limit: Int = 5) -> [String] {
+ topApps.prefix(limit).map { $0.app }
+ }
+
+ // MARK: - AI Enhancement Rate
+
+ /// Percentage of transcriptions that were AI-enhanced (0-100)
+ var aiEnhancementRate: Int {
+ guard !entries.isEmpty else { return 0 }
+ return (aiProcessedCount * 100) / entries.count
+ }
+
+ // MARK: - Peak Usage Hours
+
+ /// Hour of day with most transcriptions (0-23)
+ var peakHour: Int? {
+ guard !entries.isEmpty else { return nil }
+
+ let calendar = Calendar.current
+ var hourCounts: [Int: Int] = [:]
+
+ for entry in entries {
+ let hour = calendar.component(.hour, from: entry.timestamp)
+ hourCounts[hour, default: 0] += 1
+ }
+
+ return hourCounts.max(by: { $0.value < $1.value })?.key
+ }
+
+ /// Formatted peak hour range (e.g., "2-3 PM")
+ var peakHourFormatted: String {
+ guard let hour = peakHour else { return "N/A" }
+
+ let formatter = DateFormatter()
+ formatter.dateFormat = "h a"
+
+ let calendar = Calendar.current
+ var components = DateComponents()
+ components.hour = hour
+
+ guard let startDate = calendar.date(from: components),
+ let endDate = calendar.date(byAdding: .hour, value: 1, to: startDate) else {
+ return "N/A"
+ }
+
+ let startStr = formatter.string(from: startDate)
+ let endStr = formatter.string(from: endDate)
+
+ return "\(startStr)-\(endStr)"
+ }
+
+ // MARK: - Personal Records
+
+ /// Longest single transcription (word count)
+ var longestTranscriptionWords: Int {
+ entries.map { wordCount(in: $0.processedText) }.max() ?? 0
+ }
+
+ /// Most words in a single day
+ var mostWordsInDay: Int {
+ let calendar = Calendar.current
+ var dayTotals: [Date: Int] = [:]
+
+ for entry in entries {
+ let day = calendar.startOfDay(for: entry.timestamp)
+ dayTotals[day, default: 0] += wordCount(in: entry.processedText)
+ }
+
+ return dayTotals.values.max() ?? 0
+ }
+
+ /// Most transcriptions in a single day
+ var mostTranscriptionsInDay: Int {
+ let calendar = Calendar.current
+ var dayCounts: [Date: Int] = [:]
+
+ for entry in entries {
+ let day = calendar.startOfDay(for: entry.timestamp)
+ dayCounts[day, default: 0] += 1
+ }
+
+ return dayCounts.values.max() ?? 0
+ }
+
+ // MARK: - Milestones
+
+ /// Word count milestones and whether they've been achieved
+ var wordMilestones: [(target: Int, achieved: Bool, label: String)] {
+ let milestones = [
+ (1_000, "1K"),
+ (10_000, "10K"),
+ (50_000, "50K"),
+ (100_000, "100K"),
+ (500_000, "500K"),
+ (1_000_000, "1M")
+ ]
+
+ let total = totalWords
+ return milestones.map { (target: $0.0, achieved: total >= $0.0, label: $0.1) }
+ }
+
+ /// Transcription count milestones
+ var transcriptionMilestones: [(target: Int, achieved: Bool, label: String)] {
+ let milestones = [
+ (50, "50"),
+ (100, "100"),
+ (500, "500"),
+ (1_000, "1K"),
+ (5_000, "5K"),
+ (10_000, "10K")
+ ]
+
+ let total = entries.count
+ return milestones.map { (target: $0.0, achieved: total >= $0.0, label: $0.1) }
+ }
+
+ /// Streak milestones
+ var streakMilestones: [(target: Int, achieved: Bool, label: String)] {
+ let milestones = [
+ (7, "7 days"),
+ (14, "14 days"),
+ (30, "30 days"),
+ (60, "60 days"),
+ (100, "100 days"),
+ (365, "1 year")
+ ]
+
+ let best = bestStreak
+ return milestones.map { (target: $0.0, achieved: best >= $0.0, label: $0.1) }
+ }
+
+ /// Total milestones achieved
+ var totalMilestonesAchieved: Int {
+ wordMilestones.filter { $0.achieved }.count +
+ transcriptionMilestones.filter { $0.achieved }.count +
+ streakMilestones.filter { $0.achieved }.count
+ }
+
+ /// Total possible milestones
+ var totalMilestonesPossible: Int {
+ wordMilestones.count + transcriptionMilestones.count + streakMilestones.count
+ }
+}
+
diff --git a/Sources/Fluid/Services/ASRService.swift b/Sources/Fluid/Services/ASRService.swift
index 7ba71449..256728eb 100644
--- a/Sources/Fluid/Services/ASRService.swift
+++ b/Sources/Fluid/Services/ASRService.swift
@@ -6,10 +6,10 @@ import FluidAudio
import CoreAudio
import AppKit
-private actor TranscriptionExecutor
-{
- func run<T>(_ operation: @escaping () async throws -> T) async rethrows -> T
- {
+/// Serializes all CoreML transcription operations to prevent concurrent access issues.
+/// The actor ensures only one transcription runs at a time, preventing CoreML race conditions.
+private actor TranscriptionExecutor {
+ func run<T>(_ operation: @escaping () async throws -> T) async rethrows -> T {
try await operation()
}
}
@@ -117,9 +117,10 @@ final class ASRService: ObservableObject
// Auto-load models if they exist on disk to avoid "Downloaded but not loaded" state
if modelsExistOnDisk {
DebugLogger.shared.info("Models found on disk, auto-loading...", source: "ASRService")
- Task {
+ Task { [weak self] in
+ guard let self = self else { return }
do {
- try await ensureAsrReady()
+ try await self.ensureAsrReady()
DebugLogger.shared.info("Models auto-loaded successfully on startup", source: "ASRService")
} catch {
DebugLogger.shared.error("Failed to auto-load models on startup: \(error)", source: "ASRService")
diff --git a/Sources/Fluid/Services/CommandModeService.swift b/Sources/Fluid/Services/CommandModeService.swift
index a8157f23..4a299b8b 100644
--- a/Sources/Fluid/Services/CommandModeService.swift
+++ b/Sources/Fluid/Services/CommandModeService.swift
@@ -711,6 +711,27 @@ final class CommandModeService: ObservableObject {
User: "Create a project folder with a readme"
You: → Check if folder exists, create it, create readme, verify both
+ ## NATIVE macOS APP CONTROL (Use osascript):
+ For Reminders, Notes, Calendar, Messages, Mail, and other native macOS apps, use `osascript`:
+
+ ### Reminders:
+ - Create reminder (default list): `osascript -e 'tell application "Reminders" to make new reminder with properties {name:"<text>"}'`
+ - Create in specific list: `osascript -e 'tell application "Reminders" to make new reminder at end of list "<ListName>" with properties {name:"<text>"}'`
+ - With due date: `osascript -e 'tell application "Reminders" to make new reminder with properties {name:"<text>", due date:date "12/25/2024 3:00 PM"}'`
+ - ⚠️ Do NOT use `reminders list 1` syntax - it causes errors. Use `list "<name>"` or omit the list entirely.
+
+ ### Notes:
+ - Create note: `osascript -e 'tell application "Notes" to make new note at folder "Notes" with properties {name:"<title>", body:"<content>"}'`
+
+ ### Calendar:
+ - Create event: `osascript -e 'tell application "Calendar" to tell calendar "<CalendarName>" to make new event with properties {summary:"<title>", start date:date "<date>", end date:date "<date>"}'`
+
+ ### Messages:
+ - Send iMessage: `osascript -e 'tell application "Messages" to send "<message>" to buddy "<phone/email>"'`
+
+ ### General Pattern:
+ Always use `osascript -e 'tell application "<AppName>" to ...'` for native app automation.
+
The user is on macOS with zsh shell. Be thorough but efficient.
When task is complete, provide a clear summary starting with ✓ or ✗.
"""
diff --git a/Sources/Fluid/Services/GlobalHotkeyManager.swift b/Sources/Fluid/Services/GlobalHotkeyManager.swift
index b86f9dc6..739e6b85 100644
--- a/Sources/Fluid/Services/GlobalHotkeyManager.swift
+++ b/Sources/Fluid/Services/GlobalHotkeyManager.swift
@@ -116,10 +116,10 @@ final class GlobalHotkeyManager: NSObject
if attempt < maxRetryAttempts {
DebugLogger.shared.warning("Attempt \(attempt) failed, retrying in \(retryDelay) seconds...", source: "GlobalHotkeyManager")
- Task {
+ Task { [weak self] in
try? await Task.sleep(nanoseconds: UInt64(retryDelay * 1_000_000_000))
- await MainActor.run {
- self.setupGlobalHotkeyWithRetry()
+ await MainActor.run { [weak self] in
+ self?.setupGlobalHotkeyWithRetry()
}
}
return
diff --git a/Sources/Fluid/Services/NotchOverlayManager.swift b/Sources/Fluid/Services/NotchOverlayManager.swift
index f2378b55..75e8a7e9 100644
--- a/Sources/Fluid/Services/NotchOverlayManager.swift
+++ b/Sources/Fluid/Services/NotchOverlayManager.swift
@@ -182,10 +182,10 @@ final class NotchOverlayManager {
self.notch = newNotch
// Show in expanded state
- Task {
+ Task { [weak self] in
await newNotch.expand()
// Only update state if we're still the active generation
- guard self.generation == currentGeneration else { return }
+ guard let self = self, self.generation == currentGeneration else { return }
self.state = .visible
}
}
@@ -205,16 +205,16 @@ final class NotchOverlayManager {
// Handle visible or showing states (can hide while still expanding)
guard state == .visible || state == .showing, let currentNotch = notch else {
// Force cleanup if stuck or in inconsistent state
- Task { await performCleanup() }
+ Task { [weak self] in await self?.performCleanup() }
return
}
state = .hiding
- Task {
+ Task { [weak self] in
await currentNotch.hide()
// Only clear if we're still the active operation
- guard self.generation == currentGeneration else { return }
+ guard let self = self, self.generation == currentGeneration else { return }
self.notch = nil
self.state = .idle
}
@@ -272,9 +272,9 @@ final class NotchOverlayManager {
}
// Wait a bit for cleanup
- Task {
+ Task { [weak self] in
try? await Task.sleep(nanoseconds: 100_000_000) // 100ms
- await showExpandedCommandOutputInternal()
+ await self?.showExpandedCommandOutputInternal()
}
}
@@ -363,10 +363,10 @@ final class NotchOverlayManager {
let notchToHide = currentNotch
self.commandOutputNotch = nil
- Task {
+ Task { [weak self] in
// Try to hide gracefully, but we've already removed our reference
await notchToHide.hide()
- guard self.commandOutputGeneration == currentGeneration else { return }
+ guard let self = self, self.commandOutputGeneration == currentGeneration else { return }
self.commandOutputState = .idle
}
}
diff --git a/Sources/Fluid/Theme/Components/SetupComponents.swift b/Sources/Fluid/Theme/Components/SetupComponents.swift
index 4dfca734..3f13f399 100644
--- a/Sources/Fluid/Theme/Components/SetupComponents.swift
+++ b/Sources/Fluid/Theme/Components/SetupComponents.swift
@@ -30,92 +30,78 @@ struct SetupStepView: View {
action()
}
}) {
- HStack(alignment: .top, spacing: 12) {
+ HStack(alignment: .center, spacing: 10) {
// Status indicator
ZStack {
Circle()
- .fill(statusColor.opacity(0.15))
- .frame(width: 32, height: 32)
+ .fill(statusColor.opacity(0.12))
+ .frame(width: 28, height: 28)
.overlay(
Circle()
- .stroke(statusColor.opacity(0.3), lineWidth: 1.5)
+ .stroke(statusColor.opacity(0.25), lineWidth: 1)
)
if status == .completed {
Image(systemName: "checkmark.circle.fill")
.foregroundStyle(statusColor)
- .font(.system(size: 20, weight: .semibold))
+ .font(.body.weight(.semibold))
} else if status == .inProgress {
ProgressView()
- .scaleEffect(0.7)
+ .controlSize(.small)
.tint(statusColor)
} else {
Text("\(step)")
- .font(.system(size: 14, weight: .bold))
+ .font(.caption.weight(.bold))
.foregroundStyle(statusColor)
}
}
- VStack(alignment: .leading, spacing: 4) {
- HStack(alignment: .top) {
- VStack(alignment: .leading, spacing: 3) {
- Text(title)
- .font(.system(size: 14, weight: .semibold))
- .foregroundStyle(.primary)
-
- Text(description)
- .font(.system(size: 12))
- .foregroundStyle(.secondary)
- .fixedSize(horizontal: false, vertical: true)
- }
+ VStack(alignment: .leading, spacing: 2) {
+ Text(title)
+ .font(.body.weight(.medium))
+ .foregroundStyle(.primary)
- Spacer()
+ Text(description)
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ .lineLimit(2)
+ }
- // Action button or status badge
- if status == .completed {
- HStack(spacing: 4) {
- Image(systemName: "checkmark")
- .font(.system(size: 10, weight: .bold))
- Text("Done")
- .font(.system(size: 11, weight: .semibold))
- }
- .foregroundStyle(.white)
- .padding(.horizontal, 10)
- .padding(.vertical, 4)
- .background(
- Capsule()
- .fill(Color.green)
- )
- } else if showActionButton {
- HStack(spacing: 4) {
- Text(actionButtonTitle)
- .font(.system(size: 11, weight: .semibold))
- Image(systemName: "arrow.right")
- .font(.system(size: 9, weight: .bold))
- }
- .foregroundStyle(theme.palette.accent)
- .padding(.horizontal, 10)
- .padding(.vertical, 4)
- .background(
- Capsule()
- .fill(theme.palette.accent.opacity(0.15))
- )
- }
+ Spacer()
+
+ // Action button or status badge
+ if status == .completed {
+ Label("Done", systemImage: "checkmark")
+ .font(.caption.weight(.semibold))
+ .foregroundStyle(.white)
+ .padding(.horizontal, 8)
+ .padding(.vertical, 4)
+ .background(Color.green, in: Capsule())
+ } else if showActionButton {
+ HStack(spacing: 3) {
+ Text(actionButtonTitle)
+ .font(.caption.weight(.medium))
+ Image(systemName: "arrow.right")
+ .font(.caption2.weight(.bold))
}
+ .foregroundStyle(theme.palette.accent)
+ .padding(.horizontal, 8)
+ .padding(.vertical, 4)
+ .background(theme.palette.accent.opacity(0.12), in: Capsule())
}
}
- .padding(12)
+ .padding(10)
.background(
- RoundedRectangle(cornerRadius: 10, style: .continuous)
+ RoundedRectangle(cornerRadius: 8, style: .continuous)
.fill(status == .completed
- ? Color.green.opacity(0.08)
- : theme.palette.cardBackground.opacity(0.6))
+ ? Color.green.opacity(0.06)
+ : theme.palette.cardBackground.opacity(0.5))
.overlay(
- RoundedRectangle(cornerRadius: 10, style: .continuous)
+ RoundedRectangle(cornerRadius: 8, style: .continuous)
.stroke(
status == .completed
- ? Color.green.opacity(0.3)
- : theme.palette.cardBorder.opacity(0.3),
+ ? Color.green.opacity(0.25)
+ : theme.palette.cardBorder.opacity(0.2),
lineWidth: 1
)
)
@@ -123,7 +109,7 @@ struct SetupStepView: View {
}
.buttonStyle(.plain)
.disabled(status == .completed || !showActionButton)
- .opacity(status == .completed ? 0.85 : 1.0)
+ .opacity(status == .completed ? 0.9 : 1.0)
}
private var statusColor: Color {
@@ -144,34 +130,34 @@ struct InstructionStep: View {
let description: String
var body: some View {
- HStack(alignment: .top, spacing: 10) {
+ HStack(alignment: .top, spacing: 8) {
ZStack {
Circle()
- .fill(theme.palette.accent.opacity(0.2))
- .frame(width: 24, height: 24)
+ .fill(theme.palette.accent.opacity(0.15))
+ .frame(width: 22, height: 22)
Text("\(number)")
- .font(.system(size: 12, weight: .semibold))
+ .font(.caption.weight(.semibold))
.foregroundStyle(theme.palette.accent)
}
- VStack(alignment: .leading, spacing: 2) {
+ VStack(alignment: .leading, spacing: 1) {
Text(title)
- .font(.system(size: 13, weight: .semibold))
+ .font(.subheadline.weight(.medium))
Text(description)
- .font(.system(size: 12))
+ .font(.caption)
.foregroundStyle(.secondary)
.lineLimit(2)
}
}
- .padding(.vertical, 2)
}
}
// MARK: - Provider Guide
struct ProviderGuide: View {
+ @Environment(\.theme) private var theme
let name: String
let url: String
let description: String?
@@ -188,10 +174,10 @@ struct ProviderGuide: View {
var body: some View {
ThemedCard(hoverEffect: false) {
- VStack(alignment: .leading, spacing: 6) {
+ VStack(alignment: .leading, spacing: 8) {
HStack {
Text(name)
- .font(.system(size: 13, weight: .semibold))
+ .font(.subheadline.weight(.semibold))
Spacer()
@@ -201,41 +187,37 @@ struct ProviderGuide: View {
NSWorkspace.shared.open(url)
}
}
- .font(.system(size: 11))
.buttonStyle(.bordered)
- .controlSize(.mini)
+ .controlSize(.small)
}
}
if let description = description, !description.isEmpty {
Text(description)
- .font(.system(size: 11))
+ .font(.caption)
.foregroundStyle(.secondary)
}
- VStack(alignment: .leading, spacing: 3) {
+ VStack(alignment: .leading, spacing: 4) {
HStack {
Text("Base URL:")
- .font(.system(size: 11, weight: .medium))
+ .font(.caption)
.foregroundStyle(.secondary)
Text(baseURL)
- .font(.system(size: 11, weight: .medium))
- .foregroundStyle(.primary)
+ .font(.caption.weight(.medium))
.textSelection(.enabled)
}
HStack {
Text("Key Format:")
- .font(.system(size: 11, weight: .medium))
+ .font(.caption)
.foregroundStyle(.secondary)
Text(keyPrefix == "not-needed" ? "Not required" : "Starts with: \(keyPrefix)")
- .font(.system(size: 11, weight: .medium))
- .foregroundStyle(.primary)
+ .font(.caption.weight(.medium))
}
}
- .padding(.top, 3)
}
- .padding(10)
+ .padding(12)
}
}
}
diff --git a/Sources/Fluid/Theme/NativeButtonStyles.swift b/Sources/Fluid/Theme/NativeButtonStyles.swift
index 58ef7433..ee5d35a7 100644
--- a/Sources/Fluid/Theme/NativeButtonStyles.swift
+++ b/Sources/Fluid/Theme/NativeButtonStyles.swift
@@ -262,7 +262,7 @@ struct InlineButtonStyle: ButtonStyle {
}
}
-// MARK: - Glass Toggle Style
+// MARK: - Glass Toggle Style (now uses native switch for consistency)
struct GlassToggleStyle: ToggleStyle {
func makeBody(configuration: Configuration) -> some View {
ToggleBody(configuration: configuration)
@@ -271,7 +271,6 @@ struct GlassToggleStyle: ToggleStyle {
private struct ToggleBody: View {
@Environment(\.theme) private var theme
let configuration: ToggleStyle.Configuration
- @State private var isHovered = false
var body: some View {
HStack {
@@ -280,42 +279,38 @@ struct GlassToggleStyle: ToggleStyle {
Spacer()
- ZStack {
- Capsule()
- .fill(configuration.isOn ? theme.palette.accent.opacity(0.6) : theme.palette.cardBackground)
- .overlay(
- Capsule()
- .stroke(theme.palette.cardBorder.opacity(isHovered ? 0.4 : 0.25), lineWidth: 1)
- )
- .frame(width: 46, height: 26)
- .background(theme.materials.card, in: Capsule())
- .shadow(
- color: theme.palette.cardBorder.opacity(isHovered ? 0.35 : 0.18),
- radius: isHovered ? 8 : 4,
- x: 0,
- y: isHovered ? 3 : 1
- )
-
- Circle()
- .fill(Color.white)
- .frame(width: 22, height: 22)
- .shadow(color: Color.black.opacity(0.2), radius: 2, x: 0, y: 1)
- .overlay(
- Circle()
- .stroke(theme.palette.cardBorder.opacity(0.3), lineWidth: 0.5)
- )
- .offset(x: configuration.isOn ? 9 : -9)
- .animation(.spring(response: 0.28, dampingFraction: 0.75), value: configuration.isOn)
- }
- .onTapGesture {
- configuration.isOn.toggle()
- }
- .onHover { isHovered = $0 }
+ Toggle("", isOn: configuration.$isOn)
+ .toggleStyle(.switch)
+ .tint(theme.palette.accent)
+ .labelsHidden()
}
}
}
}
+// MARK: - Native Form Row Style
+struct FormRowStyle: ViewModifier {
+ func body(content: Content) -> some View {
+ content
+ .padding(.horizontal, 12)
+ .padding(.vertical, 10)
+ .background(
+ RoundedRectangle(cornerRadius: 8, style: .continuous)
+ .fill(.ultraThinMaterial.opacity(0.5))
+ .overlay(
+ RoundedRectangle(cornerRadius: 8, style: .continuous)
+ .stroke(.white.opacity(0.08), lineWidth: 1)
+ )
+ )
+ }
+}
+
+extension View {
+ func formRowStyle() -> some View {
+ modifier(FormRowStyle())
+ }
+}
+
diff --git a/Sources/Fluid/UI/SettingsView.swift b/Sources/Fluid/UI/SettingsView.swift
index f49fe02e..4c9b23c8 100644
--- a/Sources/Fluid/UI/SettingsView.swift
+++ b/Sources/Fluid/UI/SettingsView.swift
@@ -41,88 +41,50 @@ struct SettingsView: View {
var body: some View {
ScrollView(.vertical, showsIndicators: false) {
- VStack(spacing: 14) {
+ VStack(spacing: 16) {
// App Settings Card
ThemedCard(style: .standard) {
- VStack(alignment: .leading, spacing: 12) {
- HStack {
- Image(systemName: "power")
- .font(.title2)
- .foregroundStyle(.white)
- Text("App Settings")
- .font(.title3)
- .fontWeight(.semibold)
- }
+ VStack(alignment: .leading, spacing: 14) {
+ // Section header
+ Label("App Settings", systemImage: "power")
+ .font(.headline)
+ .foregroundStyle(.primary)
- VStack(spacing: 14) {
+ VStack(spacing: 0) {
// Launch at startup
- VStack(alignment: .leading, spacing: 8) {
- HStack(alignment: .top, spacing: 16) {
- VStack(alignment: .leading, spacing: 4) {
- Text("Launch at startup")
- .font(.headline)
- Text("Automatically start FluidVoice when you log in")
- .font(.caption)
- .foregroundStyle(.secondary)
- }
-
- Spacer()
-
- Toggle("", isOn: Binding(
- get: { SettingsStore.shared.launchAtStartup },
- set: { SettingsStore.shared.launchAtStartup = $0 }
- ))
- .toggleStyle(.switch)
- .tint(.green)
- .labelsHidden()
- }
-
- Text("Note: Requires app to be signed for this to work.")
- .font(.caption2)
- .foregroundStyle(.secondary.opacity(0.7))
- .padding(.leading, 0)
- }
+ settingsToggleRow(
+ title: "Launch at startup",
+ description: "Automatically start FluidVoice when you log in",
+ footnote: "Note: Requires app to be signed for this to work.",
+ isOn: Binding(
+ get: { SettingsStore.shared.launchAtStartup },
+ set: { SettingsStore.shared.launchAtStartup = $0 }
+ )
+ )
- Divider()
+ Divider().padding(.vertical, 10)
// Show in Dock
- VStack(alignment: .leading, spacing: 8) {
- HStack(alignment: .top, spacing: 16) {
- VStack(alignment: .leading, spacing: 4) {
- Text("Show in Dock")
- .font(.headline)
- Text("Display FluidVoice icon in the Dock")
- .font(.caption)
- .foregroundStyle(.secondary)
- }
-
- Spacer()
-
- Toggle("", isOn: Binding(
- get: { SettingsStore.shared.showInDock },
- set: { SettingsStore.shared.showInDock = $0 }
- ))
- .toggleStyle(.switch)
- .tint(.green)
- .labelsHidden()
- }
-
- Text("Note: May require app restart to take effect.")
- .font(.caption2)
- .foregroundStyle(.secondary.opacity(0.7))
- .padding(.leading, 0)
- }
+ settingsToggleRow(
+ title: "Show in Dock",
+ description: "Display FluidVoice icon in the Dock",
+ footnote: "Note: May require app restart to take effect.",
+ isOn: Binding(
+ get: { SettingsStore.shared.showInDock },
+ set: { SettingsStore.shared.showInDock = $0 }
+ )
+ )
- Divider()
+ Divider().padding(.vertical, 10)
// Automatic Updates
- VStack(alignment: .leading, spacing: 8) {
- HStack(alignment: .top, spacing: 16) {
- VStack(alignment: .leading, spacing: 4) {
+ VStack(alignment: .leading, spacing: 6) {
+ HStack(alignment: .center) {
+ VStack(alignment: .leading, spacing: 2) {
Text("Automatic Updates")
- .font(.headline)
+ .font(.body)
Text("Check for updates automatically once per day")
- .font(.caption)
+ .font(.subheadline)
.foregroundStyle(.secondary)
}
@@ -133,22 +95,20 @@ struct SettingsView: View {
set: { SettingsStore.shared.autoUpdateCheckEnabled = $0 }
))
.toggleStyle(.switch)
- .tint(.green)
+ .tint(theme.palette.accent)
.labelsHidden()
}
if let lastCheck = SettingsStore.shared.lastUpdateCheckDate {
Text("Last checked: \(lastCheck.formatted(date: .abbreviated, time: .shortened))")
- .font(.caption2)
- .foregroundStyle(.secondary.opacity(0.7))
- .padding(.leading, 0)
+ .font(.caption)
+ .foregroundStyle(.tertiary)
}
}
- // Update Buttons - Left/Right aligned
- HStack(spacing: 12) {
+ // Update Buttons
+ HStack(spacing: 10) {
Button("Check for Updates") {
- // Direct update check - same as menu bar
Task { @MainActor in
do {
try await SimpleUpdater.shared.checkAndUpdate(owner: "altic-dev", repo: "Fluid-oss")
@@ -172,250 +132,150 @@ struct SettingsView: View {
}
}
}
- .buttonStyle(PremiumButtonStyle(height: 40))
- .buttonHoverEffect()
+ .buttonStyle(.borderedProminent)
+ .tint(theme.palette.accent)
+ .controlSize(.regular)
Button("Release Notes") {
if let url = URL(string: "https://github.com/altic-dev/Fluid-oss/releases") {
NSWorkspace.shared.open(url)
}
}
- .buttonStyle(PremiumButtonStyle(height: 40))
- .buttonHoverEffect()
+ .buttonStyle(.bordered)
+ .controlSize(.regular)
}
- .padding(.top, 4)
+ .padding(.top, 12)
}
}
- .padding(14)
+ .padding(16)
}
// Microphone Permission Card
ThemedCard(style: .standard) {
- VStack(alignment: .leading, spacing: 12) {
- HStack {
- Image(systemName: "mic.fill")
- .font(.title2)
- .foregroundStyle(.white)
- Text("Microphone Permission")
- .font(.title3)
- .fontWeight(.semibold)
- }
+ VStack(alignment: .leading, spacing: 14) {
+ Label("Microphone Permission", systemImage: "mic.fill")
+ .font(.headline)
+ .foregroundStyle(.primary)
- VStack(alignment: .leading, spacing: 10) {
- HStack(spacing: 12) {
- // Status indicator
+ VStack(alignment: .leading, spacing: 12) {
+ HStack(spacing: 10) {
Circle()
.fill(asr.micStatus == .authorized ? theme.palette.success : theme.palette.warning)
- .frame(width: 10, height: 10)
+ .frame(width: 8, height: 8)
- VStack(alignment: .leading, spacing: 4) {
+ VStack(alignment: .leading, spacing: 2) {
Text(asr.micStatus == .authorized ? "Microphone access granted" :
asr.micStatus == .denied ? "Microphone access denied" :
"Microphone access not determined")
- .fontWeight(.medium)
- .foregroundStyle(asr.micStatus == .authorized ? theme.palette.primaryText : theme.palette.warning)
+ .font(.body)
+ .foregroundStyle(asr.micStatus == .authorized ? .primary : theme.palette.warning)
if asr.micStatus != .authorized {
Text("Microphone access is required for voice recording")
- .font(.caption)
+ .font(.subheadline)
.foregroundStyle(.secondary)
}
}
Spacer()
- // Action button
- Group {
- if asr.micStatus == .notDetermined {
- Button {
- asr.requestMicAccess()
- } label: {
- HStack(spacing: 6) {
- Image(systemName: "mic.fill")
- Text("Grant Access")
- .fontWeight(.medium)
- }
- }
- .buttonStyle(GlassButtonStyle())
- .buttonHoverEffect()
- } else if asr.micStatus == .denied {
- Button {
- asr.openSystemSettingsForMic()
- } label: {
- HStack(spacing: 6) {
- Image(systemName: "gear")
- Text("Open Settings")
- .fontWeight(.medium)
- }
- }
- .buttonStyle(GlassButtonStyle())
- .buttonHoverEffect()
+ if asr.micStatus == .notDetermined {
+ Button {
+ asr.requestMicAccess()
+ } label: {
+ Label("Grant Access", systemImage: "mic.fill")
+ }
+ .buttonStyle(.borderedProminent)
+ .tint(theme.palette.accent)
+ .controlSize(.regular)
+ } else if asr.micStatus == .denied {
+ Button {
+ asr.openSystemSettingsForMic()
+ } label: {
+ Label("Open Settings", systemImage: "gear")
}
+ .buttonStyle(.bordered)
+ .controlSize(.regular)
}
}
- // Step-by-step instructions when microphone is not authorized
if asr.micStatus != .authorized {
- VStack(alignment: .leading, spacing: 8) {
- HStack(spacing: 8) {
- Image(systemName: "info.circle.fill")
- .foregroundStyle(theme.palette.accent)
- .font(.caption)
- Text("How to enable microphone access:")
- .font(.caption)
- .fontWeight(.medium)
- .foregroundStyle(.secondary)
- }
-
- VStack(alignment: .leading, spacing: 4) {
- if asr.micStatus == .notDetermined {
- HStack(spacing: 8) {
- Text("1.")
- .font(.caption2)
- .foregroundStyle(theme.palette.accent)
- .fontWeight(.semibold)
- .frame(width: 16)
- Text("Click **Grant Access** above")
- .font(.caption)
- .foregroundStyle(.primary)
- }
- HStack(spacing: 8) {
- Text("2.")
- .font(.caption2)
- .foregroundStyle(theme.palette.accent)
- .fontWeight(.semibold)
- .frame(width: 16)
- Text("Choose **Allow** in the system dialog")
- .font(.caption)
- .foregroundStyle(.primary)
- }
- } else if asr.micStatus == .denied {
- HStack(spacing: 8) {
- Text("1.")
- .font(.caption2)
- .foregroundStyle(theme.palette.accent)
- .fontWeight(.semibold)
- .frame(width: 16)
- Text("Click **Open Settings** above")
- .font(.caption)
- .foregroundStyle(.primary)
- }
- HStack(spacing: 8) {
- Text("2.")
- .font(.caption2)
- .foregroundStyle(theme.palette.accent)
- .fontWeight(.semibold)
- .frame(width: 16)
- Text("Find **FluidVoice** in the microphone list")
- .font(.caption)
- .foregroundStyle(.primary)
- }
- HStack(spacing: 8) {
- Text("3.")
- .font(.caption2)
- .foregroundStyle(theme.palette.accent)
- .fontWeight(.semibold)
- .frame(width: 16)
- Text("Toggle **FluidVoice ON** to allow access")
- .font(.caption)
- .foregroundStyle(.primary)
- }
- }
- }
- .padding(.leading, 4)
- }
- .padding(12)
- .background(theme.palette.accent.opacity(0.12))
- .cornerRadius(8)
+ instructionsBox(
+ title: "How to enable microphone access:",
+ steps: asr.micStatus == .notDetermined
+ ? ["Click **Grant Access** above", "Choose **Allow** in the system dialog"]
+ : ["Click **Open Settings** above", "Find **FluidVoice** in the microphone list", "Toggle **FluidVoice ON** to allow access"]
+ )
}
}
}
- .padding(14)
+ .padding(16)
}
// Global Hotkey Card
ThemedCard(style: .standard) {
- VStack(alignment: .leading, spacing: 12) {
- HStack {
- Image(systemName: "keyboard")
- .font(.title2)
- .foregroundStyle(.white)
- Text("Global Hotkey")
- .font(.title3)
- .fontWeight(.semibold)
- }
+ VStack(alignment: .leading, spacing: 14) {
+ Label("Global Hotkey", systemImage: "keyboard")
+ .font(.headline)
+ .foregroundStyle(.primary)
if accessibilityEnabled {
- // Hotkey is enabled
VStack(alignment: .leading, spacing: 12) {
// Status indicator
- HStack(spacing: 10) {
+ HStack(spacing: 8) {
if isRecordingShortcut || isRecordingCommandModeShortcut || isRecordingRewriteShortcut {
Image(systemName: "hand.point.up.left.fill")
.foregroundStyle(.orange)
- .font(.system(size: 16, weight: .medium))
Text("Press your new hotkey combination now...")
- .font(.system(.subheadline, weight: .medium))
+ .font(.subheadline)
.foregroundStyle(.orange)
} else if hotkeyManagerInitialized {
Image(systemName: "checkmark.circle.fill")
.foregroundStyle(.green)
- .font(.system(size: 16))
Text("Global Shortcuts Active")
- .font(.system(.subheadline, weight: .semibold))
- .foregroundStyle(.white)
+ .font(.subheadline.weight(.medium))
Spacer()
- // Restart button for accessibility changes
if !hotkeyManagerInitialized && accessibilityEnabled {
Button {
DebugLogger.shared.debug("User requested app restart for accessibility changes", source: "SettingsView")
restartApp()
} label: {
- HStack(spacing: 6) {
- Image(systemName: "arrow.clockwise.circle")
- .font(.system(size: 12, weight: .semibold))
- Text("Restart")
- .font(.system(size: 12, weight: .semibold))
- }
+ Label("Restart", systemImage: "arrow.clockwise.circle")
}
- .buttonStyle(InlineButtonStyle())
- .buttonHoverEffect()
+ .buttonStyle(.bordered)
+ .controlSize(.small)
}
} else {
ProgressView()
- .scaleEffect(0.8)
- .frame(width: 16, height: 16)
- .foregroundStyle(.orange)
+ .controlSize(.small)
VStack(alignment: .leading, spacing: 2) {
Text("Hotkey Initializing...")
- .font(.system(.caption, weight: .semibold))
+ .font(.subheadline.weight(.medium))
.foregroundStyle(.orange)
Text("Please wait while the global hotkey system starts up")
- .font(.system(.caption))
+ .font(.caption)
.foregroundStyle(.secondary)
}
}
}
- .padding(.horizontal, 12)
- .padding(.vertical, 8)
+ .padding(10)
+ .frame(maxWidth: .infinity, alignment: .leading)
.background(
- RoundedRectangle(cornerRadius: 8)
+ RoundedRectangle(cornerRadius: 8, style: .continuous)
.fill(.ultraThinMaterial.opacity(0.5))
.overlay(
- RoundedRectangle(cornerRadius: 8)
+ RoundedRectangle(cornerRadius: 8, style: .continuous)
.stroke(.white.opacity(0.1), lineWidth: 1)
)
)
// MARK: - Shortcuts Section
- VStack(alignment: .leading, spacing: 10) {
+ VStack(alignment: .leading, spacing: 8) {
Text("Keyboard Shortcuts")
- .font(.subheadline)
- .fontWeight(.semibold)
+ .font(.subheadline.weight(.medium))
.foregroundStyle(.secondary)
- // Transcribe Mode Shortcut
shortcutRow(
icon: "mic.fill",
iconColor: .secondary,
@@ -430,9 +290,7 @@ struct SettingsView: View {
)
Divider()
- .padding(.vertical, 2)
- // Command Mode Shortcut
shortcutRow(
icon: "terminal.fill",
iconColor: .secondary,
@@ -447,9 +305,7 @@ struct SettingsView: View {
)
Divider()
- .padding(.vertical, 2)
- // Write Mode Shortcut
shortcutRow(
icon: "pencil.and.outline",
iconColor: .secondary,
@@ -463,105 +319,78 @@ struct SettingsView: View {
}
)
}
- .padding(.horizontal, 12)
- .padding(.vertical, 10)
+ .padding(12)
.background(
- RoundedRectangle(cornerRadius: 8)
+ RoundedRectangle(cornerRadius: 8, style: .continuous)
.fill(.ultraThinMaterial.opacity(0.5))
.overlay(
- RoundedRectangle(cornerRadius: 8)
+ RoundedRectangle(cornerRadius: 8, style: .continuous)
.stroke(.white.opacity(0.08), lineWidth: 1)
)
)
// MARK: - Options Section
-
- // Press and hold toggle
- VStack(alignment: .leading, spacing: 10) {
- Toggle("Press and Hold Mode", isOn: $pressAndHoldModeEnabled)
- .toggleStyle(GlassToggleStyle())
- Text("When enabled, the shortcut only records while you hold it down, giving you quick push-to-talk style control.")
- .font(.caption)
- .foregroundStyle(.secondary)
- }
- .padding(.horizontal, 12)
- .padding(.vertical, 10)
- .background(
- RoundedRectangle(cornerRadius: 8)
- .fill(.ultraThinMaterial.opacity(0.5))
- .overlay(
- RoundedRectangle(cornerRadius: 8)
- .stroke(.white.opacity(0.08), lineWidth: 1)
- )
- )
- .onChange(of: pressAndHoldModeEnabled) { newValue in
- SettingsStore.shared.pressAndHoldMode = newValue
- hotkeyManager?.enablePressAndHoldMode(newValue)
- }
-
- // Streaming preview toggle
- VStack(alignment: .leading, spacing: 10) {
- Toggle("Show Live Preview", isOn: $enableStreamingPreview)
- .toggleStyle(GlassToggleStyle())
- Text("Display transcription text in real-time in the overlay as you speak. When disabled, only the animation is shown.")
- .font(.caption)
- .foregroundStyle(.secondary)
- }
- .padding(.horizontal, 12)
- .padding(.vertical, 10)
- .background(
- RoundedRectangle(cornerRadius: 8)
- .fill(.ultraThinMaterial.opacity(0.5))
- .overlay(
- RoundedRectangle(cornerRadius: 8)
- .stroke(.white.opacity(0.08), lineWidth: 1)
- )
- )
- .onChange(of: enableStreamingPreview) { newValue in
- SettingsStore.shared.enableStreamingPreview = newValue
- }
-
- // Copy to clipboard toggle
- VStack(alignment: .leading, spacing: 10) {
- Toggle("Copy to Clipboard", isOn: $copyToClipboard)
- .toggleStyle(GlassToggleStyle())
- Text("Automatically copy transcribed text to clipboard as a backup, useful when no text field is selected.")
- .font(.caption)
- .foregroundStyle(.secondary)
+ VStack(spacing: 0) {
+ optionToggleRow(
+ title: "Press and Hold Mode",
+ description: "The shortcut only records while you hold it down, giving you quick push-to-talk style control.",
+ isOn: $pressAndHoldModeEnabled
+ )
+ .onChange(of: pressAndHoldModeEnabled) { newValue in
+ SettingsStore.shared.pressAndHoldMode = newValue
+ hotkeyManager?.enablePressAndHoldMode(newValue)
+ }
+
+ Divider().padding(.vertical, 8)
+
+ optionToggleRow(
+ title: "Show Live Preview",
+ description: "Display transcription text in real-time in the overlay as you speak.",
+ isOn: $enableStreamingPreview
+ )
+ .onChange(of: enableStreamingPreview) { newValue in
+ SettingsStore.shared.enableStreamingPreview = newValue
+ }
+
+ Divider().padding(.vertical, 8)
+
+ optionToggleRow(
+ title: "Copy to Clipboard",
+ description: "Automatically copy transcribed text to clipboard as a backup.",
+ isOn: $copyToClipboard
+ )
+ .onChange(of: copyToClipboard) { newValue in
+ SettingsStore.shared.copyTranscriptionToClipboard = newValue
+ }
}
- .padding(.horizontal, 12)
- .padding(.vertical, 10)
+ .padding(12)
.background(
- RoundedRectangle(cornerRadius: 8)
+ RoundedRectangle(cornerRadius: 8, style: .continuous)
.fill(.ultraThinMaterial.opacity(0.5))
.overlay(
- RoundedRectangle(cornerRadius: 8)
+ RoundedRectangle(cornerRadius: 8, style: .continuous)
.stroke(.white.opacity(0.08), lineWidth: 1)
)
)
- .onChange(of: copyToClipboard) { newValue in
- SettingsStore.shared.copyTranscriptionToClipboard = newValue
- }
}
} else {
// Hotkey disabled - accessibility not enabled
VStack(alignment: .leading, spacing: 12) {
- HStack(spacing: 12) {
- // Status indicator
+ HStack(spacing: 10) {
Circle()
.fill(theme.palette.warning)
- .frame(width: 10, height: 10)
+ .frame(width: 8, height: 8)
- VStack(alignment: .leading, spacing: 4) {
- HStack {
+ VStack(alignment: .leading, spacing: 2) {
+ HStack(spacing: 6) {
Image(systemName: "exclamationmark.triangle.fill")
.foregroundStyle(theme.palette.warning)
Text("Accessibility permissions required")
- .fontWeight(.medium)
+ .font(.body)
.foregroundStyle(theme.palette.warning)
}
Text("Required for global hotkey functionality")
- .font(.caption)
+ .font(.subheadline)
.foregroundStyle(.secondary)
}
Spacer()
@@ -569,113 +398,60 @@ struct SettingsView: View {
Button("Open Accessibility Settings") {
openAccessibilitySettings()
}
- .buttonStyle(GlassButtonStyle())
- .buttonHoverEffect()
+ .buttonStyle(.borderedProminent)
+ .tint(theme.palette.accent)
+ .controlSize(.regular)
}
- // Prominent step-by-step instructions
- VStack(alignment: .leading, spacing: 12) {
- HStack(spacing: 8) {
- Image(systemName: "info.circle.fill")
- .foregroundStyle(theme.palette.accent)
- .font(.caption)
- Text("Follow these steps to enable Accessibility:")
- .font(.caption)
- .fontWeight(.medium)
- .foregroundStyle(.secondary)
- }
-
- VStack(alignment: .leading, spacing: 8) {
- HStack(spacing: 8) {
- Text("1.")
- .font(.caption2)
- .foregroundStyle(theme.palette.accent)
- .fontWeight(.semibold)
- .frame(width: 16)
- Text("Click **Open Accessibility Settings** above")
- .font(.caption)
- .foregroundStyle(.primary)
- }
- HStack(spacing: 8) {
- Text("2.")
- .font(.caption2)
- .foregroundStyle(theme.palette.accent)
- .fontWeight(.semibold)
- .frame(width: 16)
- Text("In the Accessibility window, click the **+ button**")
- .font(.caption)
- .foregroundStyle(.primary)
- }
- HStack(spacing: 8) {
- Text("3.")
- .font(.caption2)
- .foregroundStyle(theme.palette.accent)
- .fontWeight(.semibold)
- .frame(width: 16)
- Text("Navigate to Applications and select **FluidVoice**")
- .font(.caption)
- .foregroundStyle(.primary)
- }
- HStack(spacing: 8) {
- Text("4.")
- .font(.caption2)
- .foregroundStyle(theme.palette.accent)
- .fontWeight(.semibold)
- .frame(width: 16)
- Text("Click **Open**, then toggle **FluidVoice ON** in the list")
- .font(.caption)
- .foregroundStyle(.primary)
- }
+ instructionsBox(
+ title: "Follow these steps to enable Accessibility:",
+ steps: [
+ "Click **Open Accessibility Settings** above",
+ "In the Accessibility window, click the **+ button**",
+ "Navigate to Applications and select **FluidVoice**",
+ "Click **Open**, then toggle **FluidVoice ON** in the list"
+ ],
+ warningStyle: true
+ )
+
+ HStack(spacing: 10) {
+ Button("Reveal in Finder") {
+ revealAppInFinder()
}
- .padding(.leading, 4)
+ .buttonStyle(.bordered)
+ .controlSize(.small)
- // Helper buttons
- HStack(spacing: 12) {
- Button("Reveal FluidVoice in Finder") {
- revealAppInFinder()
- }
- .buttonStyle(InlineButtonStyle())
- .buttonHoverEffect()
-
- Button("Open Applications Folder") {
- openApplicationsFolder()
- }
- .buttonStyle(InlineButtonStyle())
- .buttonHoverEffect()
+ Button("Open Applications") {
+ openApplicationsFolder()
}
+ .buttonStyle(.bordered)
+ .controlSize(.small)
}
- .padding(12)
- .background(theme.palette.warning.opacity(0.12))
- .cornerRadius(8)
}
}
}
- .padding(14)
+ .padding(16)
}
// Audio Devices Card
ThemedCard(style: .standard) {
- VStack(alignment: .leading, spacing: 12) {
- HStack {
- Image(systemName: "speaker.wave.2.fill")
- .font(.title2)
- .foregroundStyle(.white)
- Text("Audio Devices")
- .font(.title3)
- .fontWeight(.semibold)
- }
+ VStack(alignment: .leading, spacing: 14) {
+ Label("Audio Devices", systemImage: "speaker.wave.2.fill")
+ .font(.headline)
+ .foregroundStyle(.primary)
- VStack(alignment: .leading, spacing: 10) {
+ VStack(alignment: .leading, spacing: 12) {
HStack {
Text("Input Device")
- .fontWeight(.medium)
+ .font(.body)
Spacer()
Picker("Input Device", selection: $selectedInputUID) {
ForEach(inputDevices, id: \.uid) { dev in
Text(dev.name).tag(dev.uid)
}
}
- .frame(width: 280)
+ .pickerStyle(.menu)
+ .frame(width: 240)
.onChange(of: selectedInputUID) { newUID in
SettingsStore.shared.preferredInputDeviceUID = newUID
_ = AudioDevice.setDefaultInputDevice(uid: newUID)
@@ -688,63 +464,60 @@ struct SettingsView: View {
HStack {
Text("Output Device")
- .fontWeight(.medium)
+ .font(.body)
Spacer()
Picker("Output Device", selection: $selectedOutputUID) {
ForEach(outputDevices, id: \.uid) { dev in
Text(dev.name).tag(dev.uid)
}
}
- .frame(width: 280)
+ .pickerStyle(.menu)
+ .frame(width: 240)
.onChange(of: selectedOutputUID) { newUID in
SettingsStore.shared.preferredOutputDeviceUID = newUID
_ = AudioDevice.setDefaultOutputDevice(uid: newUID)
}
}
- HStack(spacing: 12) {
+ HStack(spacing: 10) {
Button {
refreshDevices()
} label: {
Label("Refresh", systemImage: "arrow.clockwise")
}
- .buttonStyle(GlassButtonStyle())
- .buttonHoverEffect()
+ .buttonStyle(.bordered)
+ .controlSize(.regular)
Spacer()
if let defIn = AudioDevice.getDefaultInputDevice()?.name,
let defOut = AudioDevice.getDefaultOutputDevice()?.name {
- Text("Default In: \(defIn) · Default Out: \(defOut)")
+ Text("Default: \(defIn) / \(defOut)")
.font(.caption)
- .foregroundColor(.secondary)
+ .foregroundStyle(.tertiary)
+ .lineLimit(1)
}
}
}
}
- .padding(14)
+ .padding(16)
}
// Visualization Sensitivity Card
ThemedCard(style: .standard) {
- VStack(alignment: .leading, spacing: 12) {
- HStack {
- Image(systemName: "waveform")
- .font(.title2)
- .foregroundStyle(.white)
- Text("Visualization")
- .font(.title3)
- .fontWeight(.semibold)
- }
+ VStack(alignment: .leading, spacing: 14) {
+ Label("Visualization", systemImage: "waveform")
+ .font(.headline)
+ .foregroundStyle(.primary)
- VStack(alignment: .leading, spacing: 10) {
+ VStack(alignment: .leading, spacing: 12) {
HStack {
- VStack(alignment: .leading, spacing: 4) {
- Text("Visualization Sensitivity")
- .font(.system(size: 16, weight: .semibold))
+ VStack(alignment: .leading, spacing: 2) {
+ Text("Sensitivity")
+ .font(.body)
Text("Control how sensitive the audio visualizer is to sound input")
- .font(.system(size: 13))
- .foregroundColor(.secondary)
+ .font(.subheadline)
+ .foregroundStyle(.secondary)
}
Spacer()
@@ -753,48 +526,42 @@ struct SettingsView: View {
visualizerNoiseThreshold = 0.4
SettingsStore.shared.visualizerNoiseThreshold = visualizerNoiseThreshold
}
- .font(.system(size: 12))
- .buttonStyle(GlassButtonStyle())
- .buttonHoverEffect()
+ .buttonStyle(.bordered)
+ .controlSize(.small)
}
- HStack(spacing: 12) {
- Text("More Sensitive")
- .font(.system(size: 12, weight: .medium))
- .foregroundColor(.secondary)
- .frame(width: 90)
+ HStack(spacing: 10) {
+ Text("More")
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ .frame(width: 36, alignment: .trailing)
Slider(value: $visualizerNoiseThreshold, in: 0.01...0.8, step: 0.01)
.controlSize(.regular)
- Text("Less Sensitive")
- .font(.system(size: 12, weight: .medium))
- .foregroundColor(.secondary)
- .frame(width: 90)
+ Text("Less")
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ .frame(width: 36, alignment: .leading)
Text(String(format: "%.2f", visualizerNoiseThreshold))
- .font(.system(size: 12, weight: .medium, design: .monospaced))
- .foregroundColor(.primary)
- .frame(width: 40)
+ .font(.caption.monospaced())
+ .foregroundStyle(.tertiary)
+ .frame(width: 36)
}
}
}
- .padding(14)
+ .padding(16)
}
// Debug Settings Card
ThemedCard(style: .standard) {
- VStack(alignment: .leading, spacing: 12) {
- HStack {
- Image(systemName: "ladybug.fill")
- .font(.title2)
- .foregroundStyle(.white)
- Text("Debug Settings")
- .font(.title3)
- .fontWeight(.semibold)
- }
+ VStack(alignment: .leading, spacing: 14) {
+ Label("Debug Settings", systemImage: "ladybug.fill")
+ .font(.headline)
+ .foregroundStyle(.primary)
- VStack(alignment: .leading, spacing: 10) {
+ VStack(alignment: .leading, spacing: 8) {
Button {
let url = FileLogger.shared.currentLogFileURL()
if FileManager.default.fileExists(atPath: url.path) {
@@ -804,21 +571,19 @@ struct SettingsView: View {
}
} label: {
Label("Reveal Log File", systemImage: "doc.richtext")
- .labelStyle(.titleAndIcon)
}
- .buttonStyle(GlassButtonStyle())
- .buttonHoverEffect()
+ .buttonStyle(.bordered)
+ .controlSize(.regular)
- Text("Click to reveal the debug log file. This file contains detailed information about app operations and can help with troubleshooting issues.")
+ Text("The debug log contains detailed information about app operations and can help with troubleshooting.")
.font(.caption)
.foregroundStyle(.secondary)
- .padding(.leading, 4)
}
}
- .padding(14)
+ .padding(16)
}
}
- .padding(14)
+ .padding(16)
}
.onAppear {
refreshDevices()
@@ -828,7 +593,103 @@ struct SettingsView: View {
}
}
- // MARK: - Shortcut Row Helper
+ // MARK: - Helper Views
+
+ @ViewBuilder
+ private func settingsToggleRow(
+ title: String,
+ description: String,
+ footnote: String? = nil,
+ isOn: Binding<Bool>
+ ) -> some View {
+ VStack(alignment: .leading, spacing: 6) {
+ HStack(alignment: .center) {
+ VStack(alignment: .leading, spacing: 2) {
+ Text(title)
+ .font(.body)
+ Text(description)
+ .font(.subheadline)
+ .foregroundStyle(.secondary)
+ }
+
+ Spacer()
+
+ Toggle("", isOn: isOn)
+ .toggleStyle(.switch)
+ .tint(theme.palette.accent)
+ .labelsHidden()
+ }
+
+ if let footnote = footnote {
+ Text(footnote)
+ .font(.caption)
+ .foregroundStyle(.tertiary)
+ }
+ }
+ }
+
+ @ViewBuilder
+ private func optionToggleRow(
+ title: String,
+ description: String,
+ isOn: Binding<Bool>
+ ) -> some View {
+ HStack(alignment: .center) {
+ VStack(alignment: .leading, spacing: 2) {
+ Text(title)
+ .font(.body)
+ Text(description)
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ }
+
+ Spacer()
+
+ Toggle("", isOn: isOn)
+ .toggleStyle(.switch)
+ .tint(theme.palette.accent)
+ .labelsHidden()
+ }
+ }
+
+ @ViewBuilder
+ private func instructionsBox(
+ title: String,
+ steps: [String],
+ warningStyle: Bool = false
+ ) -> some View {
+ VStack(alignment: .leading, spacing: 8) {
+ HStack(spacing: 6) {
+ Image(systemName: "info.circle.fill")
+ .foregroundStyle(warningStyle ? theme.palette.warning : theme.palette.accent)
+ .font(.caption)
+ Text(title)
+ .font(.caption.weight(.medium))
+ .foregroundStyle(.secondary)
+ }
+
+ VStack(alignment: .leading, spacing: 4) {
+ ForEach(Array(steps.enumerated()), id: \.offset) { index, step in
+ HStack(alignment: .top, spacing: 8) {
+ Text("\(index + 1).")
+ .font(.caption)
+ .foregroundStyle(warningStyle ? theme.palette.warning : theme.palette.accent)
+ .fontWeight(.semibold)
+ .frame(width: 16, alignment: .trailing)
+ Text(.init(step))
+ .font(.caption)
+ .foregroundStyle(.primary)
+ }
+ }
+ }
+ }
+ .padding(12)
+ .background(
+ RoundedRectangle(cornerRadius: 8, style: .continuous)
+ .fill((warningStyle ? theme.palette.warning : theme.palette.accent).opacity(0.12))
+ )
+ }
+
@ViewBuilder
private func shortcutRow(
icon: String,
@@ -839,60 +700,52 @@ struct SettingsView: View {
isRecording: Bool,
onChangePressed: @escaping () -> Void
) -> some View {
- HStack(spacing: 12) {
- // Icon
+ HStack(spacing: 10) {
Image(systemName: icon)
- .font(.system(size: 16, weight: .medium))
.foregroundStyle(iconColor)
- .frame(width: 24)
+ .frame(width: 20)
- // Title and description
- VStack(alignment: .leading, spacing: 2) {
+ VStack(alignment: .leading, spacing: 1) {
Text(title)
- .font(.system(size: 14, weight: .medium))
- .foregroundStyle(.primary)
+ .font(.body)
Text(description)
- .font(.system(size: 11))
+ .font(.caption)
.foregroundStyle(.secondary)
+ .lineLimit(1)
}
Spacer()
- // Shortcut display
if isRecording {
Text("Press shortcut...")
- .font(.system(size: 12, weight: .medium))
+ .font(.caption.weight(.medium))
.foregroundStyle(.orange)
- .padding(.horizontal, 10)
- .padding(.vertical, 5)
+ .padding(.horizontal, 8)
+ .padding(.vertical, 4)
.background(
- RoundedRectangle(cornerRadius: 6)
+ RoundedRectangle(cornerRadius: 5, style: .continuous)
.fill(.orange.opacity(0.2))
)
} else {
Text(shortcut.displayString)
- .font(.system(size: 13, weight: .semibold, design: .monospaced))
- .foregroundStyle(.primary)
- .padding(.horizontal, 10)
- .padding(.vertical, 5)
+ .font(.caption.monospaced().weight(.medium))
+ .padding(.horizontal, 8)
+ .padding(.vertical, 4)
.background(
- RoundedRectangle(cornerRadius: 6)
+ RoundedRectangle(cornerRadius: 5, style: .continuous)
.fill(.quaternary.opacity(0.5))
.overlay(
- RoundedRectangle(cornerRadius: 6)
- .stroke(.primary.opacity(0.2), lineWidth: 1)
+ RoundedRectangle(cornerRadius: 5, style: .continuous)
+ .stroke(.primary.opacity(0.15), lineWidth: 1)
)
)
}
- // Change button
- Button {
+ Button("Change") {
onChangePressed()
- } label: {
- Text("Change")
- .font(.system(size: 12, weight: .medium))
}
.buttonStyle(.bordered)
+ .controlSize(.small)
.disabled(isRecording)
}
}
diff --git a/Sources/Fluid/UI/StatsView.swift b/Sources/Fluid/UI/StatsView.swift
new file mode 100644
index 00000000..fa9691b2
--- /dev/null
+++ b/Sources/Fluid/UI/StatsView.swift
@@ -0,0 +1,562 @@
+//
+// StatsView.swift
+// Fluid
+//
+// Usage statistics dashboard with gamification elements
+//
+
+import SwiftUI
+
+struct StatsView: View {
+ @ObservedObject private var historyStore = TranscriptionHistoryStore.shared
+ @ObservedObject private var settings = SettingsStore.shared
+ @Environment(\.theme) private var theme
+
+ @State private var showResetConfirmation: Bool = false
+ @State private var showWPMEditor: Bool = false
+ @State private var editingWPM: String = ""
+ @State private var chartDays: Int = 7 // Toggle between 7 and 30
+
+ var body: some View {
+ ScrollView(.vertical, showsIndicators: false) {
+ VStack(spacing: 16) {
+ // Header row: Time Saved + Total Words
+ HStack(spacing: 16) {
+ timeSavedCard
+ totalWordsCard
+ }
+
+ // Second row: Streak + Transcriptions
+ HStack(spacing: 16) {
+ streakCard
+ transcriptionsCard
+ }
+
+ // Activity Chart
+ activityChartCard
+
+ // Milestones
+ milestonesCard
+
+ // Insights
+ insightsCard
+
+ // Personal Records
+ recordsCard
+
+ // Reset Button
+ resetSection
+ }
+ .padding(20)
+ }
+ }
+
+ // MARK: - Time Saved Card
+
+ private var timeSavedCard: some View {
+ StatCard(title: "TIME SAVED", icon: "clock.fill") {
+ VStack(alignment: .leading, spacing: 8) {
+ Text(historyStore.formattedTimeSaved(typingWPM: settings.userTypingWPM))
+ .font(.system(size: 32, weight: .bold, design: .rounded))
+ .foregroundStyle(.primary)
+
+ Button {
+ editingWPM = "\(settings.userTypingWPM)"
+ showWPMEditor = true
+ } label: {
+ HStack(spacing: 4) {
+ Text("Based on \(settings.userTypingWPM) WPM typing")
+ .font(.system(size: 11))
+ Image(systemName: "pencil")
+ .font(.system(size: 9))
+ }
+ .foregroundStyle(.secondary)
+ }
+ .buttonStyle(.plain)
+ }
+ }
+ .popover(isPresented: $showWPMEditor) {
+ wpmEditorPopover
+ }
+ }
+
+ private var wpmEditorPopover: some View {
+ VStack(alignment: .leading, spacing: 12) {
+ Text("Your Typing Speed")
+ .font(.system(size: 13, weight: .semibold))
+
+ HStack {
+ TextField("WPM", text: $editingWPM)
+ .textFieldStyle(.roundedBorder)
+ .frame(width: 60)
+ .multilineTextAlignment(.center)
+
+ Text("words per minute")
+ .font(.system(size: 12))
+ .foregroundStyle(.secondary)
+ }
+
+ Text("Average typing: 40 WPM\nProfessional: 65-75 WPM")
+ .font(.system(size: 10))
+ .foregroundStyle(.tertiary)
+
+ HStack {
+ Button("Cancel") {
+ showWPMEditor = false
+ }
+ .buttonStyle(.bordered)
+
+ Button("Save") {
+ if let wpm = Int(editingWPM), wpm > 0 {
+ settings.userTypingWPM = wpm
+ }
+ showWPMEditor = false
+ }
+ .buttonStyle(.borderedProminent)
+ }
+ }
+ .padding(16)
+ .frame(width: 220)
+ }
+
+ // MARK: - Total Words Card
+
+ private var totalWordsCard: some View {
+ StatCard(title: "TOTAL WORDS", icon: "text.word.spacing") {
+ VStack(alignment: .leading, spacing: 8) {
+ Text(formatNumber(historyStore.totalWords))
+ .font(.system(size: 32, weight: .bold, design: .rounded))
+ .foregroundStyle(.primary)
+
+ let today = historyStore.wordsToday
+ if today > 0 {
+ Text("+\(formatNumber(today)) today")
+ .font(.system(size: 11))
+ .foregroundStyle(theme.palette.success)
+ } else {
+ Text("Start dictating")
+ .font(.system(size: 11))
+ .foregroundStyle(.secondary)
+ }
+ }
+ }
+ }
+
+ // MARK: - Streak Card
+
+ private var streakCard: some View {
+ StatCard(title: "CURRENT STREAK", icon: "flame.fill") {
+ VStack(alignment: .leading, spacing: 8) {
+ HStack(alignment: .firstTextBaseline, spacing: 4) {
+ Text("\(historyStore.currentStreak)")
+ .font(.system(size: 32, weight: .bold, design: .rounded))
+ .foregroundStyle(historyStore.currentStreak > 0 ? theme.palette.warning : .primary)
+
+ Text(historyStore.currentStreak == 1 ? "day" : "days")
+ .font(.system(size: 14, weight: .medium))
+ .foregroundStyle(.secondary)
+ }
+
+ Text("Best: \(historyStore.bestStreak) days")
+ .font(.system(size: 11))
+ .foregroundStyle(.secondary)
+ }
+ }
+ }
+
+ // MARK: - Transcriptions Card
+
+ private var transcriptionsCard: some View {
+ StatCard(title: "TRANSCRIPTIONS", icon: "doc.text.fill") {
+ VStack(alignment: .leading, spacing: 8) {
+ Text("\(historyStore.entries.count)")
+ .font(.system(size: 32, weight: .bold, design: .rounded))
+ .foregroundStyle(.primary)
+
+ Text("Avg: \(historyStore.averageWordsPerTranscription) words each")
+ .font(.system(size: 11))
+ .foregroundStyle(.secondary)
+ }
+ }
+ }
+
+ // MARK: - Activity Chart Card
+
+ private var activityChartCard: some View {
+ VStack(alignment: .leading, spacing: 12) {
+ HStack {
+ Label("ACTIVITY", systemImage: "chart.bar.fill")
+ .font(.system(size: 11, weight: .semibold))
+ .foregroundStyle(.secondary)
+
+ Spacer()
+
+ Picker("", selection: $chartDays) {
+ Text("7 days").tag(7)
+ Text("30 days").tag(30)
+ }
+ .pickerStyle(.segmented)
+ .frame(width: 140)
+ }
+
+ let data = historyStore.dailyWordCounts(days: chartDays)
+ let maxWords = data.map { $0.words }.max() ?? 0
+
+ if maxWords == 0 {
+ // Empty state
+ HStack {
+ Spacer()
+ VStack(spacing: 8) {
+ Image(systemName: "chart.bar")
+ .font(.system(size: 24))
+ .foregroundStyle(.tertiary)
+ Text("No activity yet")
+ .font(.system(size: 12))
+ .foregroundStyle(.secondary)
+ }
+ .padding(.vertical, 30)
+ Spacer()
+ }
+ } else {
+ // Bar chart
+ HStack(alignment: .bottom, spacing: chartDays == 7 ? 8 : 2) {
+ ForEach(Array(data.enumerated()), id: \.offset) { index, item in
+ VStack(spacing: 4) {
+ // Bar (avoid division by zero)
+ let height = (item.words > 0 && maxWords > 0) ? CGFloat(item.words) / CGFloat(maxWords) * 80 : 2
+ RoundedRectangle(cornerRadius: 3)
+ .fill(item.words > 0 ? theme.palette.accent : Color.secondary.opacity(0.2))
+ .frame(width: chartDays == 7 ? 30 : 8, height: max(2, height))
+
+ // Label (only for 7-day view)
+ if chartDays == 7 {
+ Text(dayLabel(item.date))
+ .font(.system(size: 9, weight: .medium))
+ .foregroundStyle(.secondary)
+ }
+ }
+ }
+ }
+ .frame(height: 110)
+ .frame(maxWidth: .infinity)
+
+ // Summary
+ HStack {
+ let totalPeriod = data.reduce(0) { $0 + $1.words }
+ let activeDays = data.filter { $0.words > 0 }.count
+
+ Text("\(formatNumber(totalPeriod)) words")
+ .font(.system(size: 11, weight: .medium))
+ .foregroundStyle(.primary)
+
+ Text("across \(activeDays) active days")
+ .font(.system(size: 11))
+ .foregroundStyle(.secondary)
+
+ Spacer()
+ }
+ }
+ }
+ .padding(16)
+ .background(
+ RoundedRectangle(cornerRadius: 12)
+ .fill(.ultraThinMaterial)
+ .overlay(
+ RoundedRectangle(cornerRadius: 12)
+ .stroke(.white.opacity(0.08), lineWidth: 1)
+ )
+ )
+ }
+
+ // MARK: - Milestones Card
+
+ private var milestonesCard: some View {
+ VStack(alignment: .leading, spacing: 12) {
+ HStack {
+ Label("MILESTONES", systemImage: "flag.fill")
+ .font(.system(size: 11, weight: .semibold))
+ .foregroundStyle(.secondary)
+
+ Spacer()
+
+ Text("\(historyStore.totalMilestonesAchieved)/\(historyStore.totalMilestonesPossible)")
+ .font(.system(size: 11, weight: .medium))
+ .foregroundStyle(theme.palette.accent)
+ }
+
+ VStack(alignment: .leading, spacing: 10) {
+ // Word milestones
+ milestoneRow(
+ title: "Words",
+ milestones: historyStore.wordMilestones
+ )
+
+ // Transcription milestones
+ milestoneRow(
+ title: "Transcriptions",
+ milestones: historyStore.transcriptionMilestones
+ )
+
+ // Streak milestones
+ milestoneRow(
+ title: "Streak",
+ milestones: historyStore.streakMilestones
+ )
+ }
+ }
+ .padding(16)
+ .background(
+ RoundedRectangle(cornerRadius: 12)
+ .fill(.ultraThinMaterial)
+ .overlay(
+ RoundedRectangle(cornerRadius: 12)
+ .stroke(.white.opacity(0.08), lineWidth: 1)
+ )
+ )
+ }
+
+ private func milestoneRow(title: String, milestones: [(target: Int, achieved: Bool, label: String)]) -> some View {
+ HStack(spacing: 8) {
+ Text(title)
+ .font(.system(size: 10, weight: .medium))
+ .foregroundStyle(.secondary)
+ .frame(width: 80, alignment: .leading)
+
+ ForEach(Array(milestones.enumerated()), id: \.offset) { _, milestone in
+ HStack(spacing: 3) {
+ Image(systemName: milestone.achieved ? "checkmark.circle.fill" : "circle")
+ .font(.system(size: 10))
+ .foregroundStyle(milestone.achieved ? theme.palette.success : Color.secondary.opacity(0.4))
+
+ Text(milestone.label)
+ .font(.system(size: 10, weight: milestone.achieved ? .semibold : .regular))
+ .foregroundStyle(milestone.achieved ? .primary : .secondary)
+ }
+ .padding(.horizontal, 6)
+ .padding(.vertical, 3)
+ .background(
+ RoundedRectangle(cornerRadius: 4)
+ .fill(milestone.achieved ? theme.palette.success.opacity(0.1) : Color.clear)
+ )
+ }
+
+ Spacer()
+ }
+ }
+
+ // MARK: - Insights Card
+
+ private var insightsCard: some View {
+ VStack(alignment: .leading, spacing: 12) {
+ Label("INSIGHTS", systemImage: "lightbulb.fill")
+ .font(.system(size: 11, weight: .semibold))
+ .foregroundStyle(.secondary)
+
+ LazyVGrid(columns: [
+ GridItem(.flexible(), spacing: 12),
+ GridItem(.flexible(), spacing: 12)
+ ], spacing: 12) {
+ // Top Apps
+ insightItem(
+ icon: "app.fill",
+ title: "Top Apps",
+ value: historyStore.topAppsFormatted(limit: 3).joined(separator: ", "),
+ fallback: "No data yet"
+ )
+
+ // AI Enhancement Rate
+ insightItem(
+ icon: "sparkles",
+ title: "AI Enhanced",
+ value: "\(historyStore.aiEnhancementRate)%",
+ fallback: "0%"
+ )
+
+ // Peak Hours
+ insightItem(
+ icon: "clock.fill",
+ title: "Peak Time",
+ value: historyStore.peakHourFormatted,
+ fallback: "N/A"
+ )
+
+ // Avg Length
+ insightItem(
+ icon: "ruler.fill",
+ title: "Avg Length",
+ value: "\(historyStore.averageWordsPerTranscription) words",
+ fallback: "0 words"
+ )
+ }
+ }
+ .padding(16)
+ .background(
+ RoundedRectangle(cornerRadius: 12)
+ .fill(.ultraThinMaterial)
+ .overlay(
+ RoundedRectangle(cornerRadius: 12)
+ .stroke(.white.opacity(0.08), lineWidth: 1)
+ )
+ )
+ }
+
+ private func insightItem(icon: String, title: String, value: String, fallback: String) -> some View {
+ HStack(spacing: 10) {
+ Image(systemName: icon)
+ .font(.system(size: 12))
+ .foregroundStyle(.tertiary)
+ .frame(width: 20)
+
+ VStack(alignment: .leading, spacing: 2) {
+ Text(title)
+ .font(.system(size: 10, weight: .medium))
+ .foregroundStyle(.secondary)
+
+ Text(value.isEmpty ? fallback : value)
+ .font(.system(size: 12, weight: .medium))
+ .foregroundStyle(.primary)
+ .lineLimit(1)
+ }
+
+ Spacer()
+ }
+ .padding(10)
+ .background(
+ RoundedRectangle(cornerRadius: 8)
+ .fill(.quaternary.opacity(0.3))
+ )
+ }
+
+ // MARK: - Personal Records Card
+
+ private var recordsCard: some View {
+ VStack(alignment: .leading, spacing: 12) {
+ Label("PERSONAL RECORDS", systemImage: "trophy.fill")
+ .font(.system(size: 11, weight: .semibold))
+ .foregroundStyle(.secondary)
+
+ HStack(spacing: 12) {
+ recordItem(
+ title: "Longest Transcription",
+ value: "\(historyStore.longestTranscriptionWords) words"
+ )
+
+ recordItem(
+ title: "Most Words in a Day",
+ value: "\(formatNumber(historyStore.mostWordsInDay)) words"
+ )
+
+ recordItem(
+ title: "Most in a Day",
+ value: "\(historyStore.mostTranscriptionsInDay) transcriptions"
+ )
+ }
+ }
+ .padding(16)
+ .background(
+ RoundedRectangle(cornerRadius: 12)
+ .fill(.ultraThinMaterial)
+ .overlay(
+ RoundedRectangle(cornerRadius: 12)
+ .stroke(.white.opacity(0.08), lineWidth: 1)
+ )
+ )
+ }
+
+ private func recordItem(title: String, value: String) -> some View {
+ VStack(alignment: .leading, spacing: 4) {
+ Text(title)
+ .font(.system(size: 10, weight: .medium))
+ .foregroundStyle(.secondary)
+
+ Text(value)
+ .font(.system(size: 14, weight: .semibold, design: .rounded))
+ .foregroundStyle(.primary)
+ }
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .padding(10)
+ .background(
+ RoundedRectangle(cornerRadius: 8)
+ .fill(theme.palette.accent.opacity(0.08))
+ )
+ }
+
+ // MARK: - Reset Section
+
+ private var resetSection: some View {
+ HStack {
+ Spacer()
+
+ Button {
+ showResetConfirmation = true
+ } label: {
+ Label("Reset All Stats", systemImage: "trash")
+ .font(.system(size: 12, weight: .medium))
+ .foregroundStyle(.secondary)
+ }
+ .buttonStyle(.plain)
+ .opacity(historyStore.entries.isEmpty ? 0.3 : 0.7)
+ .disabled(historyStore.entries.isEmpty)
+
+ Spacer()
+ }
+ .padding(.top, 8)
+ .alert("Reset All Stats", isPresented: $showResetConfirmation) {
+ Button("Cancel", role: .cancel) { }
+ Button("Reset Everything", role: .destructive) {
+ historyStore.clearAllHistory()
+ }
+ } message: {
+ Text("This will permanently delete all \(historyStore.entries.count) transcriptions and reset all statistics. This action cannot be undone.")
+ }
+ }
+
+ // MARK: - Helpers
+
+ private func formatNumber(_ number: Int) -> String {
+ let formatter = NumberFormatter()
+ formatter.numberStyle = .decimal
+ return formatter.string(from: NSNumber(value: number)) ?? "\(number)"
+ }
+
+ private func dayLabel(_ date: Date) -> String {
+ let formatter = DateFormatter()
+ formatter.dateFormat = "EEE"
+ return formatter.string(from: date)
+ }
+}
+
+// MARK: - Stat Card Component
+
+private struct StatCard<Content: View>: View {
+ let title: String
+ let icon: String
+ @ViewBuilder let content: Content
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 10) {
+ Label(title, systemImage: icon)
+ .font(.system(size: 11, weight: .semibold))
+ .foregroundStyle(.secondary)
+
+ content
+ }
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .padding(16)
+ .background(
+ RoundedRectangle(cornerRadius: 12)
+ .fill(.ultraThinMaterial)
+ .overlay(
+ RoundedRectangle(cornerRadius: 12)
+ .stroke(.white.opacity(0.08), lineWidth: 1)
+ )
+ )
+ }
+}
+
+#Preview {
+ StatsView()
+ .frame(width: 600, height: 800)
+ .environment(\.theme, AppTheme.dark)
+}
+
diff --git a/Sources/Fluid/UI/TranscriptionHistoryView.swift b/Sources/Fluid/UI/TranscriptionHistoryView.swift
new file mode 100644
index 00000000..b0466ba0
--- /dev/null
+++ b/Sources/Fluid/UI/TranscriptionHistoryView.swift
@@ -0,0 +1,461 @@
+//
+// TranscriptionHistoryView.swift
+// Fluid
+//
+// Transcription history browser with search and detail view
+//
+
+import SwiftUI
+
+struct TranscriptionHistoryView: View {
+ @ObservedObject private var historyStore = TranscriptionHistoryStore.shared
+ @Environment(\.theme) private var theme
+
+ @State private var searchQuery: String = ""
+ @State private var showClearConfirmation: Bool = false
+ @State private var selectedEntryID: UUID?
+
+ private var filteredEntries: [TranscriptionHistoryEntry] {
+ historyStore.search(query: searchQuery)
+ }
+
+ private var selectedEntry: TranscriptionHistoryEntry? {
+ guard let id = selectedEntryID else { return filteredEntries.first }
+ return filteredEntries.first(where: { $0.id == id })
+ }
+
+ var body: some View {
+ HSplitView {
+ // MARK: - Left Panel: Entry List
+ VStack(spacing: 0) {
+ // Search Bar
+ searchBar
+ .padding(12)
+
+ Divider()
+ .opacity(0.3)
+
+ // Entry List
+ if filteredEntries.isEmpty {
+ emptyStateView
+ } else {
+ entryListView
+ }
+
+ // Footer with stats and clear button
+ footerView
+ }
+ .frame(minWidth: 280, idealWidth: 320, maxWidth: 400)
+ .background(theme.palette.cardBackground.opacity(0.3))
+
+ // MARK: - Right Panel: Entry Detail
+ if let entry = selectedEntry {
+ entryDetailView(entry)
+ .frame(minWidth: 400)
+ } else {
+ noSelectionView
+ .frame(minWidth: 400)
+ }
+ }
+ .onAppear {
+ if selectedEntryID == nil {
+ selectedEntryID = filteredEntries.first?.id
+ }
+ }
+ .alert("Clear All History", isPresented: $showClearConfirmation) {
+ Button("Cancel", role: .cancel) { }
+ Button("Clear All", role: .destructive) {
+ withAnimation(.easeInOut(duration: 0.2)) {
+ historyStore.clearAllHistory()
+ selectedEntryID = nil
+ }
+ }
+ } message: {
+ Text("This will permanently delete all \(historyStore.entries.count) transcription entries. This action cannot be undone.")
+ }
+ }
+
+ // MARK: - Search Bar
+ private var searchBar: some View {
+ HStack(spacing: 8) {
+ Image(systemName: "magnifyingglass")
+ .font(.system(size: 13, weight: .medium))
+ .foregroundStyle(.secondary)
+
+ TextField("Search transcriptions...", text: $searchQuery)
+ .textFieldStyle(.plain)
+ .font(.system(size: 13))
+
+ if !searchQuery.isEmpty {
+ Button {
+ searchQuery = ""
+ } label: {
+ Image(systemName: "xmark.circle.fill")
+ .font(.system(size: 12))
+ .foregroundStyle(.secondary)
+ }
+ .buttonStyle(.plain)
+ }
+ }
+ .padding(.horizontal, 10)
+ .padding(.vertical, 8)
+ .background(
+ RoundedRectangle(cornerRadius: 8)
+ .fill(.ultraThinMaterial)
+ .overlay(
+ RoundedRectangle(cornerRadius: 8)
+ .stroke(.white.opacity(0.08), lineWidth: 1)
+ )
+ )
+ }
+
+ // MARK: - Entry List
+ private var entryListView: some View {
+ ScrollView {
+ LazyVStack(spacing: 2) {
+ ForEach(filteredEntries) { entry in
+ entryRow(entry)
+ }
+ }
+ .padding(.horizontal, 8)
+ .padding(.vertical, 6)
+ }
+ }
+
+ private func entryRow(_ entry: TranscriptionHistoryEntry) -> some View {
+ let isSelected = selectedEntryID == entry.id
+
+ return Button {
+ withAnimation(.easeInOut(duration: 0.15)) {
+ selectedEntryID = entry.id
+ }
+ } label: {
+ VStack(alignment: .leading, spacing: 4) {
+ // Top row: App name and time
+ HStack(spacing: 6) {
+ Text(entry.appName.isEmpty ? "Unknown App" : entry.appName)
+ .font(.system(size: 11, weight: .semibold))
+ .foregroundStyle(isSelected ? .white : .secondary)
+ .lineLimit(1)
+
+ if entry.wasAIProcessed {
+ Text("AI")
+ .font(.system(size: 9, weight: .bold))
+ .foregroundStyle(isSelected ? .white.opacity(0.8) : theme.palette.accent)
+ .padding(.horizontal, 4)
+ .padding(.vertical, 1)
+ .background(
+ RoundedRectangle(cornerRadius: 3)
+ .fill(isSelected ? .white.opacity(0.2) : theme.palette.accent.opacity(0.15))
+ )
+ }
+
+ Spacer()
+
+ Text(entry.relativeTimeString)
+ .font(.system(size: 10, weight: .medium))
+ .foregroundStyle(isSelected ? .white.opacity(0.7) : Color.secondary.opacity(0.6))
+ }
+
+ // Preview text
+ Text(entry.previewText)
+ .font(.system(size: 12))
+ .foregroundStyle(isSelected ? .white.opacity(0.9) : .primary)
+ .lineLimit(2)
+ .multilineTextAlignment(.leading)
+ }
+ .padding(.horizontal, 10)
+ .padding(.vertical, 8)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .background(
+ RoundedRectangle(cornerRadius: 8)
+ .fill(isSelected ? theme.palette.accent : Color.clear)
+ )
+ .contentShape(Rectangle())
+ }
+ .buttonStyle(.plain)
+ .contextMenu {
+ Button {
+ NSPasteboard.general.clearContents()
+ NSPasteboard.general.setString(entry.processedText, forType: .string)
+ } label: {
+ Label("Copy Text", systemImage: "doc.on.doc")
+ }
+
+ if entry.wasAIProcessed {
+ Button {
+ NSPasteboard.general.clearContents()
+ NSPasteboard.general.setString(entry.rawText, forType: .string)
+ } label: {
+ Label("Copy Raw Text", systemImage: "doc.on.doc.fill")
+ }
+ }
+
+ Divider()
+
+ Button(role: .destructive) {
+ withAnimation(.easeInOut(duration: 0.2)) {
+ historyStore.deleteEntry(id: entry.id)
+ if selectedEntryID == entry.id {
+ selectedEntryID = filteredEntries.first(where: { $0.id != entry.id })?.id
+ }
+ }
+ } label: {
+ Label("Delete", systemImage: "trash")
+ }
+ }
+ }
+
+ // MARK: - Empty State
+ private var emptyStateView: some View {
+ VStack(spacing: 16) {
+ Spacer()
+
+ Image(systemName: searchQuery.isEmpty ? "clock.arrow.circlepath" : "magnifyingglass")
+ .font(.system(size: 36, weight: .light))
+ .foregroundStyle(.tertiary)
+
+ VStack(spacing: 4) {
+ Text(searchQuery.isEmpty ? "No History Yet" : "No Results")
+ .font(.system(size: 14, weight: .semibold))
+ .foregroundStyle(.secondary)
+
+ Text(searchQuery.isEmpty
+ ? "Your transcriptions will appear here"
+ : "Try a different search term")
+ .font(.system(size: 12))
+ .foregroundStyle(.tertiary)
+ .multilineTextAlignment(.center)
+ }
+
+ Spacer()
+ }
+ .frame(maxWidth: .infinity)
+ .padding()
+ }
+
+ // MARK: - Footer
+ private var footerView: some View {
+ VStack(spacing: 0) {
+ Divider()
+ .opacity(0.3)
+
+ HStack {
+ // Stats
+ Text("\(historyStore.entries.count) entries")
+ .font(.system(size: 11, weight: .medium))
+ .foregroundStyle(.tertiary)
+
+ Spacer()
+
+ // Clear All Button
+ if !historyStore.entries.isEmpty {
+ Button {
+ showClearConfirmation = true
+ } label: {
+ Text("Clear All")
+ .font(.system(size: 11, weight: .medium))
+ .foregroundStyle(.secondary)
+ }
+ .buttonStyle(.plain)
+ .opacity(0.8)
+ }
+ }
+ .padding(.horizontal, 14)
+ .padding(.vertical, 10)
+ }
+ }
+
+ // MARK: - Entry Detail View
+ private func entryDetailView(_ entry: TranscriptionHistoryEntry) -> some View {
+ ScrollView {
+ VStack(alignment: .leading, spacing: 20) {
+ // Header
+ VStack(alignment: .leading, spacing: 8) {
+ HStack {
+ Text("Transcription Details")
+ .font(.system(size: 18, weight: .semibold))
+
+ Spacer()
+
+ // Copy button
+ Button {
+ NSPasteboard.general.clearContents()
+ NSPasteboard.general.setString(entry.processedText, forType: .string)
+ } label: {
+ Label("Copy", systemImage: "doc.on.doc")
+ .font(.system(size: 12, weight: .medium))
+ }
+ .buttonStyle(.bordered)
+ .controlSize(.small)
+ }
+
+ Text(entry.fullDateString)
+ .font(.system(size: 13))
+ .foregroundStyle(.secondary)
+ }
+
+ Divider()
+ .opacity(0.3)
+
+ // Final Text Section
+ detailSection(
+ title: "Final Text",
+ content: entry.processedText,
+ badge: entry.wasAIProcessed ? "AI Enhanced" : nil
+ )
+
+ // Raw Text Section (only if different)
+ if entry.wasAIProcessed {
+ detailSection(
+ title: "Original Transcription",
+ content: entry.rawText,
+ badge: nil,
+ isSecondary: true
+ )
+ }
+
+ Divider()
+ .opacity(0.3)
+
+ // Metadata Grid
+ metadataGrid(entry)
+
+ Spacer(minLength: 20)
+
+ // Delete Button
+ HStack {
+ Spacer()
+ Button(role: .destructive) {
+ withAnimation(.easeInOut(duration: 0.2)) {
+ let nextEntry = filteredEntries.first(where: { $0.id != entry.id })
+ historyStore.deleteEntry(id: entry.id)
+ selectedEntryID = nextEntry?.id
+ }
+ } label: {
+ Label("Delete Entry", systemImage: "trash")
+ .font(.system(size: 12, weight: .medium))
+ }
+ .buttonStyle(.bordered)
+ .tint(.red)
+ .controlSize(.small)
+ }
+ }
+ .padding(24)
+ }
+ .background(theme.palette.cardBackground.opacity(0.15))
+ }
+
+ private func detailSection(
+ title: String,
+ content: String,
+ badge: String?,
+ isSecondary: Bool = false
+ ) -> some View {
+ VStack(alignment: .leading, spacing: 8) {
+ HStack(spacing: 8) {
+ Text(title)
+ .font(.system(size: 12, weight: .semibold))
+ .foregroundStyle(.secondary)
+ .textCase(.uppercase)
+ .tracking(0.5)
+
+ if let badge = badge {
+ Text(badge)
+ .font(.system(size: 9, weight: .bold))
+ .foregroundStyle(theme.palette.accent)
+ .padding(.horizontal, 6)
+ .padding(.vertical, 2)
+ .background(
+ RoundedRectangle(cornerRadius: 4)
+ .fill(theme.palette.accent.opacity(0.15))
+ )
+ }
+ }
+
+ Text(content)
+ .font(.system(size: 14, design: .default))
+ .foregroundStyle(isSecondary ? .secondary : .primary)
+ .textSelection(.enabled)
+ .padding(14)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .background(
+ RoundedRectangle(cornerRadius: 10)
+ .fill(.ultraThinMaterial)
+ .overlay(
+ RoundedRectangle(cornerRadius: 10)
+ .stroke(.white.opacity(isSecondary ? 0.04 : 0.08), lineWidth: 1)
+ )
+ )
+ }
+ }
+
+ private func metadataGrid(_ entry: TranscriptionHistoryEntry) -> some View {
+ VStack(alignment: .leading, spacing: 12) {
+ Text("Details")
+ .font(.system(size: 12, weight: .semibold))
+ .foregroundStyle(.secondary)
+ .textCase(.uppercase)
+ .tracking(0.5)
+
+ LazyVGrid(columns: [
+ GridItem(.flexible(), spacing: 16),
+ GridItem(.flexible(), spacing: 16)
+ ], spacing: 12) {
+ metadataItem(icon: "app.fill", label: "Application", value: entry.appName.isEmpty ? "Unknown" : entry.appName)
+ metadataItem(icon: "macwindow", label: "Window", value: entry.windowTitle.isEmpty ? "Unknown" : entry.windowTitle)
+ metadataItem(icon: "character.cursor.ibeam", label: "Characters", value: "\(entry.characterCount)")
+ metadataItem(icon: "sparkles", label: "AI Processed", value: entry.wasAIProcessed ? "Yes" : "No")
+ }
+ }
+ }
+
+ private func metadataItem(icon: String, label: String, value: String) -> some View {
+ HStack(spacing: 10) {
+ Image(systemName: icon)
+ .font(.system(size: 12, weight: .medium))
+ .foregroundStyle(.tertiary)
+ .frame(width: 20)
+
+ VStack(alignment: .leading, spacing: 2) {
+ Text(label)
+ .font(.system(size: 10, weight: .medium))
+ .foregroundStyle(.tertiary)
+
+ Text(value)
+ .font(.system(size: 12, weight: .medium))
+ .foregroundStyle(.primary)
+ .lineLimit(1)
+ }
+
+ Spacer()
+ }
+ .padding(10)
+ .background(
+ RoundedRectangle(cornerRadius: 8)
+ .fill(.ultraThinMaterial.opacity(0.5))
+ )
+ }
+
+ // MARK: - No Selection View
+ private var noSelectionView: some View {
+ VStack(spacing: 16) {
+ Image(systemName: "text.quote")
+ .font(.system(size: 40, weight: .light))
+ .foregroundStyle(.tertiary)
+
+ Text("Select a transcription")
+ .font(.system(size: 14, weight: .medium))
+ .foregroundStyle(.secondary)
+ }
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+ .background(theme.palette.cardBackground.opacity(0.15))
+ }
+}
+
+#Preview {
+ TranscriptionHistoryView()
+ .frame(width: 800, height: 600)
+ .environment(\.theme, AppTheme.dark)
+}
+
diff --git a/Sources/Fluid/UI/WelcomeView.swift b/Sources/Fluid/UI/WelcomeView.swift
index 60612a65..eca1ed43 100644
--- a/Sources/Fluid/UI/WelcomeView.swift
+++ b/Sources/Fluid/UI/WelcomeView.swift
@@ -39,27 +39,23 @@ struct WelcomeView: View {
var body: some View {
ScrollView {
- VStack(alignment: .leading, spacing: 14) {
+ VStack(alignment: .leading, spacing: 16) {
// Header
- HStack(spacing: 12) {
+ HStack(spacing: 10) {
Image(systemName: "book.fill")
- .font(.system(size: 24))
+ .font(.title2)
.foregroundStyle(theme.palette.accent)
Text("Welcome to FluidVoice")
- .font(.system(size: 22, weight: .bold))
+ .font(.title2.weight(.bold))
}
- .padding(.bottom, 6)
+ .padding(.bottom, 4)
// Quick Setup Checklist
ThemedCard(style: .prominent) {
- VStack(alignment: .leading, spacing: 10) {
- HStack {
- Image(systemName: "checkmark.circle.fill")
- .font(.system(size: 16))
- .foregroundStyle(theme.palette.accent)
- Text("Quick Setup")
- .font(.system(size: 15, weight: .semibold))
- }
+ VStack(alignment: .leading, spacing: 12) {
+ Label("Quick Setup", systemImage: "checkmark.circle.fill")
+ .font(.headline)
+ .foregroundStyle(theme.palette.accent)
VStack(alignment: .leading, spacing: 8) {
SetupStepView(
@@ -160,148 +156,65 @@ struct WelcomeView: View {
.padding(14)
}
- // How to Use - Before playground
+ // How to Use
ThemedCard(style: .standard) {
- VStack(alignment: .leading, spacing: 10) {
- HStack {
- Image(systemName: "play.fill")
- .font(.system(size: 16))
- .foregroundStyle(.green)
- Text("How to Use")
- .font(.system(size: 15, weight: .semibold))
- Spacer()
- }
-
- VStack(alignment: .leading, spacing: 12) {
- HStack(alignment: .top, spacing: 10) {
- ZStack {
- Circle()
- .fill(theme.palette.accent.opacity(0.15))
- .frame(width: 32, height: 32)
- Text("1")
- .font(.system(size: 14, weight: .bold))
- .foregroundStyle(theme.palette.accent)
- }
- VStack(alignment: .leading, spacing: 4) {
- Text("Start Recording")
- .font(.system(size: 15, weight: .semibold))
- Text("Press your hotkey (default: Right Option/Alt) or click the button")
- .font(.system(size: 13))
- .foregroundStyle(.secondary)
- }
- Spacer()
- }
-
- HStack(alignment: .top, spacing: 10) {
- ZStack {
- Circle()
- .fill(theme.palette.accent.opacity(0.15))
- .frame(width: 32, height: 32)
- Text("2")
- .font(.system(size: 14, weight: .bold))
- .foregroundStyle(theme.palette.accent)
- }
- VStack(alignment: .leading, spacing: 4) {
- Text("Speak Clearly")
- .font(.system(size: 15, weight: .semibold))
- Text("Speak naturally - works best in quiet environments")
- .font(.system(size: 13))
- .foregroundStyle(.secondary)
- }
- Spacer()
- }
+ VStack(alignment: .leading, spacing: 12) {
+ Label("How to Use", systemImage: "play.fill")
+ .font(.headline)
+ .foregroundStyle(.green)
- HStack(alignment: .top, spacing: 10) {
- ZStack {
- Circle()
- .fill(theme.palette.accent.opacity(0.15))
- .frame(width: 32, height: 32)
- Text("3")
- .font(.system(size: 14, weight: .bold))
- .foregroundStyle(theme.palette.accent)
- }
- VStack(alignment: .leading, spacing: 4) {
- Text("Auto-Type Result")
- .font(.system(size: 15, weight: .semibold))
- Text("Transcription is automatically typed into your focused app")
- .font(.system(size: 13))
- .foregroundStyle(.secondary)
- }
- Spacer()
- }
+ VStack(alignment: .leading, spacing: 10) {
+ howToStep(number: 1, title: "Start Recording", description: "Press your hotkey (default: Right Option/Alt) or click the button")
+ howToStep(number: 2, title: "Speak Clearly", description: "Speak naturally - works best in quiet environments")
+ howToStep(number: 3, title: "Auto-Type Result", description: "Transcription is automatically typed into your focused app")
}
- .padding(.vertical, 8)
}
.frame(maxWidth: .infinity, alignment: .leading)
- .padding(14)
+ .padding(16)
}
.frame(maxWidth: .infinity)
// Command Mode
ThemedCard(style: .standard) {
- VStack(alignment: .leading, spacing: 10) {
- HStack {
- Image(systemName: "terminal.fill")
- .font(.system(size: 16))
- .foregroundStyle(Color(red: 1.0, green: 0.35, blue: 0.35)) // Command mode red
- Text("Command Mode")
- .font(.system(size: 15, weight: .semibold))
-
- Text("New")
- .font(.system(size: 10, weight: .semibold))
- .foregroundStyle(.white)
- .padding(.horizontal, 6)
- .padding(.vertical, 2)
- .background(Color(red: 1.0, green: 0.35, blue: 0.35)) // Command mode red
- .cornerRadius(4)
+ VStack(alignment: .leading, spacing: 12) {
+ HStack(spacing: 8) {
+ Label("Command Mode", systemImage: "terminal.fill")
+ .font(.headline)
+ .foregroundStyle(Color(red: 1.0, green: 0.35, blue: 0.35))
- Text("Alpha")
- .font(.system(size: 10, weight: .semibold))
- .foregroundStyle(.white)
- .padding(.horizontal, 6)
- .padding(.vertical, 2)
- .background(Color(red: 1.0, green: 0.35, blue: 0.35).opacity(0.7)) // Command mode red
- .cornerRadius(4)
+ featureBadge("New", color: Color(red: 1.0, green: 0.35, blue: 0.35))
+ featureBadge("Alpha", color: Color(red: 1.0, green: 0.35, blue: 0.35).opacity(0.7))
Spacer()
- Button(action: { selectedSidebarItem = .commandMode }) {
- Text("Open")
- .font(.system(size: 12, weight: .medium))
+ Button("Open") {
+ selectedSidebarItem = .commandMode
}
.buttonStyle(.bordered)
.controlSize(.small)
}
Text("Control your Mac with voice commands. Execute terminal commands, open apps, and more.")
- .font(.system(size: 13))
+ .font(.subheadline)
.foregroundStyle(.secondary)
- // How to use
VStack(alignment: .leading, spacing: 6) {
Text("Getting Started")
- .font(.system(size: 12, weight: .semibold))
+ .font(.subheadline.weight(.medium))
.foregroundStyle(.orange)
HStack(spacing: 4) {
Text("Press")
- .font(.system(size: 12))
- Text(commandModeShortcutDisplay)
- .font(.system(size: 12, weight: .medium))
- .padding(.horizontal, 6)
- .padding(.vertical, 2)
- .background(Color.primary.opacity(0.1))
- .cornerRadius(4)
+ keyboardBadge(commandModeShortcutDisplay)
Text("to open, speak your command, then press again to send.")
- .font(.system(size: 12))
}
+ .font(.caption)
.foregroundStyle(.primary.opacity(0.8))
}
- .padding(.vertical, 4)
- VStack(alignment: .leading, spacing: 8) {
+ VStack(alignment: .leading, spacing: 6) {
Text("Examples")
- .font(.system(size: 12, weight: .semibold))
+ .font(.subheadline.weight(.medium))
.foregroundStyle(.orange)
commandModeExample(icon: "folder", text: "\"List files in my Downloads folder\"")
commandModeExample(icon: "plus.rectangle.on.folder", text: "\"Create a folder called Projects on Desktop\"")
@@ -311,93 +224,69 @@ struct WelcomeView: View {
HStack(spacing: 4) {
Image(systemName: "exclamationmark.triangle.fill")
- .font(.system(size: 11))
+ .font(.caption2)
.foregroundStyle(.orange)
Text("AI can make mistakes. Avoid destructive commands.")
- .font(.system(size: 11))
+ .font(.caption)
.foregroundStyle(.secondary)
}
- .padding(.top, 4)
}
- .padding(14)
+ .padding(16)
}
.frame(maxWidth: .infinity)
// Write Mode
ThemedCard(style: .standard) {
- VStack(alignment: .leading, spacing: 10) {
- HStack {
- Image(systemName: "pencil.and.outline")
- .font(.system(size: 16))
+ VStack(alignment: .leading, spacing: 12) {
+ HStack(spacing: 8) {
+ Label("Write Mode", systemImage: "pencil.and.outline")
+ .font(.headline)
.foregroundStyle(.blue)
- Text("Write Mode")
- .font(.system(size: 15, weight: .semibold))
- Text("New")
- .font(.system(size: 10, weight: .semibold))
- .foregroundStyle(.white)
- .padding(.horizontal, 6)
- .padding(.vertical, 2)
- .background(Color.blue)
- .cornerRadius(4)
+ featureBadge("New", color: .blue)
Spacer()
- Button(action: { selectedSidebarItem = .rewriteMode }) {
- Text("Open")
- .font(.system(size: 12, weight: .medium))
+ Button("Open") {
+ selectedSidebarItem = .rewriteMode
}
.buttonStyle(.bordered)
.controlSize(.small)
}
Text("AI-powered writing assistant. Write fresh content or rewrite selected text with voice.")
- .font(.system(size: 13))
+ .font(.subheadline)
.foregroundStyle(.secondary)
- VStack(alignment: .leading, spacing: 12) {
- // Write Fresh section
+ VStack(alignment: .leading, spacing: 10) {
VStack(alignment: .leading, spacing: 6) {
Text("To Write Fresh")
- .font(.system(size: 12, weight: .semibold))
+ .font(.subheadline.weight(.medium))
.foregroundStyle(.blue)
HStack(spacing: 4) {
Text("Press")
- .font(.system(size: 12))
- Text(writeModeShortcutDisplay)
- .font(.system(size: 12, weight: .medium))
- .padding(.horizontal, 6)
- .padding(.vertical, 2)
- .background(Color.primary.opacity(0.1))
- .cornerRadius(4)
+ keyboardBadge(writeModeShortcutDisplay)
Text("and speak what you want to write.")
- .font(.system(size: 12))
}
+ .font(.caption)
.foregroundStyle(.primary.opacity(0.8))
writeModeExample(text: "\"Write an email asking for time off\"")
writeModeExample(text: "\"Draft a thank you note\"")
}
- // Rewrite/Edit section
VStack(alignment: .leading, spacing: 6) {
Text("To Rewrite/Edit")
- .font(.system(size: 12, weight: .semibold))
+ .font(.subheadline.weight(.medium))
.foregroundStyle(.blue)
HStack(spacing: 4) {
Text("Select text first, then press")
- .font(.system(size: 12))
- Text(writeModeShortcutDisplay)
- .font(.system(size: 12, weight: .medium))
- .padding(.horizontal, 6)
- .padding(.vertical, 2)
- .background(Color.primary.opacity(0.1))
- .cornerRadius(4)
+ keyboardBadge(writeModeShortcutDisplay)
Text("and speak your instruction.")
- .font(.system(size: 12))
}
+ .font(.caption)
.foregroundStyle(.primary.opacity(0.8))
writeModeExample(text: "\"Make this more formal\"")
@@ -405,88 +294,80 @@ struct WelcomeView: View {
writeModeExample(text: "\"Summarize this\"")
}
}
- .padding(.vertical, 4)
}
- .padding(14)
+ .padding(16)
}
.frame(maxWidth: .infinity)
- // Test Playground - At the end
+ // Test Playground
ThemedCard(hoverEffect: false) {
- VStack(alignment: .leading, spacing: 12) {
+ VStack(alignment: .leading, spacing: 14) {
HStack {
- Image(systemName: "text.bubble")
- .font(.system(size: 18))
- .foregroundStyle(.white)
- VStack(alignment: .leading, spacing: 2) {
- Text("Test Playground")
- .font(.system(size: 16, weight: .semibold))
- Text("Click record, speak, and see your transcription")
- .font(.system(size: 12))
- .foregroundStyle(.secondary)
+ Label {
+ VStack(alignment: .leading, spacing: 2) {
+ Text("Test Playground")
+ .font(.headline)
+ Text("Click record, speak, and see your transcription")
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ }
+ } icon: {
+ Image(systemName: "text.bubble")
+ .font(.title3)
}
Spacer()
- // Status indicator
if asr.isRunning {
HStack(spacing: 6) {
Circle()
.fill(.red)
- .frame(width: 8, height: 8)
+ .frame(width: 6, height: 6)
Text("Recording...")
- .font(.system(size: 12, weight: .medium))
+ .font(.caption.weight(.medium))
.foregroundStyle(.red)
}
} else if !asr.finalText.isEmpty {
Text("\(asr.finalText.count) characters")
- .font(.system(size: 12))
+ .font(.caption)
.foregroundStyle(.secondary)
}
if !asr.finalText.isEmpty {
- Button(action: {
+ Button {
NSPasteboard.general.clearContents()
NSPasteboard.general.setString(asr.finalText, forType: .string)
- }) {
- HStack(spacing: 4) {
- Image(systemName: "doc.on.doc")
- .font(.system(size: 11))
- Text("Copy")
- .font(.system(size: 11))
- }
+ } label: {
+ Label("Copy", systemImage: "doc.on.doc")
}
- .buttonStyle(InlineButtonStyle())
- .buttonHoverEffect()
+ .buttonStyle(.bordered)
+ .controlSize(.small)
}
}
- VStack(alignment: .leading, spacing: 10) {
-
- // Recording Control - Big Premium Button
+ VStack(alignment: .leading, spacing: 12) {
+ // Recording Control
VStack(spacing: 10) {
- Button(action: {
+ Button {
if asr.isRunning {
Task {
await stopAndProcessTranscription()
}
} else {
startRecording()
- // Mark playground as used immediately when user clicks to test
playgroundUsed = true
SettingsStore.shared.playgroundUsed = true
}
- }) {
+ } label: {
HStack {
Image(systemName: asr.isRunning ? "stop.fill" : "mic.fill")
- .font(.system(size: 16, weight: .semibold))
Text(asr.isRunning ? "Stop Recording" : "Start Recording")
}
.frame(maxWidth: .infinity)
}
.buttonStyle(PremiumButtonStyle(isRecording: asr.isRunning))
.buttonHoverEffect()
- .scaleEffect(asr.isRunning ? 1.05 : 1.0)
+ .scaleEffect(asr.isRunning ? 1.02 : 1.0)
.animation(.spring(response: 0.3), value: asr.isRunning)
.disabled(!asr.isAsrReady && !asr.isRunning)
@@ -499,103 +380,64 @@ struct WelcomeView: View {
}
}
- // TRANSCRIPTION TEXT AREA
+ // Text Area
VStack(alignment: .leading, spacing: 8) {
- // REAL TEXT EDITOR - Can receive focus and display transcription
TextEditor(text: $asr.finalText)
- .font(.system(size: 13))
+ .font(.body)
.focused(isTranscriptionFocused)
- .frame(height: 150)
- .padding(12)
+ .frame(height: 140)
+ .padding(10)
.background(
- RoundedRectangle(cornerRadius: 8)
+ RoundedRectangle(cornerRadius: 8, style: .continuous)
.fill(
- asr.isRunning ? theme.palette.accent.opacity(0.08) : Color(nsColor: NSColor.textBackgroundColor)
+ asr.isRunning ? theme.palette.accent.opacity(0.06) : Color(nsColor: NSColor.textBackgroundColor)
)
.overlay(
- RoundedRectangle(cornerRadius: 8)
+ RoundedRectangle(cornerRadius: 8, style: .continuous)
.strokeBorder(
- asr.isRunning ? theme.palette.accent.opacity(0.5) : Color(nsColor: NSColor.separatorColor),
- lineWidth: asr.isRunning ? 2 : 1.5
+ asr.isRunning ? theme.palette.accent.opacity(0.4) : Color(nsColor: NSColor.separatorColor),
+ lineWidth: asr.isRunning ? 2 : 1
)
)
)
.scrollContentBackground(.hidden)
.overlay(
- VStack {
+ VStack(spacing: 8) {
if asr.isRunning {
- VStack(spacing: 8) {
- // Animated recording indicator overlay
- HStack(spacing: 6) {
- Image(systemName: "waveform")
- .font(.system(size: 18))
- .foregroundStyle(theme.palette.accent)
- .scaleEffect(1.0)
- .animation(.easeInOut(duration: 0.8).repeatForever(), value: asr.isRunning)
-
- Image(systemName: "waveform")
- .font(.system(size: 16))
- .foregroundStyle(theme.palette.accent.opacity(0.7))
- .scaleEffect(1.0)
- .animation(.easeInOut(duration: 0.6).repeatForever(), value: asr.isRunning)
-
- Image(systemName: "waveform")
- .font(.system(size: 14))
- .foregroundStyle(theme.palette.accent.opacity(0.5))
- .scaleEffect(1.0)
- .animation(.easeInOut(duration: 0.4).repeatForever(), value: asr.isRunning)
- }
-
- VStack(spacing: 2) {
- Text("Listening... Speak now!")
- .font(.system(size: 16, weight: .semibold))
- .foregroundStyle(theme.palette.accent)
-
- Text("Transcription will appear when you stop recording")
- .font(.system(size: 12))
- .foregroundStyle(theme.palette.accent.opacity(0.8))
- }
- }
+ Image(systemName: "waveform")
+ .font(.title2)
+ .foregroundStyle(theme.palette.accent)
+ Text("Listening... Speak now!")
+ .font(.subheadline.weight(.medium))
+ .foregroundStyle(theme.palette.accent)
+ Text("Transcription will appear when you stop recording")
+ .font(.caption)
+ .foregroundStyle(theme.palette.accent.opacity(0.7))
} else if asr.finalText.isEmpty {
- VStack(spacing: 8) {
- Image(systemName: "text.bubble")
- .font(.system(size: 24))
- .foregroundStyle(.secondary.opacity(0.6))
-
- VStack(spacing: 2) {
- Text("Ready to test!")
- .font(.system(size: 16, weight: .semibold))
- .foregroundStyle(.primary)
-
- Text("Click 'Start Recording' or press your hotkey")
- .font(.system(size: 12))
- .foregroundStyle(.secondary)
- }
- }
+ Image(systemName: "text.bubble")
+ .font(.title2)
+ .foregroundStyle(.secondary.opacity(0.5))
+ Text("Ready to test!")
+ .font(.subheadline.weight(.medium))
+ Text("Click 'Start Recording' or press your hotkey")
+ .font(.caption)
+ .foregroundStyle(.secondary)
}
}
- .allowsHitTesting(false) // Don't block text editor interaction
+ .allowsHitTesting(false)
)
- // Quick Action Buttons
if !asr.finalText.isEmpty {
HStack(spacing: 8) {
- Button(action: {
+ Button {
NSPasteboard.general.clearContents()
NSPasteboard.general.setString(asr.finalText, forType: .string)
- }) {
- HStack(spacing: 4) {
- Image(systemName: "doc.on.doc")
- .font(.system(size: 11))
- Text("Copy Text")
- .font(.system(size: 12))
- }
- .padding(.horizontal, 10)
- .padding(.vertical, 5)
- .background(theme.palette.accent.opacity(0.12))
- .foregroundStyle(theme.palette.accent)
- .cornerRadius(6)
+ } label: {
+ Label("Copy Text", systemImage: "doc.on.doc")
}
+ .buttonStyle(.borderedProminent)
+ .tint(theme.palette.accent)
+ .controlSize(.small)
Button("Clear & Test Again") {
asr.finalText = ""
@@ -605,12 +447,11 @@ struct WelcomeView: View {
Spacer()
}
- .padding(.top, 6)
}
}
}
}
- .padding(14)
+ .padding(16)
}
}
@@ -620,14 +461,52 @@ struct WelcomeView: View {
// MARK: - Helper Views
+ private func howToStep(number: Int, title: String, description: String) -> some View {
+ HStack(alignment: .top, spacing: 10) {
+ ZStack {
+ Circle()
+ .fill(theme.palette.accent.opacity(0.15))
+ .frame(width: 28, height: 28)
+ Text("\(number)")
+ .font(.caption.weight(.bold))
+ .foregroundStyle(theme.palette.accent)
+ }
+ VStack(alignment: .leading, spacing: 2) {
+ Text(title)
+ .font(.body.weight(.medium))
+ Text(description)
+ .font(.subheadline)
+ .foregroundStyle(.secondary)
+ }
+ Spacer()
+ }
+ }
+
+ private func featureBadge(_ text: String, color: Color) -> some View {
+ Text(text)
+ .font(.caption2.weight(.semibold))
+ .foregroundStyle(.white)
+ .padding(.horizontal, 6)
+ .padding(.vertical, 2)
+ .background(color, in: RoundedRectangle(cornerRadius: 4, style: .continuous))
+ }
+
+ private func keyboardBadge(_ text: String) -> some View {
+ Text(text)
+ .font(.caption.weight(.medium))
+ .padding(.horizontal, 6)
+ .padding(.vertical, 2)
+ .background(Color.primary.opacity(0.1), in: RoundedRectangle(cornerRadius: 4, style: .continuous))
+ }
+
private func commandModeExample(icon: String, text: String) -> some View {
- HStack(spacing: 8) {
+ HStack(spacing: 6) {
Image(systemName: icon)
- .font(.system(size: 11))
+ .font(.caption2)
.foregroundStyle(.orange.opacity(0.8))
- .frame(width: 16)
+ .frame(width: 14)
Text(text)
- .font(.system(size: 12))
+ .font(.caption)
.foregroundStyle(.primary.opacity(0.8))
}
}
@@ -637,7 +516,7 @@ struct WelcomeView: View {
Text("•")
.foregroundStyle(.blue.opacity(0.6))
Text(text)
- .font(.system(size: 12))
+ .font(.caption)
.foregroundStyle(.primary.opacity(0.8))
}
}