feat(ui): external dictionary lookup link on the word-check tool
CI / changes (pull_request) Successful in 3s
CI / unit (pull_request) Has been skipped
CI / integration (pull_request) Has been skipped
CI / ui (pull_request) Successful in 48s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 56s

When a checked word is found, show a 'look it up' text link beside the
complaint button that opens an external reference dictionary in a new tab:
gramota.ru for the Russian variants, scrabblewordfinder.org for English
(word lower-cased and percent-encoded). The link hides for a word that is
not found. Inside Telegram it routes through the Mini App SDK's openLink, so
Telegram opens it directly instead of the WebView's 'open this link?'
confirmation; in a browser the anchor's own target=_blank handles it.

Relabel the complaint button to 'Возражаю' (ru); English stays 'Disagree'.
This commit is contained in:
Ilia Denisov
2026-06-15 18:14:19 +02:00
parent 4d6df4bd8b
commit 8e0d7f9e17
10 changed files with 113 additions and 8 deletions
+16 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { canCheckWord, MAX_WORD_LEN, sanitizeCheckWord } from './checkword';
import { canCheckWord, dictionaryLookupUrl, MAX_WORD_LEN, sanitizeCheckWord } from './checkword';
const EN = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
@@ -40,3 +40,18 @@ describe('canCheckWord', () => {
expect(canCheckWord(' a ', false, false)).toBe(false);
});
});
describe('dictionaryLookupUrl', () => {
it('points the Russian variants at gramota.ru with a lower-cased, encoded query', () => {
expect(dictionaryLookupUrl('КОТ', 'scrabble_ru')).toBe(
'https://gramota.ru/poisk?query=' + encodeURIComponent('кот'),
);
expect(dictionaryLookupUrl('ЭРА', 'erudit_ru')).toBe(
'https://gramota.ru/poisk?query=' + encodeURIComponent('эра'),
);
});
it('points English at scrabblewordfinder.org with a lower-cased path', () => {
expect(dictionaryLookupUrl('CAT', 'scrabble_en')).toBe('https://scrabblewordfinder.org/dictionary/cat');
});
});