({
stats,
userId,
className,
}: UserStatsProps)
| 40 | ); |
| 41 | |
| 42 | export function UserStats({ |
| 43 | stats, |
| 44 | userId, |
| 45 | className, |
| 46 | }: UserStatsProps): ReactElement { |
| 47 | const { openModal } = useLazyModal< |
| 48 | LazyModal.UserFollowersModal | LazyModal.UserFollowingModal |
| 49 | >(); |
| 50 | |
| 51 | const defaultModalProps = { |
| 52 | props: { |
| 53 | queryProps: { |
| 54 | id: userId, |
| 55 | entity: ContentPreferenceType.User, |
| 56 | }, |
| 57 | }, |
| 58 | }; |
| 59 | |
| 60 | return ( |
| 61 | <div |
| 62 | className={classNames( |
| 63 | 'flex flex-wrap items-center gap-x-3 gap-y-2 text-text-tertiary typo-footnote tablet:-ml-1 tablet:grid tablet:grid-cols-[auto_auto] tablet:gap-x-2 tablet:gap-y-1', |
| 64 | className, |
| 65 | )} |
| 66 | > |
| 67 | <div className="flex items-center"> |
| 68 | <ReputationIcon |
| 69 | className="text-accent-onion-default" |
| 70 | size={IconSize.Small} |
| 71 | /> |
| 72 | <Item stat={{ title: 'Reputation', amount: stats.reputation }} /> |
| 73 | </div> |
| 74 | <Item stat={{ title: 'Upvotes', amount: stats.upvotes }} /> |
| 75 | <Item |
| 76 | stat={{ title: 'Followers', amount: stats.numFollowers }} |
| 77 | className={classNames( |
| 78 | 'tablet:pl-6', |
| 79 | stats.numFollowers && 'cursor-pointer', |
| 80 | )} |
| 81 | onClick={() => { |
| 82 | if (!stats.numFollowers) { |
| 83 | return; |
| 84 | } |
| 85 | |
| 86 | openModal({ |
| 87 | type: LazyModal.UserFollowersModal, |
| 88 | ...defaultModalProps, |
| 89 | props: { |
| 90 | ...defaultModalProps.props, |
| 91 | placeholderAmount: stats.numFollowers, |
| 92 | }, |
| 93 | }); |
| 94 | }} |
| 95 | /> |
| 96 | <Item |
| 97 | stat={{ title: 'Following', amount: stats.numFollowing }} |
| 98 | className={classNames(stats.numFollowing && 'cursor-pointer')} |
| 99 | onClick={() => { |
nothing calls this directly
no test coverage detected