import React from "react"; import {declineSaimiar} from "./saimiar_morphology"; import {SaiEntryProps, JutEntryProps, ElesuEntryProps, TukEntryProps} from "./dbtypes"; const SaiEntry = (props: {entry: SaiEntryProps}) => { const {entry} = props; const synCategory = entry.syn_category; const isNominal = synCategory === "nominal"; return (
{ entry.sai } - { entry.eng }
{ entry.syn_category } { entry.morph_type ? `\t\t${entry.morph_type}` : null }
{ isNominal ? formatMorphology(entry) : null }
); }; function formatMorphology(entry) { const decl = declineSaimiar(entry); if (!decl) { return ""; } return ( Abs: {decl.abs}, Erg: {decl.erg}, Adp: {decl.adp}, All: {decl.all}, Loc: {decl.loc}, Ell: {decl.ell}, Inst: {decl.inst}, Rel: {decl.rel} ); } const JutEntry = (props: {entry: JutEntryProps}) => { const {entry} = props; return (
{ entry.jut } - { entry.eng }
{ entry.syn_category === "noun" ? entry.gender : null }
); }; const ElesuEntry = (props: {entry: ElesuEntryProps}) => { const {entry} = props; return (
{ entry.elesu } - { entry.eng }
{ entry.syn_category }
); }; const TukEntry = (props: {entry: TukEntryProps}) => { const {entry} = props; return (
{ entry.tuk } - { entry.eng }
{ entry.syn_category }
); }; export {SaiEntry, ElesuEntry, JutEntry, TukEntry};