From d9e110c20843af1917e057bea4a67ce0a9fd5564 Mon Sep 17 00:00:00 2001 From: akestler Date: Tue, 8 Nov 2022 12:26:06 -0500 Subject: [PATCH] commented code for review see pull for summary --- README.md | 6 +++--- src/App.js | 34 +++++++++++++++--------------- src/api/leaderboard.js | 2 +- src/api/question.js | 6 +++--- src/components/Categories.js | 3 +-- src/components/EditQuestionForm.js | 20 +++++++++--------- src/components/GameCreate.js | 8 +++---- src/components/GameForm.js | 7 +++--- src/components/GameTitleEdit.js | 12 +++++------ src/components/Home.js | 4 ++-- src/components/Leaderboard.js | 6 +++--- src/components/PlayerLanding.js | 2 +- src/components/QuestionCreate.js | 10 ++++----- src/components/Result.js | 2 +- src/components/Timer.js | 4 ++-- src/components/UserGameIndex.js | 28 ++++++++++++------------ src/components/UserGamePlay.js | 23 ++++++++++---------- src/components/UserGameShow.js | 22 +++++++++---------- 18 files changed, 100 insertions(+), 99 deletions(-) diff --git a/README.md b/README.md index 9f9525a..8592bc6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Trivia-Client - + # Trivia Back-End ### Team Roles: @@ -11,7 +11,7 @@ ### Back-End: Zack Yaffee ### Full-Stack: Harrison Simon, Stephanie Parker - +
## Technologies Used @@ -52,7 +52,7 @@
## WireFrames - + ![Wireframe](/images/image3.png) ![Wireframe](/images/image2.png) ![Wireframe](/images/image1.png) diff --git a/src/App.js b/src/App.js index 2592b7d..befb977 100644 --- a/src/App.js +++ b/src/App.js @@ -13,16 +13,16 @@ import SignIn from "./components/auth/SignIn"; import SignOut from "./components/auth/SignOut"; import ChangePassword from "./components/auth/ChangePassword"; import Timer from "./components/Timer"; -import QuestionCreate from "./components/QuestionCreate"; +import QuestionCreate from "./components/QuestionCreate"; // unused import import PlayerLanding from "./components/PlayerLanding"; import GameCreate from "./components/GameCreate"; import UserGameIndex from "./components/UserGameIndex"; import UserGameShow from "./components/UserGameShow"; import { getOpenDBUrl } from "./utils/openDB"; -import GameInputs from "./components/trivia-api/GameInputs"; +import GameInputs from "./components/trivia-api/GameInputs"; // unused import import GamePlay from "./components/trivia-api/GamePlay"; import Leaderboard from "./components/Leaderboard"; -import UserGamePlay from "./components/UserGamePlay"; +import UserGamePlay from "./components/UserGamePlay"; // unused import import Result from "./components/Result"; import GameTitleEdit from "./components/GameTitleEdit"; @@ -37,7 +37,7 @@ const App = () => { const handleClick = async () => { - + // inconsistent white space if (filterOptions === {}) return; setIsLoading(true); @@ -85,7 +85,7 @@ const App = () => { return (
- + {/* change your grouping here and stay organized, follow 1 style, be consistent */} } /> } /> } /> @@ -100,7 +100,7 @@ const App = () => { - +{/* // inconsistent white space */} { element={ } - +// inconsistent white space /> - {/* } /> */} - - } /> +{/* duplicate path components !? remove one with double quotes, BE consistent */} + } /> { } /> - +{/* // inconsistent white space */} { } /> - +{/* // inconsistent white space */} { /> } /> - +{/* // inconsistent white space */} { } /> - +{/* // inconsistent white space */} { } /> - +{/* // inconsistent white space */} {msgAlerts.map((msgAlert) => ( { /> ))} - ); -}; + ); // ; ? +}; // ; ? export default App; diff --git a/src/api/leaderboard.js b/src/api/leaderboard.js index 6270354..491e605 100644 --- a/src/api/leaderboard.js +++ b/src/api/leaderboard.js @@ -1,6 +1,6 @@ import apiUrl from '../apiConfig' import axios from 'axios' - +// consider renaming, get in function name for a post request is counter intuitive export const getLeaderboard = (category) => { return axios({ method: 'POST', diff --git a/src/api/question.js b/src/api/question.js index 54ce33a..16944b0 100644 --- a/src/api/question.js +++ b/src/api/question.js @@ -19,11 +19,11 @@ export const createQuestion = (user, gameId, data) => { } // this is the api call to update a question -export const updateQuestion = (user, gameId, updatedQuestion) => { +export const updateQuestion = (user, gameId, updatedQuestion) => { // unused variable return axios({ method:'PATCH', url: `${apiUrl}/questions/${gameId}/${updatedQuestion._id}`, - +// inconsistent white space data: { question: updatedQuestion} }) } @@ -33,6 +33,6 @@ export const deleteQuestion = ( gameId, questionId) => { return axios({ method: 'DELETE', url: `${apiUrl}/questions/${gameId}/${questionId}`, - +// inconsistent white space }) } \ No newline at end of file diff --git a/src/components/Categories.js b/src/components/Categories.js index e5b0fa4..3beaf61 100644 --- a/src/components/Categories.js +++ b/src/components/Categories.js @@ -1,4 +1,4 @@ -export const categories = [ +export const categories = [ // not a component, this should go in the lib "Any", "General Knowledge", "Entertainment: Books", @@ -25,4 +25,3 @@ export const categories = [ "Entertainment: Japanese Anime & Manga", "Entertainment: Cartoon & Animations", ] - diff --git a/src/components/EditQuestionForm.js b/src/components/EditQuestionForm.js index b3df36a..579a898 100644 --- a/src/components/EditQuestionForm.js +++ b/src/components/EditQuestionForm.js @@ -7,7 +7,7 @@ import { categories } from './Categories' const EditQuestionForm = (props) => { const { question, handleChange, handleSubmit, index } = props - const [incorrectAnswerSubmissions, setIncorrectAnswers] = useState([]) + const [incorrectAnswerSubmissions, setIncorrectAnswers] = useState([]) // totally unused const [checked, setRadioValue] = useState({typeOfQuestion: "Multiple Choice", another: "another"}) const { typeOfQuestion } = checked @@ -29,7 +29,7 @@ const EditQuestionForm = (props) => { Enter the Incorrect Answer(s) { } return( - +// indentation is off from the start
Question: @@ -84,7 +84,7 @@ const EditQuestionForm = (props) => { value={question.question} required /> - + {/* fix indentation */} { onChange={handleChange} required value={question.correctAnswer} - /> - <> + />{/* incorrect indentation */} + <>{/* bad use of shards, we don't need them here to my knowledge */} {incorrectAnswers} - + {/* inconsistent white space */}