mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-01 13:12:24 -05:00
Tear down recompile button text split test (#11637)
GitOrigin-RevId: 574ebeda9517cc54e04362395a90584703198d9f
This commit is contained in:
parent
6da0a8ddf7
commit
9719b0439c
2 changed files with 3 additions and 52 deletions
|
@ -48,10 +48,6 @@ const ProjectListController = require('./ProjectListController')
|
||||||
const ProjectAuditLogHandler = require('./ProjectAuditLogHandler')
|
const ProjectAuditLogHandler = require('./ProjectAuditLogHandler')
|
||||||
const PublicAccessLevels = require('../Authorization/PublicAccessLevels')
|
const PublicAccessLevels = require('../Authorization/PublicAccessLevels')
|
||||||
|
|
||||||
// We want the recompile-button-text split test to only target users who have
|
|
||||||
// signed up recently.
|
|
||||||
const RECOMPILE_BUTTON_SPLIT_TEST_MIN_SIGNUP_DATE = new Date('2023-01-16')
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {import("./types").GetProjectsRequest} GetProjectsRequest
|
* @typedef {import("./types").GetProjectsRequest} GetProjectsRequest
|
||||||
* @typedef {import("./types").GetProjectsResponse} GetProjectsResponse
|
* @typedef {import("./types").GetProjectsResponse} GetProjectsResponse
|
||||||
|
@ -1114,27 +1110,6 @@ const ProjectController = {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
recompileButtonTextAssignment: [
|
|
||||||
'user',
|
|
||||||
(results, cb) => {
|
|
||||||
if (
|
|
||||||
results.user.signUpDate <
|
|
||||||
RECOMPILE_BUTTON_SPLIT_TEST_MIN_SIGNUP_DATE
|
|
||||||
) {
|
|
||||||
return cb()
|
|
||||||
}
|
|
||||||
SplitTestHandler.getAssignment(
|
|
||||||
req,
|
|
||||||
res,
|
|
||||||
'recompile-button-text',
|
|
||||||
{},
|
|
||||||
() => {
|
|
||||||
// do not fail editor load if assignment fails
|
|
||||||
cb()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
(
|
(
|
||||||
err,
|
err,
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
import { Button } from 'react-bootstrap'
|
import { Button } from 'react-bootstrap'
|
||||||
import PropTypes from 'prop-types'
|
|
||||||
import Tooltip from '../../../shared/components/tooltip'
|
import Tooltip from '../../../shared/components/tooltip'
|
||||||
import Icon from '../../../shared/components/icon'
|
import Icon from '../../../shared/components/icon'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { memo, useCallback } from 'react'
|
import { memo } from 'react'
|
||||||
import { useSplitTestContext } from '../../../shared/context/split-test-context'
|
|
||||||
import * as eventTracking from '../../../infrastructure/event-tracking'
|
|
||||||
|
|
||||||
const modifierKey = /Mac/i.test(navigator.platform) ? 'Cmd' : 'Ctrl'
|
const modifierKey = /Mac/i.test(navigator.platform) ? 'Cmd' : 'Ctrl'
|
||||||
|
|
||||||
|
@ -20,28 +17,7 @@ function PdfCompileButtonInner({
|
||||||
}: PdfCompileButtonInnerProps) {
|
}: PdfCompileButtonInnerProps) {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
|
||||||
const { splitTestVariants } = useSplitTestContext({
|
const compileButtonLabel = compiling ? `${t('compiling')}…` : t('recompile')
|
||||||
splitTestVariants: PropTypes.object,
|
|
||||||
})
|
|
||||||
const recompileButtonTextVariant = splitTestVariants['recompile-button-text']
|
|
||||||
|
|
||||||
let compileButtonLabel
|
|
||||||
if (compiling) {
|
|
||||||
compileButtonLabel = t('compiling') + '…'
|
|
||||||
} else if (splitTestVariants['recompile-button-text'] === 'recompile-pdf') {
|
|
||||||
compileButtonLabel = t('recompile') + ' PDF'
|
|
||||||
} else {
|
|
||||||
compileButtonLabel = t('recompile')
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleRecompileButtonClick = useCallback(() => {
|
|
||||||
if (recompileButtonTextVariant != null) {
|
|
||||||
// Only send the event when the user is targeted by the
|
|
||||||
// recompile-button-text split test
|
|
||||||
eventTracking.sendMB('recompile-pdf-clicked')
|
|
||||||
}
|
|
||||||
startCompile()
|
|
||||||
}, [recompileButtonTextVariant, startCompile])
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
|
@ -58,7 +34,7 @@ function PdfCompileButtonInner({
|
||||||
<Button
|
<Button
|
||||||
className="btn-recompile"
|
className="btn-recompile"
|
||||||
bsStyle="primary"
|
bsStyle="primary"
|
||||||
onClick={handleRecompileButtonClick}
|
onClick={() => startCompile()}
|
||||||
aria-label={compileButtonLabel}
|
aria-label={compileButtonLabel}
|
||||||
disabled={compiling}
|
disabled={compiling}
|
||||||
data-ol-loading={compiling}
|
data-ol-loading={compiling}
|
||||||
|
|
Loading…
Reference in a new issue