From 1b7668bbdc143453cd3d087ce106f7cb56c50284 Mon Sep 17 00:00:00 2001 From: damencho Date: Tue, 14 Jan 2025 12:55:46 -0600 Subject: [PATCH] feat(dialog): Adds a print when opening and hiding dialogs. --- react/features/base/dialog/actions.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/react/features/base/dialog/actions.ts b/react/features/base/dialog/actions.ts index 65a0563ed7..e3b18e9906 100644 --- a/react/features/base/dialog/actions.ts +++ b/react/features/base/dialog/actions.ts @@ -9,6 +9,7 @@ import { OPEN_SHEET } from './actionTypes'; import { isDialogOpen } from './functions'; +import logger from './logger'; /** * Signals Dialog to close its dialog. @@ -23,6 +24,8 @@ import { isDialogOpen } from './functions'; * }} */ export function hideDialog(component?: ComponentType) { + logger.info(`Hide dialog: ${getComponentDisplayName(component)}`); + return { type: HIDE_DIALOG, component @@ -55,6 +58,8 @@ export function hideSheet() { * }} */ export function openDialog(component: ComponentType, componentProps?: Object) { + logger.info(`Open dialog: ${getComponentDisplayName(component)}`); + return { type: OPEN_DIALOG, component, @@ -101,3 +106,21 @@ export function toggleDialog(component: ComponentType, componentProps?: Obj } }; } + +/** + * Extracts a printable name for a dialog component. + * + * @param {Object} component - The component to extract the name for. + * + * @returns {string} The display name. + */ +function getComponentDisplayName(component?: ComponentType) { + if (!component) { + return ''; + } + + const name = component.displayName ?? component.name ?? 'Component'; + + return name.replace('withI18nextTranslation(Connect(', '') // dialogs with translations + .replace('))', ''); // dialogs with translations suffix +}