This repository has been archived by the owner on Nov 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 363
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into components-support-eip3770-prefixes
- Loading branch information
Showing
37 changed files
with
568 additions
and
1,065 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ src/types/gateway/ | |
tsconfig.tsbuildinfo | ||
public/**/*.js | ||
jest.results.json | ||
*.#* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,40 @@ | ||
import { ReactElement } from 'react' | ||
import { ReactElement, useEffect, useState } from 'react' | ||
import { Checkbox, FormControlLabel } from '@material-ui/core' | ||
import { getLastTx } from 'src/logic/safe/store/actions/utils' | ||
import Row from 'src/components/layout/Row' | ||
import { extractSafeAddress } from 'src/routes/routes' | ||
|
||
interface ExecuteCheckboxProps { | ||
onChange: (val: boolean) => unknown | ||
} | ||
|
||
const ExecuteCheckbox = ({ onChange }: ExecuteCheckboxProps): ReactElement => { | ||
const ExecuteCheckbox = ({ onChange }: ExecuteCheckboxProps): ReactElement | null => { | ||
const [isVisible, setVisible] = useState<boolean>(false) | ||
const safeAddress = extractSafeAddress() | ||
|
||
const handleChange = (e: React.ChangeEvent<HTMLInputElement>): void => { | ||
onChange(e.target.checked) | ||
} | ||
|
||
return ( | ||
useEffect(() => { | ||
if (!safeAddress) return | ||
|
||
const checkLastTx = async () => { | ||
const lastTx = await getLastTx(safeAddress) | ||
setVisible(!lastTx || lastTx.isExecuted) | ||
} | ||
checkLastTx() | ||
}, [safeAddress, setVisible]) | ||
|
||
return isVisible ? ( | ||
<Row margin="md"> | ||
<FormControlLabel | ||
control={<Checkbox defaultChecked={true} color="primary" onChange={handleChange} />} | ||
control={<Checkbox defaultChecked color="primary" onChange={handleChange} />} | ||
label="Execute transaction" | ||
data-testid="execute-checkbox" | ||
/> | ||
</Row> | ||
) | ||
) : null | ||
} | ||
|
||
export default ExecuteCheckbox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.