diff --git a/vds-app/App/components/Results.js b/vds-app/App/components/Results.js index 28d8099..238c897 100644 --- a/vds-app/App/components/Results.js +++ b/vds-app/App/components/Results.js @@ -18,8 +18,8 @@ const styles = StyleSheet.create({ box: { backgroundColor: colors.green_alpha, width: screen.width / 1.1, - height: screen.height / 2, - borderRadius: 5, + height: 320, + borderRadius: 15, borderColor: colors.white_alpha, borderWidth: 5, alignItems: "center", @@ -28,8 +28,8 @@ const styles = StyleSheet.create({ boxWrong: { backgroundColor: colors.red_alpha, width: screen.width / 1.1, - height: screen.height / 2, - borderRadius: 5, + height: 320, + borderRadius: 15, borderColor: colors.white_alpha, borderWidth: 5, alignItems: "center", @@ -38,9 +38,9 @@ const styles = StyleSheet.create({ boxUnsafe: { backgroundColor: colors.orange, width: screen.width / 1.1, - height: screen.height / 2, - borderRadius: 5, - borderColor: colors.orange, + height: 320, + borderRadius: 15, + borderColor: colors.white_alpha, borderWidth: 5, alignItems: "center", justifyContent: "center" @@ -51,7 +51,7 @@ const styles = StyleSheet.create({ textAlign: "center", letterSpacing: -0.02, fontWeight: "500", - lineHeight: 90 + lineHeight: 50 }, textLabel: { paddingHorizontal: 20, @@ -68,10 +68,9 @@ const styles = StyleSheet.create({ } }) -export const Results = ({ correct, wrong, visible }) => { +export const Results = ({ total, correct, wrong, visible }) => { if (!visible) return null - const total = wrong+correct const percentage = total ? (100/total) * correct : 0 const boxStyle = percentage >= 80 ? percentage >= 85 ? styles.box : styles.boxUnsafe : styles.boxWrong const percentStyle = percentage >= 80 ? percentage >= 85 ? styles.correct : styles.unsafe : styles.wrong @@ -80,22 +79,13 @@ export const Results = ({ correct, wrong, visible }) => { - {`${texts.corrects}: `} - - {`${correct}`} - + {`${texts.corrects}: ${correct}`} - {`${texts.wrongs}: `} - - {`${wrong}`} - + {`${texts.wrongs}: ${wrong}`} - {`${texts.percentage}: `} - - {`${Math.round(percentage)}%`} - + {`${texts.percentage}: ${Math.round(percentage)}%`} diff --git a/vds-app/App/components/RowItem.js b/vds-app/App/components/RowItem.js index 4930195..7c3009e 100644 --- a/vds-app/App/components/RowItem.js +++ b/vds-app/App/components/RowItem.js @@ -7,8 +7,7 @@ const styles = StyleSheet.create({ paddingHorizontal: 15, paddingVertical: 20, backgroundColor: colors.blue, - borderBottomColor: colors.dark_blue, - borderBottomWidth: 1 + marginBottom: 1 }, text: { fontSize: 18, @@ -17,10 +16,10 @@ const styles = StyleSheet.create({ } }) -export const RowItem = ({ onPress = () => {}, name, color }) => ( +export const RowItem = ({ onPress = () => {}, name, color, textColor }) => ( - {name} + {name} ) diff --git a/vds-app/App/components/Variables.js b/vds-app/App/components/Variables.js index 87f951a..ec0a0d0 100644 --- a/vds-app/App/components/Variables.js +++ b/vds-app/App/components/Variables.js @@ -15,7 +15,7 @@ export const colors = { export const texts = { quizzes: "Seleziona un quiz", - exam: "Simulazione esame", + exam: "Simulazione esame (30 domande in 30min)", corrects: "Corrette", wrongs: "Sbagliate", percentage: "Percentuale", diff --git a/vds-app/App/screens/Exam.js b/vds-app/App/screens/Exam.js index 3afe47b..eb0a1e2 100644 --- a/vds-app/App/screens/Exam.js +++ b/vds-app/App/screens/Exam.js @@ -36,7 +36,7 @@ const styles = StyleSheet.create({ }) let interval = null -const maxTime = 10 +const maxTime = 10 // 1800 class Exam extends React.Component { @@ -51,7 +51,7 @@ class Exam extends React.Component { answered: false, answerCorrect: false, results: false, - timer: 0 + timer: maxTime } answer = correct => { @@ -79,7 +79,7 @@ class Exam extends React.Component { this.setState( (state) => { const updatedIndexes = state.availableIds.filter( item => item != state.activeQuestionId) const nextId = updatedIndexes[Math.floor(Math.random() * updatedIndexes.length)] - let resultsShow = this.state.timer >= maxTime-1 || false + let resultsShow = this.state.timer <= 1 || false if (!updatedIndexes.length) { resultsShow = true @@ -101,18 +101,18 @@ class Exam extends React.Component { const questions = this.props.navigation.getParam("questions", []) const question = questions.filter(item => item.id == this.state.activeQuestionId)[0] || questions[0] - if(this.state.timer==0) { + if(this.state.timer==maxTime) { interval = setInterval( () => { this.setState( (state) => { return { - timer: this.state.timer+1, - results: this.state.timer >= maxTime-1 || false + timer: this.state.timer-1, + results: this.state.timer <= 1 || false } }) }, 1000) } - if(this.state.timer >= maxTime) { + if(this.state.timer < 1) { clearInterval(interval) setTimeout( () => { this.props.navigation.popToTop() @@ -151,6 +151,7 @@ class Exam extends React.Component { visible={this.state.answered} /> ( - + navigation.navigate("Quiz", { title: texts.aerodynamics, questions: aerodynamicsQuestions, color: colors.blue })}/> - + navigation.navigate("Quiz", { title: texts.first_aid, questions: firstAidQuestions, color: colors.blue })}/> - + navigation.navigate("Quiz", { title: texts.flight_safety, questions: flightSafetyQuestions, color: colors.blue })}/> - + navigation.navigate("Quiz", { title: texts.instruments, questions: instrumentsQuestions, color: colors.blue })}/> - + navigation.navigate("Quiz", { title: texts.legislation, questions: legislationQuestions, color: colors.blue })}/> - + navigation.navigate("Quiz", { title: texts.materials, questions: materialsQuestions, color: colors.blue })}/> - + navigation.navigate("Quiz", { title: texts.meteorology, questions: meteorologyQuestions, color: colors.blue })}/> - + navigation.navigate("Quiz", { title: texts.physiopathology, questions: physiopathologyQuestions, color: colors.blue })}/> - + navigation.navigate("Quiz", { title: texts.piloting_techniques, questions: pilotingTechniquesQuestions, color: colors.blue })}/> - + navigation.navigate("Exam", { title: texts.exam, questions: examQuestions, color: colors.blue })}/> - - navigation.navigate("Quiz", { - title: "TEST", - questions: testQuestions, - color: colors.blue - })}/> - )