From a82cf2bf4e4275182db7b722600d526b7918dca6 Mon Sep 17 00:00:00 2001 From: Werner Date: Thu, 8 Jun 2023 17:57:43 -0300 Subject: [PATCH] Update instruction builder --- pages/index.js | 55 +++++++++++++++++++++----------------------------- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/pages/index.js b/pages/index.js index 874750b..43ebf4c 100644 --- a/pages/index.js +++ b/pages/index.js @@ -20,12 +20,11 @@ export default function Home() { const { updateProgram } = useContext(ProgramContext); const handleClick = () => { - const program = { name: 'John', age: 25 }; - updateProgram(program); + updateProgram(instructionList); router.push('/runner'); }; - const [instructionList, setInstructionList] = useState([]); + let [instructionList, setInstructionList] = useState([{}, {}, {}, {}, {}, {}]); return ( <> @@ -56,49 +55,41 @@ export default function Home() { - - - - - - + - {instructionList.map((instr, index) => ( + {instructionList.map((d, i) => ( -
OpOP RD RS RT
{`${instr.instrucao.operacao} ${instr.instrucao.registradorR} ${instr.instrucao.registradorS} ${instr.instrucao.registradorT}`} - - - - - - - - - - - + + + + + + + + + + + + + @@ -107,8 +98,8 @@ export default function Home() { @@ -117,8 +108,8 @@ export default function Home() {