Spaces:
Build error
Build error
Download components/ControlPanel.jsx from ActuallyCookie/anycoder-6a1e4b3a: direct link, hf CLI and curl.
- Browser
- Download file 7.88 kB
-
https://huggingface.co/spaces/ActuallyCookie/anycoder-6a1e4b3a/resolve/main/components/ControlPanel.jsx
- Command line
-
hf download hf://spaces/ActuallyCookie/anycoder-6a1e4b3a/components/ControlPanel.jsx
-
curl -L -o ControlPanel.jsx https://huggingface.co/spaces/ActuallyCookie/anycoder-6a1e4b3a/resolve/main/components/ControlPanel.jsx
7.88 kB
| import { Bell, Info, AlertTriangle, XCircle, CheckCircle2, Zap, Settings2 } from 'lucide-react'; | |
| import { useState } from 'react'; | |
| const categories = [ | |
| { id: 'success', label: 'Success', icon: CheckCircle2, color: 'bg-emerald-500/15 text-emerald-400 border-emerald-500/30 hover:bg-emerald-500/25' }, | |
| { id: 'error', label: 'Error', icon: XCircle, color: 'bg-red-500/15 text-red-400 border-red-500/30 hover:bg-red-500/25' }, | |
| { id: 'warning', label: 'Warning', icon: AlertTriangle, color: 'bg-amber-500/15 text-amber-400 border-amber-500/30 hover:bg-amber-500/25' }, | |
| { id: 'info', label: 'Info', icon: Info, color: 'bg-blue-500/15 text-blue-400 border-blue-500/30 hover:bg-blue-500/25' }, | |
| { id: 'neutral', label: 'Neutral', icon: Bell, color: 'bg-zinc-500/15 text-zinc-400 border-zinc-500/30 hover:bg-zinc-500/25' }, | |
| ]; | |
| const animations = [ | |
| { id: 'slideIn', label: 'Slide In', desc: 'Slides from right with spring' }, | |
| { id: 'slideInLeft', label: 'Slide Left', desc: 'Slides from left with spring' }, | |
| { id: 'slideUp', label: 'Slide Up', desc: 'Slides up from bottom' }, | |
| { id: 'slideDown', label: 'Slide Down', desc: 'Slides down from top' }, | |
| { id: 'fade', label: 'Fade', desc: 'Smooth fade in/out' }, | |
| { id: 'scale', label: 'Scale', desc: 'Scales from small to normal' }, | |
| { id: 'bounce', label: 'Bounce', desc: 'Springy bounce effect' }, | |
| { id: 'elastic', label: 'Elastic', desc: 'Elastic spring with movement' }, | |
| { id: 'flip', label: 'Flip', desc: '3D flip rotation' }, | |
| { id: 'swing', label: 'Swing', desc: 'Rotating swing effect' }, | |
| { id: 'zoomBounce', label: 'Zoom Bounce', desc: 'Dramatic zoom with bounce' }, | |
| ]; | |
| const positions = [ | |
| { id: 'top-left', label: 'Top Left' }, | |
| { id: 'top-center', label: 'Top Center' }, | |
| { id: 'top-right', label: 'Top Right' }, | |
| { id: 'bottom-left', label: 'Bottom Left' }, | |
| { id: 'bottom-center', label: 'Bottom Center' }, | |
| { id: 'bottom-right', label: 'Bottom Right' }, | |
| { id: 'center', label: 'Center' }, | |
| ]; | |
| export default function ControlPanel({ config, onConfigChange, onTrigger, onClearAll }) { | |
| const [activeTab, setActiveTab] = useState('content'); | |
| const tabs = [ | |
| { id: 'content', label: 'Content' }, | |
| { id: 'animation', label: 'Animation' }, | |
| { id: 'behavior', label: 'Behavior' }, | |
| ]; | |
| return ( | |
| <div className="space-y-6"> | |
| <div className="flex items-center gap-2 mb-4"> | |
| <Settings2 className="h-4 w-4 text-indigo-400" /> | |
| <h2 className="text-sm font-semibold text-white tracking-wide uppercase">Configuration</h2> | |
| </div> | |
| <div className="flex gap-1 p-1 rounded-xl bg-zinc-900/60 border border-white/[0.06]"> | |
| {tabs.map((tab) => ( | |
| <button | |
| key={tab.id} | |
| onClick={() => setActiveTab(tab.id)} | |
| className={`flex-1 px-3 py-2 text-xs font-medium rounded-lg transition-all duration-200 ${ | |
| activeTab === tab.id | |
| ? 'bg-white/[0.07] text-white shadow-sm' | |
| : 'text-zinc-500 hover:text-zinc-300' | |
| }`} | |
| > | |
| {tab.label} | |
| </button> | |
| ))} | |
| </div> | |
| {activeTab === 'content' && ( | |
| <div className="space-y-5 animate-in fade-in slide-in-from-top-2 duration-300"> | |
| <div> | |
| <label className="block text-xs font-medium text-zinc-400 mb-3">Alert Category</label> | |
| <div className="grid grid-cols-5 gap-2"> | |
| {categories.map((cat) => { | |
| const Icon = cat.icon; | |
| return ( | |
| <button | |
| key={cat.id} | |
| onClick={() => onConfigChange('category', cat.id)} | |
| className={`flex flex-col items-center gap-1.5 rounded-xl border px-2 py-3 transition-all duration-200 ${ | |
| config.category === cat.id | |
| ? `${cat.color} ring-1 ring-offset-1 ring-offset-zinc-950 ring-indigo-400/40` | |
| : 'border-white/[0.06] bg-zinc-900/40 text-zinc-500 hover:bg-zinc-800/60 hover:text-zinc-300' | |
| }`} | |
| > | |
| <Icon className="h-4 w-4" /> | |
| <span className="text-[10px] font-medium">{cat.label}</span> | |
| </button> | |
| ); | |
| })} | |
| </div> | |
| </div> | |
| <div> | |
| <label className="block text-xs font-medium text-zinc-400 mb-2">Alert Title</label> | |
| <input | |
| type="text" | |
| value={config.title} | |
| onChange={(e) => onConfigChange('title', e.target.value)} | |
| className="w-full rounded-xl border border-white/[0.06] bg-zinc-900/60 px-4 py-2.5 text-sm text-white placeholder-zinc-600 outline-none transition-all duration-200 focus:border-indigo-400/30 focus:ring-1 focus:ring-indigo-400/20" | |
| placeholder="Enter alert title..." | |
| /> | |
| </div> | |
| <div> | |
| <label className="block text-xs font-medium text-zinc-400 mb-2">Alert Message</label> | |
| <textarea | |
| value={config.message} | |
| onChange={(e) => onConfigChange('message', e.target.value)} | |
| rows={3} | |
| className="w-full resize-none rounded-xl border border-white/[0.06] bg-zinc-900/60 px-4 py-2.5 text-sm text-white placeholder-zinc-600 outline-none transition-all duration-200 focus:border-indigo-400/30 focus:ring-1 focus:ring-indigo-400/20" | |
| placeholder="Enter alert message..." | |
| /> | |
| </div> | |
| </div> | |
| )} | |
| {activeTab === 'animation' && ( | |
| <div className="space-y-5 animate-in fade-in slide-in-from-top-2 duration-300"> | |
| <div> | |
| <label className="block text-xs font-medium text-zinc-400 mb-3">Animation Style</label> | |
| <div className="grid grid-cols-2 gap-2"> | |
| {animations.map((anim) => ( | |
| <button | |
| key={anim.id} | |
| onClick={() => onConfigChange('animation', anim.id)} | |
| className={`flex flex-col items-start gap-1 rounded-xl border px-3 py-3 text-left transition-all duration-200 ${ | |
| config.animation === anim.id | |
| ? 'border-indigo-400/30 bg-indigo-400/8 text-white' | |
| : 'border-white/[0.06] bg-zinc-900/40 text-zinc-400 hover:bg-zinc-800/60 hover:text-zinc-300' | |
| }`} | |
| > | |
| <span className="text-xs font-semibold">{anim.label}</span> | |
| <span className="text-[10px] text-zinc-500">{anim.desc}</span> | |
| </button> | |
| ))} | |
| </div> | |
| </div> | |
| <div> | |
| <label className="block text-xs font-medium text-zinc-400 mb-3">Position</label> | |
| <div className="grid grid-cols-3 gap-2"> | |
| {positions.map((pos) => ( | |
| <button | |
| key={pos.id} | |
| onClick={() => onConfigChange('position', pos.id)} | |
| className={`rounded-xl border px-3 py-2 text-xs font-medium transition-all duration-200 ${ | |
| config.position === pos.id | |
| ? 'border-indigo-400/30 bg-indigo-400/8 text-indigo-300' | |
| : 'border-white/[0.06] bg-zinc-900/40 text-zinc-500 hover:bg-zinc-800/60 hover:text-zinc-300' | |
| }`} | |
| > | |
| {pos.label} | |
| </button> | |
| ))} | |
| </div> | |
| </div> | |
| </div> | |
| )} | |
| {activeTab === 'behavior' && ( | |
| <div className="space-y-5 animate-in fade-in slide-in-from-top-2 duration-300"> | |
| <div className="flex items-center justify-between rounded-xl border border-white/[0.06] bg-zinc-900/40 px-4 py-3"> | |
| <div> | |
| <span className="text-sm font-medium text-white">Auto Close</span> | |
| <p className="text |