ui touchup
This commit is contained in:
parent
7655bcd6f3
commit
17f4ff1b41
|
@ -19,6 +19,8 @@ function EntrySelect<E extends T.DictionaryEntry | T.VerbEntry>(props: ({
|
||||||
isVerbSelect?: boolean,
|
isVerbSelect?: boolean,
|
||||||
opts: T.TextOptions,
|
opts: T.TextOptions,
|
||||||
}) {
|
}) {
|
||||||
|
const placeholder = "entries" in props ? "Select…" : "Search Pashto";
|
||||||
|
const minWidth = "9rem";
|
||||||
function makeOption(e: E | T.DictionaryEntry) {
|
function makeOption(e: E | T.DictionaryEntry) {
|
||||||
if ("entry" in e) {
|
if ("entry" in e) {
|
||||||
return (props.isVerbSelect ? makeVerbSelectOption : makeSelectOption)(e, props.opts);
|
return (props.isVerbSelect ? makeVerbSelectOption : makeSelectOption)(e, props.opts);
|
||||||
|
@ -40,7 +42,7 @@ function EntrySelect<E extends T.DictionaryEntry | T.VerbEntry>(props: ({
|
||||||
if (!s) return;
|
if (!s) return;
|
||||||
props.onChange(s);
|
props.onChange(s);
|
||||||
}
|
}
|
||||||
return <div>
|
return <div style={{ minWidth }}>
|
||||||
<AsyncSelect
|
<AsyncSelect
|
||||||
isSearchable={true}
|
isSearchable={true}
|
||||||
className="mb-2"
|
className="mb-2"
|
||||||
|
@ -48,7 +50,7 @@ function EntrySelect<E extends T.DictionaryEntry | T.VerbEntry>(props: ({
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
defaultOptions={[]}
|
defaultOptions={[]}
|
||||||
loadOptions={options}
|
loadOptions={options}
|
||||||
placeholder={props.name ? `Select ${props.name}...` : undefined}
|
placeholder={placeholder}
|
||||||
{...zIndexProps}
|
{...zIndexProps}
|
||||||
/>
|
/>
|
||||||
</div>;
|
</div>;
|
||||||
|
@ -74,14 +76,14 @@ function EntrySelect<E extends T.DictionaryEntry | T.VerbEntry>(props: ({
|
||||||
if (!s) return;
|
if (!s) return;
|
||||||
props.onChange(s);
|
props.onChange(s);
|
||||||
}
|
}
|
||||||
return <div>
|
return <div style={{ minWidth }}>
|
||||||
<Select
|
<Select
|
||||||
isSearchable={true}
|
isSearchable={true}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
className="mb-2"
|
className="mb-2"
|
||||||
options={options}
|
options={options}
|
||||||
placeholder={props.name ? `Select ${props.name}...` : undefined}
|
placeholder={placeholder}
|
||||||
{...zIndexProps}
|
{...zIndexProps}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -79,8 +79,6 @@ export function getEnglishVerb(entry: T.DictionaryEntry): string {
|
||||||
|
|
||||||
export function getEnglishParticiple(entry: T.DictionaryEntry): string {
|
export function getEnglishParticiple(entry: T.DictionaryEntry): string {
|
||||||
if (!entry.ec) {
|
if (!entry.ec) {
|
||||||
console.log("errored participle");
|
|
||||||
console.log(entry);
|
|
||||||
throw new Error("no english information for participle");
|
throw new Error("no english information for participle");
|
||||||
}
|
}
|
||||||
const ec = parseEc(entry.ec);
|
const ec = parseEc(entry.ec);
|
||||||
|
|
|
@ -9,7 +9,7 @@ export function isNounEntry(e: T.Entry | T.DictionaryEntry): e is T.NounEntry {
|
||||||
return !!(e.c && (e.c.includes("n. m.") || e.c.includes("n. f.")));
|
return !!(e.c && (e.c.includes("n. m.") || e.c.includes("n. f.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isAdjectiveEntry(e: T.Entry): e is T.AdjectiveEntry {
|
export function isAdjectiveEntry(e: T.Entry | T.DictionaryEntry): e is T.AdjectiveEntry {
|
||||||
if ("entry" in e) return false;
|
if ("entry" in e) return false;
|
||||||
return !!e.c?.includes("adj.") && !isNounEntry(e);
|
return !!e.c?.includes("adj.") && !isNounEntry(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue