mirror of
https://github.com/wu736139669/hapi.git
synced 2026-12-03 06:47:03 +00:00
* fix(web): trust live hub connectivity over navigator status * fix(web): align offline and reconnecting banner precedence * test(web): provide i18n context to banner tests
24 lines
642 B
TypeScript
24 lines
642 B
TypeScript
import { useOnlineStatus } from '@/hooks/useOnlineStatus'
|
|
import { useTranslation } from '@/lib/use-translation'
|
|
|
|
export function OfflineBanner({
|
|
isHubConnected,
|
|
isReconnecting
|
|
}: {
|
|
isHubConnected: boolean
|
|
isReconnecting: boolean
|
|
}) {
|
|
const { t } = useTranslation()
|
|
const isOnline = useOnlineStatus()
|
|
|
|
if (isOnline || isHubConnected || isReconnecting) {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<div className="fixed top-0 left-0 right-0 bg-amber-500 text-white text-center pb-2 pt-[calc(env(safe-area-inset-top)+0.5rem)] text-sm font-medium z-50">
|
|
{t('offline.message')}
|
|
</div>
|
|
)
|
|
}
|