-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' of github.com:UNICEFECAR/USupport-mobile i…
…nto fix/issue_76
- Loading branch information
Showing
26 changed files
with
153 additions
and
9 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
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
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
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
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
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
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
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
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
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
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,57 @@ | ||
import React, { useState } from "react"; | ||
import { useTranslation } from "react-i18next"; | ||
import { useMutation } from "@tanstack/react-query"; | ||
|
||
import { TransparentModal } from "#components"; | ||
import { useError } from "#hooks"; | ||
import { showToast } from "#utils"; | ||
import { clientSvc } from "#services"; | ||
|
||
/** | ||
* DeleteChatHistory | ||
* | ||
* The DeleteChatHistory modal | ||
* | ||
* @return {jsx} | ||
*/ | ||
export const DeleteChatHistory = ({ isOpen, onClose }) => { | ||
const { t } = useTranslation("delete-chat-history"); | ||
|
||
const [errors, setErrors] = useState({}); | ||
|
||
const deleteChat = async () => { | ||
const res = await clientSvc.deleteChatHistory(); | ||
return res; | ||
}; | ||
|
||
const deleteAccountMutation = useMutation(deleteChat, { | ||
onSuccess: () => { | ||
showToast({ message: t("success") }); | ||
onClose(); | ||
}, | ||
onError: (error) => { | ||
const { message: errorMessage } = useError(error); | ||
setErrors({ submit: errorMessage }); | ||
}, | ||
}); | ||
|
||
const handleConfirm = () => { | ||
deleteAccountMutation.mutate(); | ||
}; | ||
|
||
return ( | ||
<TransparentModal | ||
heading={t("heading")} | ||
text={t("subheading")} | ||
isOpen={isOpen} | ||
handleClose={onClose} | ||
ctaLabel={t("confirm")} | ||
ctaColor="red" | ||
ctaHandleClick={handleConfirm} | ||
secondaryCtaLabel={t("cancel")} | ||
secondaryCtaType="primary" | ||
secondaryCtaHandleClick={onClose} | ||
errorMessage={errors.submit} | ||
/> | ||
); | ||
}; |
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 @@ | ||
export * from "./DeleteChatHistory.jsx"; |
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,3 @@ | ||
export * as en from "./locales/en.json"; | ||
export * as ru from "./locales/ru.json"; | ||
export * as kk from "./locales/kk.json"; |
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,7 @@ | ||
{ | ||
"heading": "Are you sure you want to delete all your chat data?", | ||
"subheading": "This action is irreversible.", | ||
"confirm": "Yes, delete all my chat data", | ||
"cancel": "No, keep my chat data", | ||
"success": "Your chat data has been deleted successfully." | ||
} |
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,7 @@ | ||
{ | ||
"heading": "Чат деректеріңіздің бәрін жою керек пе екеніне сенімдісіз бе?", | ||
"subheading": "Бұл әрекетті болдырмауға болмайды.", | ||
"confirm": "Иә, чат деректерімді бәрін жою", | ||
"cancel": "Жоқ, чат деректерімді сақтау", | ||
"success": "Сіздің чат деректеріңіз сәтті жойылды." | ||
} |
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,7 @@ | ||
{ | ||
"heading": "Вы уверены, что хотите удалить всю вашу историю чата?", | ||
"subheading": "Это действие необратимо.", | ||
"confirm": "Да, удалить всю мою историю чата", | ||
"cancel": "Нет, сохранить мою историю чата", | ||
"success": "Ваша история чата была успешно удалена." | ||
} |
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
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
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
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
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
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
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
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
Oops, something went wrong.