-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Languages components, add models, actions, effects
- Loading branch information
Showing
47 changed files
with
1,639 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"language_page_title": "Languages", | ||
"add_language": "Add language", | ||
"add_folder": "Add folder", | ||
"add_word": "Add word", | ||
"update_language": "Update language", | ||
"update_folder": "Update folder", | ||
"update_word": "Update word", | ||
"remove_language": "Remove language", | ||
"remove_folder": "Remove folder", | ||
"remove_word": "Remove word", | ||
"add_item": "Add", | ||
"check_word": "Check as remembered", | ||
"uncheck_word": "Check as forgotten", | ||
"language_title": "Language title", | ||
"folder_title": "Folder title", | ||
"word_original": "Word in original", | ||
"word_translations": "Translations", | ||
"word_notice": "Notice", | ||
"no_folder_selected": "Folder not selected" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"language_page_title": "Языки", | ||
"add_language": "Добавить язык", | ||
"add_folder": "Добавить папку", | ||
"add_word": "Добавить слово", | ||
"update_language": "Изменить язык", | ||
"update_folder": "Изменить папку", | ||
"update_word": "Изменить слово", | ||
"remove_language": "Удалить язык", | ||
"remove_folder": "Удалить папку", | ||
"remove_word": "Удалить слово", | ||
"add_item": "Добавить", | ||
"check_word": "Отметить как запомненное", | ||
"uncheck_word": "Отметить как забытое", | ||
"language_title": "Название языка", | ||
"folder_title": "Название папки", | ||
"word_original": "Слово в оригинале", | ||
"word_translations": "Переводы", | ||
"word_notice": "Заметка", | ||
"no_folder_selected": "Папка не выбрана" | ||
} |
13 changes: 13 additions & 0 deletions
13
src/app/action/languages/removeLanguage/removeLanguage.action.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { request } from '@/app/lib/fetch/request.ts'; | ||
import { | ||
isDomainNotificationLanguageDeletedData, | ||
} from 'product-types/dist/notification/notification-data-types/language/DomainNotificationLanguageDeletedData'; | ||
|
||
|
||
export const removeLanguageAction = function (languageId: string) { | ||
return request( | ||
`v1/language/${ languageId }`, | ||
{ method: 'DELETE' }, | ||
isDomainNotificationLanguageDeletedData, | ||
); | ||
}; |
13 changes: 13 additions & 0 deletions
13
src/app/action/languages/removeLanguageFolder/removeLanguageFolder.action.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { request } from '@/app/lib/fetch/request.ts'; | ||
import { | ||
isDomainNotificationLanguageFolderDeletedData, | ||
} from 'product-types/dist/notification/notification-data-types/language/DomainNotificationLanguageFolderDeletedData'; | ||
|
||
|
||
export const removeLanguageFolderAction = function (folderId: string) { | ||
return request( | ||
`v1/language/folder/${ folderId }`, | ||
{ method: 'DELETE' }, | ||
isDomainNotificationLanguageFolderDeletedData, | ||
); | ||
}; |
13 changes: 13 additions & 0 deletions
13
src/app/action/languages/removeLanguageWord/removeLanguageWord.action.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { request } from '@/app/lib/fetch/request.ts'; | ||
import { | ||
isDomainNotificationLanguageWordDeletedData, | ||
} from 'product-types/dist/notification/notification-data-types/language/DomainNotificationLanguageWordDeletedData'; | ||
|
||
|
||
export const removeLanguageWordAction = function (wordId: string) { | ||
return request( | ||
`v1/language/word/${ wordId }`, | ||
{ method: 'DELETE' }, | ||
isDomainNotificationLanguageWordDeletedData, | ||
); | ||
}; |
16 changes: 16 additions & 0 deletions
16
src/app/action/languages/updateLanguage/updateLanguage.action.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { | ||
DomainLanguageUpdateData, | ||
} from 'product-types/dist/language/DomainLanguageUpdateData'; | ||
import { request } from '@/app/lib/fetch/request.ts'; | ||
import { | ||
isDomainNotificationLanguageUpdateData, | ||
} from 'product-types/dist/notification/notification-data-types/language/DomainNotificationLanguageUpdateData'; | ||
|
||
|
||
export const updateLanguageAction = function (languageId: string, updateData: DomainLanguageUpdateData) { | ||
return request( | ||
`v1/language/${ languageId }`, | ||
{ method: 'PATCH', body: JSON.stringify(updateData) }, | ||
isDomainNotificationLanguageUpdateData, | ||
); | ||
}; |
16 changes: 16 additions & 0 deletions
16
src/app/action/languages/updateLanguageFolder/updateLanguageFolder.action.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { | ||
DomainLanguageFolderUpdateData, | ||
} from 'product-types/dist/language/DomainLanguageFolderUpdateData'; | ||
import { request } from '@/app/lib/fetch/request.ts'; | ||
import { | ||
isDomainNotificationLanguageFolderUpdateData, | ||
} from 'product-types/dist/notification/notification-data-types/language/DomainNotificationLanguageFolderUpdateData'; | ||
|
||
|
||
export const updateLanguageFolderAction = function (folderId: string, updateData: DomainLanguageFolderUpdateData) { | ||
return request( | ||
`v1/language/folder/${ folderId }`, | ||
{ method: 'PATCH', body: JSON.stringify(updateData) }, | ||
isDomainNotificationLanguageFolderUpdateData, | ||
); | ||
}; |
16 changes: 16 additions & 0 deletions
16
src/app/action/languages/updateLanguageWord/updateLanguageWord.action.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { | ||
DomainLanguageWordUpdateData, | ||
} from 'product-types/dist/language/DomainLanguageWordUpdateData'; | ||
import { request } from '@/app/lib/fetch/request.ts'; | ||
import { | ||
isDomainNotificationLanguageWordUpdateData, | ||
} from 'product-types/dist/notification/notification-data-types/language/DomainNotificationLanguageWordUpdateData'; | ||
|
||
|
||
export const updateLanguageWordAction = function (wordId: string, updateData: DomainLanguageWordUpdateData) { | ||
return request( | ||
`v1/language/word/${ wordId }`, | ||
{ method: 'PATCH', body: JSON.stringify(updateData) }, | ||
isDomainNotificationLanguageWordUpdateData, | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...age/button/CreateLanguageFolderFormModalButton/ui/CreateLanguageFolderFormModalButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { FC, memo } from 'react'; | ||
import { | ||
Button, | ||
ButtonProps, | ||
} from '@/shared/ui-kit/buttons/Button/ui/Button.tsx'; | ||
import { | ||
useModalController, | ||
} from '@/shared/ui-kit/modal/Modal/hooks/useModalController.ts'; | ||
import { Modal } from '@/shared/ui-kit/modal/Modal/ui/Modal.tsx'; | ||
import { IoAddCircle } from 'react-icons/io5'; | ||
import { | ||
CreateLanguageFolderForm, | ||
} from '@/widgets/language/form/CreateLanguageFolderForm/ui/CreateLanguageFolderForm.tsx'; | ||
import { PopOver } from '@/shared/ui-kit/modal/PopOver/ui/PopOver.tsx'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
|
||
export type CreateLanguageFolderFormModalButtonProps = | ||
{ | ||
languageId: string; | ||
} | ||
& ButtonProps; | ||
|
||
export const CreateLanguageFolderFormModalButton: FC<CreateLanguageFolderFormModalButtonProps> = memo(function CreateLanguageFolderFormModalButton (props) { | ||
const { languageId, ...other } = props; | ||
const modalController = useModalController(); | ||
const { t } = useTranslation([ 'languages' ]); | ||
|
||
return ( | ||
<> | ||
<Modal controller={ modalController }> | ||
<CreateLanguageFolderForm | ||
languageId={ languageId } | ||
onSubmitHandler={ () => modalController.setOpened(false) } | ||
/> | ||
</Modal> | ||
<PopOver popover={ t('add_folder') }> | ||
<Button | ||
{ ...other } | ||
onClick={ () => modalController.setOpened(true) } | ||
quad | ||
> | ||
<IoAddCircle/> | ||
</Button> | ||
</PopOver> | ||
</> | ||
); | ||
}); |
45 changes: 45 additions & 0 deletions
45
...atures/language/button/CreateLanguageFormModalButton/ui/CreateLanguageFormModalButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { FC, memo } from 'react'; | ||
import { | ||
Button, | ||
ButtonProps, | ||
} from '@/shared/ui-kit/buttons/Button/ui/Button.tsx'; | ||
import { IoAddCircle } from 'react-icons/io5'; | ||
import { Modal } from '@/shared/ui-kit/modal/Modal/ui/Modal.tsx'; | ||
import { | ||
CreateLanguageForm, | ||
} from '@/widgets/language/form/CreateLanguageForm/ui/CreateLanguageForm.tsx'; | ||
import { | ||
useModalController, | ||
} from '@/shared/ui-kit/modal/Modal/hooks/useModalController.ts'; | ||
import { PopOver } from '@/shared/ui-kit/modal/PopOver/ui/PopOver.tsx'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
|
||
export type CreateLanguageFormModalButtonProps = | ||
{} | ||
& ButtonProps; | ||
|
||
export const CreateLanguageFormModalButton: FC<CreateLanguageFormModalButtonProps> = memo(function CreateLanguageFormModalButton (props) { | ||
const { ...other } = props; | ||
const modalController = useModalController(); | ||
const { t } = useTranslation([ 'languages' ]); | ||
|
||
return ( | ||
<> | ||
<Modal controller={ modalController }> | ||
<CreateLanguageForm | ||
onSubmitHandler={ () => modalController.setOpened(false) } | ||
/> | ||
</Modal> | ||
<PopOver popover={ t('add_language') }> | ||
<Button | ||
{ ...other } | ||
onClick={ () => modalController.setOpened(true) } | ||
quad | ||
> | ||
<IoAddCircle/> | ||
</Button> | ||
</PopOver> | ||
</> | ||
); | ||
}); |
Oops, something went wrong.