Spaces:
Sleeping
Sleeping
File size: 8,135 Bytes
e4c7604 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | import React, { useState, useEffect } from 'react';
import { Tool } from '../types';
interface ExplorerViewProps {
onSelectTool: (tool: Tool) => void;
availableTools: Tool[];
}
const ExplorerView: React.FC<ExplorerViewProps> = ({ onSelectTool, availableTools }) => {
const [filter, setFilter] = useState('All');
const [search, setSearch] = useState('');
const [recentPayouts, setRecentPayouts] = useState<string[]>([]);
useEffect(() => {
const names = ['Aditya', 'Rahul', 'Sneha', 'Priya', 'Amit', 'Vikram', 'Anjali'];
const interval = setInterval(() => {
const name = names[Math.floor(Math.random() * names.length)];
const amt = Math.floor(Math.random() * 500) + 100;
setRecentPayouts(prev => [`${name} just withdrew ₹${amt} via UPI`, ...prev.slice(0, 4)]);
}, 4000);
return () => clearInterval(interval);
}, []);
const filteredTools = availableTools.filter(t =>
(filter === 'All' || t.category === filter) &&
(t.name.toLowerCase().includes(search.toLowerCase()) || t.description.toLowerCase().includes(search.toLowerCase()))
);
return (
<div className="max-w-7xl mx-auto px-6 py-12">
{/* Market Pulse Ticker */}
<div className="mb-12 overflow-hidden bg-indigo-600/5 border-y border-indigo-500/10 py-3 flex items-center gap-8 whitespace-nowrap">
<span className="text-[10px] font-black text-indigo-400 uppercase tracking-widest ml-4 flex items-center gap-2">
<span className="w-1.5 h-1.5 rounded-full bg-indigo-500 animate-ping"></span>
MARKET PULSE
</span>
<div className="flex gap-12 animate-marquee">
{recentPayouts.length > 0 ? recentPayouts.map((p, i) => (
<span key={i} className="text-[9px] font-black text-slate-500 uppercase tracking-widest italic">{p}</span>
)) : <span className="text-[9px] font-black text-slate-700 uppercase tracking-widest">Waiting for node sync...</span>}
</div>
</div>
<div className="mb-16 text-center md:text-left">
<h1 className="text-6xl font-black text-white mb-4 tracking-tighter">AI Exchange.</h1>
<p className="text-slate-500 font-medium max-w-lg">Execute neural commands, generate high-end assets, and earn royalties instantly.</p>
</div>
<div className="flex flex-col lg:flex-row lg:items-center justify-between gap-8 mb-12">
<div className="flex items-center gap-2 overflow-x-auto no-scrollbar pb-2">
{['All', 'Text', 'Image', 'Video', 'Voice'].map((cat) => (
<button
key={cat}
onClick={() => setFilter(cat)}
className={`px-8 py-3 rounded-2xl text-[9px] font-black uppercase tracking-[0.2em] transition-all whitespace-nowrap border ${filter === cat ? 'bg-indigo-600 border-indigo-500 text-white shadow-xl shadow-indigo-600/30' : 'bg-[#0a0f1e] border-slate-800 text-slate-600 hover:text-slate-300'}`}
>
{cat}
</button>
))}
</div>
<div className="relative group flex-1 max-w-md">
<div className="absolute flex items-center bg-[#0a0f1e] border border-slate-800 rounded-2xl px-6 py-4 w-full shadow-2xl focus-within:border-indigo-500/50 transition-all">
<svg className="w-5 h-5 text-slate-600 mr-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2.5} d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" /></svg>
<input
type="text"
placeholder="Search AI Assets..."
className="bg-transparent border-none focus:ring-0 text-sm w-full font-black uppercase tracking-widest text-slate-300 placeholder:text-slate-800"
value={search}
onChange={(e) => setSearch(e.target.value)}
/>
</div>
</div>
</div>
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-8">
{filteredTools.map((tool) => (
<div
key={tool.id}
onClick={() => onSelectTool(tool)}
className="group relative bg-[#0a0f1e] border border-slate-800/40 rounded-[40px] overflow-hidden hover:border-indigo-500/50 transition-all duration-500 cursor-pointer flex flex-col shadow-2xl hover:shadow-indigo-500/10"
>
<div className="p-8 relative z-10 flex-1 flex flex-col">
<div className="flex justify-between items-start mb-10">
<div className={`w-14 h-14 rounded-2xl bg-gradient-to-br ${tool.gradient} flex items-center justify-center shadow-2xl transition-transform duration-500 group-hover:scale-110 group-hover:rotate-6`}>
<svg className="w-7 h-7 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2.5} d={tool.icon} /></svg>
</div>
<div className="flex flex-col items-end gap-1">
<div className="flex items-center gap-1.5 bg-emerald-500/10 text-emerald-500 text-[7px] font-black uppercase tracking-widest px-2.5 py-1 rounded-full border border-emerald-500/20">
<span className="w-1 h-1 rounded-full bg-emerald-500 animate-pulse"></span>
Live
</div>
{tool.isUserCreated && <span className="bg-indigo-500/10 text-indigo-400 text-[7px] font-black uppercase tracking-widest px-2.5 py-1 rounded-full border border-indigo-500/20">Creator Made</span>}
</div>
</div>
<div className="mb-8">
<h3 className="text-2xl font-black text-white tracking-tight group-hover:text-indigo-400 transition-colors mb-2">{tool.name}</h3>
<p className="text-[11px] text-slate-600 font-bold uppercase tracking-widest mb-4">{tool.category} Protocol</p>
<p className="text-sm text-slate-500 font-medium leading-relaxed line-clamp-2">{tool.description}</p>
</div>
<div className="mt-auto pt-8 border-t border-white/5 flex items-center justify-between">
<div className="flex flex-col">
<span className="text-[8px] font-black text-slate-700 uppercase tracking-widest mb-1">Author</span>
<span className="text-[9px] font-black text-slate-500 truncate max-w-[80px]">{tool.author}</span>
</div>
<div className="flex flex-col items-end">
<span className="text-[8px] font-black text-slate-700 uppercase tracking-widest mb-1">Royalty/Run</span>
<span className="text-xs font-black text-emerald-400">₹{tool.epc?.toFixed(2)}</span>
</div>
</div>
</div>
<div className="absolute inset-0 bg-indigo-600 opacity-0 group-hover:opacity-100 transition-all duration-300 flex flex-col items-center justify-center p-8 text-white z-20">
<div className="mb-6 text-center translate-y-4 group-hover:translate-y-0 transition-transform duration-300">
<p className="text-[9px] font-black uppercase tracking-[0.3em] mb-2 text-indigo-200">Execution Ready</p>
<h4 className="text-2xl font-black italic tracking-tighter">Launch {tool.name}</h4>
</div>
<button className="w-full py-4 bg-white text-indigo-600 rounded-2xl font-black uppercase text-xs tracking-widest shadow-2xl hover:scale-105 active:scale-95 transition-all">
Run for 10 Fuel
</button>
</div>
</div>
))}
</div>
<style>{`
@keyframes marquee {
0% { transform: translateX(0%); }
100% { transform: translateX(-50%); }
}
.animate-marquee {
animation: marquee 20s linear infinite;
}
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
`}</style>
</div>
);
};
export default ExplorerView; |