{
}
}
-function selectMode(props: any) {
- if (props.searchText === '') {
- return (
-
-
Empty
- Type something in the searchbar.
-
- );
- } else {
- let editEntries = props.matchedEntries.map((mObj: any) => {
- let uniqueKey = mObj.guid[0] + '#' + mObj.$.id;
+function LexMatches(params: any) {
+ const selectMode = (props: any) => {
+ if (props.searchText === '') {
return (
+
+
Empty
+ Type something in the searchbar.
+
+ );
+ } else {
+ let editEntries = props.matchedEntries.map((mObj: any) => {
+ let uniqueKey = mObj.guid[0] + '#' + mObj.$.id;
+ return (
+
+ );
+ });
+ let addProps = {};
+ _.set(addProps, props.searchLens, props.searchText);
+ let addEntry = (
);
- });
- let addProps = {};
- _.set(addProps, props.searchLens, props.searchText);
- let addEntry = (
-
- );
- editEntries.push(addEntry);
- return editEntries;
- }
-}
+ editEntries.push(addEntry);
+ return editEntries;
+ }
+ };
-function LexMatches(props: any) {
return (
- {selectMode(props)}
+ {selectMode(params)}
);
}
diff --git a/src/LexEdit.tsx b/src/LexEdit.tsx
index 65d98b4..3276820 100644
--- a/src/LexEdit.tsx
+++ b/src/LexEdit.tsx
@@ -11,28 +11,28 @@ const { Box } = require('reflexbox');
const imageRoot = 'http://localhost:3000/png/';
-export const fieldMetaMap = {
- 'label': { lens: 'label[0]', type: 'text' },
- 'unl': { lens: 'unl[0]', type: 'text' },
- 'synset': { lens: 'lexprops[0].wnsynset[0]', type: 'text' },
- 'guid': { lens: 'guid[0]', type: 'text' },
- 'pos': { lens: 'pos[0]', type: 'select' },
- 'image': { lens: 'image[0]', type: 'preview' },
- 'relations': { lens: 'relations[0]', type: 'text' },
- 'frame': { lens: 'syntacticprops[0].property[0]._', type: 'select' },
- 'morphclass': {
- lens: 'lexprops[0].morphology[0].morph[0]._',
- type: 'select'
- },
- 'stats': { lens: 'stats[0].property[0]._', type: 'text' },
- 'lang': { lens: '$.id', type: 'select' },
-};
+// export const fieldMetaMap = {
+// label: { lens: 'label[0]', type: 'text' },
+// unl: { lens: 'unl[0]', type: 'text' },
+// synset: { lens: 'lexprops[0].wnsynset[0]', type: 'text' },
+// guid: { lens: 'guid[0]', type: 'text' },
+// pos: { lens: 'pos[0]', type: 'select' },
+// image: { lens: 'image[0]', type: 'preview' },
+// relations: { lens: 'relations[0]', type: 'text' },
+// frame: { lens: 'syntacticprops[0].property[0]._', type: 'select' },
+// morphclass: {
+// lens: 'lexprops[0].morphology[0].morph[0]._',
+// type: 'select'
+// },
+// stats: { lens: 'stats[0].property[0]._', type: 'text' },
+// lang: { lens: '$.id', type: 'select' },
+// };
export class LexEdit extends React.Component {
public render() {
let li = this.props.lexItem;
- let lexFields = _.keys(fieldMetaMap).map(field => {
- let defaultText = _.get(li, fieldMetaMap[field].lens, '');
+ let lexFields = _.keys(this.props.fieldMetaMap).map(field => {
+ let defaultText = _.get(li, this.props.fieldMetaMap[field].lens, '');
let sh = (e: any) => {
let eventData = {};
eventData[field] = e.target.value;
@@ -40,7 +40,7 @@ export class LexEdit extends React.Component {
};
// let pred = (x: any) => _.isEqual(fieldMetaMap[ft].type, x);
// _.findIndex(['text', 'number'], pred) !== -1
- if (fieldMetaMap[field].type === 'text') {
+ if (this.props.fieldMetaMap[field].type === 'text') {
return (
{
/>
);
- } else if (fieldMetaMap[field].type === 'select') {
+ } else if (this.props.fieldMetaMap[field].type === 'select') {
return (
);
- } else if (fieldMetaMap[field].type === 'preview' && defaultText !== '') {
+ } else if (this.props.fieldMetaMap[field].type === 'preview' && defaultText !== '') {
let imageSrc = imageRoot + defaultText;
return (
diff --git a/src/reducers/index.tsx b/src/reducers/index.tsx
index 11c64fb..2b6fe60 100644
--- a/src/reducers/index.tsx
+++ b/src/reducers/index.tsx
@@ -1,7 +1,9 @@
import { combineReducers } from 'redux';
function search(state: any = [], action: any) {
- console.log(state, action);
+ if (action.type === 'ACTION_SEARCH_TEXT') {
+ console.log(state, action);
+ }
return state;
}