Files
Kristina b624adf885 [web] trigger post-offline sync result treatments (#35854)
* trigger `UnableToSyncModal` on refresh
* trigger `UnableToSyncModal` without refresh
* show success toast when offline edits sync
* always show out of sync modal as the final backup

GitOrigin-RevId: 3ed300fef9e6d2ff81e17868309f80ffa40e0576
2026-09-17 11:39:03 +00:00

35 lines
839 B
TypeScript

import { useTranslation } from 'react-i18next'
import { GlobalToastGeneratorEntry } from '@/features/ide-react/components/global-toasts'
const CONNECTION_RESTORED_TOAST_HANDLE = 'connection-restored'
const ConnectionRestoredToastContent = () => {
const { t } = useTranslation()
return <span>{t('youre_back_online')}</span>
}
const generators: GlobalToastGeneratorEntry[] = [
{
key: 'connection-restored',
generator: () => ({
content: <ConnectionRestoredToastContent />,
type: 'success',
autoHide: true,
delay: 5000,
}),
},
]
export default generators
export const showConnectionRestoredToast = () => {
window.dispatchEvent(
new CustomEvent('ide:show-toast', {
detail: {
key: 'connection-restored',
handle: CONNECTION_RESTORED_TOAST_HANDLE,
},
})
)
}