mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
[WEB] Add "Editing Paused" banner when we lock the editor due to network stall GitOrigin-RevId: 6e8d984f03afb6a29ed900cd342a8a8a655e20d0
30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
import { FC } from 'react'
|
|
import { useTranslation } from 'react-i18next'
|
|
import MaterialIcon from '@/shared/components/material-icon'
|
|
import { useFeatureFlag } from '@/shared/context/split-test-context'
|
|
import { useIdeReactContext } from '@/features/ide-react/context/ide-react-context'
|
|
import { useUnsavedDocsContext } from '@/features/ide-react/context/unsaved-docs-context'
|
|
|
|
export const EditingPausedBanner: FC = () => {
|
|
const { t } = useTranslation()
|
|
const intermittentConnectionImprovementsEnabled = useFeatureFlag(
|
|
'intermittent-connection-improvements'
|
|
)
|
|
const { outOfSync } = useIdeReactContext()
|
|
const { isLocked } = useUnsavedDocsContext()
|
|
|
|
if (!intermittentConnectionImprovementsEnabled || (!isLocked && !outOfSync)) {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<div className="editing-paused-banner" role="alert">
|
|
<MaterialIcon type="pause_circle" unfilled />
|
|
<span>
|
|
<strong>{t('editing_paused')}</strong>{' '}
|
|
{t('been_offline_changes_saved_in_browser')}
|
|
</span>
|
|
</div>
|
|
)
|
|
}
|