Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(notifications) added toast notification on copy sharing link

Anshu Pathakb79907f7a57c
diff --git a/react/features/invite/components/add-people-dialog/web/InviteByEmailSection.tsx b/react/features/invite/components/add-people-dialog/web/InviteByEmailSection.tsx
index 6369bcb64e..0288e5b0c3 100644
--- a/react/features/invite/components/add-people-dialog/web/InviteByEmailSection.tsx
+++ b/react/features/invite/components/add-people-dialog/web/InviteByEmailSection.tsx
@@ -1,5 +1,6 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
+import { useDispatch } from 'react-redux';
import { makeStyles } from 'tss-react/mui';
import { isIosMobileBrowser } from '../../../../base/environment/utils';
@@ -13,7 +14,8 @@ import {
} from '../../../../base/icons/svg';
import Tooltip from '../../../../base/tooltip/components/Tooltip';
import { copyText } from '../../../../base/util/copyText.web';
-
+import { showSuccessNotification } from '../../../../notifications/actions';
+import { NOTIFICATION_TIMEOUT_TYPE } from '../../../../notifications/constants';
interface IProps {
/**
@@ -62,6 +64,7 @@ const useStyles = makeStyles()(theme => {
* @returns {ReactNode}
*/
function InviteByEmailSection({ inviteSubject, inviteText, inviteTextiOS }: IProps) {
+ const dispatch = useDispatch();
const { classes } = useStyles();
const { t } = useTranslation();
const encodedInviteSubject = encodeURIComponent(inviteSubject);
@@ -76,6 +79,9 @@ function InviteByEmailSection({ inviteSubject, inviteText, inviteTextiOS }: IPro
* @returns {void}
*/
function _onCopyText() {
+ dispatch(showSuccessNotification({
+ titleKey: 'dialog.copied'
+ }, NOTIFICATION_TIMEOUT_TYPE.SHORT));
copyText(inviteText);
}
@@ -89,6 +95,9 @@ function InviteByEmailSection({ inviteSubject, inviteText, inviteTextiOS }: IPro
function _onCopyTextKeyPress(e: React.KeyboardEvent) {
if (e.key === ' ' || e.key === 'Enter') {
e.preventDefault();
+ dispatch(showSuccessNotification({
+ titleKey: 'dialog.copied'
+ }, NOTIFICATION_TIMEOUT_TYPE.SHORT));
copyText(inviteText);
}
}
diff --git a/react/features/notifications/actions.ts b/react/features/notifications/actions.ts
index 7de74dae2b..69997503ab 100644
--- a/react/features/notifications/actions.ts
+++ b/react/features/notifications/actions.ts
@@ -104,6 +104,20 @@ export function showErrorNotification(props: INotificationProps, type?: string)
}, type);
}
+/**
+ * Queues a success notification for display.
+ *
+ * @param {Object} props - The props needed to show the notification component.
+ * @param {string} type - Notification type.
+ * @returns {Object}
+ */
+export function showSuccessNotification(props: INotificationProps, type?: string) {
+ return showNotification({
+ ...props,
+ appearance: NOTIFICATION_TYPE.SUCCESS
+ }, type);
+}
+
/**
* Queues a notification for display.
*