Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

Democracy Visualization #66

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
98bf7ec
created basic react skeleton for questions for map
opheez Feb 14, 2020
9b541c0
question shows up!!!
meesuekim Feb 21, 2020
7ce78ae
Merge branch 'master' into map_questions
meesuekim Feb 28, 2020
6f6bbd8
moving around order of components and adding game title/description p…
Crista2019 Feb 28, 2020
19d71d4
Merge branch 'master' into map_questions
Crista2019 Feb 28, 2020
6872e39
Merge branch 'map_questions' of https://github.com/dhmit/democracy_af…
Crista2019 Feb 28, 2020
e65884c
dynamic window resizing also scales map size
Crista2019 Feb 28, 2020
a5cefa4
jk
Crista2019 Feb 28, 2020
a3edbdd
Merge branch 'master' into map_questions
meesuekim Mar 4, 2020
9c3600d
Something was broken and now its a little less broken
meesuekim Mar 4, 2020
b5d7e1a
adding quiz component
meesuekim Mar 4, 2020
570524d
made some minor changes
meesuekim Mar 4, 2020
c91c71f
made some changes and now the quiz shows up
meesuekim Mar 6, 2020
8886094
scoretracker fixed!!
meesuekim Mar 6, 2020
91342ed
minor bug fixes
meesuekim Mar 6, 2020
a44919f
got rid of giant block of commented out code
meesuekim Mar 6, 2020
7270833
missed semicolon
meesuekim Mar 6, 2020
938aa8f
Delete mapQuestions.js
meesuekim Mar 6, 2020
c89c0c9
have into and quiz page. just need to code the end page
meesuekim Mar 6, 2020
d1c39cf
Merge branch 'master' into map_questions
ryaanahmed Mar 9, 2020
d18a480
Merge branch 'master' into map_questions
ryaanahmed Mar 9, 2020
387f317
small layout changes; add to index
ryaanahmed Mar 9, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ def edx_path(route, component_name):
edx_path('adventure/', 'ChooseAdventureView'),
edx_path('map_quiz/', 'MapQuiz'),
edx_path('budget_voting_simulation/', 'BudgetVotingSimViz'),
edx_path('heat_map/', 'DemocracyViz'),
edx_path('democracy_quiz/', 'DemocracyViz'),
edx_path('campaign_game/', 'CampaignView')
]
Empty file.
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"jest-resolve": "24.7.1",
"jest-watch-typeahead": "0.3.0",
"mini-css-extract-plugin": "0.5.0",
"node-sass": "4.13.1",
"optimize-css-assets-webpack-plugin": "5.0.1",
"pnp-webpack-plugin": "1.2.1",
"postcss-flexbugs-fixes": "4.1.0",
Expand Down
30 changes: 30 additions & 0 deletions frontend/src/UILibrary/QuizComponents/answerChoices.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react';
import * as PropTypes from 'prop-types';

function AnswerChoices(props) {
return (
<li className="answerChoices">
<input
type="radio"
className="radioCustomButton"
name="radioGroup"
checked={props.answerType === props.answer}
value={props.answerType}
disabled={props.answer}
onChange={props.onAnswerSelected}
/>
<label className="radioCustomLabel">
{props.answerContent}
</label>
</li>
);
}

AnswerChoices.propTypes = {
answerType: PropTypes.bool.isRequired,
answerContent: PropTypes.string.isRequired,
answer: PropTypes.string.isRequired,
onAnswerSelected: PropTypes.func.isRequired
};

export default AnswerChoices;
16 changes: 16 additions & 0 deletions frontend/src/UILibrary/QuizComponents/displayScore.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';
import * as PropTypes from 'prop-types';

function Score(props) {
return (
<div className="score">
You got <strong>{props.quizScore}</strong>!
</div>
);
}

Score.propTypes = {
quizScore: PropTypes.string.isRequired,
};

export default Score;
14 changes: 14 additions & 0 deletions frontend/src/UILibrary/QuizComponents/quiz.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import * as PropTypes from 'prop-types';

function Quiz(props) {
return (
<h2 className="question">{props.content}</h2>
);
}

Quiz.propTypes ={
content: PropTypes.string.isRequired
};

export default Quiz;
4 changes: 4 additions & 0 deletions frontend/src/UILibrary/QuizComponents/quiz.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.quizFrame {
@extend .float-right;
@extend .mr-5;
}
47 changes: 47 additions & 0 deletions frontend/src/UILibrary/QuizComponents/quizFrame.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React from 'react';
import * as PropTypes from 'prop-types';
import Quiz from "./quiz";
import ScoreTracker from "./scoreTracker";
import AnswerChoices from "./answerChoices";

function QuizFrame(props) {
function renderAnswerChoices(key) {
return (
<AnswerChoices
key={key.content}
answerContent={key.content}
answerType={key.type}
answer={props.answer}
questionId={props.questionId}
onAnswerSelected={props.onAnswerSelected}
/>
);
}

return (
<div className="quizFrame">
<ScoreTracker
counter={props.questionId}
total={props.questionTotal}
correct={props.correctAnswers}
/>
<Quiz content={props.question} />
<div className="answerChoices">
{props.answerChoices.map(renderAnswerChoices)}
</div>
</div>
);
}

QuizFrame.propTypes = {
answer: PropTypes.string.isRequired,
answerChoices: PropTypes.array.isRequired,
counter: PropTypes.number.isRequired,
question: PropTypes.string.isRequired,
questionId: PropTypes.number.isRequired,
questionTotal: PropTypes.number.isRequired,
onAnswerSelected: PropTypes.func.isRequired,
correctAnswers: PropTypes.number.isRequired,
};

export default QuizFrame;
19 changes: 19 additions & 0 deletions frontend/src/UILibrary/QuizComponents/scoreTracker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import * as PropTypes from 'prop-types';

function ScoreTracker(props) {
return (
<div className="scoreTracker">
<p>Question <span>{props.counter}</span> of <span>{props.total}</span></p>
<p>Score <span>{props.correct}</span> of <span>{props.total}</span></p>
</div>
);
}

ScoreTracker.propTypes = {
counter: PropTypes.number.isRequired,
total: PropTypes.number.isRequired,
correct: PropTypes.number.isRequired,
};

export default ScoreTracker;
1 change: 1 addition & 0 deletions frontend/src/UILibrary/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
@import './edx.scss';
@import "../chooseAdventure/chooseAdventure";
@import '../campaign/campaign';
@import 'QuizComponents/quiz.scss';
Loading