-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Language Ontology API in front-end (proof of concept, do not merge) #306
base: master
Are you sure you want to change the base?
Conversation
Load data from a CSV
Set up video controller
Fix titles, fix navigation, small polish
this.setState({ book: newBook, [suggestionsField]: [item] }); | ||
} | ||
|
||
languageSearchOnChange(value, languageField, languageIdField, suggestionsField) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
|
||
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]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is the same as in the getItemTitle
function, which I couldn't properly call for some reason.
|
||
function asyncSearchLanguage(query, callback) { | ||
// TODO don't hardcode URL | ||
const url = `http://localhost:6543/search?q=${query}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this hard-coded URL should be from a config constant, and should use the actual production Language Ontology API
Update fork from Wikitongues master
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!