Open
Conversation
HIPPIEKICK
previously requested changes
Sep 18, 2024
Contributor
There was a problem hiding this comment.
Hi Elina! You're on good way with this project, but there are a few things that I'd like you to work more with. Let's go through some feedback 👇
HTML/CSS
- Good idea changing the CSS a bit to make it more responsive 🥳
JavaScript
- Good job keeping consistency with double quotes and the usage of semicolons ⭐
- The conditional statements for checking user input (e.g., "Pizza" and "pizza") are case-sensitive and repetitive. Converting the input to lowercase using toLowerCase() can simplify these checks:
const showFoodOptions = (name) => {
const lowerCaseName = name.toLowerCase();
if (lowerCaseName === "pizza") {
showMessage("You've ordered a Daily Surprise Pizza! It’ll be ready in 15 minutes...", "bot");
} else if (lowerCaseName === "pasta") {
showMessage("You've ordered a Daily Surprise Pasta! It’ll be ready in 15 minutes...", "bot");
} else if (lowerCaseName === "salad") {
showMessage("You've ordered a Daily Surprise Salad! It’ll be ready in 15 minutes...", "bot");
} else {
showMessage(`Hello ${name}, what type of food would you like today?`, "bot");
}
};
- Think about naming your variables in a clear and descriptive way. The same goes for class names, IDs and functions.
showFoodOptionsis a very clear function name, but perhaps the form and inputs should have a more generic name than name-form and name-input since they are also handling the food choices? - In step 4 in the instructions it says "Add a few more questions and answers to your bot.". I realise this is a bit vague, but I would like you to add at least one more question and answer to your bot. If you want to continue on the path your already on, maybe you can create a askForSize function where the user can pick between adult and child and then base your final confirmation on that?
- Lastly, this function both asks for what the user wants and handles the response from the user. Apart from that, the order confuses me a bit, since the "question" comes last and the "answers" comes before that. I'd consider splitting this up into different functions, maybe one askForFood function and another one called handleFoodChoice.
const showFoodOptions = (name) => {
if ((name === "Pizza") || (name === "pizza")) {
showMessage("You've ordered a Daily Surprise Pizza! It'll be ready for pick up in 15 minutes, pay upon arrival😋<br> Adult size = 150SEK Child size = 100SEK", "bot");
} else if ((name === "Pasta") || (name === "pasta")) {
showMessage("You've ordered a Daily Surprise Pasta! It'll be ready for pick up in 15 minutes, pay upon arrival😋<br> Adult size = 130SEK Child size = 80SEK", "bot");
} else if ((name === "Salad") || (name === "salad")) {
showMessage("You've ordered a Daily Surprise Salad! It'll be ready for pick up in 15 minutes, pay upon arrival😋<br>Adult size = 120SEK Child size = 70SEK", "bot");
} else {
showMessage(`Hello ${name}, what type of food would you like today?<br>Please write your option: Pizza, Pasta or Salad 🍽️`, "bot");
}
}
Changes Requested
- Add at least one more question and answer to your bot. Preferably using another type of input than the one you already have, but this is up to you. Example flow based on all my feedback:
- greetUser() //start convo & ask for input
- handleNameInput() //handle input
- askForFood() //ask for input
- handleFoodChoice() //handle input
- askForSize() //ask for input
- (handleFoodSize() //handle input)
- confirmOrder() //end convo (& handle input)
- Ensure the user is correctly guided throughout the flow:
PS. Please, reach out on Stack Overflow if you have any questions or need any guidance in updating your code. Especially since you said you struggled with this project, I want you to remember that we're here for you if you have any questions or need any clarifications 🫶
| ## The problem | ||
|
|
||
| Describe how you approached to problem, and what tools and techniques you used to solve it. How did you plan? What technologies did you use? If you had more time, what would be next? | ||
| I've struggled alot this week. I've found it very hard to make sense out of the starter code and how to add the right code in general. I tried making buttons and select options but I could never make it work. Therefor I approached the different steps in another way than I think we were suppose to. I kept looking at the videos on disco but for me it was very hard to apply the content to this weeks assigment. Since I didn't figure out how to make buttons and select options I did a simple version of the chatbot. The customer can't pick the type of pizza, pasta or salad only the food type, hence the "Daily Surprise" solution. Tools I used were chatgbpt, stack overflow, the material on disco and google. |
Contributor
There was a problem hiding this comment.
Sorry to hear about your struggles 🌺 Remember that we're here to help! Ask a question on Stack Overflow or in the Q&A form ☎️
| const nameInput = document.getElementById("name-input"); | ||
| // The chat container where messages are shown | ||
| const chat = document.getElementById("chat"); | ||
| let inputWrapper = document.getElementById("inputWrapper"); |
… down menu and deleted the surprise pizza concept
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Netlify link
https://sprightly-gecko-87af32.netlify.app/