diff --git a/GUI/src/constants/config.ts b/GUI/src/constants/config.ts index 3d84f730..5969b8af 100644 --- a/GUI/src/constants/config.ts +++ b/GUI/src/constants/config.ts @@ -2,6 +2,7 @@ export const EMERGENCY_NOTICE_LENGTH = 250; export const WELCOME_MESSAGE_LENGTH = 250; export const USER_IDLE_STATUS_TIMEOUT = 300000; // milliseconds export const CHAT_INPUT_LENGTH = 500; +export const POPUP_DURATION = 2; // seconds export const CHAT_HISTORY_PREFERENCES_KEY = 'chat-history-preferences'; export const isHiddenFeaturesEnabled = import.meta.env.REACT_APP_ENABLE_HIDDEN_FEATURES?.toLowerCase().trim() == diff --git a/GUI/src/context/ToastContext.tsx b/GUI/src/context/ToastContext.tsx index 5c07ef4a..0f13cc5b 100644 --- a/GUI/src/context/ToastContext.tsx +++ b/GUI/src/context/ToastContext.tsx @@ -11,6 +11,7 @@ import * as RadixToast from '@radix-ui/react-toast'; import { Toast } from 'components'; import { generateUEID } from 'utils/generateUEID'; +import { POPUP_DURATION } from 'constants/config'; export type ToastType = { type: 'info' | 'success' | 'error' | 'warning'; @@ -46,6 +47,7 @@ export const ToastProvider: FC = ({ children }) => { {children} {toasts.map((toast) => ( diff --git a/GUI/src/pages/Chat/ChatActive/index.tsx b/GUI/src/pages/Chat/ChatActive/index.tsx index 8f9f7f41..90d4d105 100644 --- a/GUI/src/pages/Chat/ChatActive/index.tsx +++ b/GUI/src/pages/Chat/ChatActive/index.tsx @@ -88,13 +88,13 @@ const ChatActive: FC = () => { toast.open({ type: 'success', title: t('global.notification'), - message: `Chat forwarded to ${user.displayName}`, + message: `${t('chat.chatForwardedTo')} ${user.displayName}`, }); } catch (error) { toast.open({ type: 'warning', title: t('global.notificationError'), - message: `Chat ended`, + message: t('chat.chatEnded'), }); } }; @@ -108,7 +108,7 @@ const ChatActive: FC = () => { toast.open({ type: 'success', title: t('global.notification'), - message: `Chat forwarded to ${establishment}`, + message: `${t('chat.chatForwardedTo')} ${establishment}`, }); }; @@ -128,13 +128,13 @@ const ChatActive: FC = () => { toast.open({ type: 'success', title: t('global.notification'), - message: `Chat ended`, + message: t('chat.chatEnded'), }); } catch (error) { toast.open({ type: 'warning', title: t('global.notificationError'), - message: `Chat ended`, + message: t('chat.chatEnded'), }); } setEndChatModal(null); diff --git a/GUI/src/pages/Chat/ChatPending/index.tsx b/GUI/src/pages/Chat/ChatPending/index.tsx index 0a28c895..c1addcca 100644 --- a/GUI/src/pages/Chat/ChatPending/index.tsx +++ b/GUI/src/pages/Chat/ChatPending/index.tsx @@ -82,13 +82,13 @@ const ChatPending: FC = () => { toast.open({ type: 'success', title: t('global.notification'), - message: `Chat forwarded to ${user.displayName}`, + message: `${t('chat.chatForwardedTo')} ${user.displayName}`, }); } catch (error) { toast.open({ type: 'warning', title: t('global.notificationError'), - message: `Chat ended`, + message: t('chat.chatEnded'), }); } }; @@ -102,7 +102,7 @@ const ChatPending: FC = () => { toast.open({ type: 'success', title: t('global.notification'), - message: `Chat forwarded to ${establishment}`, + message: `${t('chat.chatForwardedTo')} ${establishment}`, }); }; @@ -122,13 +122,13 @@ const ChatPending: FC = () => { toast.open({ type: 'success', title: t('global.notification'), - message: `Chat ended`, + message: t('chat.chatEnded'), }); } catch (error) { toast.open({ type: 'warning', title: t('global.notificationError'), - message: `Chat ended`, + message: t('chat.chatEnded'), }); } setEndChatModal(null); diff --git a/GUI/src/pages/Chat/ChatUnanswered/index.tsx b/GUI/src/pages/Chat/ChatUnanswered/index.tsx index a0044b45..b824a465 100644 --- a/GUI/src/pages/Chat/ChatUnanswered/index.tsx +++ b/GUI/src/pages/Chat/ChatUnanswered/index.tsx @@ -80,13 +80,13 @@ const ChatUnanswered: FC = () => { toast.open({ type: 'success', title: t('global.notification'), - message: `Chat forwarded to ${user.displayName}`, + message: `${t('chat.chatForwardedTo')} ${user.displayName}`, }); } catch (error) { toast.open({ type: 'warning', title: t('global.notificationError'), - message: `Chat ended`, + message: t('chat.chatEnded'), }); } }; @@ -100,7 +100,7 @@ const ChatUnanswered: FC = () => { toast.open({ type: 'success', title: t('global.notification'), - message: `Chat forwarded to ${establishment}`, + message: `${t('chat.chatForwardedTo')} ${establishment}`, }); }; @@ -120,13 +120,13 @@ const ChatUnanswered: FC = () => { toast.open({ type: 'success', title: t('global.notification'), - message: `Chat ended`, + message: t('chat.chatEnded'), }); } catch (error) { toast.open({ type: 'warning', title: t('global.notificationError'), - message: `Chat ended`, + message: t('chat.chatEnded'), }); } setEndChatModal(null); diff --git a/GUI/translations/en/common.json b/GUI/translations/en/common.json index 897a1414..b6b3f2cb 100644 --- a/GUI/translations/en/common.json +++ b/GUI/translations/en/common.json @@ -91,6 +91,8 @@ "workingHours": "Working hours" }, "chat": { + "chatForwardedTo": "Chat forwarded to", + "chatEnded": "Chat ended", "reply": "Reply", "unansweredChats": "Unanswered chats", "unanswered": "Unanswered", diff --git a/GUI/translations/et/common.json b/GUI/translations/et/common.json index a6332fa1..73064c55 100644 --- a/GUI/translations/et/common.json +++ b/GUI/translations/et/common.json @@ -91,6 +91,8 @@ "workingHours": "Tööaeg" }, "chat": { + "chatForwardedTo": "Vestlus edastati aadressile", + "chatEnded": "Vestlus lõppes", "reply": "Vasta", "unansweredChats": "Vastamata vestlused", "unanswered": "Vastamata",