Use Language Ontology API in front-end (proof of concept, do not merge)#306
Open
baieric wants to merge 35 commits intowikitongues:masterfrom
Open
Use Language Ontology API in front-end (proof of concept, do not merge)#306baieric wants to merge 35 commits intowikitongues:masterfrom
baieric wants to merge 35 commits intowikitongues:masterfrom
Conversation
Load data from a CSV
Set up video controller
Fix titles, fix navigation, small polish
baieric
commented
May 22, 2018
| this.setState({ book: newBook, [suggestionsField]: [item] }); | ||
| } | ||
|
|
||
| languageSearchOnChange(value, languageField, languageIdField, suggestionsField) { |
Author
There was a problem hiding this comment.
There's a bit of code duplication of the languageSearchOnSelect and languageSearchOnChange functions in NewBook.es6.jsx, Book.es6.jsx, and SearchBar.es6.jsx. Didn't have the React expertise to fix this.
baieric
commented
May 22, 2018
|
|
||
| renderLanguageSuggestion(item, isHighlighted) { | ||
| // TODO couldn't figure out how to call getItemTitle here, even after binding it in constructor | ||
| const title = item.matched_identifiers.length == 0 ? item.glottocode : item.matched_identifiers[0]; |
Author
There was a problem hiding this comment.
This line is the same as in the getItemTitle function, which I couldn't properly call for some reason.
baieric
commented
May 22, 2018
|
|
||
| function asyncSearchLanguage(query, callback) { | ||
| // TODO don't hardcode URL | ||
| const url = `http://localhost:6543/search?q=${query}` |
Author
There was a problem hiding this comment.
this hard-coded URL should be from a config constant, and should use the actual production Language Ontology API
Update fork from Wikitongues master
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proof-of-concept, because the current Autosuggest package used is not optimal.
I recommend using this package, once Poly's webpack issues are resolved (though I haven't fully tested it out): https://github.com/ericgio/react-bootstrap-typeahead
Other possible packages to try:
https://github.com/fmoo/react-typeahead
https://github.com/ezequiel/react-typeahead-component
To test this out, run this branch and the Language Ontology API locally. No database changes will be stored properly until #305 is merged in. Right now the API's URL is hard-coded to
http://localhost:6543/but we can change that.Would appreciate some feedback on the stylesheet code changes, not sure if I'm following your best practices!