Skip to content

Commit d835b43

Browse files
committed
fix: preserve cost submenu availability transitions
1 parent dc85f47 commit d835b43

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

Sources/CodexBar/CostHistoryChartMenuView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,7 @@ extension CostHistoryChartMenuView {
774774
let historyDays: Int
775775
let windowLabel: String?
776776
let totalCostBitPattern: UInt64?
777+
let hasDailyEntries: Bool
777778
let daily: [VisibleDailyFingerprint]
778779
let projects: [VisibleProjectFingerprint]
779780
}
@@ -822,6 +823,7 @@ extension CostHistoryChartMenuView {
822823
historyDays: snapshot.historyDays,
823824
windowLabel: snapshot.historyLabel,
824825
totalCostBitPattern: snapshot.last30DaysCostUSD.map(\.bitPattern),
826+
hasDailyEntries: !snapshot.daily.isEmpty,
825827
daily: snapshot.daily
826828
.filter { self.chartPointInput(for: $0) != nil }
827829
.sorted { $0.date < $1.date }

Tests/CodexBarTests/CostHistoryChartMenuViewTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,8 @@ struct CostHistoryChartMenuViewTests {
466466
]
467467
let empty = Self.fingerprint(daily: [])
468468

469-
#expect(Self.fingerprint(daily: invalidRows) == empty)
470-
#expect(Self.fingerprint(daily: differentInvalidRows) == empty)
469+
#expect(Self.fingerprint(daily: invalidRows) == Self.fingerprint(daily: differentInvalidRows))
470+
#expect(Self.fingerprint(daily: invalidRows) != empty)
471471
#expect(Self.fingerprint(daily: [Self.dailyEntry(date: "2026-06-07", costUSD: 1)]) != empty)
472472
}
473473

0 commit comments

Comments
 (0)