Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@
## 2024-05-25 - Dynamic Labels and Disabled State Tooltips
**Learning:** Users can feel confused when a primary button is disabled without explanation or when a long-running action lacks immediate inline text feedback on the button itself.
**Action:** In SwiftUI, enhance button accessibility and UX by adding `.help()` tooltips to explain the required state when disabled, and using dynamic labels (e.g., 'Scanning...') to provide immediate feedback during async operations.
## 2024-05-24 - Add helpful context to disabled UI states
**Learning:** Buttons disabled during async operations or when preconditions aren't met can leave users confused. Adding `.help()` tooltips effectively explains *why* a button is disabled, improving discoverability and VoiceOver context. Dynamic labels (e.g., 'Scanning...' vs 'Scan') also provide immediate visual feedback.
**Action:** When implementing disabled states for buttons, especially for async tasks, always include a `.help()` modifier to explain the required state or current operation, and consider dynamic labels for immediate feedback.
7 changes: 5 additions & 2 deletions Sources/Cacheout/Views/MenuBarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,12 @@ struct MenuBarView: View {
Button {
Task { await viewModel.scan() }
} label: {
Label("Scan", systemImage: "arrow.clockwise")
Label(viewModel.isScanning ? "Scanning..." : "Scan", systemImage: "arrow.clockwise")
.font(.caption.weight(.medium))
}
.buttonStyle(.bordered)
.disabled(viewModel.isScanning)
.help(viewModel.isScanning ? "Scan in progress" : "Scan for caches")

if viewModel.isScanning {
ProgressView()
Expand All @@ -241,6 +242,7 @@ struct MenuBarView: View {
.buttonStyle(.borderedProminent)
.tint(Color(red: 0.85, green: 0.45, blue: 0.1)) // burnt orange — readable white text
.disabled(viewModel.totalRecoverable == 0 || viewModel.isCleaning)
.help(viewModel.isCleaning ? "Cleanup in progress" : (viewModel.totalRecoverable == 0 ? "No safe caches to clean" : "Quickly clean safe caches"))

// Open main window
Button {
Expand Down Expand Up @@ -282,12 +284,13 @@ struct MenuBarView: View {
Button {
Task { await viewModel.dockerPrune() }
} label: {
Text("Run")
Text(viewModel.isDockerPruning ? "Running..." : "Run")
.font(.caption2.weight(.medium))
}
.buttonStyle(.bordered)
.controlSize(.mini)
.disabled(viewModel.isDockerPruning)
.help(viewModel.isDockerPruning ? "Docker prune in progress" : "Run docker system prune")
}
}

Expand Down
Loading