Skip to content

Commit

Permalink
fix: added proper msg
Browse files Browse the repository at this point in the history
  • Loading branch information
amar-1995 committed May 22, 2024
1 parent 50178f1 commit 9a6ddf9
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
useHMSStore,
useHMSVanillaStore,
} from '@100mslive/react-sdk';
import { AlertTriangleIcon } from '@100mslive/react-icons';
import { AlertTriangleIcon, ClosedCaptionIcon, OpenCaptionIcon } from '@100mslive/react-icons';
// @ts-ignore: No implicit Any
import { ToastManager } from '../Toast/ToastManager';
import { EqualProminence } from './EqualProminence';
Expand Down Expand Up @@ -105,13 +105,14 @@ export const GridLayout = ({

useEffect(() => {
if (transcriptionStates && transcriptionStates.length > 0) {
console.log('state ', transcriptionStates[0].state);
match({ state: transcriptionStates[0].state, error: transcriptionStates[0].error })
.when(
({ error }) => error,
({ error }) => !!error,
() => {
ToastManager.addToast({
title: `Failed to enable Closed Caption`,
variant: 'danger',
variant: 'error',
icon: <AlertTriangleIcon style={{ marginRight: '0.5rem' }} />,
});
},
Expand All @@ -120,19 +121,19 @@ export const GridLayout = ({
({ state }) => state === HMSTranscriptionState.STARTED,
() => {
ToastManager.addToast({
title: `Failed to enable Closed Caption`,
variant: 'danger',
icon: <AlertTriangleIcon style={{ marginRight: '0.5rem' }} />,
title: `Closed Captioning enabled for everyone`,
variant: 'standard',
icon: <OpenCaptionIcon style={{ marginRight: '0.5rem' }} />,
});
},
)
.when(
({ state }) => state === HMSTranscriptionState.STOPPED || state === HMSTranscriptionState.FAILED,
() => {
ToastManager.addToast({
title: `Failed to enable Closed Caption`,
variant: 'danger',
icon: <AlertTriangleIcon style={{ marginRight: '0.5rem' }} />,
title: `Closed Captioning disabled for everyone`,
variant: 'standard',
icon: <ClosedCaptionIcon style={{ marginRight: '0.5rem' }} />,
});
},
);
Expand Down

0 comments on commit 9a6ddf9

Please sign in to comment.