diff --git a/.babelrc b/.babelrc
new file mode 100644
index 0000000..6763fb5
--- /dev/null
+++ b/.babelrc
@@ -0,0 +1,3 @@
+{
+ "presets": [ "es2015", "react" ]
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 7d9e4ea..25a478e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,3 @@
php/google/
-ipa_character_picker/
node_modules/
+public/
diff --git a/package.json b/package.json
index 9df1146..0124386 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,10 @@
"description": "A tool to build simple dictionaries using JSON.",
"main": "src/app.js",
"scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
+ "start": "node start-server.js",
+ "pack": "node ./node_modules/webpack/bin/webpack.js -d --progress --display-error-details",
+ "watch": "node ./node_modules/webpack/bin/webpack.js -d --progress --watch",
+ "build": "node ./node_modules/webpack/bin/webpack.js -p --progress"
},
"repository": {
"type": "git",
@@ -18,7 +21,25 @@
},
"homepage": "https://github.com/Alamantus/Lexiconga#readme",
"dependencies": {
+ "babel-polyfill": "^6.13.0",
+ "json-query": "^2.2.0",
"marked": "^0.3.6",
- "papaparse": "^4.1.2"
+ "papaparse": "^4.1.2",
+ "react": "^15.3.2",
+ "react-dom": "^15.3.2"
+ },
+ "devDependencies": {
+ "babel-core": "^6.14.0",
+ "babel-loader": "^6.2.5",
+ "babel-preset-es2015": "^6.14.0",
+ "babel-preset-react": "^6.11.1",
+ "css-loader": "^0.25.0",
+ "express": "^4.14.0",
+ "file-loader": "^0.9.0",
+ "html-minify-loader": "^1.1.0",
+ "node-sass": "^3.10.0",
+ "sass-loader": "^4.0.2",
+ "style-loader": "^0.13.1",
+ "webpack": "^1.13.2"
}
}
diff --git a/src/components/EditWordForm.jsx b/src/components/EditWordForm.jsx
new file mode 100644
index 0000000..3df80cb
--- /dev/null
+++ b/src/components/EditWordForm.jsx
@@ -0,0 +1,24 @@
+import React from 'react';
+
+import {Input} from './Input';
+import {TextArea} from './TextArea';
+
+import {WordForm} from './WordForm';
+
+export class EditWordForm extends React.Component {
+ constructor(props) {
+ super(props);
+ }
+
+ render() {
+ return (
+
+
+
+
+
+
+
+ );
+ }
+}
\ No newline at end of file
diff --git a/src/components/Input.jsx b/src/components/Input.jsx
new file mode 100644
index 0000000..fac0bef
--- /dev/null
+++ b/src/components/Input.jsx
@@ -0,0 +1,59 @@
+import React from 'react';
+
+export class Input extends React.Component {
+ constructor(props) {
+ super(props);
+
+ // this.defaultProps = {
+ // name: props.name || 'Field',
+ // helperLink: props.helperLink || {url: '#', label: '', hover: ''},
+ // doValidate: props.doValidate || true
+ // };
+
+ this.state = {
+ value: props.value || ''
+ };
+
+ // Bind listeners
+ this.handleOnChange = this.handleOnChange.bind(this);
+ }
+
+ handleOnChange(event) {
+ this.setValue(event);
+ }
+
+ // Whenever the input changes we update the value state of this component
+ setValue(event) {
+ this.setState({
+ isValid: !(this.props.doValidate && event.currentTarget.value === ''),
+ value: event.currentTarget.value
+ });
+ }
+
+ showHelperLink() {
+ if (this.props.helperLink) {
+ return (
+
+ {this.props.helperLink.label}
+
+ );
+ }
+ }
+
+ render() {
+ return (
+
+ );
+ }
+}
+
+Input.defaultProps = {
+ name: 'Field',
+ doValidate: true
+};
\ No newline at end of file
diff --git a/src/components/NewWordForm.jsx b/src/components/NewWordForm.jsx
new file mode 100644
index 0000000..8ddf07c
--- /dev/null
+++ b/src/components/NewWordForm.jsx
@@ -0,0 +1,30 @@
+import React from 'react';
+
+import {Input} from './Input';
+import {TextArea} from './TextArea';
+
+import {WordForm} from './WordForm';
+
+export class NewWordForm extends React.Component {
+ constructor(props) {
+ super(props);
+ }
+
+ render() {
+ return (
+
+
+
+
+ Definition/Equivalent Word(s)} />
+
+ );
+ }
+}
\ No newline at end of file
diff --git a/src/components/TextArea.jsx b/src/components/TextArea.jsx
new file mode 100644
index 0000000..28cb8e2
--- /dev/null
+++ b/src/components/TextArea.jsx
@@ -0,0 +1,43 @@
+import React from 'react';
+import {Input} from './Input';
+
+import {getInputSelection, setSelectionRange} from '../js/helpers';
+
+export class TextArea extends Input {
+ constructor(props) {
+ super(props);
+
+ // Bind listeners
+ this.handleMaximizeClick = this.handleMaximizeClick.bind(this);
+ }
+
+ handleMaximizeClick(event) {
+ this.showFullScreenTextbox();
+ }
+
+ showFullScreenTextbox() {
+ var sourceTextboxElement = document.getElementById(this.props.id);
+ var targetTextboxElement = document.getElementById("fullScreenTextbox");
+ document.getElementById("fullScreenTextboxLabel").innerHTML = this.props.name;
+ var selection = getInputSelection(sourceTextboxElement);
+
+ document.getElementById("expandedTextboxId").innerHTML = this.props.id;
+ targetTextboxElement.value = sourceTextboxElement.value;
+ document.getElementById("fullScreenTextboxScreen").style.display = "block";
+
+ targetTextboxElement.focus();
+ setSelectionRange(targetTextboxElement, selection.start, selection.end);
+ }
+
+ render() {
+ return (
+
+ );
+ }
+}
\ No newline at end of file
diff --git a/src/components/WordForm.jsx b/src/components/WordForm.jsx
new file mode 100644
index 0000000..b76a737
--- /dev/null
+++ b/src/components/WordForm.jsx
@@ -0,0 +1,69 @@
+import React from 'react';
+
+import {Input} from './Input';
+import {TextArea} from './TextArea';
+import {keyCodeFor} from '../js/helpers';
+
+export class WordForm extends React.Component {
+ constructor(props) {
+ super(props);
+
+ this.state = {
+ errorMessage: '',
+ updateConflictMessage: ''
+ };
+
+ this.isNewWord = (this.props.action == 'new');
+ }
+
+ submitWordOnCtrlEnter() {
+ var keyCode = (event.which ? event.which : event.keyCode);
+
+ //Windows and Linux Chrome accept ctrl+enter as keyCode 10.
+ if (keyCode === keyCodeFor('ctrlEnter') || (keyCode == keyCodeFor('enter') && event.ctrlKey)) {
+ event.preventDefault();
+
+ this.handleSubmit();
+ }
+ }
+
+ handleSubmit() {
+ if (this.validate()) {
+
+ }
+ }
+
+ validate() {
+
+ return true;
+ }
+
+ confirmArea() {
+ if (this.isNewWord) {
+ return ;
+ }
+ return (
+
+
+
+
+ );
+ }
+
+ clearForm() {
+ this.props.children.forEach((field) => {
+ field.state.value = '';
+ })
+ }
+
+ render() {
+ return (
+
+ );
+ }
+}
\ No newline at end of file
diff --git a/src/index.html b/src/index.html
index 0e556d3..3db1917 100644
--- a/src/index.html
+++ b/src/index.html
@@ -9,11 +9,9 @@
-
-
-
+