Skip to content

Commit

Permalink
Merge pull request #28 from nezz0746/fix/move-previous-location-bug
Browse files Browse the repository at this point in the history
fix move disabled buttong
  • Loading branch information
nezz0746 authored Dec 26, 2023
2 parents 37c6e6e + 8b42ecd commit 9cfd2a7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
7 changes: 3 additions & 4 deletions apps/web/components/MoveButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ interface MoveButtonProps {
address?: Address
tile: Address
geohash: string
disabled?: boolean
onMoveSuccess?: () => void
name?: string
}
Expand All @@ -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,
})
Expand All @@ -44,6 +42,7 @@ const MoveButton = ({
}),
() => {
onMoveSuccess()
refetch()
}
)

Expand All @@ -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) && (
Expand Down
3 changes: 1 addition & 2 deletions apps/web/components/NetworkStateMotion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -56,7 +56,6 @@ const NetworkStateMotion = ({
address={address}
tile={currentNetworkState?.id}
geohash={position.geohash}
disabled={geohashes.includes(position.geohash)}
onMoveSuccess={() => {
refetch()
}}
Expand Down
3 changes: 1 addition & 2 deletions apps/web/components/StateHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -140,7 +140,6 @@ const StateHeader = ({ currentNetworkState, firstMove }: StateHeaderProps) => {
address={address}
tile={currentNetworkState?.id}
geohash={position.geohash}
disabled={geohashes.includes(position.geohash)}
onMoveSuccess={() => {
refetch()
}}
Expand Down

0 comments on commit 9cfd2a7

Please sign in to comment.