Simulation wire

This commit is contained in:
moxitech 2024-11-16 14:51:56 +07:00
parent ef938ab84a
commit fb55999d47
2 changed files with 22 additions and 18 deletions

View File

@ -61,6 +61,11 @@ const InitPlayer: React.FC<Player> = ({ Click, TimeStep, TimeEnd, onTimeUpdate }
return ( return (
<div className="bg-slate-600 p-4 rounded-md w-full max-w-md mx-auto"> <div className="bg-slate-600 p-4 rounded-md w-full max-w-md mx-auto">
<div className="flex items-center space-x-4"> <div className="flex items-center space-x-4">
<a href='/pages/simulations'
className={`text-white p-2 rounded-md bg-green-600`}
>
{"Назад"}
</a>
{/* Кнопка старт/стоп симуляции */} {/* Кнопка старт/стоп симуляции */}
<button <button
onClick={handlePlayPause} onClick={handlePlayPause}

View File

@ -8,38 +8,37 @@ const Simulations: React.FC = () => {
const [activeSimulationWindow, setActiveSimulationWindow] = useState(false); const [activeSimulationWindow, setActiveSimulationWindow] = useState(false);
const [mathServer, setMathServer] = useState(""); const [mathServer, setMathServer] = useState("");
const [simulationDto, setSimulationDto] = useState({}); const [simulationDto, setSimulationDto] = useState({});
const ActiveSimulation = (value: boolean) => setActiveSimulationWindow(value);
const ActiveSimulation = (value: boolean) => {
// Используя mathServer - отправляем массив данных
// Устанавливает окно симуляции
setActiveSimulationWindow(value);
};
useEffect(() => { useEffect(() => {
// let value = SendRequestGetLink()
// value.then(e => {
// if (e.status == 1002){
// e.json().then( res =>{
// if (res.link) {
// setMathServer(res.link)
// }})}
// })
setMathServer("localhost:10000/run/sumulation") setMathServer("localhost:10000/run/sumulation")
}, []) }, [])
// => localhost:10000/run/sumulation
return ( return (
<div className="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]"> <div className="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]">
{/* TEST : MATH SERVER ENDPOINT */}
{/* <p>{mathServer}</p> */}
<main id="modal-root"> <main id="modal-root">
{activeSimulationWindow ? {
activeSimulationWindow ?
<div> <div>
<InitPlayer <InitPlayer
Click={() => {}} Click={() => {}}
TimeEnd={100} TimeEnd={100}
TimeStep={1} TimeStep={1}
></InitPlayer> />
</div> : <ThreeJsInstance Click={ActiveSimulation}/>} </div> : <ThreeJsInstance
Click={ActiveSimulation}
/>
}
</main> </main>
<footer className="row-start-3 flex gap-6 flex-wrap items-center justify-center"> <footer className="row-start-3 flex gap-6 flex-wrap items-center justify-center">
</footer> </footer>
</div> </div>