Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow user to copy call address #2008

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const TransactionActions: FC<TransactionActionsProps> = ({
<DetailAccordionButton
label={entryPointToHumanReadable(transaction.entrypoint)}
value={formatTruncatedAddress(transaction.contractAddress)}
copyValue={transaction.contractAddress}
/>
<DetailAccordionPanel>
{transaction.calldata?.map((calldata, cdIndex) => (
Expand Down
28 changes: 23 additions & 5 deletions packages/ui/src/components/DetailAccordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ export const DetailAccordionButton: FC<
AccordionButtonProps & {
label?: ReactNode
value?: ReactNode
copyValue?: string
}
> = ({ label, value, children, ...rest }) => {
> = ({ label, value, copyValue, children, ...rest }) => {
const { isDisabled } = useAccordionItemState()
return (
<AccordionButton
Expand All @@ -132,10 +133,27 @@ export const DetailAccordionButton: FC<
{...rest}
>
{label && <P4 fontWeight="medium">{label}</P4>}
{value && (
<P4 color="neutrals.400" fontWeight="medium">
{value}
</P4>
{value && copyValue ? (
<CopyTooltip copyValue={copyValue}>
<P4
_hover={{
color: "text",
}}
cursor="pointer"
transitionProperty="color"
transitionDuration="fast"
color="neutrals.400"
fontWeight="medium"
>
{value}
</P4>
</CopyTooltip>
) : (
value && (
<P4 color="neutrals.400" fontWeight="medium">
{value}
</P4>
)
)}
{children}
</AccordionButton>
Expand Down