import { useState, useEffect } from 'react'

function App() {
  const [health, setHealth] = useState<any>(null)

  useEffect(() => {
    fetch('/api/health')
      .then(r => r.json())
      .then(setHealth)
      .catch(console.error)
  }, [])

  return (
    <div className="min-h-screen flex items-center justify-center">
      <div className="p-6 rounded-lg bg-slate-800 shadow-xl max-w-md w-full">
        <h1 className="text-2xl font-bold mb-4 text-emerald-400">Extrudex</h1>
        <p className="text-slate-300 mb-4">React frontend scaffold</p>
        {health && (
          <pre className="text-xs bg-slate-900 p-3 rounded overflow-auto">
            {JSON.stringify(health, null, 2)}
          </pre>
        )}
      </div>
    </div>
  )
}

export default App
