Skip to content

Instantly share code, notes, and snippets.

@mlms13
Last active March 15, 2019 20:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlms13/ecfd7d2d8b5c9e407b1647b0333bb962 to your computer and use it in GitHub Desktop.
Save mlms13/ecfd7d2d8b5c9e407b1647b0333bb962 to your computer and use it in GitHub Desktop.

Current behavior

onfocus: send UpdateLocationSuggesion

UpdateLocationSuggesion

  • if we already have geolocation: send UpdateLocationSuggesions
  • if we don't: send GetLocation

UpdateLocationSuggesions

  • if mobile and empty input and LocationSuccess: set state to suggesting location
  • else: No update

GetLocation

  • Prompt for user location
  • Transform it on the server
  • if success: send LocationSuccess
  • if failure: send LocationError

LocationSuccess

  • store success in state
  • send: UpdateLocationSuggestions

LocationError

  • store error in state

on "Near me" clik: send SelectLocationSuggestion

SelectLocationSuggestion

  • side effect: build URL for geolocation and navigate

Ideal

onfocus: Show menu render menu: show "Near me" (only on mobile for now)

on "Near me" click: send PromptGeolocation

PromptGeolocation:

  • Prompt for user location
  • Transform it on the server
  • on success: Side Effect navigate to points url
  • on error: no No Update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment