From e267cd7da3a96f35db9792f8611169a30380b7a2 Mon Sep 17 00:00:00 2001 From: Dhanraj30 Date: Sat, 11 Jan 2025 16:01:17 +0530 Subject: [PATCH] Make dry run toggle live by default and add tooltip --- app/src/components/SecondaryButton.tsx | 10 +++++++++- app/src/features/toolbar/components/ActionToolbar.tsx | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/components/SecondaryButton.tsx b/app/src/components/SecondaryButton.tsx index 8b2a4b6..e517651 100644 --- a/app/src/components/SecondaryButton.tsx +++ b/app/src/components/SecondaryButton.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useEffect } from "react"; import Button from "@mui/material/Button"; import Tooltip from "@mui/material/Tooltip"; import useTheme from "../context/theme"; @@ -11,6 +11,7 @@ export interface SecondaryButtonProps { tooltip?: string; style?: React.CSSProperties; header?: boolean; + live?: boolean; } function SecondaryButton({ onClick, @@ -20,6 +21,7 @@ function SecondaryButton({ tooltip, style, header, + live = false, }: SecondaryButtonProps) { if (header) { style = { @@ -33,6 +35,12 @@ function SecondaryButton({ const { themeColor } = useTheme(); + useEffect(() => { + if (live) { + onClick(); + } + }, [live, onClick]); + return ( diff --git a/app/src/features/toolbar/components/ActionToolbar.tsx b/app/src/features/toolbar/components/ActionToolbar.tsx index 729b6c0..4bee70d 100644 --- a/app/src/features/toolbar/components/ActionToolbar.tsx +++ b/app/src/features/toolbar/components/ActionToolbar.tsx @@ -100,6 +100,7 @@ function ActionToolbar({ ? "Hide the Solidity editor" : "Show the Solidity editor to transpile Solidity to Sway" } + live={true} />