nthnluu / hollar-site

https://hollarapp.com/
1 stars 0 forks source link

Onboarding Flow #1

Open nthnluu opened 3 years ago

nthnluu commented 3 years ago

We need to create a page that walks businesses through the process of adding their business to Hollar.

Docs

Overview

This page will be a similar layout to the onboarding page we have currently. Each step on the onboarding flow is focused on a particular piece of info we need: we want to avoid showing too many fields on one page since long forms tend to overwhelm users.

We want to make use of built-in browser form validation while also keeping track of the user data for each step. Therefore, each step of the onboarding flow will have its own form component.

In the top-level page component...

{ "name":"", "street_address":"", "city":"", "state":"", "zipCode":"" }

There will be a field in this object representing the values all the text fields. We initialize the form with blank values, but as the user updates the text fields, this object will change. This object allows us to hold the user's inputs across multiple forms and serves as a single source of truth for the onboarding flow.

For each step...

  1. User fills out form
    • Each field's value is defined by the respective field in formData
    • Whenever the value changes, we have to update formData accordingly
  2. User submits form
  3. Browser validates form and submits if it passes
  4. On submit, we move to the next step.

Onboarding steps

1. What is the name of your business?

2. Choose the category that fits your business best

3. Add a location

4. Verify info

Notes

and use onboardingSteps.map((step, index) => <div key={index}> ... </div>) to render the UI.

TextInput Props:

nthnluu commented 3 years ago

Here is the code you need to execute in order to call the createBusiness Cloud Function:

  const addBusiness = fb.functions().httpsCallable('createBusiness');
        addBusiness({
            "name": "Brightside Barbershop",
            "address": "10277 University Ave",
            "city": "San Diego",
            "state": "CA",
            "zipCode": "90210",
            "created_by": "12",
            "lat": -12.7,
            "long": 97.2
        })
            .then(() => {
                console.log("done!")
            })
            .catch(error => console.log(error))
itshyyde commented 3 years ago

I've setup the form to have a more logical flow, I'll work on implementing the Cloud Function while you work on the Google Location API.

itshyyde commented 3 years ago

I made a function called setBusiness that handles the reference to the createBusiness cloud function.