import React, { useState } from 'react'; import { Lock, Flame } from 'lucide-react'; import { MOCK_CHARACTERS } from '../constants'; import { Character } from '../types'; interface DiscoveryProps { onSelectCharacter: (char: Character) => void; } const Discovery: React.FC = ({ onSelectCharacter }) => { const [activeFilter, setActiveFilter] = useState('all'); const filters = [ { id: 'all', label: '全部' }, { id: 'gentle', label: '温柔治愈' }, { id: 'dom', label: '主导强势' }, { id: 'wild', label: '反差/猎奇' }, { id: 'voice', label: '语音陪聊' }, { id: 'scenario', label: '场景扮演' }, { id: 'exclusive', label: '会员限定' }, ]; const filteredCharacters = activeFilter === 'all' ? MOCK_CHARACTERS : MOCK_CHARACTERS.filter(c => { const tags = c.tags.join(''); if (activeFilter === 'gentle') return tags.includes('治愈') || tags.includes('温顺') || tags.includes('医疗'); if (activeFilter === 'dom') return tags.includes('强势') || tags.includes('调教') || tags.includes('指令'); if (activeFilter === 'wild') return tags.includes('病娇') || tags.includes('神秘') || tags.includes('不稳定') || tags.includes('极乐'); if (activeFilter === 'exclusive') return c.isLocked; return false; }); return (
{/* Filter Bar */}
{/* Scroll Container */}
{filters.map(filter => { const isActive = activeFilter === filter.id; return ( ); })}
{/* Right Fade */}
{/* Grid Layout */}
{filteredCharacters.map((char) => (
!char.isLocked && onSelectCharacter(char)} className={`relative w-full aspect-[3/4] rounded-3xl overflow-hidden transition-all duration-300 border border-white/20 group ${ char.isLocked ? 'grayscale opacity-70' : 'active:scale-[0.98] shadow-lg hover:shadow-[0_0_25px_rgba(192,132,252,0.3)] hover:border-white/40' }`} > {/* Background Image */} {char.name} {/* Gradient Overlay - Lighter/Purple based */}
{/* Top Left: Popularity Badge */} {!char.isLocked && (
{char.compatibility}%
)} {/* Lock Icon */} {char.isLocked && (
)} {/* Content info */}

{char.name}

{char.tags.slice(0, 2).map((tag, i) => ( {tag} ))}
))}
{/* Empty State */} {filteredCharacters.length === 0 && (

暂无匹配角色

)}
); }; export default Discovery;