From 8b42ecd29aa0d69528eccda3ba75b181252dc323 Mon Sep 17 00:00:00 2001 From: Nezzar KEFIF <36443340+nezz0746@users.noreply.github.com> Date: Tue, 26 Dec 2023 23:19:01 +0100 Subject: [PATCH] fix move disabled buttong --- apps/web/components/MoveButton.tsx | 7 +++---- apps/web/components/NetworkStateMotion.tsx | 3 +-- apps/web/components/StateHeader.tsx | 3 +-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/apps/web/components/MoveButton.tsx b/apps/web/components/MoveButton.tsx index 95122cc..30d5d9b 100644 --- a/apps/web/components/MoveButton.tsx +++ b/apps/web/components/MoveButton.tsx @@ -12,7 +12,6 @@ interface MoveButtonProps { address?: Address tile: Address geohash: string - disabled?: boolean onMoveSuccess?: () => void name?: string } @@ -21,11 +20,10 @@ const MoveButton = ({ address, tile, geohash, - disabled, onMoveSuccess = () => {}, name = 'Move', }: MoveButtonProps) => { - const { config, isError, isLoading } = usePrepareMapMove({ + const { config, isError, isLoading, refetch } = usePrepareMapMove({ args: [address as Address, tile, geohash, toHex('')], enabled: !!address, }) @@ -44,6 +42,7 @@ const MoveButton = ({ }), () => { onMoveSuccess() + refetch() } ) @@ -52,7 +51,7 @@ const MoveButton = ({ onClick={() => { write && write() }} - disabled={isError || isLoading || pendingConfirm || indexing || disabled} + disabled={isError || isLoading || pendingConfirm || indexing} className={classNames('btn font-display', {})} > {(pendingConfirm || indexing) && ( diff --git a/apps/web/components/NetworkStateMotion.tsx b/apps/web/components/NetworkStateMotion.tsx index 9b9c0fa..5fe5e88 100644 --- a/apps/web/components/NetworkStateMotion.tsx +++ b/apps/web/components/NetworkStateMotion.tsx @@ -17,7 +17,7 @@ const NetworkStateMotion = ({ const { flyToGeohash } = useMapUtils() const { address } = useAccount() const { setPrecision, position } = usePosition() - const { geohashes, refetch } = useAppAgent() + const { refetch } = useAppAgent() useEffect(() => { flyToGeohash(position.geohash) @@ -56,7 +56,6 @@ const NetworkStateMotion = ({ address={address} tile={currentNetworkState?.id} geohash={position.geohash} - disabled={geohashes.includes(position.geohash)} onMoveSuccess={() => { refetch() }} diff --git a/apps/web/components/StateHeader.tsx b/apps/web/components/StateHeader.tsx index b70efef..c54c868 100644 --- a/apps/web/components/StateHeader.tsx +++ b/apps/web/components/StateHeader.tsx @@ -20,7 +20,7 @@ const StateHeader = ({ currentNetworkState, firstMove }: StateHeaderProps) => { const { flyToGeohash } = useMapUtils() const { address } = useAccount() const { setPrecision, position } = usePosition() - const { geohashes, refetch } = useAppAgent() + const { refetch } = useAppAgent() useEffect(() => { flyToGeohash(position.geohash) @@ -140,7 +140,6 @@ const StateHeader = ({ currentNetworkState, firstMove }: StateHeaderProps) => { address={address} tile={currentNetworkState?.id} geohash={position.geohash} - disabled={geohashes.includes(position.geohash)} onMoveSuccess={() => { refetch() }}