From eca6d52129f6c9aa780fbbb9b0fd3cb3bd9fe844 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Mon, 19 Oct 2020 16:54:04 +0100 Subject: [PATCH] Extract button navigator dependencies --- .../lib/button-navigator/button-navigator.tsx | 18 +++++------ .../src/lib/step-manager/step-manager.tsx | 30 ++++++++++++++++--- 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx b/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx index c0b32ac961..8e2a893227 100644 --- a/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx @@ -1,7 +1,7 @@ import React, { useState, useEffect } from 'react' import './button-navigator.css' -export const ButtonNavigation = ({ stepManager, revertedReason, stepState, jumpOutDisabled }) => { +export const ButtonNavigation = ({ stepOverBack, stepIntoBack, stepIntoForward, stepOverForward, jumpOut, jumpPreviousBreakpoint, jumpNextBreakpoint, jumpToException, revertedReason, stepState, jumpOutDisabled }) => { const [state, setState] = useState({ intoBackDisabled: true, overBackDisabled: true, @@ -53,19 +53,19 @@ export const ButtonNavigation = ({ stepManager, revertedReason, stepState, jumpO return (
- - - - + + + +
- - - + + +
- State changes made during this call will be reverted. This call will run out of gas. diff --git a/libs/remix-ui/debugger-ui/src/lib/step-manager/step-manager.tsx b/libs/remix-ui/debugger-ui/src/lib/step-manager/step-manager.tsx index 4745b03b22..a0cf47e5a7 100644 --- a/libs/remix-ui/debugger-ui/src/lib/step-manager/step-manager.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/step-manager/step-manager.tsx @@ -3,6 +3,19 @@ import Slider from '../slider/slider' import ButtonNavigator from '../button-navigator/button-navigator' export const StepManager = ({ stepManager }) => { + const { jumpTo, traceLength, stepOverBack, stepIntoBack, stepIntoForward, stepOverForward, jumpOut, jumpPreviousBreakpoint, jumpNextBreakpoint, jumpToException } = stepManager + + if (stepManager) { + jumpTo.bind(stepManager) + stepOverBack.bind(stepManager) + stepIntoBack.bind(stepManager) + stepIntoForward.bind(stepManager) + stepOverForward.bind(stepManager) + jumpOut.bind(stepManager) + jumpPreviousBreakpoint.bind(stepManager) + jumpNextBreakpoint.bind(stepManager) + jumpToException.bind(stepManager) + } const [state, setState] = useState({ sliderValue: 0, revertWarning: '', @@ -28,15 +41,24 @@ export const StepManager = ({ stepManager }) => { return { ...prevState, sliderValue: step, stepState, jumpOutDisabled } }) } - const { sliderValue, revertWarning, stepState, jumpOutDisabled } = state - const jumpTo = stepManager ? stepManager.jumpTo.bind(stepManager) : null - const traceLength = stepManager ? stepManager.traceLength : null return (
- +
) }