Files
hapi/web/src/components/VoiceErrorBanner.tsx
T
cd25660658 fix(web): keep overlays below PWA status bar (#1124)
* fix codex session import merge (#1123)

修复 Codex 会话导入合并后列表为空的问题。

Fix Codex session import merge so a session is not detected as a duplicate of itself and deleted during merge.

Co-authored-by: LIUZHIRU <ryuu@fine-net.co.jp>

* fix(web): keep overlays below PWA status bar

Account for env(safe-area-inset-top) on fixed top banners, image
preview chrome, and session action menus so installed PWA mode no
longer draws controls under the OS status bar.

Fixes #1066

---------

Co-authored-by: Himehane <36065996+Himehane@users.noreply.github.com>
Co-authored-by: LIUZHIRU <ryuu@fine-net.co.jp>
2026-07-22 23:32:10 +08:00

29 lines
819 B
TypeScript

import { useEffect } from 'react'
import { useVoiceOptional } from '@/lib/voice-context'
export function VoiceErrorBanner() {
const voice = useVoiceOptional()
const shouldShow = voice && voice.status === 'error' && voice.errorMessage
useEffect(() => {
if (!shouldShow || !voice) return
const timer = setTimeout(() => {
voice.setStatus('disconnected')
}, 3000)
return () => clearTimeout(timer)
}, [shouldShow, voice])
if (!shouldShow) {
return null
}
return (
<div className="fixed top-0 left-0 right-0 bg-red-500 text-white text-center pb-2 pt-[calc(env(safe-area-inset-top)+0.5rem)] text-sm font-medium z-50 flex items-center justify-center border-b border-red-600">
{voice.errorMessage}
</div>
)
}