import { useOnlineStatus } from '@/hooks/useOnlineStatus' import { usePlatform } from '@/hooks/usePlatform' import { usePwaUpdateContext } from '@/lib/pwa-update-context' import { useTranslation } from '@/lib/use-translation' import { useVoiceOptional } from '@/lib/voice-context' export function PwaUpdateBanner({ topClassName }: { topClassName?: string } = {}) { const { t } = useTranslation() const { needRefresh, reload } = usePwaUpdateContext() const isOnline = useOnlineStatus() const { haptic } = usePlatform() if (!needRefresh) { return null } const topClass = topClassName ?? (isOnline ? 'top-[calc(env(safe-area-inset-top)+0.5rem)]' : 'top-[calc(env(safe-area-inset-top)+2.5rem)]') return (

{t('pwa.update.title')}

{t('pwa.update.body')}

{t('pwa.update.whyToggle')}

{t('pwa.update.whyBody')}

) } export function PwaUpdateBannerWithStatusOffset({ isSyncing, isReconnecting, }: { isSyncing: boolean isReconnecting: boolean }) { const voice = useVoiceOptional() const hasTopStatusBanner = isSyncing || isReconnecting || Boolean(voice && voice.status === 'error' && voice.errorMessage) return ( ) }