Add Elesu support
This commit is contained in:
parent
4593473b33
commit
9192e070e1
37
src/App.tsx
37
src/App.tsx
@ -2,7 +2,7 @@ import React, {useState} from 'react';
|
||||
|
||||
import './App.scss';
|
||||
import {declineSaimiar} from './saimiar_morphology';
|
||||
import {SaiEntryProps, JutEntryProps} from './dbtypes';
|
||||
import {SaiEntryProps, JutEntryProps, ElesuEntryProps} from './dbtypes';
|
||||
|
||||
const backendUrl = 'https://kucinakobackend.ichigo.everydayimshuflin.com';
|
||||
|
||||
@ -58,7 +58,7 @@ function buildRequest(searchTerm: string, conlang: Conlang, direction: SearchDir
|
||||
|
||||
interface EntryProps {
|
||||
conlang: Conlang;
|
||||
entry: SaiEntryProps | JutEntryProps;
|
||||
entry: SaiEntryProps | JutEntryProps | ElesuEntryProps;
|
||||
key: string;
|
||||
}
|
||||
|
||||
@ -72,6 +72,10 @@ const Entry = (props: EntryProps) => {
|
||||
return <JutEntry entry={ props.entry as JutEntryProps } />;
|
||||
}
|
||||
|
||||
if (conlang === Conlang.Elesu) {
|
||||
return <ElesuEntry entry={ props.entry as ElesuEntryProps } />;
|
||||
}
|
||||
|
||||
return <div>Conlang { conlang } not yet supported</div>;
|
||||
};
|
||||
|
||||
@ -106,6 +110,19 @@ const JutEntry = (props: {entry: JutEntryProps}) => {
|
||||
</div>);
|
||||
};
|
||||
|
||||
const ElesuEntry = (props: {entry: ElesuEntryProps}) => {
|
||||
const {entry} = props;
|
||||
|
||||
return (
|
||||
<div className="searchResult" key={ entry.id }>
|
||||
<b>{ entry.elesu }</b> - { entry.eng }
|
||||
<br/>
|
||||
<span className="synclass">
|
||||
{ entry.syn_category }
|
||||
</span>
|
||||
</div>);
|
||||
};
|
||||
|
||||
function formatMorphology(entry) {
|
||||
const decl = declineSaimiar(entry);
|
||||
if (!decl) {
|
||||
@ -172,15 +189,11 @@ const App = (_props) => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (conlang === Conlang.Saimiar || conlang === Conlang.Juteyuji) {
|
||||
buildRequest(searchTerm, conlang, SearchDirection.ToEnglish, (json) => {
|
||||
setSearchResults(json);
|
||||
setSearchTerm(searchTerm);
|
||||
setDirection(SearchDirection.ToEnglish);
|
||||
});
|
||||
} else {
|
||||
console.error(`Conlang ${conlang} not supported`);
|
||||
}
|
||||
buildRequest(searchTerm, conlang, SearchDirection.ToEnglish, (json) => {
|
||||
setSearchResults(json);
|
||||
setSearchTerm(searchTerm);
|
||||
setDirection(SearchDirection.ToEnglish);
|
||||
});
|
||||
};
|
||||
|
||||
const searchEng = (_evt) => {
|
||||
@ -216,7 +229,7 @@ const App = (_props) => {
|
||||
<div className="container">
|
||||
<div className="search">
|
||||
<h1>Kucinako - Wordbook of Arzhanai languages</h1>
|
||||
<p><b>Kucinako</b> is a dictionary for searching for words in various languages of the world Arzhanø, and their English
|
||||
<p><b>Kucinako</b> is a dictionary of words in various languages of the world Arzhanø, and their English
|
||||
equivalents.</p>
|
||||
<div className="textInput">
|
||||
<input className="textInput" type="text" value={ searchBoxInput } onChange={ (evt) => {
|
||||
|
@ -4,6 +4,7 @@ interface SaiEntryProps {
|
||||
eng: string;
|
||||
syn_category: string;
|
||||
morph_type: string;
|
||||
notes: string;
|
||||
}
|
||||
|
||||
interface JutEntryProps {
|
||||
@ -12,6 +13,18 @@ interface JutEntryProps {
|
||||
eng: string;
|
||||
syn_category: string;
|
||||
gender: string;
|
||||
notes: string;
|
||||
}
|
||||
|
||||
export {SaiEntryProps, JutEntryProps};
|
||||
interface ElesuEntryProps {
|
||||
id: number;
|
||||
elesu: string;
|
||||
eng: string;
|
||||
syn_category: string;
|
||||
gender: string;
|
||||
sai_borrowing: string;
|
||||
notes: string;
|
||||
proto_southern_root: string;
|
||||
}
|
||||
|
||||
export {SaiEntryProps, JutEntryProps, ElesuEntryProps};
|
||||
|
Loading…
Reference in New Issue
Block a user