Skip to content

feat: International Women's Day theme auto-activates on March 8#269

Merged
PureWeen merged 2 commits intomainfrom
fix/on-march-8-in-celebration-of-internation-20260303-1643
Mar 3, 2026
Merged

feat: International Women's Day theme auto-activates on March 8#269
PureWeen merged 2 commits intomainfrom
fix/on-march-8-in-celebration-of-internation-20260303-1643

Conversation

@StephaneDelcroix
Copy link
Copy Markdown
Collaborator

Summary

On March 8, PolyPilot automatically switches to a purple/violet International Women's Day theme. The theme reverts on March 9.

Behavior

  • Auto-activation: On app start or midnight crossing into March 8, the IWD theme applies automatically
  • Opt-out: Users can change the theme in Settings — the holiday override is dismissed for the session
  • Auto-revert: On March 9 (or midnight crossing out of March 8), the user's saved theme is restored
  • Ephemeral: The IWD theme is never persisted to settings.json; ConnectionSettings.Load() sanitizes it

Changes

  • ConnectionSettings.cs: Add InternationalWomensDay to UiTheme enum; guard in Load()
  • HolidayThemeHelper.cs: Static helper with IsInternationalWomensDay(), GetActiveHolidayTheme(), GetDataThemeString() — all accept optional DateTime for testability
  • MainLayout.razor: Holiday theme auto-activation on first render + 60-second timer for date transitions
  • Settings.razor: IWD cases in all theme switch expressions; sets dismiss flag when user changes away
  • CopilotService.cs: HolidayThemeDismissed in-memory flag
  • app.css: Full [data-theme="iwd"] CSS theme with purple/violet palette
  • Also fixes pre-existing CS0126 in CreateSessionAsync early-return path

Tests

18 new tests in HolidayThemeTests.cs covering:

  • Date detection (March 8 true, March 7/9/other false, any year, with time)
  • Holiday theme activation (GetActiveHolidayTheme returns IWD or null)
  • CSS data-theme string mapping for all UiTheme values
  • Settings guard (IWD reverts to System on load, normal themes preserved)
  • Enum definition verification

Test results: 1717 passed, 1 pre-existing failure (PlatformHelperTests unrelated)

StephaneDelcroix and others added 2 commits March 3, 2026 17:51
Add a purple/violet theme that automatically activates on March 8 for
International Women's Day and reverts on March 9.

Changes:
- Add InternationalWomensDay to UiTheme enum with 'iwd' CSS data-theme
- Add HolidayThemeHelper for testable date detection and theme mapping
- MainLayout auto-applies IWD theme on first render + periodic timer
  detects midnight crossings (into/out of March 8)
- Users can change theme in Settings to dismiss the holiday override
- ConnectionSettings.Load() sanitizes IWD from persisted settings
- Fix pre-existing CS0126 in CreateSessionAsync early-return path
- 18 new tests covering date detection, theme mapping, and guards

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add _disposed flag and check in OnHolidayTimerTick to prevent callbacks
  after component disposal (timer race condition)
- Move _lastHolidayCheck and HolidayThemeDismissed mutations inside
  InvokeAsync for correct Blazor synchronization context (thread safety)
- Add try/catch with Console.Error.WriteLine logging to holiday activation path
- Replace bare catch {} with catch (Exception ex) + logging in revert path
- Wrap SetTheme in Settings.razor with try/catch and show error status on failure
- Resolve merge conflict in PolyPilot.Tests.csproj (include both HolidayThemeHelper
  and MarkdownRenderer compile links)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@PureWeen PureWeen merged commit 938e261 into main Mar 3, 2026
@PureWeen PureWeen deleted the fix/on-march-8-in-celebration-of-internation-20260303-1643 branch March 3, 2026 22:49
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