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