Spaces:
No application file
No application file
Download src/components/NewProjectModal.tsx from usrrootkali/Awakened_RiShre: direct link, hf CLI and curl.
- Browser
- Download file 6.71 kB
-
https://huggingface.co/spaces/usrrootkali/Awakened_RiShre/resolve/main/src/components/NewProjectModal.tsx
- Command line
-
hf download hf://spaces/usrrootkali/Awakened_RiShre/src/components/NewProjectModal.tsx
-
curl -L -o NewProjectModal.tsx https://huggingface.co/spaces/usrrootkali/Awakened_RiShre/resolve/main/src/components/NewProjectModal.tsx
6.71 kB
| import React, { useState } from 'react'; | |
| import { SAMPLE_PROJECTS } from '../constants/sampleProjects'; | |
| import { FolderPlus, X, Sparkles, Layers } from 'lucide-react'; | |
| interface NewProjectModalProps { | |
| isOpen: boolean; | |
| onClose: () => void; | |
| onCreateProject: (name: string, description: string, templateId?: string) => void; | |
| } | |
| export const NewProjectModal: React.FC<NewProjectModalProps> = ({ | |
| isOpen, | |
| onClose, | |
| onCreateProject, | |
| }) => { | |
| const [name, setName] = useState(''); | |
| const [description, setDescription] = useState(''); | |
| const [selectedTemplate, setSelectedTemplate] = useState<string>('scratch'); | |
| if (!isOpen) return null; | |
| const handleSubmit = (e: React.FormEvent) => { | |
| e.preventDefault(); | |
| if (!name.trim()) return; | |
| onCreateProject( | |
| name.trim(), | |
| description.trim() || 'Created with RiShre AI Vibe Coding Platform', | |
| selectedTemplate !== 'scratch' ? selectedTemplate : undefined | |
| ); | |
| setName(''); | |
| setDescription(''); | |
| setSelectedTemplate('scratch'); | |
| onClose(); | |
| }; | |
| return ( | |
| <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/75 backdrop-blur-md p-4 animate-in fade-in"> | |
| <div className="w-full max-w-lg bg-[#0c061a] border border-purple-500/30 rounded-3xl shadow-[0_0_60px_rgba(168,85,247,0.25)] overflow-hidden flex flex-col"> | |
| {/* Header */} | |
| <div className="px-6 py-4 bg-[#120826]/90 border-b border-purple-500/25 flex items-center justify-between"> | |
| <div className="flex items-center gap-2.5"> | |
| <div className="w-6 h-6 rounded-lg bg-gradient-to-tr from-purple-600 to-fuchsia-500 flex items-center justify-center shadow-[0_0_10px_rgba(168,85,247,0.4)]"> | |
| <FolderPlus className="w-3.5 h-3.5 text-white" /> | |
| </div> | |
| <h2 className="text-sm font-bold text-white tracking-wide">Create New Vibe Project</h2> | |
| </div> | |
| <button | |
| onClick={onClose} | |
| aria-label="Close" | |
| className="p-1 rounded-lg text-purple-300 hover:text-white transition-colors cursor-pointer" | |
| > | |
| <X className="w-4 h-4" /> | |
| </button> | |
| </div> | |
| {/* Form */} | |
| <form onSubmit={handleSubmit} className="p-6 space-y-5"> | |
| <div className="space-y-1.5"> | |
| <label className="text-xs font-bold text-purple-200 font-mono">Project Name</label> | |
| <input | |
| type="text" | |
| required | |
| autoFocus | |
| placeholder="e.g. Royal Void Dashboard" | |
| value={name} | |
| onChange={(e) => setName(e.target.value)} | |
| className="w-full bg-[#120826] border border-purple-500/30 rounded-xl px-3.5 py-2 text-xs text-white focus:outline-none focus:border-purple-400 font-mono shadow-inner" | |
| /> | |
| </div> | |
| <div className="space-y-1.5"> | |
| <label className="text-xs font-bold text-purple-200 font-mono">Description (Optional)</label> | |
| <input | |
| type="text" | |
| placeholder="Brief summary of what this application does..." | |
| value={description} | |
| onChange={(e) => setDescription(e.target.value)} | |
| className="w-full bg-[#120826] border border-purple-500/30 rounded-xl px-3.5 py-2 text-xs text-white focus:outline-none focus:border-purple-400 font-mono shadow-inner" | |
| /> | |
| </div> | |
| {/* Starter Template Selection */} | |
| <div className="space-y-2"> | |
| <label className="text-xs font-bold text-purple-200 font-mono flex items-center gap-1.5"> | |
| <Layers className="w-3.5 h-3.5 text-fuchsia-400" /> | |
| <span>Starting Preset</span> | |
| </label> | |
| <div className="grid grid-cols-1 gap-2 max-h-48 overflow-y-auto pr-1"> | |
| <div | |
| onClick={() => setSelectedTemplate('scratch')} | |
| className={`p-3 rounded-2xl border text-xs transition-all cursor-pointer ${ | |
| selectedTemplate === 'scratch' | |
| ? 'bg-purple-600/20 border-purple-400/50 text-purple-100 shadow-[0_0_15px_rgba(168,85,247,0.2)]' | |
| : 'bg-[#120826]/70 border-purple-500/20 text-purple-300 hover:border-purple-400/40' | |
| }`} | |
| > | |
| <div className="font-bold flex items-center gap-1.5"> | |
| <Sparkles className="w-3.5 h-3.5 text-fuchsia-400" /> | |
| <span>Start from Scratch (Empty Vibe Workspace)</span> | |
| </div> | |
| <p className="text-[11px] text-purple-300/70 mt-0.5"> | |
| Fresh canvas with boilerplate index.html, style.css, and app.js. | |
| </p> | |
| </div> | |
| {SAMPLE_PROJECTS.map((sp) => ( | |
| <div | |
| key={sp.id} | |
| onClick={() => { | |
| setSelectedTemplate(sp.id); | |
| if (!name) setName(sp.name); | |
| if (!description) setDescription(sp.description); | |
| }} | |
| className={`p-3 rounded-2xl border text-xs transition-all cursor-pointer ${ | |
| selectedTemplate === sp.id | |
| ? 'bg-purple-600/20 border-purple-400/50 text-purple-100 shadow-[0_0_15px_rgba(168,85,247,0.2)]' | |
| : 'bg-[#120826]/70 border-purple-500/20 text-purple-300 hover:border-purple-400/40' | |
| }`} | |
| > | |
| <div className="font-bold flex items-center gap-1.5"> | |
| <span>⚡</span> | |
| <span>{sp.name}</span> | |
| </div> | |
| <p className="text-[11px] text-purple-300/70 mt-0.5">{sp.description}</p> | |
| </div> | |
| ))} | |
| </div> | |
| </div> | |
| {/* Footer */} | |
| <div className="flex justify-end gap-2 pt-2 border-t border-purple-500/25"> | |
| <button | |
| type="button" | |
| onClick={onClose} | |
| className="px-4 py-2 rounded-xl text-xs font-medium text-purple-300 hover:text-white transition-colors cursor-pointer" | |
| > | |
| Cancel | |
| </button> | |
| <button | |
| type="submit" | |
| disabled={!name.trim()} | |
| className="px-5 py-2 rounded-xl bg-gradient-to-r from-purple-600 via-fuchsia-600 to-pink-500 hover:from-purple-500 hover:to-pink-500 text-white font-bold text-xs uppercase tracking-wider transition-all shadow-[0_0_20px_rgba(168,85,247,0.4)] disabled:opacity-50 cursor-pointer active:scale-95" | |
| > | |
| Create Project | |
| </button> | |
| </div> | |
| </form> | |
| </div> | |
| </div> | |
| ); | |
| }; | |