Merge pull request #26757 from overleaf/mj-papers-notification-teardown
[web] Tear down papers-notification-banner GitOrigin-RevId: c6cb0affe85147f34f3dc6c36041fe190faf7ff2
This commit is contained in:
committed by
Copybot
parent
b89951cf5d
commit
c10b95ae06
-16
@@ -1,16 +0,0 @@
|
||||
import { useFeatureFlag } from '@/shared/context/split-test-context'
|
||||
import getMeta from '@/utils/meta'
|
||||
|
||||
export const usePapersNotification = () => {
|
||||
const user = getMeta('ol-user')
|
||||
const inRollout = useFeatureFlag('papers-notification-banner')
|
||||
const shouldShow =
|
||||
inRollout &&
|
||||
user &&
|
||||
(user.features?.references || user.features?.papers) &&
|
||||
!user.refProviders?.mendeley &&
|
||||
!user.refProviders?.zotero &&
|
||||
!user.refProviders?.papers
|
||||
|
||||
return { shouldShow }
|
||||
}
|
||||
-86
@@ -1,86 +0,0 @@
|
||||
import { memo, useCallback, useEffect } from 'react'
|
||||
import Notification from './notification'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import OLButton from '@/features/ui/components/ol/ol-button'
|
||||
import usePersistedState from '@/shared/hooks/use-persisted-state'
|
||||
import { sendMB } from '@/infrastructure/event-tracking'
|
||||
|
||||
function PapersNotificationBanner() {
|
||||
const { t } = useTranslation()
|
||||
const [dismissed, setDismissed] = usePersistedState(
|
||||
'papers-notification-banner-dismissed',
|
||||
false
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
if (!dismissed) {
|
||||
sendMB('promo-prompt', {
|
||||
location: 'dashboard-banner',
|
||||
name: 'papers-integration',
|
||||
})
|
||||
}
|
||||
}, [dismissed])
|
||||
|
||||
const handleClose = useCallback(() => {
|
||||
sendMB('promo-dismiss', {
|
||||
location: 'dashboard-banner',
|
||||
name: 'papers-integration',
|
||||
})
|
||||
setDismissed(true)
|
||||
}, [setDismissed])
|
||||
|
||||
const handlePapersButtonClick = useCallback(() => {
|
||||
sendMB('promo-click', {
|
||||
location: 'dashboard-banner',
|
||||
name: 'papers-integration',
|
||||
type: 'click-try-for-free',
|
||||
})
|
||||
}, [])
|
||||
|
||||
const handleSettingsLinkClick = useCallback(() => {
|
||||
sendMB('promo-click', {
|
||||
location: 'dashboard-banner',
|
||||
name: 'papers-integration',
|
||||
type: 'click-link-account',
|
||||
})
|
||||
}, [])
|
||||
|
||||
if (dismissed) return null
|
||||
|
||||
return (
|
||||
<Notification
|
||||
type="info"
|
||||
title={t(
|
||||
'you_can_now_sync_your_papers_library_directly_with_your_overleaf_projects'
|
||||
)}
|
||||
onDismiss={handleClose}
|
||||
content={
|
||||
<p>
|
||||
<Trans
|
||||
i18nKey="already_have_a_papers_account"
|
||||
components={[
|
||||
// eslint-disable-next-line react/jsx-key, jsx-a11y/anchor-has-content
|
||||
<a
|
||||
onClick={handleSettingsLinkClick}
|
||||
href="/user/settings#references"
|
||||
/>,
|
||||
]}
|
||||
/>
|
||||
</p>
|
||||
}
|
||||
action={
|
||||
<OLButton
|
||||
variant="secondary"
|
||||
onClick={handlePapersButtonClick}
|
||||
href="https://www.papersapp.com/30-day-trial/?utm_source=overleaf_inproduct&utm_medium=referral&utm_campaign=overleaf_integration"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
{t('try_papers_for_free')}
|
||||
</OLButton>
|
||||
}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export default memo(PapersNotificationBanner)
|
||||
-5
@@ -13,9 +13,7 @@ import {
|
||||
DeprecatedBrowser,
|
||||
isDeprecatedBrowser,
|
||||
} from '@/shared/components/deprecated-browser'
|
||||
import PapersNotificationBanner from './papers-notification-banner'
|
||||
import AiAssistBanner from './ai-assist-banner'
|
||||
import { usePapersNotification } from './hooks/use-papers-notification'
|
||||
|
||||
const [enrollmentNotificationModule] = importOverleafModules(
|
||||
'managedGroupSubscriptionEnrollmentNotification'
|
||||
@@ -35,8 +33,6 @@ function UserNotifications() {
|
||||
const groupSubscriptionsPendingEnrollment =
|
||||
getMeta('ol-groupSubscriptionsPendingEnrollment') || []
|
||||
|
||||
const { shouldShow: showPapersNotificationBanner } = usePapersNotification()
|
||||
|
||||
return (
|
||||
<div className="user-notifications notification-list">
|
||||
<ul className="list-unstyled">
|
||||
@@ -57,7 +53,6 @@ function UserNotifications() {
|
||||
<GroupsAndEnterpriseBanner />
|
||||
{USGovBanner && <USGovBanner />}
|
||||
|
||||
{showPapersNotificationBanner && <PapersNotificationBanner />}
|
||||
<AiAssistBanner />
|
||||
<AccessibilitySurveyBanner />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user