recorderCardUI intl

pull/3342/head
drafish 2 years ago committed by Aniket
parent 952dc91ab3
commit 257c412c72
  1. 12
      apps/remix-ide/src/app/tabs/locales/en/udapp.json
  2. 12
      apps/remix-ide/src/app/tabs/locales/zh/udapp.json
  3. 26
      libs/remix-ui/run-tab/src/lib/components/recorderCardUI.tsx

@ -20,5 +20,15 @@
"udapp.deployedContracts": "Deployed Contracts",
"udapp.deployAndRunClearInstances": "Clear instances list and reset recorder",
"udapp.deployAndRunNoInstanceText": "Currently you have no contract instances to interact with.",
"udapp.transactionsRecorded": "Transactions recorded"
"udapp.transactionsRecorded": "Transactions recorded",
"udapp.transactionsCountTooltip": "The number of recorded transactions",
"udapp.transactionSaveTooltip1": "No transactions to save",
"udapp.transactionSaveTooltip2": "Save {count} transaction as scenario file",
"udapp.transactionSaveTooltip3": "Save {count} transactions as scenario file",
"udapp.infoRecorderTooltip": "Save transactions (deployed contracts and function executions) {br}and replay them in another environment e.g Transactions created {br}in Remix VM can be replayed in the Injected Provider.",
"udapp.livemodeRecorderTooltip": "If contracts are updated after recording transactions,{br} checking this box will run recorded transactions {br}with the latest copy of the compiled contracts",
"udapp.livemodeRecorderLabel": "Run transactions using the latest compilation result",
"udapp.runRecorderTooltip": "Run transaction(s) from the current scenario file",
"udapp.save": "Save",
"udapp.run": "Run"
}

@ -20,5 +20,15 @@
"udapp.deployedContracts": "已部署的合约",
"udapp.deployAndRunClearInstances": "清空合约实例并重置交易记录",
"udapp.deployAndRunNoInstanceText": "当前您没有可交互的合约实例.",
"udapp.transactionsRecorded": "已记录的交易"
"udapp.transactionsRecorded": "已记录的交易",
"udapp.transactionsCountTooltip": "已记录的交易数",
"udapp.transactionSaveTooltip1": "没有可保存的交易",
"udapp.transactionSaveTooltip2": "将 {count} 笔交易保存到一个场景文件",
"udapp.transactionSaveTooltip3": "将 {count} 笔交易保存到一个场景文件",
"udapp.infoRecorderTooltip": "保存交易 (合约部署和方法执行) {br}然后在另一个环境中回放,比如在 Remix VM {br}创建的交易可以在 Injected Provider 中回放。",
"udapp.livemodeRecorderTooltip": "如果记录交易后合约有更新,{br}选中这个复选框就会以最新的{br}合约编译结果执行已记录的交易",
"udapp.livemodeRecorderLabel": "用最新的编译结果执行交易",
"udapp.runRecorderTooltip": "从当前场景文件中执行交易",
"udapp.save": "保存",
"udapp.run": "执行"
}

@ -1,6 +1,6 @@
// eslint-disable-next-line no-use-before-define
import React, {useRef, useState, useEffect} from 'react'
import { FormattedMessage } from 'react-intl'
import { FormattedMessage, useIntl } from 'react-intl'
import { RecorderProps } from '../types'
import { CustomTooltip } from '@remix-ui/helper'
@ -8,6 +8,8 @@ export function RecorderUI (props: RecorderProps) {
const inputLive = useRef<HTMLInputElement>()
const [toggleExpander, setToggleExpander] = useState<boolean>(false)
const [enableRunButton, setEnableRunButton] = useState<boolean>(true)
const intl = useIntl()
const triggerRecordButton = () => {
props.storeScenario(props.scenarioPrompt)
}
@ -38,7 +40,7 @@ export function RecorderUI (props: RecorderProps) {
placement={'right'}
tooltipClasses="text-nowrap"
tooltipId="recordedTransactionsCounttooltip"
tooltipText={'The number of recorded transactions'}
tooltipText={<FormattedMessage id='udapp.transactionsCountTooltip' />}
>
<div className="ml-2 badge badge-pill badge-primary text-center" data-title="The number of recorded transactions">{props.count}</div>
</CustomTooltip>
@ -46,7 +48,7 @@ export function RecorderUI (props: RecorderProps) {
placement={'right'}
tooltipClasses="text-wrap"
tooltipId="info-recorder"
tooltipText={<span>Save transactions (deployed contracts and function executions) <br />and replay them in another environment e.g Transactions created <br />in Remix VM can be replayed in the Injected Provider.</span>}
tooltipText={<span><FormattedMessage id='udapp.infoRecorderTooltip' values={{ br: <br /> }} /></span>}
>
<i style={{ fontSize: 'medium' }} className={'ml-2 fal fa-info-circle align-self-center'} aria-hidden="true"></i>
</CustomTooltip>
@ -64,9 +66,11 @@ export function RecorderUI (props: RecorderProps) {
placement={'right'}
tooltipClasses="text-wrap"
tooltipId="tooltip-livemode-recorder"
tooltipText={<span>If contracts are updated after recording transactions,<br/> checking this box will run recorded transactions <br/>with the latest copy of the compiled contracts</span>}
tooltipText={<span><FormattedMessage id='udapp.livemodeRecorderTooltip' values={{ br: <br /> }} /></span>}
>
<label className="form-check-label custom-control-label" data-id="runtabLivemodeInput" htmlFor="livemode-recorder">Run transactions using the latest compilation result</label>
<label className="form-check-label custom-control-label" data-id="runtabLivemodeInput" htmlFor="livemode-recorder">
<FormattedMessage id='udapp.livemodeRecorderLabel' />
</label>
</CustomTooltip>
</div>
<div className="mb-1 mt-1 udapp_transactionActions">
@ -75,14 +79,14 @@ export function RecorderUI (props: RecorderProps) {
tooltipClasses="text-nowrap"
tooltipId="remixUdappTransactionSavetooltip"
tooltipText={
props.count === 0 ? 'No transactions to save'
: props.count === 1 ? `Save ${props.count} transaction as scenario file`
: `Save ${props.count} transactions as scenario file`
props.count === 0 ? intl.formatMessage({ id: 'udapp.transactionSaveTooltip1' })
: props.count === 1 ? intl.formatMessage({ id: 'udapp.transactionSaveTooltip2' }, { count: props.count })
: intl.formatMessage({ id: 'udapp.transactionSaveTooltip3' }, { count: props.count })
}
>
<span>
<button className="btn btn-sm btn-info savetransaction udapp_recorder" disabled={props.count === 0 ? true: false} onClick={triggerRecordButton} style={{ pointerEvents: props.count === 0 ? 'none' : 'auto' }}>
Save
<FormattedMessage id='udapp.save' />
</button>
</span>
</CustomTooltip>
@ -90,11 +94,11 @@ export function RecorderUI (props: RecorderProps) {
placement={'right'}
tooltipClasses="text-nowrap"
tooltipId="tooltip-run-recorder"
tooltipText="Run transaction(s) from the current scenario file"
tooltipText={<FormattedMessage id='udapp.runRecorderTooltip' />}
>
<span>
<button className="btn btn-sm btn-info runtransaction udapp_runTxs" data-id="runtransaction" disabled={enableRunButton} onClick={handleClickRunButton} style={{ pointerEvents: enableRunButton ? 'none' : 'auto' }}>
Run
<FormattedMessage id='udapp.run' />
</button>
</span>
</CustomTooltip>

Loading…
Cancel
Save