Skip to content

Commit

Permalink
fix: confirm box issue
Browse files Browse the repository at this point in the history
  • Loading branch information
naturexie committed Jan 15, 2025
1 parent 8cf7a00 commit 8eba29e
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions screens/Trading/components/TradingOperate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ const TradingOperate: React.FC<TradingOperateProps> = ({ onMobileClose, id }) =>
const [activeTab, setActiveTab] = useState<string>(ReduxActiveTab || "long");
const [estimateLoading, setEstimateLoading] = useState<boolean>(false);
const [selectedSetUpOption, setSelectedSetUpOption] = useState<string>("custom");
const [isConfirmModalOpen, setIsConfirmModalOpen] = useState<boolean>(false);
const [isLongConfirmModalOpen, setIsLongConfirmModalOpen] = useState<boolean>(false);
const [isShortConfirmModalOpen, setIsShortConfirmModalOpen] = useState<boolean>(false);
const [rangeMount, setRangeMount] = useState<number>(ReduxRangeMount || 1);
const [isDisabled, setIsDisabled] = useState<boolean>(false);
const [longInput, setLongInput] = useState<string>("");
Expand Down Expand Up @@ -353,8 +354,6 @@ const TradingOperate: React.FC<TradingOperateProps> = ({ onMobileClose, id }) =>
shortInput,
],
);
console.log("-----------ReduxcategoryAssets1", ReduxcategoryAssets1);

const setOwnBanlance = (key: string) => {
if (activeTab === "long") {
setLongInput(key);
Expand Down Expand Up @@ -413,7 +412,11 @@ const TradingOperate: React.FC<TradingOperateProps> = ({ onMobileClose, id }) =>
// open position btn click eve.
const handleConfirmButtonClick = () => {
if (isDisabled) return;
setIsConfirmModalOpen(true);
if (activeTab == "long") {
setIsLongConfirmModalOpen(true);
} else if (activeTab == "short") {
setIsShortConfirmModalOpen(true);
}
};

const isValidDecimalString = (str) => {
Expand Down Expand Up @@ -490,7 +493,6 @@ const TradingOperate: React.FC<TradingOperateProps> = ({ onMobileClose, id }) =>
setLiqPrice("");
setTokenInAmount(0);
} else if (tab === "long") {
console.log("......", estimateData?.amount_out);
outputSetter(+(estimateData?.amount_out || 0));
outputUsdSetter(inputUsdCharcate * +(estimateData?.amount_out || 0));
} else if (tab === "short") {
Expand Down Expand Up @@ -764,11 +766,11 @@ const TradingOperate: React.FC<TradingOperateProps> = ({ onMobileClose, id }) =>
) : (
<ConnectWalletButton accountId={accountId} className="w-full" />
)}
{isConfirmModalOpen && (
{isLongConfirmModalOpen && (
<ConfirmMobile
open={isConfirmModalOpen}
open={isLongConfirmModalOpen}
onClose={() => {
setIsConfirmModalOpen(false);
setIsLongConfirmModalOpen(false);
if (onMobileClose) onMobileClose();
}}
action="Long"
Expand Down Expand Up @@ -896,11 +898,11 @@ const TradingOperate: React.FC<TradingOperateProps> = ({ onMobileClose, id }) =>
) : (
<ConnectWalletButton accountId={accountId} className="w-full" isShort />
)}
{isConfirmModalOpen && (
{isShortConfirmModalOpen && (
<ConfirmMobile
open={isConfirmModalOpen}
open={isShortConfirmModalOpen}
onClose={() => {
setIsConfirmModalOpen(false);
setIsShortConfirmModalOpen(false);
if (onMobileClose) onMobileClose();
}}
action="Short"
Expand Down

0 comments on commit 8eba29e

Please sign in to comment.