From 76103eb77f34b4af1b37c6a9d18a05821cf10c5a Mon Sep 17 00:00:00 2001 From: Tim Down <158919+timdown@users.noreply.github.com> Date: Tue, 2 May 2023 15:09:38 +0100 Subject: [PATCH] Merge pull request #12874 from overleaf/td-history-binary-file History migration: Show alert for binary file preview GitOrigin-RevId: f30e4946ce9f873661055b8a096c6aba7ab08e2d --- services/web/frontend/extracted-translations.json | 1 + .../features/history/components/diff-view/main.tsx | 13 ++++++++++--- .../stylesheets/app/editor/history-react.less | 4 ++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json index 9b2badac01..b31c9e1fc2 100644 --- a/services/web/frontend/extracted-translations.json +++ b/services/web/frontend/extracted-translations.json @@ -66,6 +66,7 @@ "beta_program_already_participating": "", "beta_program_benefits": "<0>", "beta_program_not_participating": "", + "binary_history_error": "", "blank_project": "", "blocked_filename": "", "browser": "", diff --git a/services/web/frontend/js/features/history/components/diff-view/main.tsx b/services/web/frontend/js/features/history/components/diff-view/main.tsx index 80ea7ad286..34b961b677 100644 --- a/services/web/frontend/js/features/history/components/diff-view/main.tsx +++ b/services/web/frontend/js/features/history/components/diff-view/main.tsx @@ -2,6 +2,7 @@ import { Nullable } from '../../../../../../types/utils' import { Diff } from '../../services/types/doc' import DocumentDiffViewer from './document-diff-viewer' import LoadingSpinner from '../../../../shared/components/loading-spinner' +import { useTranslation } from 'react-i18next' type MainProps = { diff: Nullable @@ -9,16 +10,22 @@ type MainProps = { } function Main({ diff, isLoading }: MainProps) { + const { t } = useTranslation() + if (isLoading) { return } if (!diff) { - return
No document
+ return
No document
} if (diff.binary) { - return
Binary file
+ return ( +
+
{t('binary_history_error')}
+
+ ) } if (diff.docDiff) { @@ -26,7 +33,7 @@ function Main({ diff, isLoading }: MainProps) { return } - return
No document
+ return null } export default Main diff --git a/services/web/frontend/stylesheets/app/editor/history-react.less b/services/web/frontend/stylesheets/app/editor/history-react.less index b6b04f31e3..ee4d3a3f81 100644 --- a/services/web/frontend/stylesheets/app/editor/history-react.less +++ b/services/web/frontend/stylesheets/app/editor/history-react.less @@ -298,6 +298,10 @@ history-root { font-size: 20px; font-weight: 700; } + + .history-content { + padding: @line-height-computed / 2; + } } .history-version-label-tooltip {