mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-14 22:17:20 +00:00
feat(bar-app): tune density and add spend chart style toggle
Narrow the dropdown (380 to 360) and give it more vertical room (620 to 700). Tighten the subscription cards (less spacing/padding) since they carry only a few window rows. Make the spend chart taller (18 to 30) and let the user pick its style in Settings: chunk bars (default) or a line graph with a subtle area fill. Persist the choice in UserDefaults.
This commit is contained in:
1 parent
b9a4a4a3a4
commit
0b1c4e4908
8 files changed
+187
-27
No files matched your search
@@ -0,0 +1,35 @@
|
||||
import Foundation
|
||||
|
||||
// MARK: - SpendChartStyle
|
||||
|
||||
/// User-selectable render style for the spend sparkline in the dropdown.
|
||||
///
|
||||
/// `.bars` (default) draws the existing RoundedRectangle bar chart.
|
||||
/// `.line` draws a Path-based line graph with a faint area fill, which is
|
||||
/// better for spotting trend direction across the 30-day window.
|
||||
///
|
||||
/// Sendable + CaseIterable so the harness can iterate all cases and the value
|
||||
/// can cross actor boundaries safely.
|
||||
public enum SpendChartStyle: String, CaseIterable, Sendable {
|
||||
case bars
|
||||
case line
|
||||
}
|
||||
|
||||
// MARK: - SpendChartStyleStore
|
||||
|
||||
/// Persists the chosen spend-chart style. Mirrors the BarAppearanceStore pattern:
|
||||
/// a UserDefaults key, a static load, and a static save. The `?? .bars` fallback
|
||||
/// on a nil/unrecognized raw value is the sole source of the default.
|
||||
public enum SpendChartStyleStore {
|
||||
public static let defaultsKey = "ccsbar.spendChartStyle"
|
||||
|
||||
public static func load() -> SpendChartStyle {
|
||||
let raw = UserDefaults.standard.string(forKey: defaultsKey)
|
||||
?? SpendChartStyle.bars.rawValue
|
||||
return SpendChartStyle(rawValue: raw) ?? .bars
|
||||
}
|
||||
|
||||
public static func save(_ style: SpendChartStyle) {
|
||||
UserDefaults.standard.set(style.rawValue, forKey: defaultsKey)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user