Single Page Applications Sprint Challenge

Read these instructions carefully. Understand exactly what is expected before starting this Sprint Challenge.

This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored single page applications. During this sprint, you studied routing, forms, and testing in cypress. In your challenge this week, you will demonstrate your mastery of these skills by creating Lambda Eats, a website designed to bring food to hungry coders.

This is an individual assessment. All work must be your own. Your challenge score is a measure of your ability to work independently using the material covered through this sprint. You need to demonstrate proficiency in the concepts and objectives introduced and practiced in preceding days.

You are not allowed to collaborate during the sprint challenge. However, you are encouraged to follow the twenty-minute rule and seek support from your TL if you need direction.

You have three hours to complete this challenge. Plan your time accordingly.

Introduction

In this challenge you will be working from the Lambda Eats homepage to create a functional Pizza? button that leads to a build your own pizza custom form.

You may use the following wireframes (also in a folder above) as guidance as you design your site but it is not required that you do so.

Form

Home Page

Confirmation

Commits

Commit your code regularly and meaningfully. This helps both you (in case you ever need to return to old code for any number of reasons) and your team lead as the evaluate your solution.

Interview Questions

Demonstrate your understanding of this week's concepts by answering the following free-form questions. Edit this document to include your answers after each question.

  1. In 1-2 sentences, explain what React's useRouteMatch hook is used for.

    //useRouteMatch is an API hook, and would be used to get the match data with out having to render a .

  2. How would you explain form validation to someone who has never programmed before?

    // validation is a way to ensure the inputs are filled out and that they are of the type we expect.

  3. In 1-2 sentences, define end to end testing.

    // this type of testing allows the project designer to catch bugs by mimicking the user journey using automated scripts.

Instructions

Task 1: Project Set Up

  • Create a forked copy of this project
  • Add your team lead as collaborator on Github
  • Clone your OWN version of the repository (Not Lambda's by mistake!)
  • Create a new branch: git checkout -b <firstName-lastName>
  • Implement the project on your newly created <firstName-lastName> branch, committing changes regularly
  • Push commits: git push origin <firstName-lastName>

Task 2: Project Requirements

Your finished project must include all of the following requirements:

  • A homepage that has a "/" route and links to your form (button, nav bar, or any other type of link is acceptable)
  • A form with a "/pizza" route
  • A name text input field
  • Validation for name - name must be at least 2 characters
  • A dropdown for pizza size
  • A checklist for toppings - at least 4 (hint: name each separately!)
  • Text input for special instructions
  • An Add to Order button that submits form and returns a database record of name, size, toppings and special instructions

Testing MVP

Implement the following tests in Cypress:

  • test that you can add text to the box
  • test that you can select multiple toppings
  • test that you can submit the form

In your solution, it is essential that you follow best practices and produce clean and professional results. You will be scored on your adherence to proper code style and good organization. Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. It is better to submit a challenge that meets MVP than one that attempts too much and does not.

Task 3: Stretch Goals

After finishing your required elements, you can push your work further. These goals may or may not be things you have learned in this module but they build on the material you just studied. Time allowing, stretch your limits and see if you can deliver on the following optional goals:

  • Toggle form component for gluten free crust
  • Turn form element sections into nested routes
  • Test more of the application with Cypress
  • Build UI for the eventuality of a network error when POSTing the order
  • Add functionality to your order button that it leads to a Congrats! Pizza is on it's way! page and returns a database record of the whole order

FAQs

How do I return a database record of the order?

One of your goals is to return a database record of the order - for this you'll need to write a post request. For more detailed steps, use the below:

  1. Create a new state
  2. Post to reqres with axios
  3. Log data in console

Submission format

Follow these steps for completing your project.

  • Submit a pull request to merge <firstName-lastName> branch into the main branch (student's repo). Please don't merge your own pull request
  • Add your team lead as a reviewer on the pull request
  • Your team lead will count the project as complete after receiving your pull request