Skip to content

Commit

Permalink
Merge pull request #725 from 1AhmedYasser/pop-up-messages-fix
Browse files Browse the repository at this point in the history
Pop up messages fix
  • Loading branch information
KlviG authored Jun 18, 2024
2 parents ee29d3e + 9ab4044 commit 19bff11
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 15 deletions.
1 change: 1 addition & 0 deletions GUI/src/constants/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() ==
Expand Down
2 changes: 2 additions & 0 deletions GUI/src/context/ToastContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -46,6 +47,7 @@ export const ToastProvider: FC<PropsWithChildren> = ({ children }) => {
<RadixToast.Provider
swipeDirection='right'
label={t('global.notification') ?? 'Notification'}
duration={POPUP_DURATION * 1000}
>
{children}
{toasts.map((toast) => (
Expand Down
10 changes: 5 additions & 5 deletions GUI/src/pages/Chat/ChatActive/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
});
}
};
Expand All @@ -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}`,
});
};

Expand All @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions GUI/src/pages/Chat/ChatPending/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
});
}
};
Expand All @@ -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}`,
});
};

Expand All @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions GUI/src/pages/Chat/ChatUnanswered/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
});
}
};
Expand All @@ -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}`,
});
};

Expand All @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions GUI/translations/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@
"workingHours": "Working hours"
},
"chat": {
"chatForwardedTo": "Chat forwarded to",
"chatEnded": "Chat ended",
"reply": "Reply",
"unansweredChats": "Unanswered chats",
"unanswered": "Unanswered",
Expand Down
2 changes: 2 additions & 0 deletions GUI/translations/et/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@
"workingHours": "Tööaeg"
},
"chat": {
"chatForwardedTo": "Vestlus edastati aadressile",
"chatEnded": "Vestlus lõppes",
"reply": "Vasta",
"unansweredChats": "Vastamata vestlused",
"unanswered": "Vastamata",
Expand Down

0 comments on commit 19bff11

Please sign in to comment.