diff --git a/services/web/app/src/Features/Project/ProjectController.js b/services/web/app/src/Features/Project/ProjectController.js index 98f50d89da..445b6fb6b0 100644 --- a/services/web/app/src/Features/Project/ProjectController.js +++ b/services/web/app/src/Features/Project/ProjectController.js @@ -379,8 +379,8 @@ const _ProjectController = { 'overleaf-assist-bundle', 'word-count-client', 'editor-popup-ux-survey', - 'new-editor-error-logs-redesign', 'client-side-references', + 'editor-redesign-new-users', ].filter(Boolean) const getUserValues = async userId => diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json index 34b8d72f3f..1b19c7e8a0 100644 --- a/services/web/frontend/extracted-translations.json +++ b/services/web/frontend/extracted-translations.json @@ -980,6 +980,7 @@ "log_entry_maximum_entries": "", "log_entry_maximum_entries_enable_stop_on_first_error": "", "log_entry_maximum_entries_see_full_logs": "", + "log_entry_maximum_entries_see_full_logs_new": "", "log_entry_maximum_entries_title": "", "log_hint_extra_info": "", "log_in": "", diff --git a/services/web/frontend/js/features/ide-redesign/components/pdf-preview/pdf-preview-hybrid-toolbar.tsx b/services/web/frontend/js/features/ide-redesign/components/pdf-preview/pdf-preview-hybrid-toolbar.tsx index 79d1042506..fb02c93d09 100644 --- a/services/web/frontend/js/features/ide-redesign/components/pdf-preview/pdf-preview-hybrid-toolbar.tsx +++ b/services/web/frontend/js/features/ide-redesign/components/pdf-preview/pdf-preview-hybrid-toolbar.tsx @@ -5,9 +5,13 @@ import PdfCompileButton from '@/features/pdf-preview/components/pdf-compile-butt import PdfHybridDownloadButton from '@/features/pdf-preview/components/pdf-hybrid-download-button' import { DetachedSynctexControl } from '@/features/pdf-preview/components/detach-synctex-control' import SwitchToEditorButton from '@/features/pdf-preview/components/switch-to-editor-button' +import PdfHybridLogsButton from '@/features/pdf-preview/components/pdf-hybrid-logs-button' +import { useAreNewErrorLogsEnabled } from '../../utils/new-editor-utils' function PdfPreviewHybridToolbar() { const { t } = useTranslation() + const newErrorLogs = useAreNewErrorLogsEnabled() + // TODO: add detached pdf logic return (
+ {!newErrorLogs && }
diff --git a/services/web/frontend/js/features/ide-redesign/components/rail/rail-panel.tsx b/services/web/frontend/js/features/ide-redesign/components/rail/rail-panel.tsx index 36c243e29e..8d6e2285c8 100644 --- a/services/web/frontend/js/features/ide-redesign/components/rail/rail-panel.tsx +++ b/services/web/frontend/js/features/ide-redesign/components/rail/rail-panel.tsx @@ -1,4 +1,3 @@ -import { useFeatureFlag } from '@/shared/context/split-test-context' import { Panel } from 'react-resizable-panels' import { useRailContext } from '../../contexts/rail-context' import classNames from 'classnames' @@ -20,8 +19,6 @@ export default function RailPanel({ const { selectedTab, panelRef, handlePaneExpand, handlePaneCollapse } = useRailContext() - const newErrorlogs = useFeatureFlag('new-editor-error-logs-redesign') - const prevTab = usePreviousValue(selectedTab) const tabHasChanged = useMemo(() => { @@ -36,11 +33,7 @@ export default function RailPanel({ return ( { const { sendEvent } = useEditorAnalytics() @@ -46,7 +45,7 @@ export const RailLayout = () => { const isHistoryView = view === 'history' - const newErrorlogs = useFeatureFlag('new-editor-error-logs-redesign') + const newErrorlogs = useAreNewErrorLogsEnabled() const railTabs: RailElement[] = useMemo( () => [ @@ -92,9 +91,10 @@ export const RailLayout = () => { key: 'errors', icon: 'report', title: t('error_log'), - component: newErrorlogs ? : , + component: , indicator: , disabled: errorLogsDisabled, + hide: !newErrorlogs, }, ], [t, features.trackChangesVisible, newErrorlogs, errorLogsDisabled, view] diff --git a/services/web/frontend/js/features/ide-redesign/utils/new-editor-utils.ts b/services/web/frontend/js/features/ide-redesign/utils/new-editor-utils.ts index b0f583bcf8..761f6f1109 100644 --- a/services/web/frontend/js/features/ide-redesign/utils/new-editor-utils.ts +++ b/services/web/frontend/js/features/ide-redesign/utils/new-editor-utils.ts @@ -1,8 +1,43 @@ import { useUserSettingsContext } from '@/shared/context/user-settings-context' -import { isSplitTestEnabled } from '@/utils/splitTestUtils' +import getMeta from '@/utils/meta' +import { isSplitTestEnabled, getSplitTestVariant } from '@/utils/splitTestUtils' + +// TODO: change this when we have a launch date +const NEW_USER_CUTOFF_DATE = new Date('2100-01-01') + +const isNewUser = () => { + const user = getMeta('ol-user') + + if (!user.signUpDate) return false + + const createdAt = new Date(user.signUpDate) + return createdAt > NEW_USER_CUTOFF_DATE +} export const canUseNewEditor = () => { - return isSplitTestEnabled('editor-redesign') + const newUserTestVariant = getSplitTestVariant('editor-redesign-new-users') + + const canUseNewEditorViaPrimaryFeatureFlag = + isSplitTestEnabled('editor-redesign') + const canUseNewEditorViaNewUserFeatureFlag = + isNewUser() && + (newUserTestVariant === 'new-editor' || + newUserTestVariant === 'new-editor-old-logs') + return ( + canUseNewEditorViaPrimaryFeatureFlag || canUseNewEditorViaNewUserFeatureFlag + ) +} + +const canUseNewLogs = () => { + const newUserTestVariant = getSplitTestVariant('editor-redesign-new-users') + const canUseNewLogsViaPrimaryFeatureFlag = + isSplitTestEnabled('editor-redesign') + const canUseNewLogsViaNewUserFeatureFlag = + isNewUser() && newUserTestVariant === 'new-editor' + + return ( + canUseNewLogsViaPrimaryFeatureFlag || canUseNewLogsViaNewUserFeatureFlag + ) } export const useIsNewEditorEnabled = () => { @@ -11,3 +46,8 @@ export const useIsNewEditorEnabled = () => { const enabled = userSettings.enableNewEditor return hasAccess && enabled } + +export const useAreNewErrorLogsEnabled = () => { + const newEditorEnabled = useIsNewEditorEnabled() + return newEditorEnabled && canUseNewLogs() +} diff --git a/services/web/frontend/js/features/pdf-preview/components/pdf-log-entry.tsx b/services/web/frontend/js/features/pdf-preview/components/pdf-log-entry.tsx index 1ddbeb697f..19d7185998 100644 --- a/services/web/frontend/js/features/pdf-preview/components/pdf-log-entry.tsx +++ b/services/web/frontend/js/features/pdf-preview/components/pdf-log-entry.tsx @@ -5,9 +5,8 @@ import HumanReadableLogsHints from '../../../ide/human-readable-logs/HumanReadab import { sendMB } from '@/infrastructure/event-tracking' import getMeta from '@/utils/meta' import { ErrorLevel, LogEntry, SourceLocation } from '../util/types' -import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils' +import { useAreNewErrorLogsEnabled } from '@/features/ide-redesign/utils/new-editor-utils' import NewLogEntry from '@/features/ide-redesign/components/error-logs/log-entry' -import { useFeatureFlag } from '@/shared/context/split-test-context' function PdfLogEntry({ autoExpand, @@ -71,10 +70,9 @@ function PdfLogEntry({ [level, onSourceLocationClick, ruleId, sourceLocation] ) - const newEditor = useIsNewEditorEnabled() - const newErrorlogs = useFeatureFlag('new-editor-error-logs-redesign') + const newErrorlogs = useAreNewErrorLogsEnabled() - if (newEditor && newErrorlogs) { + if (newErrorlogs) { return ( )} - {newEditor && } + {newErrorLogs && } {compileTimeout < 60 && } @@ -44,7 +48,7 @@ function PdfPreviewPane() {
- {newEditor ? : } + {newErrorLogs ? : } {pdfPromotions.map(({ import: { default: Component }, path }) => ( ))} diff --git a/services/web/frontend/js/features/preview/components/preview-logs-pane-max-entries.tsx b/services/web/frontend/js/features/preview/components/preview-logs-pane-max-entries.tsx index 1ec82cbda3..b1f43ed3e9 100644 --- a/services/web/frontend/js/features/preview/components/preview-logs-pane-max-entries.tsx +++ b/services/web/frontend/js/features/preview/components/preview-logs-pane-max-entries.tsx @@ -5,6 +5,7 @@ import { useDetachCompileContext as useCompileContext } from '../../../shared/co import { useStopOnFirstError } from '../../../shared/hooks/use-stop-on-first-error' import MaterialIcon from '@/shared/components/material-icon' import PdfLogEntry from '@/features/pdf-preview/components/pdf-log-entry' +import { useAreNewErrorLogsEnabled } from '@/features/ide-redesign/utils/new-editor-utils' function PreviewLogsPaneMaxEntries({ totalEntries, @@ -39,6 +40,7 @@ function PreviewLogsPaneMaxEntriesContent({ }: { hasErrors?: boolean }) { + const newLogs = useAreNewErrorLogsEnabled() const { t } = useTranslation() const { startCompile, stoppedOnFirstError, setAnimateCompileDropdownArrow } = useCompileContext() @@ -76,7 +78,11 @@ function PreviewLogsPaneMaxEntriesContent({ ]} />{' '}

-

{t('log_entry_maximum_entries_see_full_logs')}

+

+ {newLogs + ? t('log_entry_maximum_entries_see_full_logs_new') + : t('log_entry_maximum_entries_see_full_logs')} +

) } @@ -86,7 +92,9 @@ function PreviewLogsPaneMaxEntriesContent({   {t('tip')}: - {t('log_entry_maximum_entries_see_full_logs')} + {newLogs + ? t('log_entry_maximum_entries_see_full_logs_new') + : t('log_entry_maximum_entries_see_full_logs')}

) } diff --git a/services/web/locales/en.json b/services/web/locales/en.json index 431bf06e6b..78c9df0bbc 100644 --- a/services/web/locales/en.json +++ b/services/web/locales/en.json @@ -1266,6 +1266,7 @@ "log_entry_maximum_entries": "Maximum log entries limit hit", "log_entry_maximum_entries_enable_stop_on_first_error": "Try to fix the first error and recompile. Often one error causes many later error messages. You can <0>Enable “Stop on first error” to focus on fixing errors. We recommend fixing errors as soon as possible; letting them accumulate may lead to hard-to-debug and fatal errors. <1>Learn more", "log_entry_maximum_entries_see_full_logs": "If you need to see the full logs, you can still download them or view the raw logs below.", + "log_entry_maximum_entries_see_full_logs_new": "If you need to see the full logs, you can still view the raw logs at the bottom of this pane or download them using the button at the top.", "log_entry_maximum_entries_title": "__total__ log messages total. Showing the first __displayed__", "log_hint_extra_info": "Learn more", "log_in": "Log in",