-
Notifications
You must be signed in to change notification settings - Fork 7
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
Disable go button when directions are not populated #378
Conversation
…s started, set it to true when data is populated, return it
* 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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const [isDirectionReady, setIsDirectionReady] = useState() | |
const [areDirectionsReady, setAreDirectionsReady] = useState() |
We usually use the plural form, "directions".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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? 🤔
Done ✅ @ammapspeople |
Hey @andreeaceachir142 |
Approved ✅ Can you please write some test cases in the ticket so I can test out the feature? @matbmapspeople |
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.