From 958447b7583a7b492659805c75392ee78eb4279f Mon Sep 17 00:00:00 2001 From: amar-1995 Date: Wed, 22 May 2024 18:01:50 +0530 Subject: [PATCH] fix: added content --- .../MoreSettings/CaptionContent.tsx | 132 ++++++++++++++++++ .../components/MoreSettings/CaptionModal.tsx | 37 +++++ 2 files changed, 169 insertions(+) create mode 100644 packages/roomkit-react/src/Prebuilt/components/MoreSettings/CaptionContent.tsx create mode 100644 packages/roomkit-react/src/Prebuilt/components/MoreSettings/CaptionModal.tsx diff --git a/packages/roomkit-react/src/Prebuilt/components/MoreSettings/CaptionContent.tsx b/packages/roomkit-react/src/Prebuilt/components/MoreSettings/CaptionContent.tsx new file mode 100644 index 0000000000..5a60f1ac38 --- /dev/null +++ b/packages/roomkit-react/src/Prebuilt/components/MoreSettings/CaptionContent.tsx @@ -0,0 +1,132 @@ +import React from 'react'; +import { HMSTranscriptionMode, selectIsTranscriptionEnabled, useHMSActions, useHMSStore } from '@100mslive/react-sdk'; +import { AlertTriangleIcon, CrossIcon } from '@100mslive/react-icons'; +import { Button } from '../../../Button'; +import { Box, Flex } from '../../../Layout'; +import { Loading } from '../../../Loading'; +import { Text } from '../../../Text'; +// @ts-ignore: No implicit Any +import { ToastManager } from '../Toast/ToastManager'; +// @ts-ignore: No implicit Any +import { useSetIsCaptionEnabled } from '../AppData/useUISettings'; + +export const CaptionContent = ({ isMobile, onExit }: { isMobile: boolean; onExit: () => void }) => { + const DURATION = 2000; + const actions = useHMSActions(); + const isTranscriptionEnabled = useHMSStore(selectIsTranscriptionEnabled); + + const [isCaptionEnabled, setIsCaptionEnabled] = useSetIsCaptionEnabled(); + return ( + <> + + {isTranscriptionEnabled ? 'Disable' : 'Enable'} Closed Caption (CC) for this session? + + + + + {!isMobile ? ( + + This will {isTranscriptionEnabled ? 'disable' : 'enable'} Closed Captions for everyone in this room. You can + {isTranscriptionEnabled ? 'enable' : 'disable'} it later. + + ) : null} + + + {isMobile ? null : ( + + )} + + {isMobile && isTranscriptionEnabled ? ( + + ) : null} + + + + {isMobile && ( + + This will {isTranscriptionEnabled ? 'disable' : 'enable'} Closed Captions for everyone in this room. You can + {isTranscriptionEnabled ? 'enable' : 'disable'} it later. + + )} + + ); +}; diff --git a/packages/roomkit-react/src/Prebuilt/components/MoreSettings/CaptionModal.tsx b/packages/roomkit-react/src/Prebuilt/components/MoreSettings/CaptionModal.tsx new file mode 100644 index 0000000000..37684c6b0a --- /dev/null +++ b/packages/roomkit-react/src/Prebuilt/components/MoreSettings/CaptionModal.tsx @@ -0,0 +1,37 @@ +import React from 'react'; +import { useMedia } from 'react-use'; +import { config as cssConfig, Dialog } from '../../..'; +import { Sheet } from '../../../Sheet'; +import { CaptionContent } from './CaptionContent'; + +export const CaptionModal = ({ onOpenChange }: { onOpenChange: (value: boolean) => void }) => { + const isMobile = useMedia(cssConfig.media.md); + + const props = { + isMobile, + onExit: () => { + onOpenChange(false); + }, + }; + + if (isMobile) { + return ( + + + + + + ); + } + + return ( + + + + + + + + + ); +};