diff --git a/src/components/App/App.scss b/src/components/App/App.scss
index 0aeb350..d957c78 100644
--- a/src/components/App/App.scss
+++ b/src/components/App/App.scss
@@ -31,4 +31,8 @@ body {
}
.game {
padding-top: 70px;
+}
+.glyphicon-none:before {
+ content: "\2122";
+ color: transparent !important;
}
\ No newline at end of file
diff --git a/src/components/Game/Game.jsx b/src/components/Game/Game.jsx
index f14d685..a81ab34 100644
--- a/src/components/Game/Game.jsx
+++ b/src/components/Game/Game.jsx
@@ -8,7 +8,7 @@ class Game extends Component {
constructor(props) {
super(props);
this.state = {
- stage:0,
+ stage:1,
showScreen: ''
}
this.showQuestion = this.showQuestion.bind(this);
diff --git a/src/components/Game/Question.jsx b/src/components/Game/Question.jsx
index d11ae74..6eeccbd 100644
--- a/src/components/Game/Question.jsx
+++ b/src/components/Game/Question.jsx
@@ -1,5 +1,6 @@
import React, { Component } from 'react';
import { kanaDictionary } from '../../data/kanaDictionary';
+import { quizSettings } from '../../data/quizSettings';
import { findRomajisAtKanaKey, removeFromArray, arrayContains, shuffle } from '../../data/helperFuncs';
import './Question.scss';
@@ -10,7 +11,8 @@ class Question extends Component {
previousQuestion: [],
previousAnswer: '',
currentQuestion: [],
- answerOptions: []
+ answerOptions: [],
+ stageProgress: 0
}
this.setNewQuestion = this.setNewQuestion.bind(this);
this.handleAnswer = this.handleAnswer.bind(this);
@@ -64,6 +66,10 @@ class Question extends Component {
this.previousAnswer = answer;
this.setState({previousAnswer: this.previousAnswer});
this.previousAllowedAnswers = this.allowedAnswers;
+ if(this.isInAllowedAnswers(this.previousAnswer))
+ this.setState({stageProgress: this.state.stageProgress+1});
+ else
+ this.setState({stageProgress: this.state.stageProgress > 0 ? this.state.stageProgress-1 : 0});
this.setNewQuestion();
}
@@ -104,18 +110,24 @@ class Question extends Component {
}
getPreviousResult() {
- let resultString;
+ let resultString='';
// console.log(this.previousAnswer);
- if(this.previousQuestion=='' || this.previousAnswer=='')
+ if(this.previousQuestion=='')
resultString =
Let's go! Which character is this?
- else if(this.isInAllowedAnswers(this.previousAnswer))
- resultString = Correct!
- else
- resultString = Wrong!
-
+ else {
+ let rightAnswer = (this.props.stage==2?findRomajisAtKanaKey(this.previousQuestion)[0]:this.previousQuestion)+' = '+
+ this.previousAllowedAnswers[0];
+ if(this.isInAllowedAnswers(this.previousAnswer))
+ resultString = {rightAnswer}
+ else
+ resultString = {rightAnswer}
+ }
return resultString;
}
+ getStageProgress() {
+ }
+
isInAllowedAnswers(previousAnswer) {
// console.log(previousAnswer);
// console.log(this.allowedAnswers);
@@ -136,17 +148,32 @@ class Question extends Component {
let btnClass = "btn btn-default answer-button";
if ('ontouchstart' in window)
btnClass += " no-hover"; // disables hover effect on touch screens
+ let stageProgressPercentage = Math.round((this.state.stageProgress/quizSettings.stageLength[this.props.stage])*100)+'%';
+ let stageProgressPercentageStyle = { width: stageProgressPercentage }
return (
{this.getPreviousResult()}
{this.getShowableQuestion()}
- {this.state.answerOptions.map(function(answer, idx) {
- return
- }, this)}
+
+ {this.state.answerOptions.map(function(answer, idx) {
+ return
+ }, this)}
+
+
+
+ Stage {this.props.stage}
+
+
);
}
diff --git a/src/components/Game/Question.scss b/src/components/Game/Question.scss
index ebd0bb8..7cfbf0e 100644
--- a/src/components/Game/Question.scss
+++ b/src/components/Game/Question.scss
@@ -1,23 +1,40 @@
.question {
+ .progress {
+ position: relative;
+ background-color: #ddd;
+ height: 30px;
+ @media (max-width: 768px) {
+ max-width: 360px;
+ margin: 0 auto;
+ }
+ }
+ .progress span {
+ position: absolute;
+ top: 5px;
+ color: #444;
+ display: block;
+ width: 100%;
+ }
.previous-result{
- max-width: 340px;
+ max-width: 360px;
padding: 8px;
- margin: 50px auto 30px;
+ margin: 30px auto 28px;
+ border-radius: 3px;
}
.none {
- background-color: #888;
+ background-color: #aaa;
color: #f5f5f5;
}
.correct {
color: #f5f5f5;
- background-color: #080;
+ background-color: #5cb85c;
}
.wrong {
color: #f5f5f5;
- background-color: #800;
+ background-color: #d9534f;
}
.previous-result-none {
- max-width: 340px;
+ max-width: 360px;
padding: 6px;
margin: 30px auto;
color: #f5f5f5;
@@ -25,15 +42,16 @@
.big-character {
font-size: 5em;
}
+ .answer-container {
+ max-width: 360px;
+ margin: 0 auto;
+ display: flex;
+ justify-content: space-between;
+ }
.answer-button {
min-width: 90px;
font-size: 2em;
- @media (min-width: 768px) {
- margin: 30px 15px 10px;
- }
- @media (max-width: 768px) {
- margin: 30px 5px 10px;
- }
+ margin: 30px 0 60px;
}
.no-hover {
/* disables hover effect on touch screens */
diff --git a/src/components/Navbar/Navbar.jsx b/src/components/Navbar/Navbar.jsx
index ac6936f..68e19b8 100644
--- a/src/components/Navbar/Navbar.jsx
+++ b/src/components/Navbar/Navbar.jsx
@@ -23,7 +23,6 @@ class Navbar extends Component {
{leftLink}
@@ -32,6 +31,8 @@ class Navbar extends Component {
)
}
}
+ // Settings
+
// {this.props.profile.hasOwnProperty('user_id')?this.props.profile.name+' is logged in':'not logged in'}
//
// - < Back to menu
diff --git a/src/components/Navbar/Navbar.scss b/src/components/Navbar/Navbar.scss
index 754557a..04ef8c6 100644
--- a/src/components/Navbar/Navbar.scss
+++ b/src/components/Navbar/Navbar.scss
@@ -11,6 +11,11 @@
.navbar-inverse {
background-color: #333;
}
+.hidden-nano {
+ @media (max-width: 390px) {
+ display: none;
+ }
+}
.nav a {
color: #fff !important;
}
diff --git a/src/data/kanaDictionary.js b/src/data/kanaDictionary.js
index 2600ff5..c49c0d1 100644
--- a/src/data/kanaDictionary.js
+++ b/src/data/kanaDictionary.js
@@ -1,21 +1,4 @@
-/* export let kanaDictionary_romajifirst = {
- 'hiragana' : {
- 'h_group1': { characters: { 'a': 'あ', 'i': 'い', 'u': 'う', 'e': 'え', 'o': 'お' } },
- 'h_group2': { characters: { 'ka': 'か', 'ki': 'き', 'ku': 'く', 'ke': 'け', 'ko': 'こ' } },
- 'h_group3': { characters: { 'sa': 'さ', 'shi': 'し', 'su': 'す', 'se': 'せ', 'so': 'そ' } },
- 'h_group4': { characters: { 'ta': 'た', 'chi': 'ち', 'tsu': 'つ', 'te': 'て' , 'to': 'と' } },
- 'h_group5': { characters: { 'na': 'な', 'ni': 'に', 'nu': 'ぬ', 'ne': 'ね', 'no': 'の' } },
- 'h_group6': { characters: { 'ha': 'は', 'hi': 'ひ', 'fu': 'ふ', 'he': 'へ', 'ho': 'ほ' } },
- 'h_group7': { characters: { 'ma': 'ま', 'mi': 'み', 'mu': 'む', 'me': 'め', 'mo': 'も' } },
- 'h_group8': { characters: { 'ya': 'や', 'yu': 'ゆ', 'yo': 'よ' } },
- 'h_group9': { characters: { 'ra': 'ら', 'ri': 'り', 'ru': 'る', 're': 'れ', 'ro': 'ろ' } },
- 'h_group10': { characters: { 'wa': 'わ', 'wo': 'を', 'n': 'ん' } },
- },
- 'katakana' : {
- }
-}; */
-
-export let kanaDictionary = {
+export const kanaDictionary = {
'hiragana' : {
'h_group1': { characters: { 'あ': ['a'], 'い': ['i'], 'う': ['u'], 'え': ['e'], 'お': ['o'] } },
'h_group2': { characters: { 'か': ['ka'], 'き': ['ki'], 'く': ['ku'], 'け': ['ke'], 'こ': ['ko'] } },
@@ -45,40 +28,3 @@ export let kanaDictionary = {
'プ': ['pu'], 'ペ': ['pe'], 'ポ': ['po'], 'キャ': ['kya'], 'キュ': ['kyu'], 'キョ': ['kyo'], 'シャ': ['sha','sya'], 'シュ': ['shu','syu'], 'ショ': ['sho','syo'], 'チャ': ['cha','cya'], 'チュ': ['chu','cyu'], 'チョ': ['cho','cyo'], 'ニャ': ['nya'], 'ニュ': ['nyu'], 'ニョ': ['nyo'], 'ヒャ': ['hya'], 'ヒュ': ['hyu'], 'ヒョ': ['hyo'], 'ミャ': ['mya'], 'ミュ': ['myu'], 'ミョ': ['myo'], 'リャ': ['rya'], 'リュ': ['ryu'], 'リョ': ['ryo'], 'ギャ': ['gya'], 'ギュ': ['gyu'], 'ギョ': ['gyo'], 'ジャ': ['ja','jya'], 'ジュ': ['ju','jyu'], 'ジョ': ['jo','jyo'], 'ビャ': ['bya'], 'ビュ': ['byu'], 'ビョ': ['byo'], 'ピャ': ['pya'], 'ピュ': ['pyu'], 'ピョ': ['pyo'] } }
}
};
-
-// If answer is wrong, let's check if the answer is a key here, and compare the value to the correct answer
-// export let acceptedAlternatives = { 'si': 'shi', 'ti': 'chi', 'tu': 'tsu', 'hu': 'fu', 'o': 'wo',
- // 'zi': 'ji', 'di': 'ji', 'du': 'zu', 'sya': 'sha', 'syu': 'shu', 'syo': 'sho',
- // 'cya': 'cha', 'cyu': 'chu', 'cyo': 'cho', 'jya': 'ja', 'jyu': 'ju', 'jyo': 'jo' };
-
-
-
-// export let acceptedAlternatives = { 'shi': 'si', 'chi': 'ti', 'tsu': 'tu', 'fu': 'hu', 'wo': 'o',
-// 'ji': 'zi', 'ji': };
-
-/*
-let kanaArray = [
- 'あ','い','う','え','お',
- 'か','き','く','け','こ',
- 'さ','し','す','せ','そ',
- 'た','ち','つ','て','と',
- 'な','に','ぬ','ね','の',
- 'は','ひ','ふ','へ','ほ',
- 'ま','み','む','め','も',
- 'や','ゆ','よ',
- 'ら','り','る','れ','ろ',
- 'わ','を','ん'
-];
-let romajiArray = [
- 'a','i','u','e','o',
- 'ka','ki','ku','ke','ko',
- 'sa','shi','su','se','so',
- 'ta','chi','tsu','te','to',
- 'na','ni','nu','ne','no',
- 'ha','hi','fu','he','ho',
- 'ma','mi','mu','me','mo',
- 'ya','yu','yo',
- 'ra','ri','ru','re','ro',
- 'wa','wo','n'
-];
-*/
diff --git a/src/data/quizSettings.js b/src/data/quizSettings.js
new file mode 100644
index 0000000..8557a09
--- /dev/null
+++ b/src/data/quizSettings.js
@@ -0,0 +1,8 @@
+export const quizSettings = {
+ stageLength : {
+ 1: 20,
+ 2: 20,
+ 3: 20,
+ 4: 20
+ }
+};
\ No newline at end of file