Skip to content

Commit

Permalink
Code organised
Browse files Browse the repository at this point in the history
  • Loading branch information
Das committed Aug 28, 2020
1 parent 1705f30 commit c7d669e
Show file tree
Hide file tree
Showing 31 changed files with 32,124 additions and 24,746 deletions.
34 changes: 17 additions & 17 deletions .firebase/hosting.YnVpbGQ.cache
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
asset-manifest.json,1598507924846,bde38ebc935123af61dd7f7b3f308a4ef710c3c788da1f99630c760e5bbde2f8
index.html,1598507924846,32a152291115ee58cb3060c90e9143a64f99b896a3a08f9426c3906003eff5d6
manifest.json,499162500000,aff3449bdc238776f5d6d967f19ec491b36aed5fb7f23ccff6500736fd58494a
precache-manifest.237fd19650d85f6b8ccb9716d4801aed.js,1598507924846,8fd766b44d1094ce6e7746b8cd7d08f6eadb39638e6a7652edd9cd354de53918
robots.txt,499162500000,bfe106a3fb878dc83461c86818bf74fc1bdc7f28538ba613cd3e775516ce8b49
favicon.ico,499162500000,d96ddbc4933b04e12c738ab39f469573143949ca2c39eda0a49d16f83d40c319
logo192.png,499162500000,3ee59515172ee198f3be375979df15ac5345183e656720a381b8872b2a39dc8b
service-worker.js,1598507924846,49746a744dcae61bfb476a718472a9cde063346850d926b88e73b1963c5985a0
static/js/2.67157743.chunk.js.LICENSE.txt,1598507924854,6e35c90a08889838097fac293adfe2716dd320ffd6ce18953bfbbb9f80852f3f
static/css/main.03adb421.chunk.css,1598507924853,f397b3f94aa0085fe8cea0c8ecf3d68f530b6acc25164213e667319a461fe2c0
static/css/main.03adb421.chunk.css.map,1598507924853,56365ac328df34f6c87a93f8997fa783f70cf8737d64d96238ba235f775a0365
logo512.png,499162500000,ee7e2f3fdb8209c4b6fd7bef6ba50d1b9dba30a25bb5c3126df057e1cb6f5331
static/js/main.e1144e45.chunk.js,1598507924853,763e673729a393e8d15d6304d1754ad92eb81dee024774b7d59be9d7ec65153a
static/js/runtime-main.d4304d1c.js,1598507924853,26f0303296f02225d1157ea161c2a2b0288df5281d303c1030b6945240554cdf
static/js/runtime-main.d4304d1c.js.map,1598507924854,1cc22d56b1fa9e0824e48491e56c4c1b83632c0aea3b4a1d9f5d497b50f929f4
static/js/main.e1144e45.chunk.js.map,1598507924853,b6afd9505f06540a33d9597e3f9fea170d308871e1390af32b62682d9c6b19ab
static/media/c3f2.13a6e59e.png,1598507924853,5bc58b9030fc4ea7b59ea279f55ec5b7728f06d130fb03e7052ef9a9ddad0bf0
static/media/quiz.e20965ee.png,1598507924850,aa8157058bf7f6a8c12f4cf436255ab38fa8224caad3e42875da080045f608d7
static/js/2.67157743.chunk.js,1598507924854,779d2ce139f8316441fe4ed2ead737b4bfdd05b0c58bc2cd46e485adb89e5c58
static/js/2.67157743.chunk.js.map,1598507924854,fe361338ad7ec0ce60ae2f31d527df7eae54cd10111d1435e2bdd2ce83dbc3cd
manifest.json,499162500000,aff3449bdc238776f5d6d967f19ec491b36aed5fb7f23ccff6500736fd58494a
robots.txt,499162500000,bfe106a3fb878dc83461c86818bf74fc1bdc7f28538ba613cd3e775516ce8b49
asset-manifest.json,1598591684818,8ad9c690e8d1c266c012ea7dde0bff1511fb1db6eed11f81b22071950c1003b4
index.html,1598591684818,b92c2c04cb5d424d8cb4354a8066650dbd8c67a015cd2cc0bce9706d97bb84a5
precache-manifest.bae64b1f61909380a20bf04d9b29bded.js,1598591684818,b23559194f1a1eef3b5bc3136679e479808fa24e635e65ce10048070ad1ee61b
service-worker.js,1598591684818,d63ef945dd0a8013a81b513418add096f63330e0065a3aeac9cc10cd09edb1b3
static/css/main.369f1e0d.chunk.css,1598591684822,c831e160ee35b7d302739bfdc2cb036cf65e5ac4107f50adbc50099ca1cf0ae9
static/js/2.aad2c480.chunk.js.LICENSE.txt,1598591684828,6e35c90a08889838097fac293adfe2716dd320ffd6ce18953bfbbb9f80852f3f
static/css/main.369f1e0d.chunk.css.map,1598591684828,475f7bda4edd9995ec9c93a44e5781ba04a8c5a27170d998fa90ab0a5796e63f
static/js/main.4fe92b7b.chunk.js.map,1598591684828,558d3e66236f4d1daa6e99297c35d4cc02c0e8d16463d9098f13bd8ae0c02f08
static/js/runtime-main.d4304d1c.js,1598591684828,26f0303296f02225d1157ea161c2a2b0288df5281d303c1030b6945240554cdf
static/js/runtime-main.d4304d1c.js.map,1598591684828,1cc22d56b1fa9e0824e48491e56c4c1b83632c0aea3b4a1d9f5d497b50f929f4
static/media/c3f2.13a6e59e.png,1598591684828,5bc58b9030fc4ea7b59ea279f55ec5b7728f06d130fb03e7052ef9a9ddad0bf0
static/media/quiz.e20965ee.png,1598591684822,aa8157058bf7f6a8c12f4cf436255ab38fa8224caad3e42875da080045f608d7
static/js/2.aad2c480.chunk.js,1598591684828,d9b4499f2b71834e7f54179530e853822e8b94e61e2ad024d6ee4f346dbcce8f
static/js/main.4fe92b7b.chunk.js,1598591684828,c91128466a811cc81bb622018c83ed1c52b0e061fd24b62670701ed26aff5c7d
static/js/2.aad2c480.chunk.js.map,1598591684829,4b063ab335bb4807679e9cbbd25057574be840295435bf46b924c6203f0ff81b
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,22 @@ The url will be created.
The code to keep footer at the bottom is done for the quiz page but need a generic solution.
5. Don't like the white background - Done
6. The Navbar disappears on scrolling - It's not hapenning now.
7. Upon loading of the quiz page if user clicks of previous button the application crashes. - Disabled the previous button on the 1st question and the next button on the last question
8. Remember the previous answers so that user can see the chosen answers. - Done
7. Upon loading of the quiz page if user clicks of previous button the application crashes. - Done.
Disabled the previous button on the 1st question and the next button on the last question
8. Remember the previous choise so that user can see the chosen answers. - Done
9. Remove the "Check Answer" and Score. Replace that by Submit button. A report will popup showing user's selection and correct answer and score.
10. Code cleanup and organize the components properly
11. When the countries are loading show "Loading..." in the page not "No data found"
11. When the countries are loading show "Loading..." not "No data found"
12. Implement 3 difficulty levels for the quiz. Easy - Medium - Hard

