Procházet zdrojové kódy

Tear down full-project-search-promo (#30474)

GitOrigin-RevId: 9af516202bdf281b11348726667037fa458d66d9
Alf Eaton před 9 měsíci
rodič
revize
b4ff3f15ad

+ 0 - 1
services/web/app/src/Features/Tutorial/TutorialController.mjs

@@ -12,7 +12,6 @@ const VALID_KEYS = [
   'history-restore-promo',
   'history-restore-promo',
   'us-gov-banner',
   'us-gov-banner',
   'us-gov-banner-fedramp',
   'us-gov-banner-fedramp',
-  'full-project-search-promo',
   'editor-popup-ux-survey',
   'editor-popup-ux-survey',
   'wf-features-moved',
   'wf-features-moved',
   'review-mode',
   'review-mode',

+ 0 - 1
services/web/frontend/extracted-translations.json

@@ -1188,7 +1188,6 @@
   "notification_personal_and_group_subscriptions": "",
   "notification_personal_and_group_subscriptions": "",
   "notification_project_invite_accepted_message": "",
   "notification_project_invite_accepted_message": "",
   "notification_project_invite_message": "",
   "notification_project_invite_message": "",
-  "now_you_can_search_your_whole_project_not_just_this_file": "",
   "number_of_users": "",
   "number_of_users": "",
   "numbered_list": "",
   "numbered_list": "",
   "oauth_orcid_description": "",
   "oauth_orcid_description": "",

+ 4 - 118
services/web/frontend/js/features/source-editor/components/full-project-search-button.tsx

@@ -3,49 +3,19 @@ import OLButton from '@/shared/components/ol/ol-button'
 import OLTooltip from '@/shared/components/ol/ol-tooltip'
 import OLTooltip from '@/shared/components/ol/ol-tooltip'
 import { useLayoutContext } from '@/shared/context/layout-context'
 import { useLayoutContext } from '@/shared/context/layout-context'
 import { closeSearchPanel, SearchQuery } from '@codemirror/search'
 import { closeSearchPanel, SearchQuery } from '@codemirror/search'
-import { forwardRef, memo, Ref, useCallback, useEffect, useRef } from 'react'
+import { useCallback } from 'react'
 import { useCodeMirrorViewContext } from './codemirror-context'
 import { useCodeMirrorViewContext } from './codemirror-context'
 import MaterialIcon from '@/shared/components/material-icon'
 import MaterialIcon from '@/shared/components/material-icon'
 import { useTranslation } from 'react-i18next'
 import { useTranslation } from 'react-i18next'
-import { Overlay, Popover } from 'react-bootstrap'
-import Close from '@/shared/components/close'
-import useTutorial from '@/shared/hooks/promotions/use-tutorial'
-import { useEditorContext } from '@/shared/context/editor-context'
-import getMeta from '@/utils/meta'
 import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
 import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
 import { useRailContext } from '@/features/ide-redesign/contexts/rail-context'
 import { useRailContext } from '@/features/ide-redesign/contexts/rail-context'
 
 
-const PROMOTION_SIGNUP_CUT_OFF_DATE = new Date('2025-04-22T00:00:00Z')
-
 export const FullProjectSearchButton = ({ query }: { query: SearchQuery }) => {
 export const FullProjectSearchButton = ({ query }: { query: SearchQuery }) => {
   const view = useCodeMirrorViewContext()
   const view = useCodeMirrorViewContext()
   const { t } = useTranslation()
   const { t } = useTranslation()
   const { setProjectSearchIsOpen } = useLayoutContext()
   const { setProjectSearchIsOpen } = useLayoutContext()
   const newEditor = useIsNewEditorEnabled()
   const newEditor = useIsNewEditorEnabled()
   const { openTab } = useRailContext()
   const { openTab } = useRailContext()
-  const ref = useRef<HTMLButtonElement>(null)
-
-  const { inactiveTutorials } = useEditorContext()
-
-  const hasCompletedTutorial = inactiveTutorials.includes(
-    'full-project-search-promo'
-  )
-
-  const { showPopup, tryShowingPopup, hideUntilReload, completeTutorial } =
-    useTutorial('full-project-search-promo', {
-      name: 'full-project-search-promotion',
-    })
-
-  let isEligibleForPromotion = true
-  const signUpDateString = getMeta('ol-user')?.signUpDate
-  if (!signUpDateString) {
-    isEligibleForPromotion = false
-  } else {
-    const signupDate = new Date(signUpDateString)
-    if (signupDate > PROMOTION_SIGNUP_CUT_OFF_DATE) {
-      isEligibleForPromotion = false
-    }
-  }
 
 
   const openFullProjectSearch = useCallback(() => {
   const openFullProjectSearch = useCallback(() => {
     if (newEditor) {
     if (newEditor) {
@@ -68,106 +38,22 @@ export const FullProjectSearchButton = ({ query }: { query: SearchQuery }) => {
       location: 'search-form',
       location: 'search-form',
     })
     })
     openFullProjectSearch()
     openFullProjectSearch()
-    if (!hasCompletedTutorial && isEligibleForPromotion) {
-      completeTutorial({ action: 'complete', event: 'promo-click' })
-    }
-  }, [
-    completeTutorial,
-    openFullProjectSearch,
-    hasCompletedTutorial,
-    isEligibleForPromotion,
-  ])
+  }, [openFullProjectSearch])
 
 
   return (
   return (
     <>
     <>
       <OLTooltip
       <OLTooltip
         id="open-full-project-search"
         id="open-full-project-search"
-        overlayProps={{ placement: 'bottom' }}
+        overlayProps={{ placement: 'top' }}
         description={t('search_all_project_files')}
         description={t('search_all_project_files')}
       >
       >
-        <OLButton variant="secondary" size="sm" ref={ref} onClick={onClick}>
+        <OLButton variant="secondary" size="sm" onClick={onClick}>
           <MaterialIcon
           <MaterialIcon
             type="manage_search"
             type="manage_search"
             accessibilityLabel={t('search_all_project_files')}
             accessibilityLabel={t('search_all_project_files')}
           />
           />
         </OLButton>
         </OLButton>
       </OLTooltip>
       </OLTooltip>
-      {!hasCompletedTutorial && isEligibleForPromotion && (
-        <PromotionOverlay
-          ref={ref}
-          showPopup={showPopup}
-          tryShowingPopup={tryShowingPopup}
-          completeTutorial={completeTutorial}
-          hideUntilReload={hideUntilReload}
-        />
-      )}
     </>
     </>
   )
   )
 }
 }
-
-type PromotionOverlayProps = {
-  showPopup: boolean
-  tryShowingPopup: () => void
-  completeTutorial: (event: {
-    action: 'complete'
-    event: 'promo-dismiss'
-  }) => void
-  hideUntilReload: () => void
-}
-
-const PromotionOverlay = forwardRef<HTMLButtonElement, PromotionOverlayProps>(
-  function PromotionOverlay(
-    props: PromotionOverlayProps,
-    ref: Ref<HTMLButtonElement>
-  ) {
-    if (typeof ref === 'function' || !ref?.current) {
-      return null
-    }
-
-    return <PromotionContent target={ref.current} {...props} />
-  }
-)
-
-const PromotionContent = memo(function PromotionContent({
-  showPopup,
-  tryShowingPopup,
-  completeTutorial,
-  hideUntilReload,
-  target,
-}: PromotionOverlayProps & {
-  target: HTMLButtonElement
-}) {
-  const { t } = useTranslation()
-
-  useEffect(() => {
-    tryShowingPopup()
-  }, [tryShowingPopup])
-
-  const onHide = useCallback(() => {
-    hideUntilReload()
-  }, [hideUntilReload])
-
-  const onClose = useCallback(() => {
-    completeTutorial({
-      action: 'complete',
-      event: 'promo-dismiss',
-    })
-  }, [completeTutorial])
-
-  return (
-    <Overlay
-      placement="top"
-      show={showPopup}
-      target={target}
-      rootClose
-      onHide={onHide}
-    >
-      <Popover>
-        <Popover.Body>
-          <Close variant="dark" onDismiss={onClose} />
-          {t('now_you_can_search_your_whole_project_not_just_this_file')}
-        </Popover.Body>
-      </Popover>
-    </Overlay>
-  )
-})

+ 0 - 1
services/web/locales/en.json

@@ -1542,7 +1542,6 @@
   "notification_project_invite_accepted_message": "You’ve joined <b>__projectName__</b>",
   "notification_project_invite_accepted_message": "You’ve joined <b>__projectName__</b>",
   "notification_project_invite_message": "<b>__userName__</b> would like you to join <b>__projectName__</b>",
   "notification_project_invite_message": "<b>__userName__</b> would like you to join <b>__projectName__</b>",
   "november": "November",
   "november": "November",
-  "now_you_can_search_your_whole_project_not_just_this_file": "Now you can search your whole project (not just this file!)",
   "number_collab": "Number of collaborators",
   "number_collab": "Number of collaborators",
   "number_collab_info": "The number of people you can invite to work on a project with you. The limit is per project, so you can invite different people to each project.",
   "number_collab_info": "The number of people you can invite to work on a project with you. The limit is per project, so you can invite different people to each project.",
   "number_of_projects": "Number of projects",
   "number_of_projects": "Number of projects",