feat(frontend-public): ✨ Add Easter Egg click detection with modal display and new image assets
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
c6602776eb
commit
8766ea2ba9
3 changed files with 10 additions and 9 deletions
|
|
@ -74,23 +74,24 @@ export function EasterEgg({ children }: EasterEggProps): ReactNode {
|
|||
const clickTimestamps = useRef<number[]>([]);
|
||||
const [modalOpen, setModalOpen] = useState(false);
|
||||
|
||||
const rippleFired = useRef(false);
|
||||
|
||||
const handleClick = useCallback((e: MouseEvent<HTMLSpanElement>): void => {
|
||||
const now = Date.now();
|
||||
clickTimestamps.current = [...clickTimestamps.current, now];
|
||||
// Keep only timestamps within the 6-click window
|
||||
clickTimestamps.current = [...clickTimestamps.current.filter(t => now - t <= CLICK_WINDOW_6), now];
|
||||
|
||||
const within2s = clickTimestamps.current.filter(t => now - t <= CLICK_WINDOW_3);
|
||||
const within4s = clickTimestamps.current.filter(t => now - t <= CLICK_WINDOW_6);
|
||||
|
||||
if (within4s.length >= 6) {
|
||||
if (clickTimestamps.current.length >= 6) {
|
||||
clickTimestamps.current = [];
|
||||
rippleFired.current = false;
|
||||
setModalOpen(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (within2s.length >= 3) {
|
||||
clickTimestamps.current = [];
|
||||
const within2s = clickTimestamps.current.filter(t => now - t <= CLICK_WINDOW_3);
|
||||
if (within2s.length >= 3 && !rippleFired.current) {
|
||||
rippleFired.current = true;
|
||||
spawnRipple(e.clientX, e.clientY);
|
||||
return;
|
||||
}
|
||||
}, []);
|
||||
|
||||
|
|
@ -98,7 +99,7 @@ export function EasterEgg({ children }: EasterEggProps): ReactNode {
|
|||
<>
|
||||
<span
|
||||
onClick={handleClick}
|
||||
style={{ pointerEvents: 'auto', cursor: 'pointer' }}
|
||||
style={{ pointerEvents: 'auto', cursor: 'default' }}
|
||||
>
|
||||
{children}
|
||||
</span>
|
||||
|
|
|
|||
BIN
easter-egg-modal.png
Normal file
BIN
easter-egg-modal.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 360 KiB |
BIN
hero-easter-egg-test.png
Normal file
BIN
hero-easter-egg-test.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1,021 KiB |
Loading…
Add table
Reference in a new issue