feat(bar-app): legible tier chips, honest Icon label, dashboard auto-start

Lift chip text toward white so small tier badges (max/pro) read clearly on the
dark surface. Rename the icon toggle from Color/Mono to 'Icon' (it only swaps
the menu-bar icon, not the bar theme) to remove the misunderstanding. Make the
Dashboard button actually work when the server is down: probe reachability and,
if not up, launch 'ccs config' (detached) which boots the web-server and opens
the dashboard itself; degrade gracefully when the ccs binary isn't found.
This commit is contained in:
Tam Nhu Tran committed 2026-06-09 15:39:50 -04:00
1 parent 20854a94b4
commit 11b3cd5a5c
2 files changed
+82 -9

No files matched your search

+15 -9
View File
@@ -208,11 +208,11 @@ struct BarMenuView: View {
viewModel.toggleIconStyle()
} label: {
Label(
viewModel.iconStyle == .color ? "Color" : "Mono",
"Icon",
systemImage: viewModel.iconStyle == .color ? "paintpalette" : "circle.lefthalf.filled"
)
}
.help("Toggle the menu-bar icon between color and monochrome")
.help("Toggle the menu-bar icon between color and monochrome (does not change the bar theme)")
Button {
showingPrefs = true
} label: {
@@ -240,9 +240,8 @@ struct BarMenuView: View {
}
private func openDashboard() {
if case .success(let discovery) = BarDiscovery.load(), let url = discovery.resolvedURL {
NSWorkspace.shared.open(url)
}
// Open the dashboard if the server is up; otherwise start it via `ccs config`.
Task { await DashboardLauncher.openOrStart() }
}
}
@@ -510,12 +509,19 @@ struct Chip: View {
self.text = text
self.tint = tint
}
/// Lift the tint toward white so the small 9pt label stays legible on the dark
/// surface — the raw tint (e.g. the indigo subscription color) was too dim to read.
private var textColor: Color {
if tint == .secondary { return .secondary }
let lifted = NSColor(tint).blended(withFraction: 0.5, of: .white) ?? NSColor(tint)
return Color(nsColor: lifted)
}
var body: some View {
Text(text)
.font(.system(size: 9, weight: .semibold))
.font(.system(size: 9.5, weight: .semibold))
.padding(.horizontal, 5)
.padding(.vertical, 1)
.background(tint.opacity(0.16), in: Capsule())
.foregroundStyle(tint == .secondary ? Color.secondary : tint)
.padding(.vertical, 1.5)
.background(tint.opacity(0.22), in: Capsule())
.foregroundStyle(textColor)
}
}