From 13733bb9694e0d7f0a5f052216e447d9fa59bdd0 Mon Sep 17 00:00:00 2001 From: Federico Ricciuti Date: Thu, 5 Sep 2024 10:31:33 +0200 Subject: [PATCH] Show matesub alert in upload page (#3451) * Remove Google login alert notification * Show matesub in upload page * Update notifications css * Submodule update --- public/css/sass/notifications.scss | 29 ++++++------------- .../es6/components/modals/LoginModal.js | 16 ---------- .../NotificationItem.js | 3 -- .../quality_report/QualityReport.js | 14 --------- public/js/cat_source/es6/pages/AnalyzePage.js | 4 --- public/js/cat_source/es6/pages/CatTool.js | 4 --- public/js/cat_source/es6/pages/NewProject.js | 4 --- public/js/cat_source/es6/utils/commonUtils.js | 4 +++ public/js/upload_main.js | 21 ++------------ 9 files changed, 15 insertions(+), 84 deletions(-) diff --git a/public/css/sass/notifications.scss b/public/css/sass/notifications.scss index 5cb34ca43f..7245240fe2 100644 --- a/public/css/sass/notifications.scss +++ b/public/css/sass/notifications.scss @@ -92,26 +92,6 @@ @extend .notification-type; border-top: 3px solid $notification-info; } - -.notifications-position-bl { - .notifications-cat-smiling { - background: url('/public/img/matecat_smiling.png') no-repeat 90% bottom; - padding-top: 64px; - background-size: 60px; - margin-bottom: -10px; - @include transition(0.3s ease-in-out); - position: absolute; - top: -67px; - right: 40px; - width: 60px; - display: none; - } - .notification-type-info:first-child { - .notifications-cat-smiling { - display: block; - } - } -} .notification-message { .warning-call-to { text-transform: uppercase; @@ -171,6 +151,15 @@ color: $notification-info; } +.notification-message{ + a { + color: $notification-info; + } + a.bold { + font-weight: bold; + } +} + .notifications-wrapper-inside { .translator-notification-sent { font-weight: bold; diff --git a/public/js/cat_source/es6/components/modals/LoginModal.js b/public/js/cat_source/es6/components/modals/LoginModal.js index 8990eea6ae..b681b8bf62 100644 --- a/public/js/cat_source/es6/components/modals/LoginModal.js +++ b/public/js/cat_source/es6/components/modals/LoginModal.js @@ -10,11 +10,6 @@ import {checkRedeemProject as checkRedeemProjectApi} from '../../api/checkRedeem import {loginUser} from '../../api/loginUser' import ModalsActions from '../../actions/ModalsActions' import ForgotPasswordModal from './ForgotPasswordModal' -import CatToolActions from '../../actions/CatToolActions' -import { - GOOGLE_LOGIN_LOCAL_STORAGE, - GOOGLE_LOGIN_NOTIFICATION, -} from '../../hooks/useGoogleLoginNotification' class LoginModal extends React.Component { constructor(props) { @@ -59,9 +54,6 @@ class LoginModal extends React.Component { } googole_popup() { - // TODO: Remove temp notification warning login google (search in files this todo) - this.showNotificationGoogleLogin() - let url = this.props.googleUrl let self = this this.checkRedeemProject() @@ -277,14 +269,6 @@ class LoginModal extends React.Component { } } - showNotificationGoogleLogin() { - const googleNotification = localStorage.getItem(GOOGLE_LOGIN_LOCAL_STORAGE) - if (!googleNotification) { - localStorage.setItem(GOOGLE_LOGIN_LOCAL_STORAGE, 'true') - CatToolActions.addNotification(GOOGLE_LOGIN_NOTIFICATION) - } - } - render() { let htmlMessage = (
diff --git a/public/js/cat_source/es6/components/notificationsComponent/NotificationItem.js b/public/js/cat_source/es6/components/notificationsComponent/NotificationItem.js index c43f5879aa..5c0b75c4a3 100644 --- a/public/js/cat_source/es6/components/notificationsComponent/NotificationItem.js +++ b/public/js/cat_source/es6/components/notificationsComponent/NotificationItem.js @@ -122,9 +122,6 @@ const NotificationItem = ({ return (
- {position === 'bl' && type === 'info' ? ( -
- ) : null} {dismissable ? ( CatToolActions.addNotification(GOOGLE_LOGIN_NOTIFICATION), - 100, - ) - } } getReviseUrlParameter() { let url = new URL(window.location.href) diff --git a/public/js/cat_source/es6/pages/AnalyzePage.js b/public/js/cat_source/es6/pages/AnalyzePage.js index 9bc96ae90a..a637c3b1ca 100644 --- a/public/js/cat_source/es6/pages/AnalyzePage.js +++ b/public/js/cat_source/es6/pages/AnalyzePage.js @@ -10,7 +10,6 @@ import {getVolumeAnalysis} from '../api/getVolumeAnalysis' import Immutable from 'immutable' import {createRoot} from 'react-dom/client' import {ANALYSIS_STATUS} from '../constants/Constants' -import {useGoogleLoginNotification} from '../hooks/useGoogleLoginNotification' let pollingTime = 1000 const segmentsThreshold = 50000 @@ -20,9 +19,6 @@ const AnalyzePage = () => { const [volumeAnalysis, setVolumeAnalysis] = useState() const containerRef = useRef() - // TODO: Remove temp notification warning login google (search in files this todo) - useGoogleLoginNotification() - const getProjectVolumeAnalysisData = () => { if (config.jobAnalysis) { getJobVolumeAnalysis().then((response) => { diff --git a/public/js/cat_source/es6/pages/CatTool.js b/public/js/cat_source/es6/pages/CatTool.js index 0474ea2b5b..4727c5612f 100644 --- a/public/js/cat_source/es6/pages/CatTool.js +++ b/public/js/cat_source/es6/pages/CatTool.js @@ -26,7 +26,6 @@ import {getTmKeysJob} from '../api/getTmKeysJob' import {getSupportedLanguages} from '../api/getSupportedLanguages' import ApplicationStore from '../stores/ApplicationStore' import useProjectTemplates from '../hooks/useProjectTemplates' -import {useGoogleLoginNotification} from '../hooks/useGoogleLoginNotification' import ModalsActions from '../actions/ModalsActions' import FatalErrorModal from '../components/modals/FatalErrorModal' import {Shortcuts} from '../utils/shortcuts' @@ -54,9 +53,6 @@ function CatTool() { const [supportedLanguages, setSupportedLanguages] = useState([]) const [isAnalysisCompleted, setIsAnalysisCompleted] = useState(false) - // TODO: Remove temp notification warning login google (search in files this todo) - useGoogleLoginNotification() - const startSegmentIdRef = useRef(UI.startSegmentId) const callbackAfterSegmentsResponseRef = useRef() diff --git a/public/js/cat_source/es6/pages/NewProject.js b/public/js/cat_source/es6/pages/NewProject.js index c64888ba48..8a98f49f14 100644 --- a/public/js/cat_source/es6/pages/NewProject.js +++ b/public/js/cat_source/es6/pages/NewProject.js @@ -36,7 +36,6 @@ import {TemplateSelect} from '../components/settingsPanel/ProjectTemplate/Templa import {checkLexiqaIsEnabled} from '../components/settingsPanel/Contents/AdvancedOptionsTab/Lexiqa' import {checkGuessTagIsEnabled} from '../components/settingsPanel/Contents/AdvancedOptionsTab/GuessTag' import {getMMTKeys} from '../api/getMMTKeys/getMMTKeys' -import {useGoogleLoginNotification} from '../hooks/useGoogleLoginNotification' import {AlertDeleteResourceProjectTemplates} from '../components/modals/AlertDeleteResourceProjectTemplates' import {getDeepLGlosssaries} from '../api/getDeepLGlosssaries/getDeepLGlosssaries' @@ -91,9 +90,6 @@ const NewProject = ({ const isDeviceCompatible = useDeviceCompatibility() - // TODO: Remove temp notification warning login google (search in files this todo) - useGoogleLoginNotification() - const projectNameRef = useRef() const prevSourceLang = useRef(sourceLang) const createProject = useRef() diff --git a/public/js/cat_source/es6/utils/commonUtils.js b/public/js/cat_source/es6/utils/commonUtils.js index 49cefbb65e..a3bf27feca 100644 --- a/public/js/cat_source/es6/utils/commonUtils.js +++ b/public/js/cat_source/es6/utils/commonUtils.js @@ -503,6 +503,10 @@ const CommonUtils = { const event = new CustomEvent('dataLayer-event', {detail: data}) document.dispatchEvent(event) }, + dispatchCustomEvent: (name, data) => { + const event = new CustomEvent(name, {detail: data}) + document.dispatchEvent(event) + }, } const ParsedHash = function (hash) { diff --git a/public/js/upload_main.js b/public/js/upload_main.js index c4f1e2b8ae..0ce3791986 100644 --- a/public/js/upload_main.js +++ b/public/js/upload_main.js @@ -16,6 +16,7 @@ import {convertFileRequest} from './cat_source/es6/api/convertFileRequest' import {clearNotCompletedUploads} from './cat_source/es6/api/clearNotCompletedUploads' import CreateProjectStore from './cat_source/es6/stores/CreateProjectStore' import CreateProjectActions from './cat_source/es6/actions/CreateProjectActions' +import CommonUtils from './cat_source/es6/utils/commonUtils' window.UI = null @@ -132,10 +133,6 @@ window.UI = { return checkAnalyzability() }, - TMXloaded: function () { - this.createKeyByTMX() - }, - createKeyByTMX: function (extension, filename) { CreateProjectActions.createKeyFromTMXFile({extension, filename}) }, @@ -170,21 +167,6 @@ window.UI = { .append('' + message + '') } }, - updateTMAddedMsg: function () { - var numTM = $('#activetm tr.mine').length - if (numTM) { - $('.tm-added .num').text(numTM) - if (numTM > 1) { - $('.tm-added .msg').text(' TMs added') - } else { - $('.tm-added .msg').text(' TM added') - } - $('.tm-added').show() - } else { - $('.tm-added').hide() - $('.tm-added .num').text('') - } - }, uploadingTMX: function () { return $('.mgmt-tm td.uploadfile.uploading').length }, @@ -419,6 +401,7 @@ window.UI = { } else { CreateProjectActions.enableAnalyzeButton(true) } + CommonUtils.dispatchCustomEvent('uploaded-file', fileSpecs) } else if (fileSpecs.error) { CreateProjectActions.enableAnalyzeButton(false) $('#fileupload').fileupload('option', 'dropZone', null)