Compare commits

...

3 Commits

Author SHA1 Message Date
Greg Shuflin
cc8920ef25 Normalize search input to lowercase for consistent results 2025-03-07 23:26:12 -08:00
Greg Shuflin
de44275090 table data for sai declension 2025-03-07 23:24:25 -08:00
Greg Shuflin
5ac5490d6a Fix arrows 2025-03-07 23:21:17 -08:00
2 changed files with 25 additions and 11 deletions

View File

@ -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">

View File

@ -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>);
}
}