Skip to content

feat: add 2x usage indicator for Claude and Codex promotions#535

Open
Deveshb15 wants to merge 1 commit intosteipete:mainfrom
Deveshb15:feat/2x-usage-indicator
Open

feat: add 2x usage indicator for Claude and Codex promotions#535
Deveshb15 wants to merge 1 commit intosteipete:mainfrom
Deveshb15:feat/2x-usage-indicator

Conversation

@Deveshb15
Copy link

Summary

  • Add PromotionStatus.swift with pure-function logic to determine if Claude or Codex is in 2x mode based on current date/time
  • Append promotion badge (⚡ 2× or Peak) to plan text in the menu card header
  • Claude Spring Break (Mar 13–27, 2026): 2x during off-peak/weekends, "Peak" during weekday 8AM–2PM ET
  • Codex: 2x 24/7 until April 2, 2026. No external API calls needed

Test plan

  • swift build compiles successfully
  • Open Claude menu card during off-peak → verify Pro · ⚡ 2× appears
  • Open Claude menu card during peak hours → verify Pro · Peak appears
  • Open Codex menu card → verify ⚡ 2× appears next to plan
  • After promo dates, verify badges disappear and plan text is unchanged
  • Unit test PromotionStatus.check with fixed dates covering boundary cases

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings March 16, 2026 06:02
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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))!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 from provider + 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.

Comment on lines +689 to +701
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
Comment on lines +24 to +31
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))!
Comment on lines +36 to +37
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)
Comment on lines +50 to +54
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 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants