import { useState, useEffect } from 'react' import Plot from 'react-plotly.js' import { getLandscape } from '../lib/api.js' const TEMPLATES = [ 'quadratic', 'rosenbrock', 'styblinski_tang', 'huber', 'gaussian_mix', 'himmelblau', 'plateau', 'cliff', ] export function LandscapeExplorer() { const [template, setTemplate] = useState('rosenbrock') const [dim, setDim] = useState(2) const [seed, setSeed] = useState(0) const [data, setData] = useState(null) const [loading, setLoading] = useState(false) async function build() { setLoading(true) try { const d = await getLandscape({ template, dim, seed }) setData(d) } finally { setLoading(false) } } useEffect(() => { build() /* initial load */ // eslint-disable-next-line }, []) return (
| {k} | {v} |