Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add word status #347

Merged
merged 11 commits into from
Nov 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix !
sonic16x committed Nov 24, 2024
commit 55f9a7f916b59deb9c6cc9ddba3067389a9293ad
9 changes: 3 additions & 6 deletions src/components/ResultsCard/ResultsCard.tsx
Original file line number Diff line number Diff line change
@@ -18,8 +18,6 @@ import { wordHasForms } from 'utils/wordHasForms';

import { Clipboard } from 'components/Clipboard';

import { removeBrackets } from "../../utils/removeBrackets";

import './ResultsCard.scss';

import ErrorIcon from './images/error-icon.svg';
@@ -114,7 +112,6 @@ export const ResultsCard =
({ item, short, index }: IResultsCardProps) => {
const alphabets = useAlphabets();
const caseQuestions = useCaseQuestions();
const wordId = Dictionary.getField(item.raw, 'id')?.toString();
const pos = getPartOfSpeech(item.details);
const dispatch = useDispatch();
const lang = useLang();
@@ -130,7 +127,7 @@ export const ResultsCard =
dispatch(showModalDialog({
type: MODAL_DIALOG_TYPES.MODAL_DIALOG_WORD_ERROR,
data: {
wordId,
wordId: item.id,
isvWord: item.original,
translatedWord: item.translate,
},
@@ -141,7 +138,7 @@ export const ResultsCard =
dispatch(showModalDialog({
type: MODAL_DIALOG_TYPES.MODAL_DIALOG_WORD_FORMS,
data: {
word: removeBrackets(Dictionary.getField(item.raw, 'isv'), '[', ']'),
word: item.isv,
add: Dictionary.getField(item.raw, 'addition'),
details: Dictionary.getField(item.raw, 'partOfSpeech'),
},
@@ -151,7 +148,7 @@ export const ResultsCard =
const shareWord = () => {
const { origin, pathname } = window.location;
const query = toQueryString({
text: `id${wordId}`,
text: `id${item.id}`,
lang: `${lang.from}-${lang.to}`,
});

4 changes: 3 additions & 1 deletion src/services/dictionary.ts
Original file line number Diff line number Diff line change
@@ -512,7 +512,9 @@ class DictionaryClass {
return results.map((item) => {
const isvRaw = this.getField(item, 'isv');
const remove = isvRaw.startsWith('!');
const isv = remove ? isvRaw.substring(1) : isvRaw;
const isv = removeBrackets(
removeExclamationMark(isvRaw), '[', ']'
);

const id = this.getField(item, 'id');
const addArray = this.getField(item, 'addition').match(/\(.+?\)/) || [];