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

Pop up messages fix #725

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion DSL/DMapper/lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function getUuid() {
);
}

export function lookup(configurationArray, key) {
export function lookupConfigs(configurationArray, key) {
for (const element of configurationArray) {
if (element.key === key) {
return element.value;
Expand Down
30 changes: 17 additions & 13 deletions GUI/src/components/Chat/Chat.scss
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,11 @@
color: get-color(white);

:any-link {
background: url("../../static/icons/link-external-blue.svg") no-repeat right center;
padding-right: 1.25em;
color: blue;
text-decoration: underline;
background: url('../../static/icons/link-external-blue.svg')
no-repeat right center;
padding-right: 1.25em;
color: blue;
text-decoration: underline;
}

&:hover {
Expand All @@ -183,12 +184,13 @@
&__message-text {
background-color: get-color(black-coral-10);
color: get-color(white);

:any-link {
background: url("../../static/icons/link-external-white.svg") no-repeat right center;
padding-right: 1.25em;
color: white;
text-decoration: underline;
background: url('../../static/icons/link-external-white.svg')
no-repeat right center;
padding-right: 1.25em;
color: white;
text-decoration: underline;
}

&:hover {
Expand Down Expand Up @@ -281,13 +283,16 @@
line-height: $veera-line-height-500;
transition: all 0.25s ease-out;
cursor: pointer;
word-break: break-word;
white-space: pre-wrap;

&:hover {
background-color: get-color(black-coral-1);
}

:any-link {
background: url("../../static/icons/link-external-blue.svg") no-repeat right center;
background: url('../../static/icons/link-external-blue.svg') no-repeat
right center;
padding-right: 1.25em;
color: blue;
text-decoration: underline;
Expand All @@ -304,8 +309,8 @@
transition: all 0.25s ease-out;
cursor: pointer;

color: #4472C4;
background-color: #E7F3FF;
color: #4472c4;
background-color: #e7f3ff;
}

&__message-date {
Expand All @@ -331,7 +336,6 @@
display: inline-block;
width: 16px;
height: 16px;

}
}
}
1 change: 1 addition & 0 deletions GUI/src/constants/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ 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';
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
6 changes: 5 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ services:
- application.internalRequests.allowedIPs=127.0.0.1
- application.logging.displayRequestContent=true
- application.logging.displayResponseContent=true
- application.logging.printStackTrace=true
- application.internalRequests.disabled=true
- server.port=8086
volumes:
- ./DSL/Ruuter.public/DSL:/DSL
Expand All @@ -30,6 +32,8 @@ services:
- application.internalRequests.allowedIPs=127.0.0.1
- application.logging.displayRequestContent=true
- application.logging.displayResponseContent=true
- application.logging.printStackTrace=true
- application.internalRequests.disabled=true
- server.port=8088
volumes:
- ./DSL/Ruuter.private/DSL:/DSL
Expand Down Expand Up @@ -82,7 +86,7 @@ services:
- ./DSL:/data
- ./DSL/DMapper/hbs:/workspace/app/views/chat-bot
- ./DSL/DMapper/js:/workspace/app/js/chat-bot
- ./DSL/DMapper/lib:/workspace/app/lib
- ./DSL/DMapper/lib/helpers.js:/workspace/app/lib/helpers.js
ports:
- 3000:3000
networks:
Expand Down