feat: add 2x usage indicator for Claude and Codex promotions#535
feat: add 2x usage indicator for Claude and Codex promotions#535Deveshb15 wants to merge 1 commit intosteipete:mainfrom
Conversation
Show promotion status badge next to plan text in the menu card header. Claude Spring Break (Mar 13–27): "⚡ 2×" during off-peak, "Peak" during peak hours. Codex: "⚡ 2×" 24/7 until Apr 2, 2026. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a0fbcf34d0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // Promo window: March 13, 2026 00:00 ET → March 28, 2026 00:00 ET | ||
| // (March 27 11:59 PM PT ≈ March 28 ~03:00 AM ET) | ||
| let start = cal.date(from: DateComponents(year: 2026, month: 3, day: 13))! | ||
| let end = cal.date(from: DateComponents(year: 2026, month: 3, day: 28))! |
There was a problem hiding this comment.
Align Claude promo end timestamp with documented PT cutoff
The Claude window currently ends at 2026-03-28 00:00 in America/New_York, but the comment and feature spec describe the promotion as lasting through March 27 11:59 PM PT (about 03:00 AM ET on March 28). As written, users will lose the badge for the final ~3 hours of the promo (9:00–11:59 PM PT on Mar 27), so the boundary should be computed in PT or shifted to the equivalent ET instant.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
Adds a small promotion-badge system so the menu card can indicate when Claude/Codex are in “2×” mode (or “Peak” for Claude) based purely on local date/time.
Changes:
- Introduces
PromotionStatus(pure-ish helper) to compute provider promotion status/badge fromprovider+now. - Updates menu card model generation to append the promo badge to the displayed plan text (
Plan · ⚡ 2×/Plan · Peak).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
Sources/CodexBarCore/PromotionStatus.swift |
New date/time-based promotion logic for Claude and Codex. |
Sources/CodexBar/MenuCardView.swift |
Appends promotion badge to planText in the menu card header model. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| let planText: String? = { | ||
| let base = Self.plan( | ||
| for: input.provider, | ||
| snapshot: input.snapshot, | ||
| account: input.account, | ||
| metadata: input.metadata) | ||
| guard let promo = PromotionStatus.check(provider: input.provider, now: input.now) else { | ||
| return base | ||
| } | ||
| if let plan = base { | ||
| return "\(plan) · \(promo.badge)" | ||
| } | ||
| return promo.badge |
| let et = TimeZone(identifier: "America/New_York")! | ||
| var cal = Calendar(identifier: .gregorian) | ||
| cal.timeZone = et | ||
|
|
||
| // Promo window: March 13, 2026 00:00 ET → March 28, 2026 00:00 ET | ||
| // (March 27 11:59 PM PT ≈ March 28 ~03:00 AM ET) | ||
| let start = cal.date(from: DateComponents(year: 2026, month: 3, day: 13))! | ||
| let end = cal.date(from: DateComponents(year: 2026, month: 3, day: 28))! |
| let weekday = comps.weekday! // 1 = Sun, 7 = Sat | ||
| let hour = comps.hour! |
| cal.timeZone = et | ||
|
|
||
| // Promo window: March 13, 2026 00:00 ET → March 28, 2026 00:00 ET | ||
| // (March 27 11:59 PM PT ≈ March 28 ~03:00 AM ET) |
| private static func checkCodex(now: Date) -> Result? { | ||
| var cal = Calendar(identifier: .gregorian) | ||
| cal.timeZone = TimeZone(identifier: "America/New_York")! | ||
| let end = cal.date(from: DateComponents(year: 2026, month: 4, day: 2))! | ||
| guard now < end else { return nil } |
Summary
PromotionStatus.swiftwith pure-function logic to determine if Claude or Codex is in 2x mode based on current date/time⚡ 2×orPeak) to plan text in the menu card headerTest plan
swift buildcompiles successfullyPro · ⚡ 2×appearsPro · Peakappears⚡ 2×appears next to planPromotionStatus.checkwith fixed dates covering boundary cases🤖 Generated with Claude Code