diff --git a/package.json b/package.json index 27cb1a2..97bf983 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "dexie": "^1.5.1", "inferno": "^1.6.0", "inferno-component": "^1.6.0", + "inferno-devtools": "^1.6.0", "marked": "^0.3.6", "papaparse": "^4.2.0" } diff --git a/src/components/Lexiconga.jsx b/src/components/Lexiconga.jsx new file mode 100644 index 0000000..a22f2c3 --- /dev/null +++ b/src/components/Lexiconga.jsx @@ -0,0 +1,45 @@ +import Inferno from 'inferno'; +import Component from 'inferno-component'; + +import {LeftColumn} from './structure/LeftColumn'; +import {RightColumn} from './structure/RightColumn'; + +import {WordForm} from './management/WordForm'; +import {DictionaryDetails} from './display/DictionaryDetails'; + +export class Lexiconga extends Component { + constructor (props) { + super(props); + } + + render () { + return ( +
+
+
+ + + + + + + + + +
+
+
+ ); + } +} diff --git a/src/components/display/DictionaryDetails.jsx b/src/components/display/DictionaryDetails.jsx new file mode 100644 index 0000000..0a98c82 --- /dev/null +++ b/src/components/display/DictionaryDetails.jsx @@ -0,0 +1,204 @@ +import Inferno from 'inferno'; +import Component from 'inferno-component'; +import marked from 'marked'; + +import {SearchBox} from '../management/SearchBox'; + +const DISPLAY = { + NONE: false +, DESCRIPTION: 1 +, DETAILS: 2 +, STATS: 3 +, SEARCH: 4 +} + +export class DictionaryDetails extends Component { + constructor (props) { + super(props); + + this.state = { + currentDisplay: DISPLAY.NONE + } + + this._descriptionHTML = marked(props.description); + } + + componentWillReceiveProps (nextProps) { + const currentDescription = this.props.description + , nextDescription = nextProps.description; + + if (currentDescription !== nextDescription) { + this._descriptionHTML = marked(nextProps.description); + } + } + + toggleDisplay (display) { + display = (this.state.currentDisplay !== display) ? display : DISPLAY.NONE; + + this.setState({ + currentDisplay: display + }); + } + + displayInfo () { + if (this.state.currentDisplay !== DISPLAY.NONE) { + let displayJSX; + + switch(this.state.currentDisplay) { + case DISPLAY.DESCRIPTION : { + // Not sure why, but the dangerouslySet div needs to be wrapped in another div or else + // the HTML content sticks around for some reason. + displayJSX = ( +
+
+
+ ); + break; + } + + case DISPLAY.DETAILS : { + let additionalMenu; + if (this.props.details.hasOwnProperty('custom')) { + let customTabsJSX = this.props.details.custom.map((tab) => { + return ( +
  • + + {tab.name} + +
  • + ); + }); + + additionalMenu = ( +
    +

    + Additional +

    + +
    + ); + } + + const menu = ( + + ); + + let content = ( +
    +

    + Details Content! +

    +
    + ); + + displayJSX = ( +
    + {menu} + {content} +
    + ); + break; + } + + case DISPLAY.STATS : { + displayJSX = ( +
    +

    Stats!

    +
    + ); + break; + } + + case DISPLAY.SEARCH : { + displayJSX = ; + break; + } + } + + return ( +
    + {displayJSX} +
    + ) + } + } + + render () { + return ( +
    + +
    +
    +
    +

    + Dictionary Name +

    +
    +
    + +
    + +
    +
    + +
    +
    + +
    +
    + + {this.displayInfo()} + +
    + ); + } +} diff --git a/src/components/management/SearchBox.jsx b/src/components/management/SearchBox.jsx new file mode 100644 index 0000000..a66183d --- /dev/null +++ b/src/components/management/SearchBox.jsx @@ -0,0 +1,81 @@ +import Inferno from 'inferno'; +import Component from 'inferno-component'; + +export class SearchBox extends Component { + constructor (props) { + super(props); + } + + showFilterOptions () { + if (this.props.hasOwnProperty('partsOfSpeech') + && this.props.partsOfSpeech.length > 0) { + let filterOptionsJSX = this.props.partsOfSpeech.map((partOfSpeech) => { + return ( + + ); + }); + + return ( +
    + +

    + {filterOptionsJSX} +

    +
    + ); + } + } + + render () { + return ( +
    +
    + + Search + + +
    +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    + + + +
    +
    +
    +
    +
    + + {this.showFilterOptions()} + +
    + ); + } +} diff --git a/src/components/management/WordForm.jsx b/src/components/management/WordForm.jsx new file mode 100644 index 0000000..11a6f0b --- /dev/null +++ b/src/components/management/WordForm.jsx @@ -0,0 +1,58 @@ +import Inferno from 'inferno'; +import Component from 'inferno-component'; + +export class WordForm extends Component { + constructor (props) { + super(props); + } + + render () { + return ( +
    +
    + +

    + +

    +
    + +
    + +

    + +

    +
    + +
    + +

    + + + +

    +
    + +
    + +

    + +

    +
    + +
    + +

    +