import { Calendar, Github, Globe, Linkedin, MapPin, Twitter, } from "lucide-react"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; interface SocialLinks { twitter?: string; linkedin?: string; github?: string; website?: string; } interface Stats { followers: number; following: number; contributions: number; } interface User { name: string; avatar?: string; coverImage?: string; role?: string; company?: string; bio?: string; location?: string; joinedAt?: string; skills?: string[]; socialLinks?: SocialLinks; stats?: Stats; isFollowing?: boolean; } interface UserProfile3Props { user?: User; className?: string; } const formatNumber = (num: number): string => { if (num >= 1000000) { const value = num / 1000000; const formatted = parseFloat(value.toFixed(1).replace(/\.0$/, "")).toLocaleString( "fa-IR", { useGrouping: false }, ); return `${formatted} میلیون`; } if (num >= 1000) { const value = num / 1000; const formatted = parseFloat(value.toFixed(1).replace(/\.0$/, "")).toLocaleString( "fa-IR", { useGrouping: false }, ); return `${formatted} هزار`; } return num.toLocaleString("fa-IR"); }; const UserProfile3 = ({ user = { name: "سارا احمدی", avatar: "/block-media/shadcnblocks/block/avatar/avatar8.jpg", coverImage: "/block-media/shadcnblocks/block/photos/pawel-czerwinski-O4fAgtXLRwI-unsplash.jpg", role: "مهندس طراحی", company: "لینیر", bio: "پل زدن بین طراحی و مهندسی برای ساخت تجربه‌های کاربری روان. پیش‌تر سیستم‌های طراحی در نوشن ساخته و به Radix UI مشارکت کرده‌ام. درباره توکن‌های طراحی، معماری کامپوننت و تقاطع زیبایی‌شناسی و کارایی می‌نویسم.", location: "تهران، ایران", joinedAt: "فروردین ۱۴۰۰", skills: [ "React", "TypeScript", "Figma", "سیستم‌های طراحی", "CSS", "انیمیشن", ], socialLinks: { twitter: "https://twitter.com", linkedin: "https://linkedin.com", github: "https://github.com", website: "https://example.com", }, stats: { followers: 8420, following: 312, contributions: 1247, }, isFollowing: false, }, className, }: UserProfile3Props) => { const initials = user.name .split(" ") .map((n) => n[0]) .join(""); const socialIcons = [ { key: "twitter", icon: Twitter, href: user.socialLinks?.twitter }, { key: "linkedin", icon: Linkedin, href: user.socialLinks?.linkedin }, { key: "github", icon: Github, href: user.socialLinks?.github }, { key: "website", icon: Globe, href: user.socialLinks?.website }, ].filter((item) => item.href); return (
{user.coverImage && ( )}
{initials}

{user.name}

{user.role} {user.company && ( <> {" "} در {user.company} )}

{user.bio && (

{user.bio}

)}
{user.location && (
{user.location}
)} {user.joinedAt && (
عضویت از {user.joinedAt}
)}
{socialIcons.length > 0 && (
{socialIcons.map(({ key, icon: Icon, href }) => ( ))}
)} {user.stats && (
{formatNumber(user.stats.followers)} {" "} دنبال‌کننده
{formatNumber(user.stats.following)} {" "} دنبال‌شده
{formatNumber(user.stats.contributions)} {" "} مشارکت
)} {user.skills && user.skills.length > 0 && (

مهارت‌ها

{user.skills.map((skill) => ( {skill} ))}
)}
); }; export { UserProfile3 };