import { useTranslation } from 'react-i18next' import { LostConnectionAlert } from './lost-connection-alert' import { useConnectionContext } from '@/features/ide-react/context/connection-context' import { debugging } from '@/utils/debugging' import { Alert } from 'react-bootstrap' // TODO SavingNotificationController, SystemMessagesController, out-of-sync modal export function Alerts() { const { t } = useTranslation() const { connectionState, isConnected, isStillReconnecting, tryReconnectNow, secondsUntilReconnect, } = useConnectionContext() // TODO: Get this from a context const synctexError = false return (
{connectionState.forceDisconnected ? ( {t('disconnected')} ) : null} {connectionState.reconnectAt ? ( ) : null} {isStillReconnecting ? ( {t('reconnecting')}… ) : null} {synctexError ? ( {t('synctex_failed')} {t('more_info')} ) : null} {connectionState.inactiveDisconnect || (connectionState.readyState === WebSocket.CLOSED && (connectionState.error === 'rate-limited' || connectionState.error === 'unable-to-connect') && !secondsUntilReconnect()) ? ( {t('editor_disconected_click_to_reconnect')} ) : null} {debugging ? ( Connected: {isConnected.toString()} ) : null}
) }