import {User} from '@common/auth/user';
import React, {
Children,
Fragment,
ReactElement,
ReactNode,
useContext,
} from 'react';
import {SiteConfigContext} from '@common/core/settings/site-config-context';
import {Trans} from '@common/i18n/trans';
import {Link} from 'react-router-dom';
import {FormattedNumber} from '@common/i18n/formatted-number';
interface Props {
user: User;
}
export function ProfileStatsList({user}: Props) {
const {
auth: {getUserProfileLink},
} = useContext(SiteConfigContext);
const profileLink = getUserProfileLink!(user);
return (
}
value={user.followers_count || 0}
link={`${profileLink}/followers`}
/>
}
value={user.followed_users_count || 0}
link={`${profileLink}/followed-users`}
/>
}
value={user.lists_count || 0}
link={`${profileLink}/lists`}
/>
);
}
interface StatsItemsProps {
children: ReactNode;
}
function StatsItems(props: StatsItemsProps) {
const children = Children.toArray(props.children);
return (
{children.map((child, index) => (
{child}
{index < children.length - 1 && (
)}
))}
);
}
interface StatsItemProps {
label: ReactElement;
value: number;
link: string;
}
function StatsItem({label, value, link}: StatsItemProps) {
return (
{label}
);
}