Skip to content

Commit 6c2e12f

Browse files
LianaHusAniket-Engg
authored andcommitted
fixing recorder "run" btn behaviour
1 parent 33c6f22 commit 6c2e12f

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

libs/remix-ui/run-tab/src/lib/components/recorderCardUI.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ export function RecorderUI(props: RecorderProps) {
2020
}
2121

2222
useEffect(() => {
23-
if (props.currentFile && props.currentFile.endsWith('.json')) setEnableRunButton(false)
24-
else setEnableRunButton(true)
25-
}, [props.currentFile])
23+
if (props.txCount > 0 && props.currentFile && props.currentFile.endsWith('.json')) setEnableRunButton(true)
24+
else setEnableRunButton(false)
25+
console.log('props.txCount', props.txCount)
26+
}, [props.currentFile, props.txCount])
2627

2728
const toggleClass = () => {
2829
setToggleExpander(!toggleExpander)
@@ -47,7 +48,7 @@ export function RecorderUI(props: RecorderProps) {
4748
tooltipText={<FormattedMessage id="udapp.transactionsCountTooltip" />}
4849
>
4950
<div className="ml-2 badge badge-pill badge-primary text-center" style={{ cursor:"default" }} data-title="The number of recorded transactions">
50-
{props.count}
51+
{props.txCount}
5152
</div>
5253
</CustomTooltip>
5354
<CustomTooltip
@@ -96,18 +97,18 @@ export function RecorderUI(props: RecorderProps) {
9697
tooltipClasses="text-nowrap"
9798
tooltipId="remixUdappTransactionSavetooltip"
9899
tooltipText={
99-
props.count === 0
100+
props.txCount === 0
100101
? intl.formatMessage({ id: 'udapp.transactionSaveTooltip1' })
101-
: props.count === 1
102-
? intl.formatMessage({ id: 'udapp.transactionSaveTooltip2' }, { count: props.count })
103-
: intl.formatMessage({ id: 'udapp.transactionSaveTooltip3' }, { count: props.count })
102+
: props.txCount === 1
103+
? intl.formatMessage({ id: 'udapp.transactionSaveTooltip2' }, { count: props.txCount })
104+
: intl.formatMessage({ id: 'udapp.transactionSaveTooltip3' }, { count: props.txCount })
104105
}
105106
>
106107
<button
107108
className="btn btn-sm btn-secondary savetransaction udapp_recorder"
108-
disabled={props.count === 0 ? true : false}
109+
disabled={props.txCount === 0 ? true : false}
109110
onClick={triggerRecordButton}
110-
style={{ pointerEvents: props.count === 0 ? 'none' : 'auto' }}
111+
style={{ pointerEvents: props.txCount === 0 ? 'none' : 'auto' }}
111112
id="udappRecorderSave"
112113
>
113114
<FormattedMessage id="udapp.save" />
@@ -117,9 +118,9 @@ export function RecorderUI(props: RecorderProps) {
117118
<button
118119
className={enableRunButton ? "btn btn-sm btn-secondary runtransaction udapp_runTxs" : "btn btn-sm btn-secondary runtransaction udapp_runTxs disabled"}
119120
data-id="runtransaction"
120-
disabled={enableRunButton}
121+
disabled={!enableRunButton}
121122
onClick={handleClickRunButton}
122-
style={{ pointerEvents: enableRunButton ? 'none' : 'auto' }}
123+
style={{ pointerEvents: !enableRunButton ? 'none' : 'auto' }}
123124
id="udappRecorderRun"
124125
>
125126
<FormattedMessage id="udapp.run" />

libs/remix-ui/run-tab/src/lib/run-tab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ export function RunTabUI(props: RunTabProps) {
424424
storeScenario={storeNewScenario}
425425
runCurrentScenario={runScenario}
426426
scenarioPrompt={scenarioPrompt}
427-
count={runTab.recorder.transactionCount}
427+
txCount={runTab.recorder.transactionCount}
428428
currentFile={currentfile}
429429
/>
430430
<InstanceContainerUI

libs/remix-ui/run-tab/src/lib/types/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ export interface RecorderProps {
296296
gasEstimationPrompt: (msg: string) => JSX.Element,
297297
passphrasePrompt: (msg: string) => JSX.Element,
298298
scenarioPrompt: (msg: string, defaultValue: string) => JSX.Element,
299-
count: number
299+
txCount: number
300300
currentFile: string
301301
plugin: RunTab
302302
}

0 commit comments

Comments
 (0)