({
user,
tooltip = true,
size = IconSize.Size16,
}: Props)
| 26 | }; |
| 27 | |
| 28 | export const PlusUserBadge = ({ |
| 29 | user, |
| 30 | tooltip = true, |
| 31 | size = IconSize.Size16, |
| 32 | }: Props): ReactElement | null => { |
| 33 | const { isPlus, logSubscriptionEvent } = usePlusSubscription(); |
| 34 | const { value: isApiLanding } = useConditionalFeature({ |
| 35 | feature: featurePlusApiLanding, |
| 36 | shouldEvaluate: !isPlus, |
| 37 | }); |
| 38 | const plusCta = isApiLanding ? 'Get API Access' : 'Level Up with Plus'; |
| 39 | |
| 40 | if (!user.isPlus) { |
| 41 | return null; |
| 42 | } |
| 43 | |
| 44 | return ( |
| 45 | <ConditionalWrapper |
| 46 | condition={tooltip} |
| 47 | wrapper={(child) => ( |
| 48 | <SimpleTooltip |
| 49 | interactive |
| 50 | content={ |
| 51 | <> |
| 52 | <DateFormat |
| 53 | prefix="Plus member since " |
| 54 | date={user.plusMemberSince} |
| 55 | type={TimeFormatType.PlusMember} |
| 56 | /> |
| 57 | {!isPlus && ( |
| 58 | <Link passHref href={plusUrl}> |
| 59 | <Typography |
| 60 | tag={TypographyTag.Link} |
| 61 | color={TypographyColor.Link} |
| 62 | onClick={() => { |
| 63 | logSubscriptionEvent({ |
| 64 | event_name: LogEvent.UpgradeSubscription, |
| 65 | target_id: TargetId.PlusBadge, |
| 66 | }); |
| 67 | }} |
| 68 | > |
| 69 | {plusCta}! |
| 70 | </Typography> |
| 71 | </Link> |
| 72 | )} |
| 73 | </> |
| 74 | } |
| 75 | placement="top" |
| 76 | container={{ |
| 77 | className: 'text-center flex-col', |
| 78 | }} |
| 79 | > |
| 80 | {child as ReactElement} |
| 81 | </SimpleTooltip> |
| 82 | )} |
| 83 | > |
| 84 | <div className="flex items-center"> |
| 85 | <PlusUser withText={false} iconSize={size} /> |
nothing calls this directly
no test coverage detected