import { useEffect, useState } from 'react' import { usePWAInstall } from '@/hooks/usePWAInstall' import { usePlatform } from '@/hooks/usePlatform' import { CloseIcon, ShareIcon, PlusCircleIcon } from '@/components/icons' import { useTranslation } from '@/lib/use-translation' export function InstallPrompt() { const { t } = useTranslation() const { canInstall, canInstallIOS, promptInstall, dismissInstall, isStandalone } = usePWAInstall() const { isTelegram, haptic } = usePlatform() const [showIOSGuide, setShowIOSGuide] = useState(false) const showFloatingPrompt = !isTelegram && !isStandalone && ((canInstallIOS && !showIOSGuide) || canInstall) useEffect(() => { const root = document.documentElement if (!root) return if (showFloatingPrompt) { root.style.setProperty('--app-floating-bottom-offset', '112px') } else { root.style.removeProperty('--app-floating-bottom-offset') } return () => { root.style.removeProperty('--app-floating-bottom-offset') } }, [showFloatingPrompt]) if (isTelegram || isStandalone) { return null } // iOS Safari install guide if (canInstallIOS) { if (showIOSGuide) { return (
Tap the
Scroll down and tap
Tap Add in the top right corner
{t('install.title')}
{t('install.description')}
{t('install.title')}
{t('install.description')}