Add English word field to Greek word cards
- New englishGloss field on every word object (editable input, placeholder "e.g. grace") - Populated automatically from the macula-greek gloss map on lookup and suggest - Shows alongside Short definition in the card's second row Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+18
-1
@@ -880,6 +880,7 @@ useEffect(() => {
|
|||||||
id: makeId(),
|
id: makeId(),
|
||||||
query: '',
|
query: '',
|
||||||
strongNumber: '',
|
strongNumber: '',
|
||||||
|
englishGloss: '',
|
||||||
lexeme: '',
|
lexeme: '',
|
||||||
transliteration: '',
|
transliteration: '',
|
||||||
partOfSpeech: '',
|
partOfSpeech: '',
|
||||||
@@ -1039,6 +1040,7 @@ useEffect(() => {
|
|||||||
id: makeId(),
|
id: makeId(),
|
||||||
query: w.strongKey,
|
query: w.strongKey,
|
||||||
strongNumber: w.strongKey,
|
strongNumber: w.strongKey,
|
||||||
|
englishGloss: w.def,
|
||||||
lexeme: w.lexeme,
|
lexeme: w.lexeme,
|
||||||
transliteration: w.translit,
|
transliteration: w.translit,
|
||||||
partOfSpeech: '',
|
partOfSpeech: '',
|
||||||
@@ -1172,7 +1174,10 @@ useEffect(() => {
|
|||||||
const raw = word.query.trim();
|
const raw = word.query.trim();
|
||||||
const normalized = /^\d+$/.test(raw) ? `G${raw}` : /^[gGhH]\d+$/.test(raw) ? raw.toUpperCase() : raw;
|
const normalized = /^\d+$/.test(raw) ? `G${raw}` : /^[gGhH]\d+$/.test(raw) ? raw.toUpperCase() : raw;
|
||||||
|
|
||||||
const definitions = await fetchBollsDefinition(normalized);
|
const [definitions, gloss] = await Promise.all([
|
||||||
|
fetchBollsDefinition(normalized),
|
||||||
|
loadNtGloss().catch(() => ({})),
|
||||||
|
]);
|
||||||
if (!definitions || definitions.length === 0) {
|
if (!definitions || definitions.length === 0) {
|
||||||
updateChunkWord(chunkId, wordId, {
|
updateChunkWord(chunkId, wordId, {
|
||||||
strongNumber: '',
|
strongNumber: '',
|
||||||
@@ -1182,9 +1187,11 @@ useEffect(() => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const first = definitions[0];
|
const first = definitions[0];
|
||||||
|
const strongKey = (first.topic || normalized).toUpperCase();
|
||||||
const extractedPartOfSpeech = extractPartOfSpeech(first.definition || '');
|
const extractedPartOfSpeech = extractPartOfSpeech(first.definition || '');
|
||||||
updateChunkWord(chunkId, wordId, {
|
updateChunkWord(chunkId, wordId, {
|
||||||
strongNumber: first.topic || normalized,
|
strongNumber: first.topic || normalized,
|
||||||
|
englishGloss: gloss[strongKey] || '',
|
||||||
lexeme: first.lexeme || '',
|
lexeme: first.lexeme || '',
|
||||||
transliteration: first.transliteration || '',
|
transliteration: first.transliteration || '',
|
||||||
partOfSpeech: extractedPartOfSpeech || word.partOfSpeech || '',
|
partOfSpeech: extractedPartOfSpeech || word.partOfSpeech || '',
|
||||||
@@ -2046,6 +2053,16 @@ const restoreRemoteProject = async (id) => {
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-4 grid gap-4 sm:grid-cols-2">
|
<div className="mt-4 grid gap-4 sm:grid-cols-2">
|
||||||
|
<label className="text-sm text-slate-600">
|
||||||
|
English word
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
value={word.englishGloss ?? ''}
|
||||||
|
onChange={(e) => updateChunkWord(selectedChunk.id, word.id, { englishGloss: e.target.value })}
|
||||||
|
placeholder="e.g. grace"
|
||||||
|
className="mt-2 block w-full rounded-2xl border border-slate-300 bg-slate-50 px-3 py-2 text-slate-900 shadow-sm focus:border-sky-500 focus:outline-none focus:ring-2 focus:ring-sky-200"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
<label className="text-sm text-slate-600">
|
<label className="text-sm text-slate-600">
|
||||||
Short definition
|
Short definition
|
||||||
<input
|
<input
|
||||||
|
|||||||
Reference in New Issue
Block a user