feat: add Peak Hours widget with color-coded countdown#279
Open
elhoim wants to merge 1 commit intosirmalloc:mainfrom
Open
feat: add Peak Hours widget with color-coded countdown#279elhoim wants to merge 1 commit intosirmalloc:mainfrom
elhoim wants to merge 1 commit intosirmalloc:mainfrom
Conversation
Shows Anthropic's peak hours status (weekdays 5am-11am PT) with a countdown timer. Displays red with warning sign during peak hours, green with time-until-next-peak outside. Uses Intl.DateTimeFormat for automatic DST handling. Also generalizes preserveColors in the renderer to work for any widget type, not just custom-command. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Intl.DateTimeFormatwithAmerica/Los_Angelestimezone for automatic DST handlingpreserveColorsin the renderer to work for any widget type (not justcustom-command)Widget details
peak-hours| Category: Usageskeybind) and raw value modegetDefaultColor()returns''to prevent renderer from overridingformatUsageDuration,formatRawOrLabeledValue,isUsageCompact, andapplyColorsutilitiesIntl.DateTimeFormatformatter is cached at module level for performanceFiles changed
src/widgets/PeakHours.ts— New widget (165 lines)src/widgets/__tests__/PeakHours.test.ts— 34 tests covering timezone logic, rendering, colors, editor actionssrc/utils/renderer.ts— GeneralizepreserveColorscheck (4 locations)src/utils/widget-manifest.ts— Register widgetsrc/widgets/index.ts— Export widgetTest plan
bun test— all 631 tests pass (including 34 new)bun run lint— zero errorswithFixedTimein tests)🤖 Generated with Claude Code