2021-03-09 12:39:13 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2021 lingdocs.com
|
|
|
|
*
|
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
import {
|
|
|
|
CSSProperties,
|
|
|
|
useState,
|
|
|
|
} from "react";
|
|
|
|
import {
|
|
|
|
pickPersInf,
|
|
|
|
hasPersInfs,
|
|
|
|
noPersInfs,
|
|
|
|
} from "../../lib/misc-helpers";
|
|
|
|
import VerbInfoItemDisplay from "./VerbInfoItemDisplay";
|
|
|
|
import PersonInfsPicker from "../PersInfsPicker";
|
|
|
|
import VerbTypeInfo from "./VerbTypeInfo";
|
|
|
|
import Hider from "../Hider";
|
|
|
|
import * as T from "../../types";
|
|
|
|
import fadedTree from "./faded-tree.svg";
|
|
|
|
|
|
|
|
// import camera from "../icons/camera-fill";
|
|
|
|
// import video from "../icons/camera-video-fill";
|
|
|
|
|
|
|
|
const indentR = {
|
|
|
|
paddingLeft: "1rem",
|
|
|
|
};
|
|
|
|
|
2021-07-04 09:55:26 +00:00
|
|
|
const highlight = {
|
2021-07-09 10:36:56 +00:00
|
|
|
background: "rgba(255, 227, 10, 0.6)",
|
2021-07-04 09:55:26 +00:00
|
|
|
};
|
|
|
|
|
2021-03-09 12:39:13 +00:00
|
|
|
const title: CSSProperties = {
|
|
|
|
fontWeight: "bolder",
|
|
|
|
marginBottom: "0.5rem",
|
|
|
|
marginTop: "0.5rem",
|
|
|
|
};
|
|
|
|
|
2021-07-04 09:55:26 +00:00
|
|
|
export function RootsAndStems({ textOptions, info, hidePastParticiple, highlighted }: {
|
2021-03-09 12:39:13 +00:00
|
|
|
textOptions: T.TextOptions,
|
|
|
|
info: T.NonComboVerbInfo,
|
2021-07-04 09:55:26 +00:00
|
|
|
hidePastParticiple?: boolean,
|
2021-07-09 10:36:56 +00:00
|
|
|
highlighted?: T.RootsOrStemsToHighlight,
|
2021-03-09 12:39:13 +00:00
|
|
|
}) {
|
|
|
|
const hasPerfectiveSplit = !!(info.root.perfectiveSplit || info.stem.perfectiveSplit);
|
|
|
|
const showPersInf = hasPersInfs(info);
|
|
|
|
const [persInf, setPersInf] = useState<T.PersonInflectionsField>("mascSing");
|
|
|
|
const [split, setSplit] = useState<boolean>(false);
|
|
|
|
const perfectiveStem = (info.stem.perfectiveSplit && split)
|
|
|
|
? info.stem.perfectiveSplit
|
|
|
|
: info.stem.perfective;
|
|
|
|
const perfectiveRoot = (info.root.perfectiveSplit && split)
|
|
|
|
? info.root.perfectiveSplit
|
|
|
|
: info.root.perfective;
|
|
|
|
const colClass = "col col-md-5 px-0 mb-1";
|
|
|
|
const rowClass = "row justify-content-between";
|
|
|
|
return (
|
|
|
|
<div className="mt-3">
|
|
|
|
{showPersInf && <PersonInfsPicker
|
|
|
|
persInf={persInf}
|
|
|
|
handleChange={(p) => setPersInf(p)}
|
|
|
|
transitivity={info.transitivity}
|
|
|
|
/>}
|
|
|
|
<div className="verb-info" style={{
|
|
|
|
textAlign: "center",
|
|
|
|
maxWidth: "500px",
|
|
|
|
margin: "0 auto",
|
|
|
|
backgroundImage: `url(${fadedTree})`,
|
|
|
|
backgroundRepeat: "no-repeat",
|
2021-07-04 09:55:26 +00:00
|
|
|
backgroundPosition: hidePastParticiple ? "50% 45%" : "50% 35%",
|
2021-03-09 12:39:13 +00:00
|
|
|
backgroundSize: "50%",
|
|
|
|
}}>
|
|
|
|
{/* <div style={{
|
|
|
|
fontSize: "larger",
|
|
|
|
}}>
|
|
|
|
{info.def}
|
|
|
|
</div>
|
|
|
|
{info.subDef &&
|
|
|
|
<div style={{ fontSize: "smaller", color: "grey" }}>
|
|
|
|
{info.subDef}
|
|
|
|
</div>
|
|
|
|
} */}
|
|
|
|
<div style={{
|
|
|
|
border: "2px solid black",
|
|
|
|
padding: "1rem",
|
|
|
|
margin: "0.25rem",
|
|
|
|
}} className="container">
|
|
|
|
<div className={rowClass + " align-items-center"}>
|
|
|
|
<div className={colClass}>
|
|
|
|
<i className="fas fa-video fa-lg" />
|
|
|
|
</div>
|
|
|
|
<div className={colClass}>
|
|
|
|
<div className="d-flex flex-row justify-content-center align-items-center">
|
|
|
|
<div>
|
|
|
|
<i className="fas fa-camera fa-lg mx-3" />
|
|
|
|
</div>
|
|
|
|
{hasPerfectiveSplit && <div>
|
|
|
|
<button
|
|
|
|
className="btn btn-sm btn-outline-secondary"
|
|
|
|
onClick={() => setSplit(!split)}
|
|
|
|
>
|
|
|
|
split
|
|
|
|
</button>
|
|
|
|
</div>}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className={rowClass}>
|
2021-07-04 09:55:26 +00:00
|
|
|
<div className={colClass} style={highlighted?.includes("imperfective stem") ? highlight : {}}>
|
2021-03-09 12:39:13 +00:00
|
|
|
<div style={title}>
|
|
|
|
<div>Imperfective Stem</div>
|
|
|
|
</div>
|
|
|
|
<div style={indentR}>
|
|
|
|
<VerbInfoItemDisplay
|
|
|
|
item={pickPersInf(info.stem.imperfective, persInf)}
|
|
|
|
textOptions={textOptions}
|
|
|
|
tails
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-07-04 09:55:26 +00:00
|
|
|
<div className={colClass} style={highlighted?.includes("perfective stem") ? highlight : {}}>
|
2021-03-09 12:39:13 +00:00
|
|
|
<div style={title}>
|
|
|
|
<div>Perfective Stem</div>
|
|
|
|
</div>
|
|
|
|
<div style={indentR}>
|
|
|
|
<VerbInfoItemDisplay
|
|
|
|
item={pickPersInf(perfectiveStem, persInf)}
|
|
|
|
textOptions={textOptions}
|
|
|
|
tails
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className={rowClass}>
|
2021-07-04 09:55:26 +00:00
|
|
|
<div className={colClass} style={highlighted?.includes("imperfective root") ? highlight : {}}>
|
2021-03-09 12:39:13 +00:00
|
|
|
<div style={title}>
|
|
|
|
<div>Imperfective Root</div>
|
|
|
|
</div>
|
|
|
|
<div style={indentR}>
|
|
|
|
<VerbInfoItemDisplay
|
|
|
|
item={pickPersInf(info.root.imperfective, persInf)}
|
|
|
|
textOptions={textOptions}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-07-04 09:55:26 +00:00
|
|
|
<div className={colClass} style={highlighted?.includes("perfective root") ? highlight : {}}>
|
2021-03-09 12:39:13 +00:00
|
|
|
<div>
|
|
|
|
<div style={title}>
|
|
|
|
<div>Perfective Root</div>
|
|
|
|
</div>
|
|
|
|
<div style={indentR}>
|
|
|
|
<VerbInfoItemDisplay
|
|
|
|
item={pickPersInf(perfectiveRoot, persInf)}
|
|
|
|
textOptions={textOptions}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-07-04 09:55:26 +00:00
|
|
|
{!hidePastParticiple && <div className="text-center" style={highlighted?.includes("imperfective stem") ? highlight : {}}>
|
2021-03-09 12:39:13 +00:00
|
|
|
<div style={title}>Past Participle</div>
|
|
|
|
<VerbInfoItemDisplay
|
|
|
|
item={pickPersInf(info.participle.past, persInf)}
|
|
|
|
textOptions={textOptions}
|
|
|
|
/>
|
2021-07-04 09:55:26 +00:00
|
|
|
</div>}
|
2021-03-09 12:39:13 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-07-18 09:15:21 +00:00
|
|
|
function VerbInfo({ info, textOptions, showingStemsAndRoots, toggleShowingSar, highlightInRootsAndStems, hidePastParticiple, hideTypeInfo }: {
|
2021-03-09 12:39:13 +00:00
|
|
|
info: T.NonComboVerbInfo,
|
|
|
|
textOptions: T.TextOptions,
|
|
|
|
showingStemsAndRoots: boolean,
|
2021-07-09 10:36:56 +00:00
|
|
|
highlightInRootsAndStems?: T.RootsOrStemsToHighlight,
|
2021-03-09 12:39:13 +00:00
|
|
|
toggleShowingSar: () => void,
|
2021-07-09 10:36:56 +00:00
|
|
|
hidePastParticiple?: boolean,
|
2021-07-18 09:15:21 +00:00
|
|
|
hideTypeInfo?: boolean,
|
2021-03-09 12:39:13 +00:00
|
|
|
}) {
|
|
|
|
const inf = noPersInfs(info.root.imperfective).long;
|
|
|
|
return (
|
|
|
|
<div className="my-3">
|
2021-07-18 09:15:21 +00:00
|
|
|
{!hideTypeInfo && <VerbTypeInfo
|
2021-03-09 12:39:13 +00:00
|
|
|
info={info}
|
|
|
|
textOptions={textOptions}
|
2021-07-18 09:15:21 +00:00
|
|
|
/>}
|
2021-03-09 12:39:13 +00:00
|
|
|
<Hider
|
|
|
|
showing={showingStemsAndRoots}
|
|
|
|
label={`🌳 Roots and Stems for ${inf.p}`}
|
|
|
|
handleChange={toggleShowingSar}
|
|
|
|
hLevel={4}
|
|
|
|
>
|
|
|
|
<RootsAndStems
|
|
|
|
textOptions={textOptions}
|
|
|
|
info={info}
|
2021-07-09 10:36:56 +00:00
|
|
|
highlighted={highlightInRootsAndStems}
|
|
|
|
hidePastParticiple={hidePastParticiple}
|
2021-03-09 12:39:13 +00:00
|
|
|
/>
|
|
|
|
</Hider>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default VerbInfo;
|