mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-28 19:41:33 +02:00
Merge pull request #25262 from overleaf/mj-project-search-signup-date-promo
[web] Only show full-project-search promotion to older users GitOrigin-RevId: 086d904d2f78c2eba30e1db37ac8eb3c606f118f
This commit is contained in:
committed by
Copybot
parent
75868a5454
commit
108ade3084
@@ -11,6 +11,9 @@ import { Overlay, Popover } from 'react-bootstrap-5'
|
||||
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'
|
||||
|
||||
const PROMOTION_SIGNUP_CUT_OFF_DATE = new Date('2025-04-22T00:00:00Z')
|
||||
|
||||
export const FullProjectSearchButton = ({ query }: { query: SearchQuery }) => {
|
||||
const view = useCodeMirrorViewContext()
|
||||
@@ -29,6 +32,17 @@ export const FullProjectSearchButton = ({ query }: { query: SearchQuery }) => {
|
||||
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(() => {
|
||||
setProjectSearchIsOpen(true)
|
||||
closeSearchPanel(view)
|
||||
@@ -46,10 +60,15 @@ export const FullProjectSearchButton = ({ query }: { query: SearchQuery }) => {
|
||||
location: 'search-form',
|
||||
})
|
||||
openFullProjectSearch()
|
||||
if (!hasCompletedTutorial) {
|
||||
if (!hasCompletedTutorial && isEligibleForPromotion) {
|
||||
completeTutorial({ action: 'complete', event: 'promo-click' })
|
||||
}
|
||||
}, [completeTutorial, openFullProjectSearch, hasCompletedTutorial])
|
||||
}, [
|
||||
completeTutorial,
|
||||
openFullProjectSearch,
|
||||
hasCompletedTutorial,
|
||||
isEligibleForPromotion,
|
||||
])
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -65,7 +84,7 @@ export const FullProjectSearchButton = ({ query }: { query: SearchQuery }) => {
|
||||
/>
|
||||
</OLButton>
|
||||
</OLTooltip>
|
||||
{!hasCompletedTutorial && (
|
||||
{!hasCompletedTutorial && isEligibleForPromotion && (
|
||||
<PromotionOverlay
|
||||
ref={ref}
|
||||
showPopup={showPopup}
|
||||
|
||||
Reference in New Issue
Block a user