Defects

1. Faulty scoring system.
2. In the country capital quiz duplicate answer is shown. This is because Country Niue and Jamica have the same capital name Kingston.

Git commands
git init
git add .
git commit -m "first commit"
git remote add origin https://github.com/SwarnenduDasKW/Country-Capital-Flag.git
git push -u origin master
3 changes: 0 additions & 3 deletions src/Appbar.css

This file was deleted.

29 changes: 0 additions & 29 deletions src/Appbar.js

This file was deleted.

59 changes: 0 additions & 59 deletions src/LearnTheHardWay.js

This file was deleted.

4 changes: 0 additions & 4 deletions src/QuizCountryCurrency.css

This file was deleted.

14 changes: 7 additions & 7 deletions src/App.js → src/components/App.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React, { useState, useMemo } from "react";
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
import { CountryContext } from "./CountryContext";
import { AnswerContext } from "./answer-context";
import Countries from "./Countries";
import Navbar from "./Navbar";
import Footer from "./Footer";
import QuizMaster from "./QuizMaster";
import "./App.css";
import { CountryContext } from "../contexts/CountryContext";
import { AnswerContext } from "../contexts/answerContext";
import Countries from "../components/Countries";
import Navbar from "../components/Navbar";
import Footer from "../components/Footer";
import QuizMaster from "../components/QuizMaster";
import "../stylesheets/App.css";

