import React from 'react'
import { useLocation } from 'react-router-dom'
import Sidebar from './Sidebar'
import TitleBar from './TitleBar'

interface LayoutProps {
  children: React.ReactNode
}

const Layout: React.FC<LayoutProps> = ({ children }) => {
  const location = useLocation()
  const isEditorPage = location.pathname === '/editor'

  return (
    <div className="h-screen flex flex-col bg-secondary-50">
      <TitleBar />
      <div className="flex flex-1 min-h-0">
        {!isEditorPage && <Sidebar />}
        <main className="flex-1 overflow-auto">
          {children}
        </main>
      </div>
    </div>
  )
}

export default Layout
