import Twemoji from "react-twemoji"; import { useMemo } from "react"; // List of cute animals and human faces emojis const emojiList = [ // Cute animals "ðķ", "ðą", "ð", "ðđ", "ð°", "ðĶ", "ðŧ", "ðž", "ðĻ", "ðŊ", "ðĶ", "ðŪ", "ð·", "ðļ", "ðĩ", "ð", "ð§", "ðĶ", "ðĶ", "ðĶ", "ðĒ", "ð", "ðĶĨ", "ðĶĶ", "ðĶ", "ðŋïļ", "ðĶ", "ðĶ", "ðĶ", "ð", // Cute human faces "ð", "ðĨ°", "ð", "ðĪ", "ð", "ð", "ðĨš", "ð", "ð", "ð", "ð", "ð", "ð", "ð", "ðĪŠ", "ðš", "ðļ", "ðđ", "ðŧ", "ð―", "ð", "ð", "ð", "ðķ", "ð§", "ðĶ", "ð§", "ðĨģ", "ð", "ðĪ" ]; // Simple hash function to get a consistent number from a string const hashString = (str: string): number => { let hash = 0; for (let i = 0; i < str.length; i++) { const char = str.charCodeAt(i); hash = ((hash << 5) - hash) + char; hash = hash & hash; // Convert to 32bit integer } return Math.abs(hash); }; export const EmojiComponent = ({ personality, size = 100 }: { personality: IPersonality, size?: number }) => { // Use useMemo to avoid recalculating on every render const emoji = useMemo(() => { // Use personality.id or another unique property as seed const seed = personality.personality_id || personality.title; const hash = hashString(seed); const index = hash % emojiList.length; return emojiList[index]; }, [personality]); return (