import { useState } from 'react'; // README §3.3: "分类 Tab(最近/表情/手势/物品),12 列网格" -- the design mockup itself has no // specific emoji asset list, just gray placeholder tiles captioned "use system emoji or a branded // pack." This is a plain Unicode emoji grid (no custom art), same call the old app made (per its own // comment: no WeChat/QQ-style sticker assets available, system emoji is the fallback). const EMOJI_FACES = [ '😀', '😁', '😂', '🤣', '😊', '😍', '😘', '😜', '🤔', '😐', '😴', '😭', '😡', '🥳', '😱', '🤯', '🥰', '😇', '🙃', '😉', '😆', '😅', '☺️', '😋', '😝', '🤗', '🤩', '🥺', '😢', '😤', '🤬', '🥵', '🥶', '😵', '🤢', '😷', '🤒', '🥴', '😪', '🙄', ]; const EMOJI_GESTURES = [ '👍', '👎', '👏', '🙏', '💪', '🤝', '✌️', '👌', '🤞', '👋', '👊', '✊', '🤛', '🤜', '🤟', '🤘', '👆', '👇', '👈', '👉', '☝️', '✋', '🤚', '🖐️', '🖖', '🤙', '💅', '🤳', '👐', '🙌', '🤲', '🫶', '🤌', '🫰', '🫵', '👋', '💃', '🕺', '🙋', '🙆', ]; const EMOJI_OBJECTS = [ '❤️', '💔', '💯', '🔥', '✨', '🎉', '🎂', '☕', '🍺', '🌹', '🎁', '🎈', '⭐', '🌈', '☀️', '🌙', '⚡', '💧', '🎵', '🎮', '📷', '📱', '💻', '📌', '📎', '🔔', '💰', '⏰', '🔑', '💡', '📖', '✏️', '🍎', '🍕', '🍔', '🍜', '🎄', '🎃', '⚽', '🏆', ]; type EmojiTab = 'recent' | 'faces' | 'gestures' | 'objects'; const TABS: { key: EmojiTab; label: string; list: string[] }[] = [ { key: 'recent', label: '最近', list: [] }, { key: 'faces', label: '表情', list: EMOJI_FACES }, { key: 'gestures', label: '手势', list: EMOJI_GESTURES }, { key: 'objects', label: '物品', list: EMOJI_OBJECTS }, ]; interface EmojiPanelProps { onPick: (emoji: string) => void; } export function EmojiPanel({ onPick }: EmojiPanelProps) { const [tab, setTab] = useState('recent'); const recent = (() => { try { return JSON.parse(localStorage.getItem('im-recent-emoji') || '[]') as string[]; } catch { return []; } })(); const pick = (emoji: string) => { const next = [emoji, ...recent.filter((e) => e !== emoji)].slice(0, 36); try { localStorage.setItem('im-recent-emoji', JSON.stringify(next)); } catch { /* storage unavailable -- recents just won't persist */ } onPick(emoji); }; const list = tab === 'recent' ? recent : (TABS.find((t) => t.key === tab)?.list ?? []); return (
{TABS.map((t) => ( ))}
{list.length === 0 ? (
暂无最近使用
) : (
{list.map((emoji, i) => ( ))}
)}
); }