@@ -36,6 +36,7 @@ struct UsageMenuCardView: View {
3636 let detailRightText : String ?
3737 let pacePercent : Double ?
3838 let paceOnTop : Bool
39+ let warningMarkerPercents : [ Double ]
3940
4041 init (
4142 id: String ,
@@ -48,7 +49,8 @@ struct UsageMenuCardView: View {
4849 detailLeftText: String ? ,
4950 detailRightText: String ? ,
5051 pacePercent: Double ? ,
51- paceOnTop: Bool )
52+ paceOnTop: Bool ,
53+ warningMarkerPercents: [ Double ] = [ ] )
5254 {
5355 self . id = id
5456 self . title = title
@@ -61,6 +63,7 @@ struct UsageMenuCardView: View {
6163 self . detailRightText = detailRightText
6264 self . pacePercent = pacePercent
6365 self . paceOnTop = paceOnTop
66+ self . warningMarkerPercents = warningMarkerPercents
6467 }
6568
6669 var percentLabel : String {
@@ -373,7 +376,8 @@ private struct MetricRow: View {
373376 tint: self . progressColor,
374377 accessibilityLabel: self . metric. percentStyle. accessibilityLabel,
375378 pacePercent: self . metric. pacePercent,
376- paceOnTop: self . metric. paceOnTop)
379+ paceOnTop: self . metric. paceOnTop,
380+ warningMarkerPercents: self . metric. warningMarkerPercents)
377381 VStack ( alignment: . leading, spacing: 2 ) {
378382 HStack ( alignment: . firstTextBaseline) {
379383 Text ( self . metric. percentLabel)
@@ -677,6 +681,7 @@ extension UsageMenuCardView.Model {
677681 let hidePersonalInfo : Bool
678682 let claudePeakHoursEnabled : Bool
679683 let weeklyPace : UsagePace ?
684+ let quotaWarningThresholds : [ QuotaWarningWindow : [ Int ] ]
680685 let now : Date
681686
682687 init (
@@ -702,6 +707,7 @@ extension UsageMenuCardView.Model {
702707 hidePersonalInfo: Bool ,
703708 claudePeakHoursEnabled: Bool = true ,
704709 weeklyPace: UsagePace ? = nil ,
710+ quotaWarningThresholds: [ QuotaWarningWindow : [ Int ] ] = [ : ] ,
705711 now: Date )
706712 {
707713 self . provider = provider
@@ -726,6 +732,7 @@ extension UsageMenuCardView.Model {
726732 self . hidePersonalInfo = hidePersonalInfo
727733 self . claudePeakHoursEnabled = claudePeakHoursEnabled
728734 self . weeklyPace = weeklyPace
735+ self . quotaWarningThresholds = quotaWarningThresholds
729736 self . now = now
730737 }
731738 }
@@ -1010,7 +1017,10 @@ extension UsageMenuCardView.Model {
10101017 detailLeftText: nil ,
10111018 detailRightText: nil ,
10121019 pacePercent: nil ,
1013- paceOnTop: true ) )
1020+ paceOnTop: true ,
1021+ warningMarkerPercents: Self . warningMarkerPercents (
1022+ thresholds: input. quotaWarningThresholds [ . weekly] ,
1023+ showUsed: input. usageBarsShowUsed) ) )
10141024 }
10151025 if let extraRateWindows = snapshot. extraRateWindows {
10161026 metrics. append ( contentsOf: extraRateWindows. map { namedWindow in
@@ -1175,7 +1185,10 @@ extension UsageMenuCardView.Model {
11751185 detailLeftText: primaryDetailLeft,
11761186 detailRightText: primaryDetailRight,
11771187 pacePercent: primaryPacePercent,
1178- paceOnTop: primaryPaceOnTop)
1188+ paceOnTop: primaryPaceOnTop,
1189+ warningMarkerPercents: Self . warningMarkerPercents (
1190+ thresholds: input. quotaWarningThresholds [ . session] ,
1191+ showUsed: input. usageBarsShowUsed) )
11791192 }
11801193
11811194 private static func secondaryMetric(
@@ -1247,7 +1260,10 @@ extension UsageMenuCardView.Model {
12471260 detailLeftText: paceDetail? . leftLabel,
12481261 detailRightText: paceDetail? . rightLabel,
12491262 pacePercent: paceDetail? . pacePercent,
1250- paceOnTop: paceDetail? . paceOnTop ?? true )
1263+ paceOnTop: paceDetail? . paceOnTop ?? true ,
1264+ warningMarkerPercents: Self . warningMarkerPercents (
1265+ thresholds: input. quotaWarningThresholds [ . weekly] ,
1266+ showUsed: input. usageBarsShowUsed) )
12511267 }
12521268
12531269 private static func codexRateMetrics(
@@ -1286,7 +1302,10 @@ extension UsageMenuCardView.Model {
12861302 detailLeftText: paceDetail? . leftLabel,
12871303 detailRightText: paceDetail? . rightLabel,
12881304 pacePercent: paceDetail? . pacePercent,
1289- paceOnTop: paceDetail? . paceOnTop ?? true )
1305+ paceOnTop: paceDetail? . paceOnTop ?? true ,
1306+ warningMarkerPercents: Self . warningMarkerPercents (
1307+ thresholds: input. quotaWarningThresholds [ lane. quotaWarningWindow] ,
1308+ showUsed: input. usageBarsShowUsed) )
12901309 }
12911310 }
12921311
0 commit comments