mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #20435 from overleaf/jdt-hide-wf-promo-from-wf-commons
Hide Writefull Promo From Writefull Commons Users GitOrigin-RevId: 7adcb8f6e71c9c5b27da248e025b14a51fab703b
This commit is contained in:
parent
a807a810e6
commit
5b73f08703
5 changed files with 14 additions and 1 deletions
|
@ -4,6 +4,7 @@ import { sendMB } from '@/infrastructure/event-tracking'
|
|||
import customLocalStorage from '@/infrastructure/local-storage'
|
||||
import WritefullLogo from '@/shared/svgs/writefull-logo'
|
||||
import OLButton from '@/features/ui/components/ol/ol-button'
|
||||
import getMeta from '@/utils/meta'
|
||||
|
||||
const eventSegmentation = {
|
||||
location: 'dashboard-banner',
|
||||
|
@ -20,6 +21,11 @@ function WritefullPremiumPromoBanner({
|
|||
setShow: (value: boolean) => void
|
||||
onDismiss: () => void
|
||||
}) {
|
||||
// dont show the add to WF commons users since their license already includes it
|
||||
const userAffiliations = getMeta('ol-userAffiliations') || []
|
||||
const hasWritefullCommons = userAffiliations.some(
|
||||
affil => affil.institution?.writefullCommonsAccount
|
||||
)
|
||||
const handleClose = useCallback(() => {
|
||||
customLocalStorage.setItem('has_dismissed_writefull_promo_banner', true)
|
||||
setShow(false)
|
||||
|
@ -27,7 +33,7 @@ function WritefullPremiumPromoBanner({
|
|||
onDismiss()
|
||||
}, [setShow, onDismiss])
|
||||
|
||||
if (!show) {
|
||||
if (!show || hasWritefullCommons) {
|
||||
return null
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ const userEmailData: UserEmailData & { affiliation: Affiliation } = {
|
|||
department: 'Art History',
|
||||
institution: {
|
||||
commonsAccount: false,
|
||||
writefullCommonsAccount: false,
|
||||
confirmed: true,
|
||||
id: 1,
|
||||
isUniversity: true,
|
||||
|
|
|
@ -23,6 +23,7 @@ const userData1: UserEmailData & { affiliation: Affiliation } = {
|
|||
department: null,
|
||||
institution: {
|
||||
commonsAccount: false,
|
||||
writefullCommonsAccount: false,
|
||||
confirmed: true,
|
||||
id: 1,
|
||||
isUniversity: false,
|
||||
|
@ -53,6 +54,7 @@ const userData2: UserEmailData & { affiliation: Affiliation } = {
|
|||
department: 'Art History',
|
||||
institution: {
|
||||
commonsAccount: false,
|
||||
writefullCommonsAccount: false,
|
||||
confirmed: true,
|
||||
id: 1,
|
||||
isUniversity: false,
|
||||
|
|
|
@ -24,6 +24,7 @@ export const professionalUserData: UserEmailData & {
|
|||
department: 'Art History',
|
||||
institution: {
|
||||
commonsAccount: false,
|
||||
writefullCommonsAccount: false,
|
||||
confirmed: true,
|
||||
id: 1,
|
||||
isUniversity: false,
|
||||
|
@ -56,6 +57,7 @@ export const unconfirmedCommonsUserData: UserEmailData & {
|
|||
department: 'Art History',
|
||||
institution: {
|
||||
commonsAccount: true,
|
||||
writefullCommonsAccount: false,
|
||||
confirmed: true,
|
||||
id: 1,
|
||||
isUniversity: false,
|
||||
|
@ -85,6 +87,7 @@ export const ssoUserData: UserEmailData = {
|
|||
department: 'Art History',
|
||||
institution: {
|
||||
commonsAccount: true,
|
||||
writefullCommonsAccount: false,
|
||||
confirmed: true,
|
||||
id: 2,
|
||||
isUniversity: true,
|
||||
|
|
|
@ -2,6 +2,7 @@ import { Nullable } from './utils'
|
|||
|
||||
export type Institution = {
|
||||
commonsAccount: boolean
|
||||
writefullCommonsAccount: boolean
|
||||
confirmed: boolean
|
||||
id: number
|
||||
isUniversity: boolean
|
||||
|
|
Loading…
Reference in a new issue