diff --git a/npm-debug.log b/npm-debug.log new file mode 100644 index 0000000..77471e8 --- /dev/null +++ b/npm-debug.log @@ -0,0 +1,48 @@ +0 info it worked if it ends with ok +1 verbose cli [ '/Users/krissalvador/.nvm/versions/node/v5.10.1/bin/node', +1 verbose cli '/Users/krissalvador/.nvm/versions/node/v5.10.1/bin/npm', +1 verbose cli 'run', +1 verbose cli 'start' ] +2 info using npm@3.8.3 +3 info using node@v5.10.1 +4 verbose run-script [ 'prestart', 'start', 'poststart' ] +5 info lifecycle react-flashcards@1.0.0~prestart: react-flashcards@1.0.0 +6 silly lifecycle react-flashcards@1.0.0~prestart: no script for prestart, continuing +7 info lifecycle react-flashcards@1.0.0~start: react-flashcards@1.0.0 +8 verbose lifecycle react-flashcards@1.0.0~start: unsafe-perm in lifecycle true +9 verbose lifecycle react-flashcards@1.0.0~start: PATH: /Users/krissalvador/.nvm/versions/node/v5.10.1/lib/node_modules/npm/bin/node-gyp-bin:/Users/krissalvador/Personal Projects/react-flashcards/node_modules/.bin:/Users/krissalvador/.nvm/versions/node/v5.10.1/bin:/Users/krissalvador/.rvm/gems/ruby-2.1.2/bin:/Users/krissalvador/.rvm/gems/ruby-2.1.2@global/bin:/Users/krissalvador/.rvm/rubies/ruby-2.1.2/bin:/Users/krissalvador/.nvm/versions/node/v5.10.1/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Postgres.app/Contents/Versions/9.3/bin:/Users/krissalvador/.rvm/bin +10 verbose lifecycle react-flashcards@1.0.0~start: CWD: /Users/krissalvador/Personal Projects/react-flashcards +11 silly lifecycle react-flashcards@1.0.0~start: Args: [ '-c', 'node src/server/server.js' ] +12 silly lifecycle react-flashcards@1.0.0~start: Returned: code: 1 signal: null +13 info lifecycle react-flashcards@1.0.0~start: Failed to exec start script +14 verbose stack Error: react-flashcards@1.0.0 start: `node src/server/server.js` +14 verbose stack Exit status 1 +14 verbose stack at EventEmitter. (/Users/krissalvador/.nvm/versions/node/v5.10.1/lib/node_modules/npm/lib/utils/lifecycle.js:239:16) +14 verbose stack at emitTwo (events.js:100:13) +14 verbose stack at EventEmitter.emit (events.js:185:7) +14 verbose stack at ChildProcess. (/Users/krissalvador/.nvm/versions/node/v5.10.1/lib/node_modules/npm/lib/utils/spawn.js:24:14) +14 verbose stack at emitTwo (events.js:100:13) +14 verbose stack at ChildProcess.emit (events.js:185:7) +14 verbose stack at maybeClose (internal/child_process.js:850:16) +14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5) +15 verbose pkgid react-flashcards@1.0.0 +16 verbose cwd /Users/krissalvador/Personal Projects/react-flashcards +17 error Darwin 15.5.0 +18 error argv "/Users/krissalvador/.nvm/versions/node/v5.10.1/bin/node" "/Users/krissalvador/.nvm/versions/node/v5.10.1/bin/npm" "run" "start" +19 error node v5.10.1 +20 error npm v3.8.3 +21 error code ELIFECYCLE +22 error react-flashcards@1.0.0 start: `node src/server/server.js` +22 error Exit status 1 +23 error Failed at the react-flashcards@1.0.0 start script 'node src/server/server.js'. +23 error Make sure you have the latest version of node.js and npm installed. +23 error If you do, this is most likely a problem with the react-flashcards package, +23 error not with npm itself. +23 error Tell the author that this fails on your system: +23 error node src/server/server.js +23 error You can get information on how to open an issue for this project with: +23 error npm bugs react-flashcards +23 error Or if that isn't available, you can get their info via: +23 error npm owner ls react-flashcards +23 error There is likely additional logging output above. +24 verbose exit [ 1, true ] diff --git a/src/js/components/flashcard/front/front.js b/src/js/components/flashcard/front/front.js index 3fd58e0..297ea22 100644 --- a/src/js/components/flashcard/front/front.js +++ b/src/js/components/flashcard/front/front.js @@ -5,6 +5,7 @@ export default function Front(props) {
Question: { buildFlashcardTags(props.question) } Source: { props.source } +
Tags: { props.tags }
); diff --git a/src/js/components/question-input/preview.js b/src/js/components/question-input/preview.js new file mode 100644 index 0000000..8d9a201 --- /dev/null +++ b/src/js/components/question-input/preview.js @@ -0,0 +1,9 @@ +import { buildFlashcardTags } from "../../../lib/helpers/questions-helpers"; + +export default function Preview(props) { + return ( +
+ { buildFlashcardTags(props.content) } +
+ ); +} \ No newline at end of file diff --git a/src/js/components/question-input/question-input.js b/src/js/components/question-input/question-input.js new file mode 100644 index 0000000..ac952f1 --- /dev/null +++ b/src/js/components/question-input/question-input.js @@ -0,0 +1,175 @@ +import Preview from "./preview"; +import "./question-input.scss"; + +import { SimpleSelect } from "react-selectize"; +import { buildOptions } from "../../../lib/helpers/questions-helpers"; + +export const TEXTAREA_PLACEHOLDER = "Enter your line here."; +export const TYPE_OPTIONS = buildOptions(['Code', 'Text']); +export const VIEW_OPTIONS = buildOptions(['Normal', 'Italics', 'Bolded']); + +export default class QuestionInput extends React.Component { + constructor(props) { + super(props); + this.typeOptions = TYPE_OPTIONS; + this.viewOptions = VIEW_OPTIONS; + this.textareaPlaceholder = TEXTAREA_PLACEHOLDER; + + this.state = { + questionText: "", + questionType: "Code", + questionStyle: null, + answerText: "", + answerType: "Code", + answerStyle: null, + questionArray: [], + answerArray: [] + } + } + + setQuestionState(e) { + this.setState({ questionText: e.target.value }); + } + + setAnswerState(e) { + this.setState({ answerText: e.target.value }); + } + + updateQuestionType(value) { + this.setState({ questionType: value }) + } + + addQuestionLine() { + let questionType = this.state.questionType === "Code" ? "pre" : "div"; + let newQuestion = { + tag: questionType, + class: questionType === "div" ? "text-question" : "code-question", + content: (this.state.questionText) + }; + + this.setState({ questionArray: this.state.questionArray.concat([newQuestion])}) + this.setState({ questionText: "" }) + document.getElementsByName("question-textarea").value = ""; + } + + addAnswerLine() { + let answerType = this.state.questionType === "Code" ? "pre" : "div"; + let newAnswer = { + tag: answerType, + class: answerType === "div" ? "text-answer" : "code-answer", + content: (this.state.answerText) + }; + + this.setState({ answerArray: this.state.answerArray.concat([newAnswer])}) + this.setState({ answerText: "" }) + document.getElementsByName("answer-textarea").value = ""; + } + + handleTextAreaKeydown(e) { + if (e.keyCode === 9) { + e.preventDefault(); + + let textarea = e.target; + let start = textarea.selectionStart; + let end = textarea.selectionEnd; + let value = textarea.value; + + textarea.value = value.substring(0, start) + "\t" + value.substring(end); + + textarea.selectionEnd = start + 1; + } + } + + render() { + return ( +
+
+ +
+

Question Info

+ {this.questionText} +
+