feat: save notif and close tab

This commit is contained in:
Rohit
2025-03-11 20:28:01 +05:30
parent efd5d023a4
commit 3289a7203d

View File

@@ -47,13 +47,27 @@ export const SaveRecording = ({ fileName }: SaveRecordingProps) => {
}; };
const exitRecording = useCallback(async () => { const exitRecording = useCallback(async () => {
notify('success', t('save_recording.notifications.save_success')); const notificationData = {
type: 'success',
message: t('save_recording.notifications.save_success'),
timestamp: Date.now()
};
window.sessionStorage.setItem('pendingNotification', JSON.stringify(notificationData));
if (window.opener) {
window.opener.postMessage({
type: 'recording-notification',
notification: notificationData
}, '*');
}
if (browserId) { if (browserId) {
await stopRecording(browserId); await stopRecording(browserId);
} }
setBrowserId(null); setBrowserId(null);
navigate('/');
}, [setBrowserId, browserId, notify]); window.close();
}, [setBrowserId, browserId]);
// notifies backed to save the recording in progress, // notifies backed to save the recording in progress,
// releases resources and changes the view for main page by clearing the global browserId // releases resources and changes the view for main page by clearing the global browserId
@@ -142,4 +156,4 @@ const modalStyle = {
height: 'fit-content', height: 'fit-content',
display: 'block', display: 'block',
padding: '20px', padding: '20px',
}; };