-
-
Notifications
You must be signed in to change notification settings - Fork 934
added quizeo play #162
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
Merged
Merged
added quizeo play #162
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
900c619
added quizeo play
vasantisuthar 3460e9c
added the readme details
vasantisuthar 6de601d
modified CSS
vasantisuthar d503ca9
Merge branch 'main' into vasantisuthar
vasantisuthar 8f27076
Merge branch 'main' into vasantisuthar
vasantisuthar b8ae4b4
changed the gitignore file, removed routing from RouteDef file, creat…
vasantisuthar ca78ee2
Merge branch 'vasantisuthar' of https://github.com/vasantisuthar/reac…
vasantisuthar afcec42
added navigation to different page
vasantisuthar 2b18fbe
managed the state through redux to render the question page and creat…
vasantisuthar fc673c8
changed movie-reducer
vasantisuthar 385ba1c
Merge branch 'main' into vasantisuthar
vasantisuthar e6ae17f
removed logger
vasantisuthar bfe0802
Merge branch 'main' into vasantisuthar
vasantisuthar e6ff4fa
Merge branch 'main' into vasantisuthar
vasantisuthar e4dd7da
removed redux-logger from store.js
vasantisuthar 1105aff
removed unnecessary whitespaces, updated readme,css file
vasantisuthar 7b3660f
resolved conflicts
vasantisuthar ad41451
changed the styles.css files
vasantisuthar f1ffd87
removed the font
vasantisuthar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # Quizeo | ||
|
|
||
| Quizeo is a react fun project to play quiz around favourite movies and series, if you have watched. | ||
|
|
||
| ## What you will learn | ||
| The app demonstrates | ||
| - the use of reusable components, shows you how to divide your react app into components | ||
| - use of react-redux | ||
| - use of react-redux with hooks | ||
| - use of reselect for better memoization and cache management | ||
| - use of ES6 features | ||
|
|
||
| The app uses redux store to store the state and data of the app globally and is fetched with the help of selectors 'react-reselect' to implement memoization to the app. Also each component contains its own CSS for easy implementation of design. | ||
|
|
||
| Happy learning! |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import { getPlayById } from 'meta/play-meta-util'; | ||
| import PlayHeader from 'common/playlists/PlayHeader'; | ||
| import { store,persistor } from './redux/store'; | ||
| import { useEffect } from 'react'; | ||
| import { setScore, setQuestionNo } from "./redux/questions/questions-action"; | ||
| import Directory from "./components/directory/directory.component"; | ||
| import Header from "./components/header/header.component"; | ||
| import { Provider} from 'react-redux'; | ||
| import { PersistGate } from 'redux-persist/integration/react'; | ||
| import './quizeo.css' | ||
|
|
||
| function Quizeo(props) { | ||
| // Do not remove the below lines. | ||
| // The following code is to fetch the current play from the URL | ||
| const { id } = props; | ||
| const play = getPlayById(id); | ||
|
|
||
| // Your Code Start below. | ||
| useEffect(() =>{ | ||
| store.dispatch(setScore()); | ||
| store.dispatch(setQuestionNo()); | ||
| }) | ||
| return ( | ||
| <> | ||
| <div className="play-details"> | ||
| <PlayHeader play={play} /> | ||
| <div className="play-details-body quizeo"> | ||
| {/* Your Code Starts Here */} | ||
vasantisuthar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <Provider store = {store}> | ||
| <PersistGate persistor={persistor}> | ||
| <Header/> | ||
| <Directory/> | ||
| </PersistGate> | ||
| </Provider> | ||
| {/* Your Code Ends Here */} | ||
| </div> | ||
| </div> | ||
| </> | ||
| ); | ||
| } | ||
|
|
||
| export default Quizeo; | ||
29 changes: 29 additions & 0 deletions
29
src/plays/quizeo/src/components/directory/directory.component.jsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import React from "react"; | ||
| import { selectDirectorySection } from "../../redux/directory/directory-selectors"; | ||
| import MoviePage from "../../pages/moviePage/moviePage.component"; | ||
| import { useSelector} from 'react-redux'; | ||
| import MenuItem from "../menu-item/menuItem.component"; | ||
| import { selectQuestionIndex, selectClickedAction} from "../../redux/movie/movieSelector"; | ||
|
|
||
| import './directory.styles.css'; | ||
| const Directory = () => { | ||
|
|
||
| let questionIndex = useSelector(selectQuestionIndex); | ||
| let isClick = useSelector(selectClickedAction); | ||
| const sections = useSelector(selectDirectorySection); | ||
|
|
||
| return ( | ||
| <div> | ||
| { | ||
| isClick ? <MoviePage categoryId={questionIndex}/> : | ||
| <div className="directoryMenu"> | ||
| {sections.map(({id, ...otherSectionComponent}) => ( | ||
| <MenuItem key={id} {...otherSectionComponent}/> | ||
| ))} | ||
| </div> | ||
| } | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| export default Directory; |
8 changes: 8 additions & 0 deletions
8
src/plays/quizeo/src/components/directory/directory.styles.css
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| .quizeo .directoryMenu{ | ||
| margin: 3rem; | ||
| display: flex; | ||
| flex-direction: row; | ||
| flex-wrap: wrap; | ||
| justify-content: center; | ||
| align-items: center; | ||
| } |
15 changes: 15 additions & 0 deletions
15
src/plays/quizeo/src/components/header/header.component.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import React from 'react'; | ||
| import { useDispatch } from 'react-redux'; | ||
| import './header.styles.css'; | ||
| import { isClicked } from '../../redux/questions/questions-action'; | ||
|
|
||
| const Header = () => { | ||
| let dispatch = useDispatch(); | ||
| return ( | ||
| <div> | ||
| <h1 className="header" onClick={() => dispatch(isClicked())}>Quizeo</h1> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| export default Header; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| .quizeo .header{ | ||
| cursor: pointer; | ||
| margin-top: 1.5rem; | ||
| margin-bottom: 3.5rem; | ||
| font-size: 3rem; | ||
| line-height: 1; | ||
| font-weight: 700; | ||
| text-decoration: none; | ||
| } |
35 changes: 35 additions & 0 deletions
35
src/plays/quizeo/src/components/menu-item/menu-item.styles.css
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| .quizeo .menu-item{ | ||
| display: flex; | ||
| position: relative; | ||
| margin: 0.25rem; | ||
| display: flex; | ||
| flex-direction: column; | ||
| justify-content: center; | ||
| align-items: center; | ||
| width: 18rem; | ||
| border-width: 4px; | ||
| opacity: 0.9; | ||
| } | ||
|
|
||
| .quizeo .image-container{ | ||
| background-position: center; | ||
| background-size: cover; | ||
| width: 100%; | ||
| height: 18rem; | ||
| } | ||
|
|
||
| .quizeo .image-content{ | ||
| position: absolute; | ||
| padding: 1.25rem; | ||
| background-color: #ffffff; | ||
| color: #000000; | ||
| font-weight: 600; | ||
| border-width: 2px; | ||
| cursor: pointer; | ||
| opacity: 0.8; | ||
| } | ||
|
|
||
| .quizeo .image-content h1{ | ||
| font-size: 1.125rem; | ||
| line-height: 1.75rem; | ||
| } |
21 changes: 21 additions & 0 deletions
21
src/plays/quizeo/src/components/menu-item/menuItem.component.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import React from "react"; | ||
| import { useDispatch} from "react-redux" | ||
| import { displayQuestionComponent, isClicked } from "../../redux/questions/questions-action"; | ||
|
|
||
| import './menu-item.styles.css' | ||
|
|
||
| const MenuItem = ({title, imageUrl, linkUrl}) => { | ||
| const dispatch = useDispatch(); | ||
|
|
||
| return ( | ||
| <div className="menu-item"> | ||
| <div className="image-container" style={{backgroundImage:`url(${imageUrl})`}}/> | ||
| <div className="image-content" | ||
| onClick={() => {dispatch(displayQuestionComponent(linkUrl)); dispatch(isClicked())}}> | ||
| <h1>{title}</h1> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| export default MenuItem; |
59 changes: 59 additions & 0 deletions
59
src/plays/quizeo/src/components/questions/questions.component.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import React from "react"; | ||
| import { useSelector, useDispatch } from "react-redux"; | ||
| import { ScoreModel } from "../../pages/score-page/score.component"; | ||
| import { addScore,showModel } from "../../redux/questions/questions-action"; | ||
| import { increaseQuestionNo } from "../../redux/questions/questions-action"; | ||
| import { selectQuestionNo, selectHiddenState } from "../../redux/movie/movieSelector"; | ||
|
|
||
| import './questions.styles.css'; | ||
|
|
||
| const Questions = (collection) => { | ||
| const counter = useSelector(selectQuestionNo); | ||
| const hidden = useSelector(selectHiddenState); | ||
| const dispatch = useDispatch(); | ||
| let obj; | ||
| return ( | ||
| <div className="question-container"> | ||
| {Object.keys(collection).map((item,i) => ( | ||
| <div className={`${hidden ? '' : 'question-background'} question-model`}> | ||
| {/* movie title */} | ||
| <p className="category-title"><span className="title"> | ||
| {collection[item].title}</span> | ||
| </p> | ||
| <div className="questions-section"> | ||
| {/* question */} | ||
| <p className="question-title"> | ||
| {counter + 1}.{collection[item].questions[counter].question} | ||
| </p> | ||
|
|
||
| {/* options */} | ||
| <div className="options-section"> | ||
| {Object.keys(collection[item].questions[counter].options).map((option, i) =>( | ||
| <button className="option-button" | ||
| value={collection[item].questions[counter].options[option]} | ||
| // eslint-disable-next-line no-undef | ||
| onClick={(e) => { | ||
| obj = { | ||
| answer :e.target.value, | ||
| correct : collection[item].questions[counter].answer | ||
| } | ||
| }} | ||
| > | ||
| {collection[item].questions[counter].options[option]} | ||
| </button> | ||
| ))} | ||
| <br></br> | ||
| {counter === collection[item].questions.length-1 ? | ||
| <button className="submit-answer" onClick= {() => {dispatch(addScore(obj));dispatch(showModel())}} >submit</button> : | ||
| <button type="button" className="submit-answer" onClick={() => {dispatch(addScore(obj)); dispatch(increaseQuestionNo())}}>Next</button>} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ))} | ||
| {hidden ? null: <ScoreModel questionNo = {counter}/>} | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
|
|
||
| export default Questions; |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.