Просмотр исходного кода

Merge pull request #9866 from overleaf/ta-pdf-detach-safari-no-warnings

Remove PDF Detach Safari Warning

GitOrigin-RevId: 80f17660d81dc3812fab74c5e2ea4ff23cd7f1d0
Timothée Alby 4 лет назад
Родитель
Сommit
4af5ed24ad

+ 0 - 1
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": "",

+ 0 - 38
services/web/frontend/js/features/pdf-preview/components/pdf-hybrid-safari-warning.tsx

@@ -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 (
-    <Tooltip
-      id="safari-pdf-detach-warning"
-      description={t('pdf_detach_safari_issues')}
-      overlayProps={{ placement: 'bottom' }}
-    >
-      <Button bsStyle="link">
-        <Icon type="warning" fw />
-      </Button>
-    </Tooltip>
-  )
-}
-
-export default PdfHybridSafariWarning

+ 0 - 38
services/web/frontend/js/features/pdf-preview/components/pdf-preview-detached-root-safari-warning.js

@@ -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 (
-    <div className="global-alerts global-alerts-detached">
-      <Alert bsStyle="warning" onDismiss={handleDismiss}>
-        {t('pdf_detach_safari_issues')}
-      </Alert>
-    </div>
-  )
-}
-
-export default PdfPreviewDetachedRootSafariWarning

+ 0 - 2
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 (
     <ContextRoot>
-      <PdfPreviewDetachedRootSafariWarning />
       <PdfPreview />
     </ContextRoot>
   )

+ 0 - 2
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() {
         <PdfCompileButton />
         <PdfHybridLogsButton />
         <PdfHybridDownloadButton />
-        <PdfHybridSafariWarning />
       </div>
       <div className="toolbar-pdf-right">
         <PdfHybridCodeCheckButton />

+ 1 - 9
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 {

+ 0 - 1
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",