feat(midsummer): rain of flowers/frogs/Swedish flags, dots become frogs, drop jingle
Per request: remove the WebAudio jingle (+ its 🔊 toggle and sound state); replace the one-shot confetti with a continuous rain of 🌼🌸🐸🇸🇪🌿 over the screen (MidsummerRain, gated by the theme, reduced-motion aware, leak-free); and replace player-dot markers with frogs themselves (override the inline dot color/border) instead of a flower-crown on top. Still toggled by the 🐸 Midsommar switch. Includes rebuilt static bundle. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
7141a38c5c
commit
d86bc48862
24 changed files with 129 additions and 202 deletions
|
|
@ -1,13 +1,10 @@
|
|||
import React, { createContext, useContext, useState, useEffect, useCallback } from 'react';
|
||||
|
||||
const KEY = 'mo-midsummer';
|
||||
const SOUND_KEY = 'mo-midsummer-sound';
|
||||
|
||||
interface MidsummerCtx {
|
||||
enabled: boolean;
|
||||
toggle: () => void;
|
||||
soundOn: boolean;
|
||||
toggleSound: () => void;
|
||||
}
|
||||
|
||||
const Ctx = createContext<MidsummerCtx | null>(null);
|
||||
|
|
@ -15,7 +12,6 @@ const Ctx = createContext<MidsummerCtx | null>(null);
|
|||
export const MidsummerProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
||||
// Default ON: only the literal "off" disables it.
|
||||
const [enabled, setEnabled] = useState<boolean>(() => localStorage.getItem(KEY) !== 'off');
|
||||
const [soundOn, setSoundOn] = useState<boolean>(() => localStorage.getItem(SOUND_KEY) !== 'off');
|
||||
|
||||
useEffect(() => {
|
||||
const el = document.documentElement;
|
||||
|
|
@ -24,15 +20,10 @@ export const MidsummerProvider: React.FC<{ children: React.ReactNode }> = ({ chi
|
|||
localStorage.setItem(KEY, enabled ? 'on' : 'off');
|
||||
}, [enabled]);
|
||||
|
||||
useEffect(() => {
|
||||
localStorage.setItem(SOUND_KEY, soundOn ? 'on' : 'off');
|
||||
}, [soundOn]);
|
||||
|
||||
const toggle = useCallback(() => setEnabled(e => !e), []);
|
||||
const toggleSound = useCallback(() => setSoundOn(s => !s), []);
|
||||
|
||||
return (
|
||||
<Ctx.Provider value={{ enabled, toggle, soundOn, toggleSound }}>
|
||||
<Ctx.Provider value={{ enabled, toggle }}>
|
||||
{children}
|
||||
</Ctx.Provider>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue