Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable go button when directions are not populated #378

Conversation

matbmapspeople
Copy link
Contributor

What:

Disable 'Go' button if directions are not populated.

How:
Created a simple boolean that is false when we start fetching data.
When data is populated, the boolean is set to true.
Applied specific styling for disabled button.

Working example:

Screen.Recording.2024-06-17.at.12.50.54.mov

PS. Talking to @andreeaceachir142, I removed two input fields for the time data is being fetched.

* and have geometry, call the MapsIndoors SDK to get information about the route.
*/
const useDirectionsInfo = (originLocation, destinationLocation, directionsService, travelMode, accessibilityOn) => {
const [totalDistance, setTotalDistance] = useState()
const [totalTime, setTotalTime] = useState();
const [hasFoundRoute, setHasFoundRoute] = useRecoilState(hasFoundRouteState);
const [, setDirectionsResponse] = useRecoilState(directionsResponseState);
const [isDirectionReady, setIsDirectionReady] = useState()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const [isDirectionReady, setIsDirectionReady] = useState()
const [areDirectionsReady, setAreDirectionsReady] = useState()

We usually use the plural form, "directions".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ✅

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still see isDirectionReady in the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try now. I might have not pushed changes for some reason @ammapspeople

@@ -38,6 +40,7 @@ const useDirectionsInfo = (originLocation, destinationLocation, directionsServic
totalTime,
directionsResult
});
setAreDirectionReady(true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use one of the existing atoms (for example directionsResponse or hasFoundRoute) instead of introducing a new one? 🤔

@matbmapspeople
Copy link
Contributor Author

Done ✅ @ammapspeople

@matbmapspeople
Copy link
Contributor Author

Hey @andreeaceachir142
Can you please take a final look so we can proceed with it?

@andreeaceachir142
Copy link
Contributor

Approved ✅ Can you please write some test cases in the ticket so I can test out the feature? @matbmapspeople

@matbmapspeople matbmapspeople added patch and removed minor labels Jul 2, 2024
@matbmapspeople matbmapspeople merged commit 5bca955 into main Jul 2, 2024
@matbmapspeople matbmapspeople deleted the feature/disable_go_button_when_directions_are_not_populated branch July 2, 2024 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants