import { Avatar, Badge, Card, Flex, Separator, Text } from "@radix-ui/themes"; import { useAtomValue } from "jotai"; import { userAtom } from "../../AtomStore/AtomStore"; type TUserCard = { username?: string; userId?: string; }; export default function UserCard(props: TUserCard) { const user = useAtomValue(userAtom); const getInitials = (username: string): string => { const result = username .split(" ") .map((word) => word[0].toUpperCase()) .join(""); return result; }; const getUsername = (): string => { if (!user || props.username) return props.username || "Nothing"; return user.username; }; return ( {getInitials(getUsername())}} radius="full" /> Test User @testuser123 test user admin ); }