Skip to content

Commit

Permalink
Show matesub alert in upload page (#3451)
Browse files Browse the repository at this point in the history
* Remove Google login alert notification

* Show matesub in upload page

* Update notifications css

* Submodule update
  • Loading branch information
riccio82 authored Sep 5, 2024
1 parent 57fc727 commit 13733bb
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 84 deletions.
29 changes: 9 additions & 20 deletions public/css/sass/notifications.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
16 changes: 0 additions & 16 deletions public/js/cat_source/es6/components/modals/LoginModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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 = (
<div className="login-container-right">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ const NotificationItem = ({

return (
<div className={styleNameContainer} style={getNotificationStyle()}>
{position === 'bl' && type === 'info' ? (
<div className="notifications-cat-smiling" />
) : null}
{dismissable ? (
<span
className={'notification-close-button'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ import QRConstants from '../../constants/QualityReportConstants'
import Header from '../header/Header'
import {getUserData} from '../../api/getUserData'
import {CookieConsent} from '../common/CookieConsent'
import {
GOOGLE_LOGIN_NOTIFICATION,
shouldShowNotificationGoogleLogin,
} from '../../hooks/useGoogleLoginNotification'
import CatToolActions from '../../actions/CatToolActions'
import NotificationBox from '../notificationsComponent/NotificationBox'

class QualityReport extends React.Component {
Expand All @@ -33,15 +28,6 @@ class QualityReport extends React.Component {
this.noMoreSegments = this.noMoreSegments.bind(this)

QRActions.loadInitialAjaxData({id_segment: this.state.idSegment})

// TODO: Remove temp notification warning login google (search in files this todo)
const shouldShowNotification = shouldShowNotificationGoogleLogin()
if (shouldShowNotification) {
setTimeout(
() => CatToolActions.addNotification(GOOGLE_LOGIN_NOTIFICATION),
100,
)
}
}
getReviseUrlParameter() {
let url = new URL(window.location.href)
Expand Down
4 changes: 0 additions & 4 deletions public/js/cat_source/es6/pages/AnalyzePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) => {
Expand Down
4 changes: 0 additions & 4 deletions public/js/cat_source/es6/pages/CatTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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()

Expand Down
4 changes: 0 additions & 4 deletions public/js/cat_source/es6/pages/NewProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions public/js/cat_source/es6/utils/commonUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
21 changes: 2 additions & 19 deletions public/js/upload_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -132,10 +133,6 @@ window.UI = {
return checkAnalyzability()
},

TMXloaded: function () {
this.createKeyByTMX()
},

createKeyByTMX: function (extension, filename) {
CreateProjectActions.createKeyFromTMXFile({extension, filename})
},
Expand Down Expand Up @@ -170,21 +167,6 @@ window.UI = {
.append('<span class="label label-important">' + message + '</span>')
}
},
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
},
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 13733bb

Please sign in to comment.