import React, {useState} from "react"; import {updateEntry, getPassword} from "./requests"; import {declineSaimiar} from "./saimiar_morphology"; import {SaiEntryProps, JutEntryProps, ElesuEntryProps, TukEntryProps, Conlang} from "./types"; interface BaseProps { id: number; conlang: Conlang; conlangEntry: string; english: string; langSpecific: React.ReactNode; } const EntryBase = (props: BaseProps) => { const [editing, setEditing] = useState(false); const [english, setEnglish] = useState(props.english); const mainEntryStyle = { display: "flex", justifyContent: "space-between", flexDirection: "row", flexWrap: "wrap", }; const controlStyle = { display: "flex", justifyContent: "space-between", flexDirection: "row", minWidth: "20%", marginTop: "10px", }; const save = () => { updateEntry(props.conlang, props.id, english); }; const engTranslation = editing ? setEnglish(evt.target.value) } style={{ width: "100%", marginTop: "5px" }} /> : english; const EditControls = ({onSave}: { onSave: () => void }) => { const cancel = () => setEditing(false); const edit = (evt) => { evt.preventDefault(); setEditing(true); }; if (!getPassword()) { return null; } return (editing ? ( ) : Edit); }; 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} |