function App() {
const [countrydata, setCountrydata] = useState([]);
Expand Down
6 changes: 3 additions & 3 deletions src/Countries.js → src/components/Countries.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useState, useContext } from "react";
import "./Countries.css";
import Country from "./Country";
import { CountryContext } from "./CountryContext";
import "../stylesheets/Countries.css";
import Country from "../components/Country";
import { CountryContext } from "../contexts/CountryContext";

function Countries() {
const { countrydata, setCountrydata } = useContext(CountryContext);
Expand Down
2 changes: 1 addition & 1 deletion src/Country.js → src/components/Country.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import "./Country.css";
import "../stylesheets/Country.css";

function Country(props) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import FormControl from "@material-ui/core/FormControl";
import FormHelperText from "@material-ui/core/FormHelperText";
import Button from "@material-ui/core/Button";
import Chip from "@material-ui/core/Chip";
import { AnswerContext } from "./answer-context";
import { AnswerContext } from "../contexts/answerContext";
import Avatar from "@material-ui/core/Avatar";
import { makeStyles } from "@material-ui/core/styles";
import "./CountryCapitalQuiz.css";
import "../stylesheets/CountryCapitalQuiz.css";

const useStyles = makeStyles((theme) => ({
root: {
Expand Down
2 changes: 1 addition & 1 deletion src/Footer.js → src/components/Footer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import "./Footer.css";
import "../stylesheets/Footer.css";
import TwitterIcon from "@material-ui/icons/Twitter";
import GitHubIcon from "@material-ui/icons/GitHub";
import LinkedInIcon from "@material-ui/icons/LinkedIn";
Expand Down
8 changes: 4 additions & 4 deletions src/Navbar.js → src/components/Navbar.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useState, useEffect, useContext } from "react";
import "./Navbar.css";
import logo from "./images/c3f2.png";
import quiz_logo from "./images/quiz.png";
import { CountryContext } from "./CountryContext";
import "../stylesheets/Navbar.css";
import logo from "../images/c3f2.png";
import quiz_logo from "../images/quiz.png";
import { CountryContext } from "../contexts/CountryContext";
import Badge from "@material-ui/core/Badge";
import PublicIcon from "@material-ui/icons/Public";
import { Link } from "react-router-dom";
Expand Down
10 changes: 5 additions & 5 deletions src/QuizMaster.js → src/components/QuizMaster.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React, { useState, useEffect, useContext } from "react";
import CountryCapitalQuiz from "./CountryCapitalQuiz";
import CountryCapitalQuiz from "../components/CountryCapitalQuiz";
import Button from "@material-ui/core/Button";
import FastRewindIcon from "@material-ui/icons/FastRewind";
import FastForwardIcon from "@material-ui/icons/FastForward";
import { AnswerContext } from "./answer-context";
import QuizCountryCurrency from "./QuizCountryCurrency";
import "./QuizMaster.css";
import { AnswerContext } from "../contexts/answerContext";
import getCountryListForQuiz from "../components/getCountryListForQuiz";
import "../stylesheets/QuizMaster.css";

function QuizMaster() {
const [id, setId] = useState(0);
const [quizCountries] = useState(QuizCountryCurrency());
const [quizCountries] = useState(getCountryListForQuiz());
const { answer } = useContext(AnswerContext);

//Clear the previous answers when the quiz page is loaded
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import AllCountries from "./data/AllCountries.json";
import AllCountries from "../data/AllCountries.json";
// import AllCountriesLite from "./data/AllCountriesLight.json";
import {
getRandomNumbersArray,
getRandomIntInclusive,
FisherYatesShuffle,
} from "./Utilities";
} from "../helpers/Utilities";

function QuizCountryCurrency() {
function getCountryListForQuiz() {
const noOfQuestions = 10;
let allCountriesWithIndex = [];
let quizCountries = [];
Expand Down Expand Up @@ -105,4 +105,4 @@ function QuizCountryCurrency() {
return quizCountries;
}

export default QuizCountryCurrency;
export default getCountryListForQuiz;
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit c7d669e

Please sign in to comment.