diff --git a/packages/testnet/frontend/src/components/buttons/ButtonAttackPlanet.tsx b/packages/testnet/frontend/src/components/buttons/ButtonAttackPlanet.tsx index 2345be0..1262d0e 100644 --- a/packages/testnet/frontend/src/components/buttons/ButtonAttackPlanet.tsx +++ b/packages/testnet/frontend/src/components/buttons/ButtonAttackPlanet.tsx @@ -26,6 +26,7 @@ import { getFuelConsumption, } from '../../shared/utils/FleetUtils'; import { convertSecondsToTime } from '../../shared/utils'; +import { TransactionStatus } from '../ui/TransactionStatus'; type ShipName = 'carrier' | 'scraper' | 'sparrow' | 'frigate' | 'armade'; @@ -165,6 +166,8 @@ function ButtonAttackPlanet({ const [travelTime, setTravelTime] = useState(0); const [fuelConsumption, setFuelConsumption] = useState(0); const [cargoCapacity, setCargoCapacity] = useState(0); + const [isModalOpen, setIsModalOpen] = useState(false); + const [isButtotClicked, setisButtotClicked] = useState(false); const missions = useGetActiveMissions(planetId); const isMissionLimitReached = @@ -179,8 +182,6 @@ function ButtonAttackPlanet({ 0 ); - const [isModalOpen, setIsModalOpen] = useState(false); - const handleButtonClick = () => { setIsModalOpen(true); }; @@ -216,7 +217,7 @@ function ButtonAttackPlanet({ setCargoCapacity(calculateTotalCargoCapacity(fleet)); }, [distance, fleet, ownPosition, techs]); - const { writeAsync } = useSendFleet(fleet, position, false); + const { writeAsync, data } = useSendFleet(fleet, position, false); const ships = ['carrier', 'scraper', 'sparrow', 'frigate', 'armade']; @@ -234,6 +235,10 @@ function ButtonAttackPlanet({ } }, [travelTime]); + const handleSendClick = () => { + writeAsync(), setIsModalOpen(false), setisButtotClicked(true); + }; + return (