import { HashRouter, Routes, Route, Navigate } from 'react-router-dom'
import Login from '@/pages/Login'
import MainLayout from '@/layouts/MainLayout'
import AssetLibrary from '@/pages/assets/AssetLibrary'

// Placeholder for other pages to avoid 404s during demo
const PlaceholderPage = ({ title }: { title: string }) => (
  <div className="flex items-center justify-center h-full text-slate-400">
    <div className="text-center">
      <h2 className="text-2xl font-bold mb-2">{title}</h2>
      <p>功能开发中...</p>
    </div>
  </div>
)

function App() {
  return (
    <HashRouter>
      <Routes>
        <Route path="/" element={<Login />} />
        
        {/* Main Application Routes */}
        <Route path="/app" element={<MainLayout />}>
          <Route index element={<Navigate to="/app/plugins" replace />} />
          <Route path="plugins" element={<AssetLibrary />} />
          <Route path="components" element={<PlaceholderPage title="组件库" />} />
          <Route path="tools" element={<PlaceholderPage title="工具库" />} />
          <Route path="prototypes" element={<PlaceholderPage title="原型库" />} />
          <Route path="design" element={<PlaceholderPage title="设计库" />} />
          <Route path="projects" element={<PlaceholderPage title="项目库" />} />
          <Route path="files" element={<PlaceholderPage title="文件库" />} />
          <Route path="cases" element={<PlaceholderPage title="案例库" />} />
          <Route path="pending" element={<PlaceholderPage title="待审核" />} />
        </Route>

        {/* Legacy/Redirects */}
        <Route path="/dashboard" element={<Navigate to="/app" replace />} />
      </Routes>
    </HashRouter>
  )
}

export default App
