loading-error.tsx 785 B

1234567891011121314151617181920212223242526
  1. import { FC } from 'react'
  2. import { ConnectionError } from '@/features/ide-react/connection/types/connection-state'
  3. import getMeta from '@/utils/meta'
  4. // NOTE: i18n translations might not be loaded in the client at this point,
  5. // so these translations have to be loaded from meta tags
  6. export const LoadingError: FC<{
  7. connectionStateError: ConnectionError | ''
  8. i18nError?: Error
  9. }> = ({ connectionStateError, i18nError }) => {
  10. if (connectionStateError) {
  11. switch (connectionStateError) {
  12. case 'io-not-loaded':
  13. return <>{getMeta('ol-translationIoNotLoaded')}</>
  14. case 'unable-to-join':
  15. return <>{getMeta('ol-translationUnableToJoin')}</>
  16. }
  17. }
  18. if (i18nError) {
  19. return <>{getMeta('ol-translationLoadErrorMessage')}</>
  20. }
  21. return null
  22. }