Skip to content

Commit

Permalink
add copy tx data button
Browse files Browse the repository at this point in the history
  • Loading branch information
samepant committed Mar 5, 2024
1 parent 88d06f0 commit f194812
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 8 deletions.
1 change: 1 addition & 0 deletions extension/src/browser/Drawer/Submit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ const Submit: React.FC = () => {
<Button
onClick={connectWallet}
disabled={!submitTransactions || transactions.length === 0}
secondary
>
Connect wallet to submit
</Button>
Expand Down
22 changes: 19 additions & 3 deletions extension/src/browser/Drawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ import { RiFileCopy2Line, RiRefreshLine } from 'react-icons/ri'
import { encodeMulti, encodeSingle } from 'react-multisend'
import { toast } from 'react-toastify'

import { BlockButton, Box, Drawer, Flex, IconButton } from '../../components'
import {
BlockButton,
Box,

Check warning on line 8 in extension/src/browser/Drawer/index.tsx

View workflow job for this annotation

GitHub Actions / tests

'Box' is defined but never used. Allowed unused vars must match /^_/u
Button,
Drawer,
Flex,
IconButton,
} from '../../components'
import { ForkProvider } from '../../providers'
import { wrapRequest } from '../../providers/WrappingProvider'
import { useConnection } from '../../connections'
Expand Down Expand Up @@ -166,9 +173,18 @@ const TransactionsDrawer: React.FC = () => {
</p>
)}
</Flex>
<Box p={2} bg>
<Flex justifyContent="space-between" gap={2}>
{!connection.pilotAddress && (
<Button
secondary
onClick={copyTransactionData}
disabled={newTransactions.length === 0}
>
Copy transaction data
</Button>
)}
<Submit />
</Box>
</Flex>
</Flex>
</Drawer>
)
Expand Down
4 changes: 4 additions & 0 deletions extension/src/browser/Drawer/style.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ button.link:hover {
left: 0;
}

.secondaryButton {
background: none;
}

@-webkit-keyframes pulse {
to {
box-shadow: 0 0 0 8px rgba(232, 76, 61, 0);
Expand Down
19 changes: 14 additions & 5 deletions extension/src/components/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,22 @@ import React from 'react'

import classes from './style.module.css'

const Button: React.FC<
React.DetailedHTMLProps<
interface ButtonProps
extends React.DetailedHTMLProps<
React.ButtonHTMLAttributes<HTMLButtonElement>,
HTMLButtonElement
>
> = ({ className, ...rest }) => (
<button className={cn(classes.button, className)} {...rest} />
> {
secondary?: boolean
}
const Button: React.FC<ButtonProps> = ({
className,
secondary = false,
...rest
}) => (
<button
className={cn(classes.button, className, secondary && classes.secondary)}
{...rest}
/>
)

export default Button
4 changes: 4 additions & 0 deletions extension/src/components/Button/style.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@
height: 16px;
margin-right: 10px;
}

.secondary {
background: none;
}

0 comments on commit f194812

Please sign in to comment.