Compare commits
3 Commits
8c82698593
...
cc8920ef25
Author | SHA1 | Date | |
---|---|---|---|
|
cc8920ef25 | ||
|
de44275090 | ||
|
5ac5490d6a |
19
src/App.tsx
19
src/App.tsx
@ -95,7 +95,7 @@ const Results = (props: ResultsProps) => {
|
||||
const num = props.searchResults.length;
|
||||
|
||||
const renderedName = renderConlang(conlang);
|
||||
const searchType = (props.direction === SearchDirection.ToConlang) ? `English -> ${renderedName}` : `${renderedName} -> English`;
|
||||
const searchType = (props.direction === SearchDirection.ToConlang) ? `English → ${renderedName}` : `${renderedName} → English`;
|
||||
const result = num === 1 ? "result" : "results";
|
||||
const header = (
|
||||
<div className="searchResultHeader" key="header">
|
||||
@ -143,15 +143,22 @@ const App = (_props) => {
|
||||
};
|
||||
|
||||
const handleSearch = (direction: SearchDirection) => {
|
||||
const searchTerm = direction === SearchDirection.ToEnglish ? convertSearchBoxShorthand(searchBoxInput, conlang) : searchBoxInput;
|
||||
if (searchTerm === "") {
|
||||
// First convert any shorthand notation
|
||||
let processedSearchTerm = direction === SearchDirection.ToEnglish ?
|
||||
convertSearchBoxShorthand(searchBoxInput, conlang) :
|
||||
searchBoxInput;
|
||||
|
||||
// Then normalize to lowercase
|
||||
processedSearchTerm = processedSearchTerm.toLowerCase();
|
||||
|
||||
if (processedSearchTerm === "") {
|
||||
setSearchResults(null);
|
||||
setSearchTerm(null);
|
||||
setDirection(null);
|
||||
} else {
|
||||
searchEntry(searchTerm, conlang, direction, (json) => {
|
||||
searchEntry(processedSearchTerm, conlang, direction, (json) => {
|
||||
setSearchResults(json);
|
||||
setSearchTerm(searchTerm);
|
||||
setSearchTerm(processedSearchTerm);
|
||||
setDirection(direction);
|
||||
});
|
||||
}
|
||||
@ -205,7 +212,7 @@ const App = (_props) => {
|
||||
onChange={ (evt) => {
|
||||
setSearchBoxInput(evt.target.value);
|
||||
}}
|
||||
placeholder="Enter search term"
|
||||
placeholder="Enter search term (case-insensitive)"
|
||||
/>
|
||||
</div>
|
||||
<div className="searchControls">
|
||||
|
@ -88,11 +88,18 @@ const SaiEntry = (props: {entry: SaiEntryProps}) => {
|
||||
if (isNominal) {
|
||||
const decl = declineSaimiar(entry);
|
||||
if (decl) {
|
||||
morphology = (<span className="saimiarNounMorpho">
|
||||
Abs: <i>{decl.abs}</i>, Erg: <i>{decl.erg}</i>, Adp: <i>{decl.adp}</i>,
|
||||
All: <i>{decl.all}</i>, Loc: <i>{decl.loc}</i>, Ell: <i>{decl.ell}</i>,
|
||||
Inst: <i>{decl.inst}</i>, Rel: <i>{decl.rel}</i>
|
||||
</span>);
|
||||
morphology = (
|
||||
<table className="saimiarNounMorpho">
|
||||
<tr>
|
||||
<td>Abs: <i>{decl.abs}</i></td><td>Erg: <i>{decl.erg}</i></td><td>Adp: <i>{decl.adp}</i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>All: <i>{decl.all}</i></td><td>Loc: <i>{decl.loc}</i></td><td>Ell: <i>{decl.ell}</i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Inst: <i>{decl.inst}</i></td><td>Rel: <i>{decl.rel}</i></td><td></td>
|
||||
</tr>
|
||||
</table>);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user