From 4af5ed24ad31504f4a3891d8cbe5204a77e95b41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Alby?= Date: Mon, 17 Oct 2022 12:26:46 +0200 Subject: [PATCH] Merge pull request #9866 from overleaf/ta-pdf-detach-safari-no-warnings Remove PDF Detach Safari Warning GitOrigin-RevId: 80f17660d81dc3812fab74c5e2ea4ff23cd7f1d0 --- .../web/frontend/extracted-translations.json | 1 - .../components/pdf-hybrid-safari-warning.tsx | 38 ------------------- ...df-preview-detached-root-safari-warning.js | 38 ------------------- .../components/pdf-preview-detached-root.js | 2 - .../components/pdf-preview-hybrid-toolbar.js | 2 - .../web/frontend/stylesheets/app/editor.less | 10 +---- services/web/locales/en.json | 1 - 7 files changed, 1 insertion(+), 91 deletions(-) delete mode 100644 services/web/frontend/js/features/pdf-preview/components/pdf-hybrid-safari-warning.tsx delete mode 100644 services/web/frontend/js/features/pdf-preview/components/pdf-preview-detached-root-safari-warning.js diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json index c93b1c4b6f..46a713e0c9 100644 --- a/services/web/frontend/extracted-translations.json +++ b/services/web/frontend/extracted-translations.json @@ -436,7 +436,6 @@ "pdf_compile_in_progress_error": "", "pdf_compile_rate_limit_hit": "", "pdf_compile_try_again": "", - "pdf_detach_safari_issues": "", "pdf_in_separate_tab": "", "pdf_only_hide_editor": "", "pdf_preview_error": "", diff --git a/services/web/frontend/js/features/pdf-preview/components/pdf-hybrid-safari-warning.tsx b/services/web/frontend/js/features/pdf-preview/components/pdf-hybrid-safari-warning.tsx deleted file mode 100644 index 505c72dd12..0000000000 --- a/services/web/frontend/js/features/pdf-preview/components/pdf-hybrid-safari-warning.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { useTranslation } from 'react-i18next' -import { Button } from 'react-bootstrap' -import Tooltip from '../../../shared/components/tooltip' -import Icon from '../../../shared/components/icon' -import { useLayoutContext } from '../../../shared/context/layout-context' - -const BROWSER_IS_SAFARI = - navigator.userAgent && - /.*Safari\/.*/.test(navigator.userAgent) && - !/.*Chrome\/.*/.test(navigator.userAgent) && - !/.*Chromium\/.*/.test(navigator.userAgent) - -function PdfHybridSafariWarning() { - const { t } = useTranslation() - const { detachRole } = useLayoutContext() - - if (!BROWSER_IS_SAFARI) { - return null - } - - if (detachRole !== 'detached') { - return null - } - - return ( - - - - ) -} - -export default PdfHybridSafariWarning diff --git a/services/web/frontend/js/features/pdf-preview/components/pdf-preview-detached-root-safari-warning.js b/services/web/frontend/js/features/pdf-preview/components/pdf-preview-detached-root-safari-warning.js deleted file mode 100644 index 62c6a3b170..0000000000 --- a/services/web/frontend/js/features/pdf-preview/components/pdf-preview-detached-root-safari-warning.js +++ /dev/null @@ -1,38 +0,0 @@ -import { Alert } from 'react-bootstrap' -import { useTranslation } from 'react-i18next' -import usePersistedState from '../../../shared/hooks/use-persisted-state' - -const BROWSER_IS_SAFARI = - navigator.userAgent && - /.*Safari\/.*/.test(navigator.userAgent) && - !/.*Chrome\/.*/.test(navigator.userAgent) && - !/.*Chromium\/.*/.test(navigator.userAgent) - -function PdfPreviewDetachedRootSafariWarning() { - const { t } = useTranslation() - - const [hidePdfDetachSafariAlert, setHidePdfDetachSafariAlert] = - usePersistedState('hide-pdf-detach-safari-alert', false, true) - - function handleDismiss() { - setHidePdfDetachSafariAlert(true) - } - - if (!BROWSER_IS_SAFARI) { - return null - } - - if (hidePdfDetachSafariAlert) { - return null - } - - return ( -
- - {t('pdf_detach_safari_issues')} - -
- ) -} - -export default PdfPreviewDetachedRootSafariWarning diff --git a/services/web/frontend/js/features/pdf-preview/components/pdf-preview-detached-root.js b/services/web/frontend/js/features/pdf-preview/components/pdf-preview-detached-root.js index 6a5d494c23..cc64f58e6a 100644 --- a/services/web/frontend/js/features/pdf-preview/components/pdf-preview-detached-root.js +++ b/services/web/frontend/js/features/pdf-preview/components/pdf-preview-detached-root.js @@ -2,7 +2,6 @@ import ReactDOM from 'react-dom' import PdfPreview from './pdf-preview' import { ContextRoot } from '../../../shared/context/root-context' import useWaitForI18n from '../../../shared/hooks/use-wait-for-i18n' -import PdfPreviewDetachedRootSafariWarning from './pdf-preview-detached-root-safari-warning' function PdfPreviewDetachedRoot() { const { isReady } = useWaitForI18n() @@ -13,7 +12,6 @@ function PdfPreviewDetachedRoot() { return ( - ) diff --git a/services/web/frontend/js/features/pdf-preview/components/pdf-preview-hybrid-toolbar.js b/services/web/frontend/js/features/pdf-preview/components/pdf-preview-hybrid-toolbar.js index e5d3958f15..06794c781c 100644 --- a/services/web/frontend/js/features/pdf-preview/components/pdf-preview-hybrid-toolbar.js +++ b/services/web/frontend/js/features/pdf-preview/components/pdf-preview-hybrid-toolbar.js @@ -6,7 +6,6 @@ import PdfCompileButton from './pdf-compile-button' import SwitchToEditorButton from './switch-to-editor-button' import PdfHybridLogsButton from './pdf-hybrid-logs-button' import PdfHybridDownloadButton from './pdf-hybrid-download-button' -import PdfHybridSafariWarning from './pdf-hybrid-safari-warning' import PdfHybridCodeCheckButton from './pdf-hybrid-code-check-button' import PdfOrphanRefreshButton from './pdf-orphan-refresh-button' import { DetachedSynctexControl } from './detach-synctex-control' @@ -61,7 +60,6 @@ function PdfPreviewHybridToolbarInner() { -
diff --git a/services/web/frontend/stylesheets/app/editor.less b/services/web/frontend/stylesheets/app/editor.less index 03e7912a62..2da95d5cf5 100644 --- a/services/web/frontend/stylesheets/app/editor.less +++ b/services/web/frontend/stylesheets/app/editor.less @@ -64,20 +64,12 @@ display: inline-block; text-align: left; min-width: 400px; + padding: @global-alerts-padding; font-size: 14px; margin-bottom: (@line-height-computed / 4); position: relative; z-index: 20; } - - .alert&:not(.alert-dismissable) { - padding: @global-alerts-padding; - } -} - -.global-alerts-detached { - margin-top: 0; - padding-top: @margin-sm; } #try-reconnect-now-button { diff --git a/services/web/locales/en.json b/services/web/locales/en.json index 0f9f60418f..e1453a7a01 100644 --- a/services/web/locales/en.json +++ b/services/web/locales/en.json @@ -1709,7 +1709,6 @@ "redirect_to_editor": "Redirect to editor", "layout_processing": "Layout processing", "your_browser_does_not_support_this_feature": "Sorry, your browser doesn’t support this feature. Please update your browser to its latest version.", - "pdf_detach_safari_issues": "Safari users reported experiencing problems with opening PDF in a new tab. If you are also experiencing problems, we recommend trying a different browser.", "show_in_code": "Show in code", "show_in_pdf": "Show in PDF", "fold_line": "Fold line",