diff --git a/services/web/app/src/Features/Project/ProjectController.js b/services/web/app/src/Features/Project/ProjectController.js index d2864183be..c40d5aa13a 100644 --- a/services/web/app/src/Features/Project/ProjectController.js +++ b/services/web/app/src/Features/Project/ProjectController.js @@ -349,7 +349,6 @@ const _ProjectController = { !anonymous && 'ro-mirror-on-client', 'track-pdf-download', !anonymous && 'writefull-oauth-promotion', - 'default-visual-for-beginners', 'hotjar', 'reviewer-role', 'editor-redesign', @@ -404,13 +403,6 @@ const _ProjectController = { userId, projectId ), - usedLatex: OnboardingDataCollectionManager.getOnboardingDataValue( - userId, - 'usedLatex' - ).catch(err => { - logger.error({ err, userId }) - return null - }), odcRole: OnboardingDataCollectionManager.getOnboardingDataValue( userId, 'role' @@ -470,7 +462,6 @@ const _ProjectController = { subscription, isTokenMember, isInvitedMember, - usedLatex, odcRole, } = userValues @@ -887,12 +878,6 @@ const _ProjectController = { fixedSizeDocument: true, hasTrackChangesFeature: Features.hasFeature('track-changes'), projectTags, - usedLatex: - // only use the usedLatex value if the split test is enabled - splitTestAssignments['default-visual-for-beginners']?.variant === - 'enabled' - ? usedLatex - : null, odcRole: // only use the ODC role value if the split test is enabled splitTestAssignments['paywall-change-compile-timeout']?.variant === diff --git a/services/web/app/src/Features/Tutorial/TutorialController.mjs b/services/web/app/src/Features/Tutorial/TutorialController.mjs index 3672f8db0d..9afb5bb245 100644 --- a/services/web/app/src/Features/Tutorial/TutorialController.mjs +++ b/services/web/app/src/Features/Tutorial/TutorialController.mjs @@ -8,7 +8,6 @@ const VALID_KEYS = [ 'writefull-oauth-promotion', 'bib-file-tpr-prompt', 'ai-error-assistant-consent', - 'code-editor-mode-prompt', 'history-restore-promo', 'us-gov-banner', 'us-gov-banner-fedramp', diff --git a/services/web/app/views/project/editor/_meta.pug b/services/web/app/views/project/editor/_meta.pug index 720802aba8..20e90576c9 100644 --- a/services/web/app/views/project/editor/_meta.pug +++ b/services/web/app/views/project/editor/_meta.pug @@ -35,7 +35,6 @@ meta(name="ol-showTemplatesServerPro", data-type="boolean" content=showTemplates meta(name="ol-hasTrackChangesFeature", data-type="boolean" content=hasTrackChangesFeature) meta(name="ol-inactiveTutorials", data-type="json" content=user.inactiveTutorials) meta(name="ol-projectTags" data-type="json" content=projectTags) -meta(name="ol-usedLatex" data-type="string" content=usedLatex) meta(name="ol-ro-mirror-on-client-no-local-storage" data-type="boolean" content=roMirrorOnClientNoLocalStorage) meta(name="ol-isSaas" data-type="boolean" content=isSaas) meta(name="ol-shouldLoadHotjar" data-type="boolean" content=shouldLoadHotjar) diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json index 00e0df3169..b65269eeee 100644 --- a/services/web/frontend/extracted-translations.json +++ b/services/web/frontend/extracted-translations.json @@ -257,8 +257,6 @@ "code_check_failed": "", "code_check_failed_explanation": "", "code_editor": "", - "code_editor_tooltip_message": "", - "code_editor_tooltip_title": "", "collaborate_online_and_offline": "", "collaborator_chat": "", "collabs_per_proj": "", diff --git a/services/web/frontend/js/features/ide-react/scope-adapters/editor-manager-context-adapter.ts b/services/web/frontend/js/features/ide-react/scope-adapters/editor-manager-context-adapter.ts index 537c501c72..42e03ff8f6 100644 --- a/services/web/frontend/js/features/ide-react/scope-adapters/editor-manager-context-adapter.ts +++ b/services/web/frontend/js/features/ide-react/scope-adapters/editor-manager-context-adapter.ts @@ -1,6 +1,5 @@ import { ReactScopeValueStore } from '@/features/ide-react/scope-value-store/react-scope-value-store' import customLocalStorage from '@/infrastructure/local-storage' -import getMeta from '@/utils/meta' import { DocumentContainer } from '@/features/ide-react/editor/document-container' export type EditorScopeValue = { @@ -37,24 +36,13 @@ export function populateEditorScope( store.persisted( 'editor.showVisual', - getMeta('ol-usedLatex') === 'never' || showVisualFallbackValue(projectId), + showVisualFallbackValue(projectId), `editor.lastUsedMode`, { toPersisted: showVisual => (showVisual ? 'visual' : 'code'), fromPersisted: mode => mode === 'visual', } ) - - store.persisted( - 'editor.codeEditorOpened', - codeEditorOpenedFallbackValue(), - 'editor.codeEditorOpened' - ) - store.watch('editor.showVisual', showVisual => { - if (store.get('editor.codeEditorOpened') !== true && showVisual === false) { - store.set('editor.codeEditorOpened', true) - } - }) } function showVisualFallbackValue(projectId: string) { @@ -68,16 +56,3 @@ function showVisualFallbackValue(projectId: string) { return editorModeVal === 'rich-text' } - -function codeEditorOpenedFallbackValue() { - const signUpDate = getMeta('ol-user').signUpDate - if ( - typeof signUpDate === 'string' && - new Date(signUpDate) < new Date('2024-08-02') - ) { - // if signUpDate is before releasing "codeEditorOpened" value - // it is assumed that the user has opened the code editor at some point - return true - } - return false -} diff --git a/services/web/frontend/js/features/source-editor/components/editor-switch-beginner-popover.tsx b/services/web/frontend/js/features/source-editor/components/editor-switch-beginner-popover.tsx deleted file mode 100644 index 40fea785bf..0000000000 --- a/services/web/frontend/js/features/source-editor/components/editor-switch-beginner-popover.tsx +++ /dev/null @@ -1,102 +0,0 @@ -import { ReactElement, useCallback, useEffect, useState } from 'react' -import Close from '@/shared/components/close' -import { useEditorContext } from '@/shared/context/editor-context' -import useTutorial from '@/shared/hooks/promotions/use-tutorial' -import { useUserContext } from '@/shared/context/user-context' -import useScopeValue from '@/shared/hooks/use-scope-value' -import { useTranslation } from 'react-i18next' -import getMeta from '@/utils/meta' -import OLPopover from '@/features/ui/components/ol/ol-popover' -import OLOverlay from '@/features/ui/components/ol/ol-overlay' - -const CODE_EDITOR_POPOVER_TIMEOUT = 1000 -export const codeEditorModePrompt = 'code-editor-mode-prompt' - -export const EditorSwitchBeginnerPopover = ({ - children, - targetRef, -}: { - children: ReactElement - targetRef: React.RefObject -}) => { - const user = useUserContext() - const { inactiveTutorials } = useEditorContext() - const { t } = useTranslation() - const [codeEditorOpened] = useScopeValue('editor.codeEditorOpened') - const { completeTutorial } = useTutorial(codeEditorModePrompt, { - location: 'logs', - name: codeEditorModePrompt, - }) - const [popoverShown, setPopoverShown] = useState(false) - - const shouldShowCodeEditorPopover = useCallback(() => { - if (inactiveTutorials.includes(codeEditorModePrompt)) { - return false - } - - if (getMeta('ol-usedLatex') !== 'never') { - // only show popover to the users that never used LaTeX (submitted in onboarding data collection) - return false - } - - if (codeEditorOpened) { - // dont show popover if code editor was opened at some point - return false - } - - const msSinceSignedUp = - user.signUpDate && Date.now() - new Date(user.signUpDate).getTime() - - if (msSinceSignedUp && msSinceSignedUp < 24 * 60 * 60 * 1000) { - // dont show popover if user has signed up is less than 24 hours - return false - } - - return true - }, [codeEditorOpened, inactiveTutorials, user.signUpDate]) - - useEffect(() => { - if (popoverShown && codeEditorOpened) { - setPopoverShown(false) - } - }, [codeEditorOpened, popoverShown]) - - useEffect(() => { - const timeout = setTimeout(() => { - if (shouldShowCodeEditorPopover()) { - setPopoverShown(true) - } - }, CODE_EDITOR_POPOVER_TIMEOUT) - - return () => clearTimeout(timeout) - }, [shouldShowCodeEditorPopover]) - - return ( - <> - {children} - setPopoverShown(false)} - target={targetRef.current} - > - -
- { - setPopoverShown(false) - completeTutorial({ event: 'promo-click', action: 'complete' }) - }} - /> -
- {t('code_editor_tooltip_title')} -
-
{t('code_editor_tooltip_message')}
-
-
-
- - ) -} diff --git a/services/web/frontend/js/features/source-editor/components/editor-switch.tsx b/services/web/frontend/js/features/source-editor/components/editor-switch.tsx index 525f979e1c..e6b1dd8f40 100644 --- a/services/web/frontend/js/features/source-editor/components/editor-switch.tsx +++ b/services/web/frontend/js/features/source-editor/components/editor-switch.tsx @@ -1,29 +1,17 @@ -import { ChangeEvent, FC, memo, useCallback, useRef } from 'react' +import { ChangeEvent, FC, memo, useCallback } from 'react' import useScopeValue from '@/shared/hooks/use-scope-value' import OLTooltip from '@/features/ui/components/ol/ol-tooltip' -import useTutorial from '@/shared/hooks/promotions/use-tutorial' import { sendMB } from '../../../infrastructure/event-tracking' import { isValidTeXFile } from '../../../main/is-valid-tex-file' import { useTranslation } from 'react-i18next' -import { - EditorSwitchBeginnerPopover, - codeEditorModePrompt, -} from './editor-switch-beginner-popover' import { useEditorManagerContext } from '@/features/ide-react/context/editor-manager-context' function EditorSwitch() { const { t } = useTranslation() const [visual, setVisual] = useScopeValue('editor.showVisual') - const [codeEditorOpened] = useScopeValue('editor.codeEditorOpened') const { openDocName } = useEditorManagerContext() - const codeEditorRef = useRef(null) - const richTextAvailable = openDocName ? isValidTeXFile(openDocName) : false - const { completeTutorial } = useTutorial(codeEditorModePrompt, { - location: 'logs', - name: codeEditorModePrompt, - }) const handleChange = useCallback( event => { @@ -32,9 +20,6 @@ function EditorSwitch() { switch (editorType) { case 'cm6': setVisual(false) - if (!codeEditorOpened) { - completeTutorial({ event: 'promo-click', action: 'complete' }) - } break case 'rich-text': @@ -44,7 +29,7 @@ function EditorSwitch() { sendMB('editor-switch-change', { editorType }) }, - [codeEditorOpened, completeTutorial, setVisual] + [setVisual] ) return ( @@ -64,15 +49,9 @@ function EditorSwitch() { checked={!richTextAvailable || !visual} onChange={handleChange} /> - - - +