"use client"; import { useEditorStore } from "../store/editor-zustand"; function StudioEditor() { const openTabs = useEditorStore((s) => s.openTabs); const activeTabId = useEditorStore((s) => s.activeTabId); const setActiveTab = useEditorStore((s) => s.setActiveTab); const closeTab = useEditorStore((s) => s.closeTab); // Find active file const activeFile = openTabs.find(f => f.id === activeTabId); return (
{openTabs.length === 0 && (
No files open
)} {openTabs.map((file) => (
setActiveTab(file.id)} style={{ cursor: "pointer" }} > 📄 {file.name} { e.stopPropagation(); closeTab(file.id); }} >×
))}
{activeFile ? ( activeFile.content.split("\n").map((line, i) => (
{i + 1}
{line}
)) ) : (
No file open. Select a file to begin.
)}
); } export default StudioEditor;