feat(seasonal): show Auto activation dates in settings + single-source schedule
Settings never told the user which days "Auto" turns each seasonal theme on.
Extracted the date windows out of getActiveSeason into a shared SEASON_SCHEDULE
(seasonSchedule.ts) — the single source of truth for both the runtime Auto
selector and the settings UI, so displayed dates can't drift from real activation.
- seasonal/types.ts: SeasonTheme + SeasonalOverlayProps (leaf module).
- seasonal/seasonSchedule.ts: priority-ordered SEASON_SCHEDULE with human date
ranges + SEASON_DATE_RANGES + getActiveSeason (behavior-preserving refactor).
- SeasonalEffect.tsx: consume the shared type/selector; re-export SeasonTheme.
- General.tsx: per-theme date caption under each swatch ("Oct 15 – Nov 1"), Auto
reads "By calendar", and the section description explains it.
- seasonSchedule.test.ts (6): representative day per theme, overlap priority
(Deep Space > Autumn, New Year > Lunar), inclusive boundaries, off-season null.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -57,6 +57,7 @@ import {
|
||||
settingsAtom,
|
||||
} from '../../../state/settings';
|
||||
import { SeasonalPreview, SeasonTheme } from '../../../components/seasonal/SeasonalEffect';
|
||||
import { SEASON_DATE_RANGES } from '../../../components/seasonal/seasonSchedule';
|
||||
import { SettingTile } from '../../../components/setting-tile';
|
||||
import { KeySymbol } from '../../../utils/key-symbol';
|
||||
import { isMacOS } from '../../../utils/user-agent';
|
||||
@@ -438,7 +439,7 @@ function Appearance() {
|
||||
>
|
||||
<SettingTile
|
||||
title="Seasonal Theme"
|
||||
description="Decorative overlays for holidays and events. Preview below — click to select."
|
||||
description="Decorative overlays for holidays and events. “Auto” follows the calendar — each theme below shows the dates it turns on. Click to select."
|
||||
/>
|
||||
<Box style={{ padding: `0 ${config.space.S400} ${config.space.S300}` }}>
|
||||
<SeasonalBgGrid
|
||||
@@ -1699,6 +1700,13 @@ function SeasonalBgGrid({
|
||||
<Text size="T200" style={selected ? { color: color.Primary.Main } : undefined}>
|
||||
{opt.label}
|
||||
</Text>
|
||||
{(opt.value === 'auto' || !isSpecial) && (
|
||||
<Text size="T200" style={{ opacity: 0.6, textAlign: 'center' }}>
|
||||
{opt.value === 'auto'
|
||||
? 'By calendar'
|
||||
: SEASON_DATE_RANGES[opt.value as SeasonTheme]}
|
||||
</Text>
|
||||
)}
|
||||
</Box>
|
||||
);
|
||||
})}
|
||||
|
||||
Reference in New Issue
Block a user