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

Custom forms #297

Merged
merged 9 commits into from
Jul 3, 2020
Merged

Custom forms #297

merged 9 commits into from
Jul 3, 2020

Conversation

SeHarlan
Copy link
Contributor

Describe your PR

Related to #295
Fixes #

Pages/Interfaces that will change

businesses.js - commented out Airtable embed added Custome form and added (closeOnOverlayClick={false}) to parent modal for better functionality (like a success message)
AllyFeed.js - same as above except with AllySignUpForm

Screenshots / video of changes

Screen Shot 2020-06-30 at 11 32 57 AM
Screen Shot 2020-06-30 at 11 32 46 AM

Steps to test

  1. Must add new .env keys (uses same values)
    GATSBY_AIRTABLE_API_KEY=
    GATSBY_AIRTABLE_BASE_ID=
  2. I tried a few different things here but Gatsby only seems to recognize keys on the FE when appended with GATSBY_

Additional notes

  • Everything should be set up correctly. I'm hitting the Airtable api but getting 403 from it. So it appears there is still a permissions issue with my API key or something like that. Hopefully it'll work for someone who has proper writing access.
  • using Chakra's "as" attribute still didn't let me use default browser validation when use as="form" so I made a basic custom one that checks the state for null values (the default any any we need to require). If it finds any it returns out of the submit function and renders a message, we can customize this further in the future if we want to.
  • The BE team asked me to validate URLs for the business. I came up with a hacky way to do this using cors-anywhere but again its real hacky/questionable so I've commented it out. This is my first time trying to do custom validation so we way want to pass that part on to someone with a little more experience in the area.

@netlify
Copy link

netlify bot commented Jun 30, 2020

Deploy request for rebuild-black-business accepted.

Accepted with commit 7e04277

https://app.netlify.com/sites/rebuild-black-business/deploys/5eff6130ab6404000854f7ae

Copy link
Member

@magnificode magnificode left a comment

Choose a reason for hiding this comment

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

This is great @SeHarlan thank you so much for taking this on. It'll really help set us up to be able to handle the data in a much better way!

package.json Outdated Show resolved Hide resolved
import PrimaryButton from '../Buttons/PrimaryButton';
import { submitAlly } from '../../services/AirtableServices';

const skillTypes = [
Copy link
Member

Choose a reason for hiding this comment

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

@SeHarlan are we able to pull the skill types from Airtable via the API? Just thinking of ways we can possibly keep things as dynamic as possible!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is proving really difficult. I've looked through all the docs and as far as I can see they don't provide access to the select options. There are quite a few complaints about it in the community forums lol. I made a custom hook that grabs the first page of docs and filters for just the specialty field and then I reduce it to only unique items. But this really isn't performant. Not sure what you wanna do with it so I'll leave it in just in case.

src/components/Forms/BusinessSignUpForm.js Show resolved Hide resolved
src/components/Forms/BusinessSignUpForm.js Outdated Show resolved Hide resolved
src/components/Feeds/AllyFeed.js Outdated Show resolved Hide resolved
src/templates/businesses.js Outdated Show resolved Hide resolved
@SeHarlan
Copy link
Contributor Author

SeHarlan commented Jul 1, 2020

Screen Shot 2020-07-01 at 12 05 40 PM

@SeHarlan
Copy link
Contributor Author

SeHarlan commented Jul 1, 2020

the dynamic fetch wasn't catching the businesses "Other" category so I add it in conditionally on line 88 on AirtableServices.js

@SeHarlan
Copy link
Contributor Author

SeHarlan commented Jul 2, 2020

Exports in components/index.js were left as airtable embeds cause I don't know everything those might be linked to and didn't wanna mess up any fallbacks that might exist.

Copy link
Member

@racedale racedale left a comment

Choose a reason for hiding this comment

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

With the change of adding GATSBY_ prefix to the airtable environment variables, the gatsby-config.js file will also need updated along with .env.EXAMPLE and README.md. After updating the gatsby-config I was able to get passing tests locally (an admin will need to update Circle CI after the code change to get a ✔️ to show here)

README.md Show resolved Hide resolved
@magnificode
Copy link
Member

@SeHarlan This has been merged, can't thank you enough for the hard work here! This will help us to be able to move on some of our tasks to help improve the UX around business submissions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants