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

Fix dashboard resizing

altic-devab6b9796ea00
diff --git a/Fluid.xcodeproj/project.pbxproj b/Fluid.xcodeproj/project.pbxproj
index 04d4298a..55aa73bb 100644
--- a/Fluid.xcodeproj/project.pbxproj
+++ b/Fluid.xcodeproj/project.pbxproj
@@ -17,6 +17,7 @@
7C5AF14C2F15041600DE21B0 /* MediaRemoteAdapter in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 7C5AF14A2F15041600DE21B0 /* MediaRemoteAdapter */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
7C9A71022F58B00000FB7CAF /* TranscribeCpp in Frameworks */ = {isa = PBXBuildFile; productRef = 7C9A71012F58B00000FB7CAF /* TranscribeCpp */; };
7C91B0012F42AA0100C0DEF0 /* HotkeyShortcutTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C91B0022F42AA0100C0DEF0 /* HotkeyShortcutTests.swift */; };
+ DAB600000000000000000001 /* DashboardLayoutTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAB600000000000000000002 /* DashboardLayoutTests.swift */; };
7C91B0A12F42AA0100C0DEF0 /* DeliveryTargetAssessmentTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C91B0A22F42AA0100C0DEF0 /* DeliveryTargetAssessmentTests.swift */; };
C0DE89000000000000000002 /* SettingsNavigationStateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DE89000000000000000001 /* SettingsNavigationStateTests.swift */; };
7CDB0A2D2F3C4D5600FB7CAD /* DictationE2ETests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDB0A292F3C4D5600FB7CAD /* DictationE2ETests.swift */; };
@@ -203,6 +204,7 @@
FEED67600000000000000001 /* PasteDeliveryCoordinatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasteDeliveryCoordinatorTests.swift; sourceTree = "<group>"; };
7C078D8F2E3B339200FB7CAC /* FluidVoice Debug.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "FluidVoice Debug.app"; sourceTree = BUILT_PRODUCTS_DIR; };
7C91B0022F42AA0100C0DEF0 /* HotkeyShortcutTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HotkeyShortcutTests.swift; sourceTree = "<group>"; };
+ DAB600000000000000000002 /* DashboardLayoutTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashboardLayoutTests.swift; sourceTree = "<group>"; };
7C91B0A22F42AA0100C0DEF0 /* DeliveryTargetAssessmentTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeliveryTargetAssessmentTests.swift; sourceTree = "<group>"; };
C0DE89000000000000000001 /* SettingsNavigationStateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsNavigationStateTests.swift; sourceTree = "<group>"; };
7CDB0A202F3C4D5600FB7CAD /* FluidDictationIntegrationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FluidDictationIntegrationTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -353,6 +355,7 @@
7CDB0A292F3C4D5600FB7CAD /* DictationE2ETests.swift */,
CD1C7A0000000000000000B1 /* CustomDictionaryManualEntryTests.swift */,
7C91B0022F42AA0100C0DEF0 /* HotkeyShortcutTests.swift */,
+ DAB600000000000000000002 /* DashboardLayoutTests.swift */,
7C91B0A22F42AA0100C0DEF0 /* DeliveryTargetAssessmentTests.swift */,
C0DE89000000000000000001 /* SettingsNavigationStateTests.swift */,
343B29013F4441D6A797D12D /* LLMClientRequestBodyTests.swift */,
@@ -702,6 +705,7 @@
B52000000000000000000002 /* PrivateAIDictationTokenBudgetTests.swift in Sources */,
CD1C7A0000000000000000B2 /* CustomDictionaryManualEntryTests.swift in Sources */,
7C91B0012F42AA0100C0DEF0 /* HotkeyShortcutTests.swift in Sources */,
+ DAB600000000000000000001 /* DashboardLayoutTests.swift in Sources */,
7C91B0A12F42AA0100C0DEF0 /* DeliveryTargetAssessmentTests.swift in Sources */,
C0DE89000000000000000002 /* SettingsNavigationStateTests.swift in Sources */,
86CAA2D4EF18433096185602 /* LLMClientRequestBodyTests.swift in Sources */,
diff --git a/Sources/Fluid/UI/DashboardView.swift b/Sources/Fluid/UI/DashboardView.swift
index 72b70e7f..1079b51f 100644
--- a/Sources/Fluid/UI/DashboardView.swift
+++ b/Sources/Fluid/UI/DashboardView.swift
@@ -2,6 +2,29 @@ import AppKit
import AVFoundation
import SwiftUI
+/// Uses available detail width, not window width (the sidebar can resize independently).
+struct DashboardLayout {
+ static let inset: CGFloat = 28
+ static let gap: CGFloat = 28
+ static let maximumWidth: CGFloat = 1440
+ static let actionWidth: CGFloat = 300
+ let contentWidth: CGFloat
+
+ init(width: CGFloat) {
+ self.contentWidth = max(0, min(width, Self.maximumWidth) - Self.inset * 2)
+ }
+
+ var hasActionColumn: Bool { self.contentWidth >= 640 + Self.gap + Self.actionWidth }
+ var mainWidth: CGFloat { self.hasActionColumn ? self.contentWidth - Self.gap - Self.actionWidth : self.contentWidth }
+ var hasHorizontalActions: Bool { !self.hasActionColumn && self.contentWidth >= 620 }
+ var lessonColumns: Int { self.contentWidth >= 1040 ? 4 : (self.contentWidth >= 520 ? 2 : 1) }
+
+ func statisticColumns(count: Int) -> Int {
+ if self.mainWidth >= CGFloat(count) * 160 + 40 { return count }
+ return count == 4 && self.mainWidth >= 360 ? 2 : 1
+ }
+}
+
/// Home reuses the history and stats snapshots; no polling or duplicate aggregation.
struct DashboardView: View {
@ObservedObject var asr: ASRService
@@ -28,24 +51,26 @@ struct DashboardView: View {
var body: some View {
GeometryReader { geometry in
+ let layout = DashboardLayout(width: geometry.size.width)
Group {
ScrollView {
VStack(alignment: .leading, spacing: 28) {
self.header
- if geometry.size.width >= 900 {
+ if layout.hasActionColumn {
HStack(alignment: .top, spacing: 28) {
- self.mainColumn
+ self.mainColumn(layout: layout)
.frame(maxWidth: .infinity)
- self.quickActions
- .frame(width: min(300, (geometry.size.width - 76) * 0.25))
+ self.quickActions(horizontal: false)
+ .frame(width: DashboardLayout.actionWidth)
}
} else {
- self.mainColumn
- self.quickActions
+ self.mainColumn(layout: layout)
+ self.quickActions(horizontal: layout.hasHorizontalActions)
}
+ self.learningCenter(columns: layout.lessonColumns)
}
- .padding(28)
- .frame(maxWidth: 1440, alignment: .leading)
+ .padding(DashboardLayout.inset)
+ .frame(maxWidth: DashboardLayout.maximumWidth, alignment: .leading)
.frame(maxWidth: .infinity)
}
}
@@ -68,41 +93,28 @@ struct DashboardView: View {
.fixedSize(horizontal: false, vertical: true)
}
- private var mainColumn: some View {
+ private func mainColumn(layout: DashboardLayout) -> some View {
VStack(alignment: .leading, spacing: 28) {
- self.statistics
+ self.statistics(layout: layout)
self.recents
- self.learningCenter
}
}
- private var statistics: some View {
+ private func statistics(layout: DashboardLayout) -> some View {
let today = self.history.todaySummary
let streak = self.stats.snapshot?.usingWeekdays(self.settings.weekendsDontBreakStreak).currentStreak
+ let fixed = self.stats.snapshot?.fluidFixedWords ?? 0
return Button { self.selectedSidebarItem = .stats } label: {
- HStack(alignment: .top, spacing: 20) {
+ LazyVGrid(columns: Array(repeating: GridItem(.flexible(), spacing: 20, alignment: .leading), count: layout.statisticColumns(count: fixed > 0 ? 4 : 3)), alignment: .leading, spacing: 20) {
self.stat("Today", value: today.words.formatted(), detail: "words dictated")
- Divider()
self.stat("Time saved", value: today.words == 0 ? "0m" : today.formattedTimeSaved(typingWPM: self.settings.userTypingWPM), detail: "estimated today")
- Divider()
self.stat("Streak", value: streak.map { "\($0) \($0 == 1 ? "day" : "days")" } ?? "—", detail: "keep it going")
// Quiet proof that Smart mode earns its keep; absent until it has fixed something.
- if let fixed = self.stats.snapshot?.fluidFixedWords, fixed > 0 {
- Divider()
+ if fixed > 0 {
self.stat("Fluid Intelligence", value: fixed.formatted(), detail: "words fixed for you")
}
}
.fixedSize(horizontal: false, vertical: true)
- .overlay(alignment: .topTrailing) {
- HStack(spacing: 4) {
- Text("View stats")
- Image(systemName: "chevron.right").font(.fluidSystem(size: 9, weight: .semibold))
- }
- .font(self.theme.typography.captionStrong)
- .foregroundStyle(self.theme.palette.accent)
- .opacity(self.statisticsHovered ? 1 : 0)
- .offset(x: self.statisticsHovered || self.reduceMotion ? 0 : -4)
- }
// Keyboard focus reuses the hover border instead of the heavy system ring,
// which otherwise lands on this card every time the dashboard opens.
.dashboardTile(hovered: self.statisticsHovered || self.statisticsFocused, horizontalPadding: 20, verticalPadding: 18, cornerRadius: 18)
@@ -170,7 +182,7 @@ struct DashboardView: View {
let action: () -> Void
}
- private var learningCenter: some View {
+ private func learningCenter(columns: Int) -> some View {
let lessons: [Lesson] = [
.init(title: "Voice model", icon: "waveform", complete: self.asr.modelsExistOnDisk || self.asr.isAsrReady, detail: "Pick your engine", action: { self.selectedSidebarItem = .voiceEngine }),
.init(title: "Microphone", icon: "mic", complete: self.asr.micStatus == .authorized, detail: "Set up voice input", action: {
@@ -191,8 +203,8 @@ struct DashboardView: View {
.buttonStyle(.plain).font(self.theme.typography.caption)
.foregroundStyle(.secondary).disabled(self.busy)
}
- // Fills the row and wraps on narrow windows instead of leaving a gap or scrolling sideways.
- LazyVGrid(columns: [GridItem(.adaptive(minimum: 180), spacing: 10)], alignment: .leading, spacing: 10) {
+ // Four items always form complete rows; never a cramped three-plus-one layout.
+ LazyVGrid(columns: Array(repeating: GridItem(.flexible(), spacing: 10), count: columns), alignment: .leading, spacing: 10) {
ForEach(lessons, id: \.title) { lesson in
DashboardLessonCard(title: lesson.title, detail: lesson.detail, icon: lesson.icon, complete: lesson.complete, action: lesson.action)
.disabled(self.busy)
@@ -201,59 +213,68 @@ struct DashboardView: View {
}
}
- private var quickActions: some View {
- VStack(alignment: .leading, spacing: 18) {
+ private func quickActions(horizontal: Bool) -> some View {
+ let layout = horizontal
+ ? AnyLayout(HStackLayout(alignment: .top, spacing: 18))
+ : AnyLayout(VStackLayout(alignment: .leading, spacing: 18))
+ return VStack(alignment: .leading, spacing: 18) {
Text("Quick actions").font(self.theme.typography.sectionTitle)
- if !self.shortcut.isEmpty {
- VStack(spacing: 18) {
- Text("YOUR SHORTCUT")
- .font(.fluidSystem(size: 10, weight: .semibold))
- .tracking(1.4).foregroundStyle(.secondary)
- self.shortcutKey
- if self.settings.primaryDictationShortcuts.count > 1 {
- Text("+\(self.settings.primaryDictationShortcuts.count - 1) more")
- .font(self.theme.typography.caption).foregroundStyle(.secondary)
+ layout {
+ if !self.shortcut.isEmpty {
+ VStack(spacing: 18) {
+ Text("YOUR SHORTCUT")
+ .font(.fluidSystem(size: 10, weight: .semibold))
+ .tracking(1.4).foregroundStyle(.secondary)
+ self.shortcutKey
+ if self.settings.primaryDictationShortcuts.count > 1 {
+ Text("+\(self.settings.primaryDictationShortcuts.count - 1) more")
+ .font(self.theme.typography.caption).foregroundStyle(.secondary)
+ }
+ Button(action: self.openShortcutSettings) {
+ HStack(spacing: 6) {
+ Text("Change shortcut")
+ Image(systemName: "arrow.up.right").font(.fluidSystem(size: 10, weight: .medium))
+ }
+ .font(self.theme.typography.captionStrong)
+ }
+ .buttonStyle(.plain).foregroundStyle(self.theme.palette.accent)
+ }
+ .frame(maxWidth: .infinity)
+ .padding(.vertical, 16).padding(.horizontal, 14)
+ .background {
+ RoundedRectangle(cornerRadius: 20)
+ .fill(LinearGradient(colors: [self.theme.palette.accent.opacity(0.12), self.theme.palette.cardBackground], startPoint: .topLeading, endPoint: .bottomTrailing))
+ }
+ .overlay(RoundedRectangle(cornerRadius: 20).strokeBorder(self.theme.palette.accent.opacity(0.13), lineWidth: 1))
+ .disabled(self.busy)
+ .frame(width: horizontal ? 220 : nil)
+ }
+ VStack(alignment: .leading, spacing: 18) {
+ DashboardQuickAction(title: "Add a word", detail: "Names & terms", icon: "text.book.closed", tint: self.theme.palette.accent) {
+ self.selectedSidebarItem = .customDictionary
+ }
+ .disabled(self.busy)
+ DashboardQuickAction(title: "Cleanup styles", detail: "Shape your writing", icon: "wand.and.stars", tint: self.theme.palette.accent) {
+ self.selectedSidebarItem = .cleanupStyles
}
- Button(action: self.openShortcutSettings) {
- HStack(spacing: 6) {
- Text("Change shortcut")
- Image(systemName: "arrow.up.right").font(.fluidSystem(size: 10, weight: .medium))
+ .disabled(self.busy)
+ HStack(spacing: 12) {
+ Image(systemName: "note.text").font(.fluidSystem(size: 20))
+ .frame(width: 36, height: 40)
+ VStack(alignment: .leading, spacing: 5) {
+ Text("Notepad").font(self.theme.typography.bodySmallStrong)
+ Text("Coming soon").font(self.theme.typography.caption)
}
- .font(self.theme.typography.captionStrong)
+ Spacer(minLength: 0)
}
- .buttonStyle(.plain).foregroundStyle(self.theme.palette.accent)
+ .foregroundStyle(.secondary)
+ .padding(14)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .overlay(RoundedRectangle(cornerRadius: 16).strokeBorder(self.theme.palette.cardBorder.opacity(0.5), style: StrokeStyle(lineWidth: 1, dash: [4, 4])))
+ .accessibilityElement(children: .combine)
}
.frame(maxWidth: .infinity)
- .padding(.vertical, 24).padding(.horizontal, 14)
- .background {
- RoundedRectangle(cornerRadius: 20)
- .fill(LinearGradient(colors: [self.theme.palette.accent.opacity(0.12), self.theme.palette.cardBackground], startPoint: .topLeading, endPoint: .bottomTrailing))
- }
- .overlay(RoundedRectangle(cornerRadius: 20).strokeBorder(self.theme.palette.accent.opacity(0.13), lineWidth: 1))
- .disabled(self.busy)
- }
- DashboardQuickAction(title: "Add a word", detail: "Names, terms, your vocabulary", icon: "text.book.closed", tint: self.theme.palette.accent) {
- self.selectedSidebarItem = .customDictionary
}
- .disabled(self.busy)
- DashboardQuickAction(title: "Cleanup styles", detail: "Shape how your words read", icon: "wand.and.stars", tint: self.theme.palette.accent) {
- self.selectedSidebarItem = .cleanupStyles
- }
- .disabled(self.busy)
- HStack(spacing: 12) {
- Image(systemName: "note.text").font(.fluidSystem(size: 20))
- .frame(width: 36, height: 40)
- VStack(alignment: .leading, spacing: 5) {
- Text("Notepad").font(self.theme.typography.bodySmallStrong)
- Text("Coming soon").font(self.theme.typography.caption)
- }
- Spacer(minLength: 0)
- }
- .foregroundStyle(.secondary)
- .padding(14)
- .frame(maxWidth: .infinity, alignment: .leading)
- .overlay(RoundedRectangle(cornerRadius: 16).strokeBorder(self.theme.palette.cardBorder.opacity(0.5), style: StrokeStyle(lineWidth: 1, dash: [4, 4])))
- .accessibilityElement(children: .combine)
}
.padding(20)
.background(self.reduceTransparency ? self.theme.palette.cardBackground : self.theme.palette.accent.opacity(0.025), in: RoundedRectangle(cornerRadius: 24))
@@ -272,7 +293,7 @@ struct DashboardView: View {
.lineLimit(2).minimumScaleFactor(0.5)
.multilineTextAlignment(.center)
.padding(.horizontal, 12)
- .frame(width: 126, height: 92)
+ .frame(width: 126, height: 64)
.contentShape(RoundedRectangle(cornerRadius: 18))
}
.buttonStyle(.plain)
@@ -356,9 +377,9 @@ private struct DashboardQuickAction: View {
HStack(spacing: 12) {
FluidIconTile(icon: self.icon, tint: self.tint)
VStack(alignment: .leading, spacing: 3) {
- Text(self.title).font(self.theme.typography.bodySmallStrong)
+ Text(self.title).font(self.theme.typography.bodySmallStrong).lineLimit(1)
Text(self.detail).font(self.theme.typography.caption).foregroundStyle(.secondary)
- .fixedSize(horizontal: false, vertical: true)
+ .lineLimit(1)
}
Spacer(minLength: 0)
Image(systemName: "chevron.right")
@@ -392,10 +413,9 @@ private struct DashboardLessonCard: View {
HStack(spacing: 12) {
FluidIconTile(icon: self.icon, tint: self.theme.palette.accent)
VStack(alignment: .leading, spacing: 3) {
- Text(self.title).font(self.theme.typography.bodySmallStrong)
+ Text(self.title).font(self.theme.typography.bodySmallStrong).lineLimit(1)
Text(self.detail).font(self.theme.typography.caption).foregroundStyle(.secondary)
.lineLimit(1)
- .minimumScaleFactor(0.9)
}
Spacer(minLength: 0)
if self.complete {
@@ -406,6 +426,7 @@ private struct DashboardLessonCard: View {
Text("Set up")
.font(self.theme.typography.captionStrong)
.foregroundStyle(self.theme.palette.accent)
+ .fixedSize()
}
}
.frame(maxWidth: .infinity, alignment: .leading)
diff --git a/Tests/FluidDictationIntegrationTests/DashboardLayoutTests.swift b/Tests/FluidDictationIntegrationTests/DashboardLayoutTests.swift
new file mode 100644
index 00000000..c9637ddf
--- /dev/null
+++ b/Tests/FluidDictationIntegrationTests/DashboardLayoutTests.swift
@@ -0,0 +1,33 @@
+@testable import FluidVoice_Debug
+import XCTest
+
+@MainActor
+final class DashboardLayoutTests: XCTestCase {
+ func testLearningCardsAlwaysFillTheirRows() {
+ for width in stride(from: 320, through: 2000, by: 1) {
+ let layout = DashboardLayout(width: CGFloat(width))
+ XCTAssertEqual(4 % layout.lessonColumns, 0)
+ if layout.hasActionColumn {
+ XCTAssertGreaterThanOrEqual(layout.mainWidth, 640)
+ }
+ }
+ }
+
+ func testBreakpointsAndCappedWidth() {
+ XCTAssertFalse(DashboardLayout(width: 1023).hasActionColumn)
+ XCTAssertTrue(DashboardLayout(width: 1024).hasActionColumn)
+ XCTAssertEqual(DashboardLayout(width: 575).lessonColumns, 1)
+ XCTAssertEqual(DashboardLayout(width: 576).lessonColumns, 2)
+ XCTAssertEqual(DashboardLayout(width: 1096).lessonColumns, 4)
+ XCTAssertFalse(DashboardLayout(width: 675).hasHorizontalActions)
+ XCTAssertTrue(DashboardLayout(width: 676).hasHorizontalActions)
+ XCTAssertFalse(DashboardLayout(width: 1024).hasHorizontalActions)
+ XCTAssertEqual(DashboardLayout(width: 2000).contentWidth, DashboardLayout(width: 1440).contentWidth)
+ }
+
+ func testStatisticsDoNotSqueezeFourColumnsBesideActions() {
+ XCTAssertEqual(DashboardLayout(width: 1024).statisticColumns(count: 4), 2)
+ XCTAssertEqual(DashboardLayout(width: 1440).statisticColumns(count: 4), 4)
+ XCTAssertEqual(DashboardLayout(width: 320).statisticColumns(count: 4), 1)
+ }
+}