🚸(frontend) add error handling for unsaved recording states

Implement proper error message display when recordings are unavailable due
to being active, pending webhook notification, or other transitional states.
Improves user experience by clearly communicating why content cannot be
accessed and setting appropriate expectations.
This commit is contained in:
lebaudantoine
2025-04-17 16:03:27 +02:00
committed by aleb_the_flash
parent e5af74685e
commit d1a17d2aa9
8 changed files with 38 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
import { fetchApi } from '@/api/fetchApi' import { fetchApi } from '@/api/fetchApi'
import { ApiRoom } from '@/features/rooms/api/ApiRoom' import { ApiRoom } from '@/features/rooms/api/ApiRoom'
import { RecordingMode } from '@/features/recording' import { RecordingMode, RecordingStatus } from '@/features/recording'
export type RecordingApi = { export type RecordingApi = {
id: string id: string
@@ -8,6 +8,7 @@ export type RecordingApi = {
created_at: string created_at: string
key: string key: string
mode: RecordingMode mode: RecordingMode
status: RecordingStatus
} }
export const fetchRecording = ({ recordingId }: { recordingId?: string }) => { export const fetchRecording = ({ recordingId }: { recordingId?: string }) => {

View File

@@ -7,7 +7,7 @@ export { useIsRecordingActive } from './hooks/useIsRecordingActive'
// api // api
export { useStartRecording } from './api/startRecording' export { useStartRecording } from './api/startRecording'
export { useStopRecording } from './api/stopRecording' export { useStopRecording } from './api/stopRecording'
export { RecordingMode } from './types' export { RecordingMode, RecordingStatus } from './types'
// components // components
export { RecordingStateToast } from './components/RecordingStateToast' export { RecordingStateToast } from './components/RecordingStateToast'

View File

@@ -12,6 +12,7 @@ import { formatDate } from '@/utils/formatDate'
import { ErrorScreen } from '@/components/ErrorScreen' import { ErrorScreen } from '@/components/ErrorScreen'
import { LoadingScreen } from '@/components/LoadingScreen' import { LoadingScreen } from '@/components/LoadingScreen'
import { fetchRecording } from '../api/fetchRecording' import { fetchRecording } from '../api/fetchRecording'
import { RecordingStatus } from '@/features/recording'
export const RecordingDownload = () => { export const RecordingDownload = () => {
const { t } = useTranslation('recording') const { t } = useTranslation('recording')
@@ -42,6 +43,13 @@ export const RecordingDownload = () => {
return <ErrorScreen title={t('error.title')} body={t('error.body')} /> return <ErrorScreen title={t('error.title')} body={t('error.body')} />
} }
if (
data.status !== RecordingStatus.Saved &&
data.status !== RecordingStatus.NotificationSucceed
) {
return <ErrorScreen title={t('unsaved.title')} body={t('unsaved.body')} />
}
return ( return (
<UserAware> <UserAware>
<Screen layout="centered" footer={false}> <Screen layout="centered" footer={false}>

View File

@@ -2,3 +2,14 @@ export enum RecordingMode {
Transcript = 'transcript', Transcript = 'transcript',
ScreenRecording = 'screen_recording', ScreenRecording = 'screen_recording',
} }
export enum RecordingStatus {
Initiated = 'initiated',
Active = 'active',
Stopped = 'stopped',
Saved = 'saved',
Aborted = 'aborted',
FailedToStart = 'failedToStart',
FailedToStop = 'failedToStop',
NotificationSucceed = 'notification_succeeded',
}

View File

@@ -7,6 +7,10 @@
"title": "", "title": "",
"body": "" "body": ""
}, },
"unsaved": {
"title": "",
"body": ""
},
"success": { "success": {
"title": "", "title": "",
"body": "", "body": "",

View File

@@ -7,6 +7,10 @@
"title": "Authentication required", "title": "Authentication required",
"body": "Please log in to access this recording." "body": "Please log in to access this recording."
}, },
"unsaved": {
"title": "Download Unavailable",
"body": "This recording is not ready for download yet. Please try again later."
},
"success": { "success": {
"title": "Your recording is ready!", "title": "Your recording is ready!",
"body": "Recording of the meeting <b>{{room}}</b> from {{created_at}}.", "body": "Recording of the meeting <b>{{room}}</b> from {{created_at}}.",

View File

@@ -7,6 +7,10 @@
"title": "Authentification requise", "title": "Authentification requise",
"body": "Veuillez vous connecter pour accéder à cet enregistrement." "body": "Veuillez vous connecter pour accéder à cet enregistrement."
}, },
"unsaved": {
"title": "Téléchargement indisponible",
"body": "Cet enregistrement n'est pas encore prêt à être téléchargé. Veuillez réessayer plus tard."
},
"success": { "success": {
"title": "Votre enregistrement est prêt !", "title": "Votre enregistrement est prêt !",
"body": "Enregistrement de la réunion <b>{{room}}</b> du {{created_at}}.", "body": "Enregistrement de la réunion <b>{{room}}</b> du {{created_at}}.",

View File

@@ -7,6 +7,10 @@
"title": "Authenticatie vereist", "title": "Authenticatie vereist",
"body": "Log in om toegang te krijgen tot deze opname." "body": "Log in om toegang te krijgen tot deze opname."
}, },
"unsaved": {
"title": "Download niet beschikbaar",
"body": "Deze opname is nog niet klaar om te worden gedownload. Probeer het later opnieuw."
},
"success": { "success": {
"title": "Je opname is klaar!", "title": "Je opname is klaar!",
"body": "Opname van de vergadering <b>{{room}}</b> op {{created_at}}.", "body": "Opname van de vergadering <b>{{room}}</b> op {{created_at}}.",