From 489845cd70a4318e35f595731f5e4a9d14a4bb61 Mon Sep 17 00:00:00 2001 From: Rohit Date: Wed, 9 Apr 2025 21:13:22 +0530 Subject: [PATCH] feat: emit robot save type --- src/components/recorder/SaveRecording.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/components/recorder/SaveRecording.tsx b/src/components/recorder/SaveRecording.tsx index 87d9bd17..a85cb868 100644 --- a/src/components/recorder/SaveRecording.tsx +++ b/src/components/recorder/SaveRecording.tsx @@ -60,10 +60,22 @@ export const SaveRecording = ({ fileName }: SaveRecordingProps) => { } }; - const exitRecording = useCallback(async () => { + const exitRecording = useCallback(async (data?: { actionType: string }) => { + let successMessage = t('save_recording.notifications.save_success'); + + if (data && data.actionType) { + if (data.actionType === 'retrained') { + successMessage = t('save_recording.notifications.retrain_success'); + } else if (data.actionType === 'saved') { + successMessage = t('save_recording.notifications.save_success'); + } else if (data.actionType === 'error') { + successMessage = t('save_recording.notifications.save_error'); + } + } + const notificationData = { type: 'success', - message: t('save_recording.notifications.save_success'), + message: successMessage, timestamp: Date.now() }; @@ -73,7 +85,6 @@ export const SaveRecording = ({ fileName }: SaveRecordingProps) => { notification: notificationData }, '*'); - // Also notify about clearing any remaining session data window.opener.postMessage({ type: 'session-data-clear', timestamp: Date.now()