import type { ElementType } from 'react' import { useTranslation } from 'react-i18next' import importOverleafModules from '../../../../macros/import-overleaf-module.macro' import { BinaryFile, hasProvider } from '../types/binary-file' const tprLinkedFileRefreshError = importOverleafModules( 'tprLinkedFileRefreshError' ) as { import: { LinkedFileRefreshError: ElementType } path: string }[] type FileViewRefreshErrorProps = { file: BinaryFile refreshError: string } export default function FileViewRefreshError({ file, refreshError, }: FileViewRefreshErrorProps) { const isMendeleyOrZotero = hasProvider(file, 'mendeley') || hasProvider(file, 'zotero') return (

{isMendeleyOrZotero ? ( ) : ( )}
) } type FileViewMendeleyOrZoteroRefreshErrorProps = { file: BinaryFile } function FileViewMendeleyOrZoteroRefreshError({ file, }: FileViewMendeleyOrZoteroRefreshErrorProps) { const { t } = useTranslation() return (
{t('something_not_right')}!  {tprLinkedFileRefreshError.map( ({ import: { LinkedFileRefreshError }, path }) => ( ) )}
) } type FileViewDefaultRefreshErrorProps = { refreshError: string } function FileViewDefaultRefreshError({ refreshError, }: FileViewDefaultRefreshErrorProps) { const { t } = useTranslation() return (
{t('access_denied')}: {refreshError}
) }