Tukvaysi support

This commit is contained in:
Greg Shuflin 2021-09-12 23:09:58 -07:00
parent 9192e070e1
commit f4e674c88f
2 changed files with 27 additions and 4 deletions

View File

@ -2,7 +2,7 @@ import React, {useState} from 'react';
import './App.scss';
import {declineSaimiar} from './saimiar_morphology';
import {SaiEntryProps, JutEntryProps, ElesuEntryProps} from './dbtypes';
import {SaiEntryProps, JutEntryProps, ElesuEntryProps, TukEntryProps} 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 | ElesuEntryProps;
entry: SaiEntryProps | JutEntryProps | ElesuEntryProps | TukEntryProps;
key: string;
}
@ -76,7 +76,9 @@ const Entry = (props: EntryProps) => {
return <ElesuEntry entry={ props.entry as ElesuEntryProps } />;
}
return <div>Conlang { conlang } not yet supported</div>;
if (conlang === Conlang.Tukvaysi) {
return <TukEntry entry={ props.entry as TukEntryProps } />;
}
};
const SaiEntry = (props: {entry: SaiEntryProps}) => {
@ -123,6 +125,19 @@ const ElesuEntry = (props: {entry: ElesuEntryProps}) => {
</div>);
};
const TukEntry = (props: {entry: TukEntryProps}) => {
const {entry} = props;
return (
<div className="searchResult" key={ entry.id }>
<b>{ entry.tuk }</b> - { entry.eng }
<br/>
<span className="synclass">
{ entry.syn_category }
</span>
</div>);
};
function formatMorphology(entry) {
const decl = declineSaimiar(entry);
if (!decl) {

View File

@ -27,4 +27,12 @@ interface ElesuEntryProps {
proto_southern_root: string;
}
export {SaiEntryProps, JutEntryProps, ElesuEntryProps};
interface TukEntryProps {
id: number;
tuk: string;
eng: string;
syn_category: string;
notes: string;
}
export {SaiEntryProps, JutEntryProps, ElesuEntryProps, TukEntryProps};