Update AnimatedBackground.tsx

This commit is contained in:
Egor
2026-01-20 04:52:54 +03:00
committed by GitHub
parent 706b2b34f7
commit 1403a63df5

View File

@@ -4,16 +4,11 @@ import { brandingApi } from '../api/branding'
const ANIMATION_CACHE_KEY = 'cabinet_animation_enabled' const ANIMATION_CACHE_KEY = 'cabinet_animation_enabled'
// Detect low-performance device (mobile in Telegram WebApp) // Detect if user prefers reduced motion
const isLowPerformance = (): boolean => { const isLowPerformance = (): boolean => {
// Check if running in Telegram WebApp // Only check for reduced motion preference - let animation run everywhere else
const isTelegramWebApp = !!(window as unknown as { Telegram?: { WebApp?: unknown } }).Telegram?.WebApp
// Check if mobile
const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent)
// Check for reduced motion preference
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches
return prefersReducedMotion
return prefersReducedMotion || (isTelegramWebApp && isMobile)
} }
// Get cached value from localStorage // Get cached value from localStorage