|
1 | 1 | import { useCallback, useEffect, useRef, useState } from 'react' |
| 2 | +import { useTranslation } from 'react-i18next' |
2 | 3 |
|
3 | 4 | interface FireworksAnimationProps { |
4 | 5 | onComplete: () => void |
5 | 6 | duration?: number // Duration in ms before auto-dismiss starts |
| 7 | + senderName?: string |
6 | 8 | } |
7 | 9 |
|
8 | 10 | // Soft, slightly desaturated tricolore palette — an understated evening |
@@ -115,7 +117,8 @@ function burst(sparks: Spark[], rocket: Rocket): void { |
115 | 117 | } |
116 | 118 | } |
117 | 119 |
|
118 | | -export function FireworksAnimation({ onComplete, duration = 6000 }: FireworksAnimationProps) { |
| 120 | +export function FireworksAnimation({ onComplete, duration = 6000, senderName }: FireworksAnimationProps) { |
| 121 | + const { t } = useTranslation() |
119 | 122 | const canvasRef = useRef<HTMLCanvasElement>(null) |
120 | 123 | const [isVisible, setIsVisible] = useState(true) |
121 | 124 | // Read inside the rAF loop to stop launching new shells during fade-out, |
@@ -285,10 +288,19 @@ export function FireworksAnimation({ onComplete, duration = 6000 }: FireworksAni |
285 | 288 |
|
286 | 289 | {/* Click hint at bottom. Dark pill keeps the white text readable when |
287 | 290 | the app behind the half-opacity scrim is in light mode. */} |
288 | | - <div className="absolute bottom-8 inset-x-0 text-center"> |
289 | | - <span className="rounded-full bg-black/40 px-3 py-1 text-sm text-white/90"> |
290 | | - Click anywhere to dismiss |
291 | | - </span> |
| 291 | + <div className="absolute bottom-8 inset-x-0 text-center space-y-2"> |
| 292 | + {senderName && ( |
| 293 | + <div> |
| 294 | + <span className="rounded-full bg-black/40 px-3 py-1 text-sm text-white/90"> |
| 295 | + {t('easterEgg.sentBy', { name: senderName })} |
| 296 | + </span> |
| 297 | + </div> |
| 298 | + )} |
| 299 | + <div> |
| 300 | + <span className="rounded-full bg-black/40 px-3 py-1 text-sm text-white/90"> |
| 301 | + Click anywhere to dismiss |
| 302 | + </span> |
| 303 | + </div> |
292 | 304 | </div> |
293 | 305 | </div> |
294 | 306 | ) |
|
0 commit comments