Upload pages/index.js with huggingface_hub
Browse files- pages/index.js +52 -9
pages/index.js
CHANGED
|
@@ -5,12 +5,20 @@ import TutorialOverlay from '../components/TutorialOverlay'
|
|
| 5 |
import NodeEditor from '../components/NodeEditor'
|
| 6 |
import Toolbar from '../components/Toolbar'
|
| 7 |
import PropertiesPanel from '../components/PropertiesPanel'
|
|
|
|
| 8 |
import { useTutorial } from '../components/TutorialContext'
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
export default function Home() {
|
| 11 |
const [showWizard, setShowWizard] = useState(false)
|
| 12 |
const [hasSeenWizard, setHasSeenWizard] = useState(true)
|
|
|
|
|
|
|
| 13 |
const { isTutorialActive } = useTutorial()
|
|
|
|
|
|
|
| 14 |
const [selectedNode, setSelectedNode] = useState(null)
|
| 15 |
const [nodes, setNodes] = useState([])
|
| 16 |
const [connections, setConnections] = useState([])
|
|
@@ -35,6 +43,10 @@ export default function Home() {
|
|
| 35 |
localStorage.setItem('hasSeenSetupWizard', 'true')
|
| 36 |
}
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
return (
|
| 39 |
<>
|
| 40 |
<Head>
|
|
@@ -43,29 +55,51 @@ export default function Home() {
|
|
| 43 |
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 44 |
</Head>
|
| 45 |
|
| 46 |
-
<div className=
|
| 47 |
{/* Header */}
|
| 48 |
-
<header className=
|
| 49 |
<div className="flex items-center space-x-4">
|
| 50 |
-
<
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
</div>
|
| 53 |
<div className="flex items-center space-x-3">
|
| 54 |
<button
|
| 55 |
onClick={() => window.dispatchEvent(new CustomEvent('start-tutorial'))}
|
| 56 |
-
className="px-4 py-2 text-sm font-medium text-primary-600 bg-primary-50 rounded-lg hover:bg-primary-100 transition-colors"
|
| 57 |
>
|
| 58 |
-
|
|
|
|
| 59 |
</button>
|
| 60 |
-
<button
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
</button>
|
| 63 |
</div>
|
| 64 |
</header>
|
| 65 |
|
| 66 |
{/* Main Content */}
|
| 67 |
<div className="flex flex-1 overflow-hidden">
|
| 68 |
-
<Toolbar />
|
| 69 |
<NodeEditor
|
| 70 |
nodes={nodes}
|
| 71 |
setNodes={setNodes}
|
|
@@ -90,6 +124,15 @@ export default function Home() {
|
|
| 90 |
|
| 91 |
{/* Tutorial Overlay */}
|
| 92 |
{isTutorialActive && <TutorialOverlay />}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
</div>
|
| 94 |
</>
|
| 95 |
)
|
|
|
|
| 5 |
import NodeEditor from '../components/NodeEditor'
|
| 6 |
import Toolbar from '../components/Toolbar'
|
| 7 |
import PropertiesPanel from '../components/PropertiesPanel'
|
| 8 |
+
import CodeExportModal from '../components/CodeExportModal'
|
| 9 |
import { useTutorial } from '../components/TutorialContext'
|
| 10 |
+
import { useProject } from '../components/ProjectContext'
|
| 11 |
+
import { useTheme } from '../components/ThemeContext'
|
| 12 |
+
import { Menu, Moon, Sun, Download, BookOpen } from 'lucide-react'
|
| 13 |
|
| 14 |
export default function Home() {
|
| 15 |
const [showWizard, setShowWizard] = useState(false)
|
| 16 |
const [hasSeenWizard, setHasSeenWizard] = useState(true)
|
| 17 |
+
const [showExportModal, setShowExportModal] = useState(false)
|
| 18 |
+
const [sidebarOpen, setSidebarOpen] = useState(false)
|
| 19 |
const { isTutorialActive } = useTutorial()
|
| 20 |
+
const { saveProject } = useProject()
|
| 21 |
+
const { theme, toggleTheme } = useTheme()
|
| 22 |
const [selectedNode, setSelectedNode] = useState(null)
|
| 23 |
const [nodes, setNodes] = useState([])
|
| 24 |
const [connections, setConnections] = useState([])
|
|
|
|
| 43 |
localStorage.setItem('hasSeenSetupWizard', 'true')
|
| 44 |
}
|
| 45 |
|
| 46 |
+
const handleExport = () => {
|
| 47 |
+
setShowExportModal(true)
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
return (
|
| 51 |
<>
|
| 52 |
<Head>
|
|
|
|
| 55 |
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 56 |
</Head>
|
| 57 |
|
| 58 |
+
<div className={`flex flex-col h-screen ${theme === 'dark' ? 'bg-gray-900' : 'bg-gray-50'}`}>
|
| 59 |
{/* Header */}
|
| 60 |
+
<header className={`${theme === 'dark' ? 'bg-gray-800 border-gray-700' : 'bg-white border-gray-200'} border-b px-6 py-3 flex items-center justify-between`}>
|
| 61 |
<div className="flex items-center space-x-4">
|
| 62 |
+
<button
|
| 63 |
+
onClick={() => setSidebarOpen(!sidebarOpen)}
|
| 64 |
+
className={`p-2 rounded-lg ${theme === 'dark' ? 'text-gray-300 hover:bg-gray-700' : 'text-gray-600 hover:bg-gray-100'} transition-colors lg:hidden`}
|
| 65 |
+
>
|
| 66 |
+
<Menu className="w-5 h-5" />
|
| 67 |
+
</button>
|
| 68 |
+
<div className="flex items-center space-x-3">
|
| 69 |
+
<div className="w-8 h-8 bg-gradient-to-br from-primary-500 to-primary-700 rounded-lg flex items-center justify-center">
|
| 70 |
+
<span className="text-white font-bold text-sm">NA</span>
|
| 71 |
+
</div>
|
| 72 |
+
<h1 className="text-2xl font-bold text-primary-600">NeuroArch Studio</h1>
|
| 73 |
+
<span className="text-xs text-gray-500">Built with <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" rel="noopener noreferrer" className="text-primary-500 hover:underline">anycoder</a></span>
|
| 74 |
+
</div>
|
| 75 |
</div>
|
| 76 |
<div className="flex items-center space-x-3">
|
| 77 |
<button
|
| 78 |
onClick={() => window.dispatchEvent(new CustomEvent('start-tutorial'))}
|
| 79 |
+
className="px-4 py-2 text-sm font-medium text-primary-600 bg-primary-50 rounded-lg hover:bg-primary-100 transition-colors flex items-center space-x-2"
|
| 80 |
>
|
| 81 |
+
<BookOpen className="w-4 h-4" />
|
| 82 |
+
<span>Tutorial</span>
|
| 83 |
</button>
|
| 84 |
+
<button
|
| 85 |
+
onClick={toggleTheme}
|
| 86 |
+
className={`p-2 rounded-lg ${theme === 'dark' ? 'text-gray-300 hover:bg-gray-700' : 'text-gray-600 hover:bg-gray-100'} transition-colors`}
|
| 87 |
+
>
|
| 88 |
+
{theme === 'dark' ? <Sun className="w-5 h-5" /> : <Moon className="w-5 h-5" />}
|
| 89 |
+
</button>
|
| 90 |
+
<button
|
| 91 |
+
onClick={handleExport}
|
| 92 |
+
className="px-4 py-2 text-sm font-medium text-white bg-primary-600 rounded-lg hover:bg-primary-700 transition-colors flex items-center space-x-2"
|
| 93 |
+
>
|
| 94 |
+
<Download className="w-4 h-4" />
|
| 95 |
+
<span>Export</span>
|
| 96 |
</button>
|
| 97 |
</div>
|
| 98 |
</header>
|
| 99 |
|
| 100 |
{/* Main Content */}
|
| 101 |
<div className="flex flex-1 overflow-hidden">
|
| 102 |
+
<Toolbar sidebarOpen={sidebarOpen} setSidebarOpen={setSidebarOpen} />
|
| 103 |
<NodeEditor
|
| 104 |
nodes={nodes}
|
| 105 |
setNodes={setNodes}
|
|
|
|
| 124 |
|
| 125 |
{/* Tutorial Overlay */}
|
| 126 |
{isTutorialActive && <TutorialOverlay />}
|
| 127 |
+
|
| 128 |
+
{/* Code Export Modal */}
|
| 129 |
+
{showExportModal && (
|
| 130 |
+
<CodeExportModal
|
| 131 |
+
nodes={nodes}
|
| 132 |
+
connections={connections}
|
| 133 |
+
onClose={() => setShowExportModal(false)}
|
| 134 |
+
/>
|
| 135 |
+
)}
|
| 136 |
</div>
|
| 137 |
</>
|
| 138 |
)
|