mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
- use OAuth instead of tokens - add an integration card - improve error handling - add BibLaTeX format support - fix indexing of linked .bib files on creation
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import { useTranslation } from 'react-i18next'
|
|
import OLNotification from '@/shared/components/ol/ol-notification'
|
|
import type { LinkedFile, LinkedFileData } from '@/features/file-view/types/binary-file'
|
|
import { hasProvider } from '@/features/file-view/types/binary-file'
|
|
|
|
/**
|
|
* Zotero-specific error messages when refreshing a linked file fails.
|
|
* Registered via overleafModuleImports.tprFileViewRefreshError.
|
|
*/
|
|
|
|
type TPRFileViewRefreshErrorProps = {
|
|
file: LinkedFile<keyof LinkedFileData>
|
|
refreshError: string
|
|
}
|
|
|
|
export function TPRFileViewRefreshError({
|
|
file,
|
|
refreshError,
|
|
}: TPRFileViewRefreshErrorProps) {
|
|
const { t } = useTranslation()
|
|
|
|
let message = refreshError
|
|
|
|
if (hasProvider(file, 'zotero')) {
|
|
if (!refreshError) {
|
|
message = t('zotero_reference_loading_error')
|
|
} else if (refreshError?.includes('not linked')) {
|
|
message = t('zotero_reference_loading_error_not_linked')
|
|
} else if (refreshError === 'forbidden' || refreshError?.includes('403')) {
|
|
message = t('zotero_reference_loading_error_forbidden')
|
|
} else if (refreshError === 'expired' || refreshError?.includes('token expired')) {
|
|
message = t('zotero_reference_loading_error_expired')
|
|
}
|
|
}
|
|
|
|
return (
|
|
<div className="file-view-error">
|
|
<OLNotification type="error" content={message} />
|
|
</div>
|
|
)
|
|
}
|