mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-28 19:41:33 +02:00
Merge pull request #29496 from overleaf/dp-remove-new-editor-old-logs
Move all new editor users to new logs GitOrigin-RevId: 224a4476eddb6576eaa04086a68b6579650a1bc5
This commit is contained in:
@@ -41,18 +41,6 @@ export const canUseNewEditor = () => {
|
||||
)
|
||||
}
|
||||
|
||||
const canUseNewLogs = () => {
|
||||
const newUserTestVariant = getSplitTestVariant('editor-redesign-new-users')
|
||||
const canUseNewLogsViaNewUserFeatureFlag =
|
||||
isNewUser() &&
|
||||
(newUserTestVariant === 'new-editor' ||
|
||||
newUserTestVariant === 'new-editor-new-logs-old-position')
|
||||
|
||||
return (
|
||||
canUseNewEditorViaPrimaryFeatureFlag() || canUseNewLogsViaNewUserFeatureFlag
|
||||
)
|
||||
}
|
||||
|
||||
export const useIsNewEditorEnabledViaPrimaryFeatureFlag = () => {
|
||||
const { userSettings } = useUserSettingsContext()
|
||||
const hasAccess = canUseNewEditorViaPrimaryFeatureFlag()
|
||||
@@ -67,15 +55,8 @@ export const useIsNewEditorEnabled = () => {
|
||||
return hasAccess && enabled
|
||||
}
|
||||
|
||||
export const useAreNewErrorLogsEnabled = () => {
|
||||
const newEditorEnabled = useIsNewEditorEnabled()
|
||||
return newEditorEnabled && canUseNewLogs()
|
||||
}
|
||||
|
||||
export function useNewEditorVariant() {
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
const newErrorLogs = useAreNewErrorLogsEnabled()
|
||||
if (!newEditor) return 'default'
|
||||
if (!newErrorLogs) return 'new-editor-old-logs'
|
||||
return 'new-editor-new-logs-old-position'
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ import PdfLogEntryContent from './pdf-log-entry-content'
|
||||
import HumanReadableLogsHints from '../../../ide/human-readable-logs/HumanReadableLogsHints'
|
||||
import getMeta from '@/utils/meta'
|
||||
import { ErrorLevel, LogEntry, SourceLocation } from '../util/types'
|
||||
import { useAreNewErrorLogsEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
import NewLogEntry from '@/features/ide-redesign/components/error-logs/log-entry'
|
||||
import { useEditorAnalytics } from '@/shared/hooks/use-editor-analytics'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
|
||||
function PdfLogEntry({
|
||||
autoExpand,
|
||||
@@ -71,9 +71,9 @@ function PdfLogEntry({
|
||||
[level, onSourceLocationClick, ruleId, sourceLocation, sendEvent]
|
||||
)
|
||||
|
||||
const newErrorlogs = useAreNewErrorLogsEnabled()
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
|
||||
if (newErrorlogs) {
|
||||
if (newEditor) {
|
||||
return (
|
||||
<NewLogEntry
|
||||
autoExpand={autoExpand}
|
||||
|
||||
@@ -9,10 +9,7 @@ import { PdfPreviewMessages } from './pdf-preview-messages'
|
||||
import CompileTimeWarningUpgradePrompt from './compile-time-warning-upgrade-prompt'
|
||||
import { PdfPreviewProvider } from './pdf-preview-provider'
|
||||
import PdfPreviewHybridToolbarNew from '@/features/ide-redesign/components/pdf-preview/pdf-preview-hybrid-toolbar'
|
||||
import {
|
||||
useAreNewErrorLogsEnabled,
|
||||
useIsNewEditorEnabled,
|
||||
} from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
import importOverleafModules from '../../../../macros/import-overleaf-module.macro'
|
||||
import PdfCodeCheckFailedBanner from '@/features/ide-redesign/components/pdf-preview/pdf-code-check-failed-banner'
|
||||
import getMeta from '@/utils/meta'
|
||||
@@ -26,7 +23,6 @@ function PdfPreviewPane() {
|
||||
'pdf-empty': !pdfUrl,
|
||||
})
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
const newErrorLogs = useAreNewErrorLogsEnabled()
|
||||
|
||||
const pdfPromotions = importOverleafModules('pdfPreviewPromotions') as {
|
||||
import: { default: ElementType }
|
||||
@@ -41,7 +37,7 @@ function PdfPreviewPane() {
|
||||
) : (
|
||||
<PdfHybridPreviewToolbar />
|
||||
)}
|
||||
{newErrorLogs && <PdfCodeCheckFailedBanner />}
|
||||
{newEditor && <PdfCodeCheckFailedBanner />}
|
||||
<PdfPreviewMessages>
|
||||
{compileTimeout < 60 && <CompileTimeWarningUpgradePrompt />}
|
||||
</PdfPreviewMessages>
|
||||
@@ -51,7 +47,7 @@ function PdfPreviewPane() {
|
||||
<ClsiCachePrompt />
|
||||
</div>
|
||||
</Suspense>
|
||||
{newErrorLogs ? <NewPdfLogsViewer /> : <PdfLogsViewer />}
|
||||
{newEditor ? <NewPdfLogsViewer /> : <PdfLogsViewer />}
|
||||
{pdfPromotions.map(({ import: { default: Component }, path }) => (
|
||||
<Component key={path} />
|
||||
))}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { useCallback } from 'react'
|
||||
import { useLayoutContext } from '@/shared/context/layout-context'
|
||||
import { useAreNewErrorLogsEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
import { useEditorContext } from '@/shared/context/editor-context'
|
||||
import useEventListener from '@/shared/hooks/use-event-listener'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
|
||||
function scrollIntoView(element: Element) {
|
||||
setTimeout(() => {
|
||||
@@ -18,7 +18,7 @@ function scrollIntoView(element: Element) {
|
||||
*/
|
||||
export const useLogEvents = (setShowLogs: (show: boolean) => void) => {
|
||||
const { pdfLayout, setView } = useLayoutContext()
|
||||
const newLogs = useAreNewErrorLogsEnabled()
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
const { hasPremiumSuggestion } = useEditorContext()
|
||||
|
||||
const selectLogOldLogs = useCallback((id: string, suggestFix: boolean) => {
|
||||
@@ -117,7 +117,7 @@ export const useLogEvents = (setShowLogs: (show: boolean) => void) => {
|
||||
|
||||
openLogs()
|
||||
|
||||
if (newLogs) {
|
||||
if (newEditor) {
|
||||
selectLogNewLogs(
|
||||
id,
|
||||
Boolean(suggestFix),
|
||||
@@ -127,7 +127,7 @@ export const useLogEvents = (setShowLogs: (show: boolean) => void) => {
|
||||
selectLogOldLogs(id, Boolean(suggestFix))
|
||||
}
|
||||
},
|
||||
[openLogs, selectLogNewLogs, selectLogOldLogs, newLogs]
|
||||
[openLogs, selectLogNewLogs, selectLogOldLogs, newEditor]
|
||||
)
|
||||
|
||||
useEventListener(
|
||||
|
||||
@@ -14,7 +14,7 @@ describe('new-editor-utils', function () {
|
||||
},
|
||||
{
|
||||
splitTestVariant: 'new-editor-old-logs',
|
||||
uiVariant: 'new-editor-old-logs',
|
||||
uiVariant: 'new-editor-new-logs-old-position',
|
||||
},
|
||||
{
|
||||
splitTestVariant: 'new-editor-new-logs-old-position',
|
||||
|
||||
Reference in New Issue
Block a user