agora-appbuilder-core 4.1.10-beta.1 → 4.1.11-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/package.json +2 -2
  2. package/template/agora-rn-uikit/src/Utils/isBotUser.ts +1 -1
  3. package/template/android/app/build.gradle +0 -7
  4. package/template/bridge/rtc/webNg/RtcEngine.ts +2 -2
  5. package/template/bridge/rtm/web/Types.ts +0 -183
  6. package/template/bridge/rtm/web/index.ts +488 -450
  7. package/template/customization-api/typeDefinition.ts +0 -1
  8. package/template/defaultConfig.js +3 -4
  9. package/template/global.d.ts +0 -1
  10. package/template/ios/Podfile +0 -41
  11. package/template/package.json +5 -5
  12. package/template/src/AppRoutes.tsx +3 -3
  13. package/template/src/ai-agent/components/ControlButtons.tsx +1 -1
  14. package/template/src/assets/font-styles.css +1 -33
  15. package/template/src/assets/fonts/icomoon.ttf +0 -0
  16. package/template/src/assets/selection.json +1 -1
  17. package/template/src/atoms/ActionMenu.tsx +93 -13
  18. package/template/src/atoms/CustomIcon.tsx +1 -8
  19. package/template/src/atoms/DropDownMulti.tsx +80 -29
  20. package/template/src/atoms/Dropdown.tsx +0 -5
  21. package/template/src/atoms/Input.tsx +2 -1
  22. package/template/src/atoms/TertiaryButton.tsx +1 -1
  23. package/template/src/atoms/UserAvatar.tsx +1 -1
  24. package/template/src/components/ChatContext.ts +3 -5
  25. package/template/src/components/Controls.tsx +167 -208
  26. package/template/src/components/DeviceConfigure.tsx +1 -1
  27. package/template/src/components/EventsConfigure.tsx +168 -118
  28. package/template/src/components/Navbar.tsx +11 -14
  29. package/template/src/components/RTMConfigure.tsx +819 -32
  30. package/template/src/components/beauty-effect/useBeautyEffects.tsx +13 -50
  31. package/template/src/components/chat/chatConfigure.tsx +1 -7
  32. package/template/src/components/chat-messages/useChatMessages.tsx +11 -43
  33. package/template/src/components/controls/useControlPermissionMatrix.tsx +4 -32
  34. package/template/src/components/participants/AllHostParticipants.tsx +2 -10
  35. package/template/src/components/participants/Participant.tsx +1 -7
  36. package/template/src/components/participants/UserActionMenuOptions.tsx +2 -12
  37. package/template/src/components/precall/joinCallBtn.native.tsx +7 -2
  38. package/template/src/components/precall/joinCallBtn.tsx +7 -2
  39. package/template/src/components/precall/joinWaitingRoomBtn.native.tsx +16 -15
  40. package/template/src/components/precall/joinWaitingRoomBtn.tsx +31 -17
  41. package/template/src/components/precall/textInput.tsx +45 -22
  42. package/template/src/components/precall/usePreCall.tsx +7 -0
  43. package/template/src/components/recordings/RecordingsDateTable.tsx +2 -3
  44. package/template/src/components/room-info/useRoomInfo.tsx +5 -0
  45. package/template/src/components/useUserPreference.tsx +12 -39
  46. package/template/src/components/virtual-background/useVB.tsx +0 -18
  47. package/template/src/components/whiteboard/WhiteboardConfigure.tsx +0 -27
  48. package/template/src/language/default-labels/videoCallScreenLabels.ts +27 -11
  49. package/template/src/logger/AppBuilderLogger.tsx +3 -11
  50. package/template/src/pages/VideoCall.tsx +518 -171
  51. package/template/src/pages/video-call/ActionSheetContent.tsx +77 -77
  52. package/template/src/pages/video-call/SidePanelHeader.tsx +81 -53
  53. package/template/src/pages/video-call/VideoCallScreen.tsx +0 -18
  54. package/template/src/pages/video-call/VideoCallScreenWrapper.tsx +1 -0
  55. package/template/src/rtm/RTMEngine.ts +37 -262
  56. package/template/src/rtm/utils.ts +1 -68
  57. package/template/src/rtm-events/constants.ts +7 -40
  58. package/template/src/rtm-events-api/Events.ts +39 -158
  59. package/template/src/subComponents/ChatBubble.tsx +3 -3
  60. package/template/src/subComponents/ChatContainer.tsx +9 -19
  61. package/template/src/subComponents/LocalAudioMute.tsx +2 -2
  62. package/template/src/subComponents/LocalVideoMute.tsx +2 -2
  63. package/template/src/subComponents/SidePanelEnum.tsx +0 -1
  64. package/template/src/subComponents/caption/Caption.tsx +48 -7
  65. package/template/src/subComponents/caption/CaptionContainer.tsx +324 -51
  66. package/template/src/subComponents/caption/CaptionIcon.tsx +35 -34
  67. package/template/src/subComponents/caption/CaptionText.tsx +103 -2
  68. package/template/src/subComponents/caption/LanguageSelectorPopup.tsx +179 -69
  69. package/template/src/subComponents/caption/Transcript.tsx +46 -11
  70. package/template/src/subComponents/caption/TranscriptIcon.tsx +27 -35
  71. package/template/src/subComponents/caption/TranscriptText.tsx +78 -3
  72. package/template/src/subComponents/caption/proto/ptoto.js +38 -4
  73. package/template/src/subComponents/caption/proto/test.proto +34 -19
  74. package/template/src/subComponents/caption/useCaption.tsx +754 -11
  75. package/template/src/subComponents/caption/useSTTAPI.tsx +118 -205
  76. package/template/src/subComponents/caption/useStreamMessageUtils.native.ts +152 -33
  77. package/template/src/subComponents/caption/useStreamMessageUtils.ts +165 -34
  78. package/template/src/subComponents/caption/utils.ts +171 -3
  79. package/template/src/subComponents/chat/ChatSendButton.tsx +0 -1
  80. package/template/src/subComponents/screenshare/ScreenshareButton.tsx +0 -16
  81. package/template/src/subComponents/screenshare/ScreenshareConfigure.native.tsx +1 -1
  82. package/template/src/subComponents/waiting-rooms/WaitingRoomControls.tsx +4 -7
  83. package/template/src/utils/SdkEvents.ts +3 -0
  84. package/template/src/utils/useEndCall.ts +4 -4
  85. package/template/src/utils/useMuteToggleLocal.ts +10 -14
  86. package/template/src/utils/useSpeechToText.ts +31 -20
  87. package/template/bridge/rtm/web/index-legacy.ts +0 -540
  88. package/template/src/components/RTMConfigure-legacy.tsx +0 -848
  89. package/template/src/components/UserGlobalPreferenceProvider.tsx +0 -227
  90. package/template/src/components/breakout-room/BreakoutRoomPanel.tsx +0 -58
  91. package/template/src/components/breakout-room/context/BreakoutRoomContext.tsx +0 -2508
  92. package/template/src/components/breakout-room/events/BreakoutRoomEventsConfigure.tsx +0 -272
  93. package/template/src/components/breakout-room/events/constants.ts +0 -17
  94. package/template/src/components/breakout-room/hoc/BreakoutRoomNameRenderer.tsx +0 -68
  95. package/template/src/components/breakout-room/hooks/useBreakoutRoomExit.ts +0 -49
  96. package/template/src/components/breakout-room/state/reducer.ts +0 -522
  97. package/template/src/components/breakout-room/state/types.ts +0 -54
  98. package/template/src/components/breakout-room/ui/BreakoutMeetingTitle.tsx +0 -60
  99. package/template/src/components/breakout-room/ui/BreakoutRoomActionMenu.tsx +0 -136
  100. package/template/src/components/breakout-room/ui/BreakoutRoomAnnouncementModal.tsx +0 -135
  101. package/template/src/components/breakout-room/ui/BreakoutRoomGroupSettings.tsx +0 -588
  102. package/template/src/components/breakout-room/ui/BreakoutRoomMainRoomUsers.tsx +0 -142
  103. package/template/src/components/breakout-room/ui/BreakoutRoomMemberActionMenu.tsx +0 -122
  104. package/template/src/components/breakout-room/ui/BreakoutRoomParticipants.tsx +0 -124
  105. package/template/src/components/breakout-room/ui/BreakoutRoomRaiseHand.tsx +0 -65
  106. package/template/src/components/breakout-room/ui/BreakoutRoomRenameModal.tsx +0 -227
  107. package/template/src/components/breakout-room/ui/BreakoutRoomSettings.tsx +0 -140
  108. package/template/src/components/breakout-room/ui/BreakoutRoomTransition.tsx +0 -52
  109. package/template/src/components/breakout-room/ui/BreakoutRoomView.tsx +0 -193
  110. package/template/src/components/breakout-room/ui/ExitBreakoutRoomIconButton.tsx +0 -79
  111. package/template/src/components/breakout-room/ui/ParticipantManualAssignmentModal.tsx +0 -638
  112. package/template/src/components/breakout-room/ui/SelectParticipantAssignmentStrategy.tsx +0 -57
  113. package/template/src/components/common/Dividers.tsx +0 -53
  114. package/template/src/components/controls/toolbar-items/ExitBreakoutRoomToolbarItem.tsx +0 -13
  115. package/template/src/components/raise-hand/RaiseHandButton.tsx +0 -50
  116. package/template/src/components/raise-hand/RaiseHandProvider.tsx +0 -308
  117. package/template/src/components/raise-hand/index.ts +0 -14
  118. package/template/src/components/room-info/useCurrentRoomInfo.tsx +0 -42
  119. package/template/src/components/room-info/useSetBreakoutRoomInfo.tsx +0 -64
  120. package/template/src/pages/video-call/BreakoutVideoCall.tsx +0 -213
  121. package/template/src/pages/video-call/VideoCallContent.tsx +0 -211
  122. package/template/src/pages/video-call/VideoCallStateWrapper.tsx +0 -495
  123. package/template/src/rtm/RTMConfigureBreakoutRoomProvider.tsx +0 -882
  124. package/template/src/rtm/RTMConfigureMainRoomProvider.tsx +0 -757
  125. package/template/src/rtm/RTMCoreProvider.tsx +0 -419
  126. package/template/src/rtm/RTMGlobalStateProvider.tsx +0 -706
  127. package/template/src/rtm/RTMStatusBanner.tsx +0 -99
  128. package/template/src/rtm/constants.ts +0 -12
  129. package/template/src/rtm/hooks/useMainRoomUserDisplayName.ts +0 -45
  130. package/template/src/rtm/rtm-presence-utils.ts +0 -344
  131. package/template/src/subComponents/chat/ChatAnnouncementView.tsx +0 -65
  132. package/template/src/utils/useDebouncedCallback.tsx +0 -20
@@ -1,140 +0,0 @@
1
- import React, {useState} from 'react';
2
- import {View, StyleSheet, Text} from 'react-native';
3
- import BreakoutRoomParticipants from './BreakoutRoomParticipants';
4
- import SelectParticipantAssignmentStrategy from './SelectParticipantAssignmentStrategy';
5
- import Divider from '../../common/Dividers';
6
- import ThemeConfig from '../../../theme';
7
- import {useBreakoutRoom} from '../context/BreakoutRoomContext';
8
- import Toggle from '../../../atoms/Toggle';
9
- import ParticipantManualAssignmentModal from './ParticipantManualAssignmentModal';
10
- import {useModal} from '../../../utils/useModal';
11
- import {RoomAssignmentStrategy} from '../state/reducer';
12
- import TertiaryButton from '../../../atoms/TertiaryButton';
13
-
14
- export default function BreakoutRoomSettings() {
15
- const {
16
- unassignedParticipants,
17
- assignmentStrategy,
18
- handleAssignParticipants,
19
- canUserSwitchRoom,
20
- toggleRoomSwitchingAllowed,
21
- } = useBreakoutRoom();
22
-
23
- // Local dropdown state to prevent sync conflicts
24
- const [localAssignmentStrategy, setLocalAssignmentStrategy] =
25
- useState(assignmentStrategy);
26
-
27
- const disableAssignmentSelect = unassignedParticipants.length === 0;
28
- const disableHandleAssignment =
29
- disableAssignmentSelect ||
30
- localAssignmentStrategy === RoomAssignmentStrategy.NO_ASSIGN;
31
-
32
- const {
33
- modalOpen: isManualAssignmentModalOpen,
34
- setModalOpen: setManualAssignmentModalOpen,
35
- } = useModal();
36
-
37
- // Handle strategy change from dropdown
38
- const handleStrategyChange = (newStrategy: RoomAssignmentStrategy) => {
39
- setLocalAssignmentStrategy(newStrategy);
40
-
41
- // Immediately call API for NO_ASSIGN strategy
42
- if (newStrategy === RoomAssignmentStrategy.NO_ASSIGN) {
43
- handleAssignParticipants(newStrategy);
44
- }
45
- };
46
-
47
- // Handle assign participants button click
48
- const handleAssignClick = () => {
49
- if (localAssignmentStrategy === RoomAssignmentStrategy.MANUAL_ASSIGN) {
50
- // Open manual assignment modal
51
- setManualAssignmentModalOpen(true);
52
- } else {
53
- // Handle other assignment strategies
54
- handleAssignParticipants(localAssignmentStrategy);
55
- }
56
- };
57
-
58
- return (
59
- <View style={style.card}>
60
- {/* Avatar list */}
61
- <View style={style.section}>
62
- <BreakoutRoomParticipants participants={unassignedParticipants} />
63
- </View>
64
- <Divider marginTop={0} marginBottom={0} />
65
- <View style={style.section}>
66
- <SelectParticipantAssignmentStrategy
67
- selectedStrategy={localAssignmentStrategy}
68
- onStrategyChange={handleStrategyChange}
69
- disabled={disableAssignmentSelect}
70
- />
71
- <TertiaryButton
72
- disabled={disableHandleAssignment}
73
- containerStyle={{
74
- backgroundColor: disableHandleAssignment
75
- ? $config.SEMANTIC_NEUTRAL
76
- : $config.PRIMARY_ACTION_BRAND_COLOR,
77
- borderColor: disableHandleAssignment
78
- ? $config.SEMANTIC_NEUTRAL
79
- : $config.PRIMARY_ACTION_BRAND_COLOR,
80
- }}
81
- textStyle={{color: $config.PRIMARY_ACTION_TEXT_COLOR}}
82
- onPress={handleAssignClick}
83
- text={'Assign participants'}
84
- />
85
- </View>
86
- <Divider />
87
- <View style={style.section}>
88
- <View style={style.switchSection}>
89
- <Text style={style.label}>Allow people to switch rooms</Text>
90
- <Toggle
91
- disabled={$config.EVENT_MODE}
92
- isEnabled={canUserSwitchRoom}
93
- toggleSwitch={toggleRoomSwitchingAllowed}
94
- circleColor={$config.PRIMARY_ACTION_TEXT_COLOR}
95
- />
96
- </View>
97
- </View>
98
- {isManualAssignmentModalOpen && (
99
- <ParticipantManualAssignmentModal
100
- setModalOpen={setManualAssignmentModalOpen}
101
- />
102
- )}
103
- </View>
104
- );
105
- }
106
-
107
- const style = StyleSheet.create({
108
- card: {
109
- width: '100%',
110
- padding: 16,
111
- display: 'flex',
112
- flexDirection: 'column',
113
- justifyContent: 'center',
114
- alignItems: 'center',
115
- borderRadius: 8,
116
- backgroundColor: $config.CARD_LAYER_2_COLOR,
117
- borderColor: $config.CARD_LAYER_3_COLOR,
118
- gap: 12,
119
- },
120
- section: {
121
- width: '100%',
122
- display: 'flex',
123
- flexDirection: 'column',
124
- gap: 12,
125
- },
126
- switchSection: {
127
- width: '100%',
128
- display: 'flex',
129
- flexDirection: 'row',
130
- justifyContent: 'space-between',
131
- alignItems: 'center',
132
- },
133
- label: {
134
- fontWeight: '400',
135
- fontSize: ThemeConfig.FontSize.small,
136
- lineHeight: 16,
137
- color: $config.FONT_COLOR,
138
- fontFamily: ThemeConfig.FontFamily.sansPro,
139
- },
140
- });
@@ -1,52 +0,0 @@
1
- import React, {useEffect, useState} from 'react';
2
- import Loading from '../../../subComponents/Loading';
3
- import {View, StyleSheet} from 'react-native';
4
-
5
- interface BreakoutRoomTransitionProps {
6
- onTimeout: () => void;
7
- direction?: 'enter' | 'exit';
8
- }
9
-
10
- const BreakoutRoomTransition = ({
11
- onTimeout,
12
- direction = 'enter',
13
- }: BreakoutRoomTransitionProps) => {
14
- const [dots, setDots] = useState('');
15
-
16
- useEffect(() => {
17
- const interval = setInterval(() => {
18
- setDots(prev => (prev.length >= 3 ? '' : prev + '.'));
19
- }, 500);
20
-
21
- const timeout = setTimeout(onTimeout, 10000); // 10s timeout
22
-
23
- return () => {
24
- clearInterval(interval);
25
- clearTimeout(timeout);
26
- };
27
- }, [onTimeout]);
28
-
29
- const transitionText =
30
- direction === 'exit' ? 'Exiting breakout room' : 'Entering breakout room';
31
-
32
- return (
33
- <View style={styles.transitionContainer}>
34
- <Loading
35
- text={`${transitionText}...${dots}`}
36
- background={$config.CARD_LAYER_1_COLOR}
37
- textColor={$config.FONT_COLOR}
38
- />
39
- </View>
40
- );
41
- };
42
-
43
- export default BreakoutRoomTransition;
44
- const styles = StyleSheet.create({
45
- transitionContainer: {
46
- height: '100%',
47
- display: 'flex',
48
- flex: 1,
49
- alignItems: 'center',
50
- justifyContent: 'center',
51
- },
52
- });
@@ -1,193 +0,0 @@
1
- import React, {useEffect, useState, useRef} from 'react';
2
- import {View, StyleSheet, ScrollView} from 'react-native';
3
- import {useRoomInfo} from '../../room-info/useRoomInfo';
4
- import {useBreakoutRoom} from './../context/BreakoutRoomContext';
5
- import BreakoutRoomSettings from './BreakoutRoomSettings';
6
- import BreakoutRoomGroupSettings from './BreakoutRoomGroupSettings';
7
- import ThemeConfig from '../../../theme';
8
- import TertiaryButton from '../../../atoms/TertiaryButton';
9
- import {BreakoutRoomHeader} from '../../../pages/video-call/SidePanelHeader';
10
- import BreakoutRoomRaiseHand from './BreakoutRoomRaiseHand';
11
- import BreakoutRoomMainRoomUsers from './BreakoutRoomMainRoomUsers';
12
- import Loading from '../../../subComponents/Loading';
13
-
14
- interface Props {
15
- closeSidePanel: () => void;
16
- }
17
- export default function BreakoutRoomView({closeSidePanel}: Props) {
18
- const [isInitializing, setIsInitializing] = useState(true);
19
-
20
- const {
21
- data: {isHost},
22
- } = useRoomInfo();
23
-
24
- const scrollViewRef = useRef<ScrollView>(null);
25
- const [scrollOffset, setScrollOffset] = useState(0);
26
-
27
- const onScroll = event => {
28
- setScrollOffset(event.nativeEvent.contentOffset.y);
29
- };
30
-
31
- const {
32
- checkIfBreakoutRoomSessionExistsAPI,
33
- createBreakoutRoomGroup,
34
- upsertBreakoutRoomAPI,
35
- closeAllRooms,
36
- permissions,
37
- isBreakoutUILocked,
38
- } = useBreakoutRoom();
39
-
40
- useEffect(() => {
41
- const init = async () => {
42
- try {
43
- setIsInitializing(true);
44
- const activeSession = await checkIfBreakoutRoomSessionExistsAPI();
45
- console.log('supriya-sync-queue activeSession: ', activeSession);
46
- if (!activeSession && isHost) {
47
- console.log(
48
- 'supriya-sync-queue callubg upsertBreakoutRoomAPI: ',
49
- activeSession,
50
- );
51
-
52
- await upsertBreakoutRoomAPI('START');
53
- }
54
- } catch (error) {
55
- console.error('Failed to check breakout session:', error);
56
- } finally {
57
- setIsInitializing(false);
58
- }
59
- };
60
- init();
61
- }, []);
62
-
63
- // Disable all actions when API is in flight or another host is operating
64
- const disableAllActions = isBreakoutUILocked;
65
-
66
- return (
67
- <>
68
- <BreakoutRoomHeader />
69
- <ScrollView
70
- ref={scrollViewRef}
71
- onScroll={onScroll}
72
- scrollEventThrottle={64}
73
- style={[style.pannelOuterBody]}
74
- contentContainerStyle={
75
- isInitializing ? style.contentCenter : style.contentStart
76
- }>
77
- {isInitializing ? (
78
- <View style={style.panelInnerBody}>
79
- <Loading
80
- text={'Initializing...'}
81
- background={$config.CARD_LAYER_1_COLOR}
82
- textColor={$config.FONT_COLOR}
83
- />
84
- </View>
85
- ) : (
86
- <View
87
- style={[
88
- style.panelInnerBody,
89
- disableAllActions ? style.disabledPannelInnerBody : {},
90
- ]}>
91
- {permissions?.canRaiseHands ? <BreakoutRoomRaiseHand /> : <></>}
92
- {permissions?.canHostManageMainRoom &&
93
- permissions.canAssignParticipants ? (
94
- <BreakoutRoomSettings />
95
- ) : (
96
- <BreakoutRoomMainRoomUsers scrollOffset={scrollOffset} />
97
- )}
98
- <BreakoutRoomGroupSettings scrollOffset={scrollOffset} />
99
- {permissions?.canHostManageMainRoom &&
100
- permissions?.canCreateRooms ? (
101
- <TertiaryButton
102
- disabled={disableAllActions}
103
- containerStyle={style.createBtnContainer}
104
- textStyle={style.createBtnText}
105
- text={'+ Create New Room'}
106
- onPress={() => createBreakoutRoomGroup()}
107
- />
108
- ) : (
109
- <></>
110
- )}
111
- </View>
112
- )}
113
- </ScrollView>
114
- {!isInitializing &&
115
- permissions.canHostManageMainRoom &&
116
- permissions?.canCloseRooms ? (
117
- <View style={style.footer}>
118
- <View style={style.fullWidth}>
119
- <TertiaryButton
120
- disabled={disableAllActions}
121
- containerStyle={{
122
- borderColor: $config.SEMANTIC_ERROR,
123
- }}
124
- textStyle={{
125
- color: $config.SEMANTIC_ERROR,
126
- }}
127
- onPress={() => {
128
- try {
129
- closeAllRooms();
130
- closeSidePanel();
131
- } catch (error) {
132
- console.error('Error while closing the room', error);
133
- }
134
- }}
135
- text={'Close All Rooms'}
136
- />
137
- </View>
138
- </View>
139
- ) : (
140
- <></>
141
- )}
142
- </>
143
- );
144
- }
145
-
146
- const style = StyleSheet.create({
147
- footer: {
148
- width: '100%',
149
- padding: 12,
150
- height: 'auto',
151
- flexDirection: 'row',
152
- alignItems: 'center',
153
- justifyContent: 'center',
154
- backgroundColor: $config.CARD_LAYER_2_COLOR,
155
- },
156
- contentCenter: {
157
- height: '100%',
158
- justifyContent: 'center',
159
- },
160
- contentStart: {
161
- justifyContent: 'flex-start',
162
- },
163
- pannelOuterBody: {
164
- display: 'flex',
165
- flex: 1,
166
- },
167
- panelInnerBody: {
168
- display: 'flex',
169
- flex: 1,
170
- padding: 12,
171
- gap: 12,
172
- },
173
- fullWidth: {
174
- display: 'flex',
175
- flex: 1,
176
- },
177
- createBtnContainer: {
178
- backgroundColor: $config.INPUT_FIELD_BACKGROUND_COLOR,
179
- borderColor: $config.INPUT_FIELD_BORDER_COLOR,
180
- borderRadius: 8,
181
- },
182
- createBtnText: {
183
- color: $config.PRIMARY_ACTION_BRAND_COLOR,
184
- lineHeight: 20,
185
- fontWeight: '500',
186
- fontSize: ThemeConfig.FontSize.normal,
187
- },
188
-
189
- disabledPannelInnerBody: {
190
- opacity: 0.4,
191
- pointerEvents: 'none',
192
- },
193
- });
@@ -1,79 +0,0 @@
1
- /*
2
- ********************************************
3
- Copyright © 2021 Agora Lab, Inc., all rights reserved.
4
- AppBuilder and all associated components, source code, APIs, services, and documentation
5
- (the “Materials”) are owned by Agora Lab, Inc. and its licensors. The Materials may not be
6
- accessed, used, modified, or distributed for any purpose without a license from Agora Lab, Inc.
7
- Use without a license or in violation of any license terms and conditions (including use for
8
- any purpose competitive to Agora Lab, Inc.’s business) is strictly prohibited. For more
9
- information visit https://appbuilder.agora.io.
10
- *********************************************
11
- */
12
-
13
- import React from 'react';
14
- import IconButton, {IconButtonProps} from '../../../atoms/IconButton';
15
- import {useToolbarMenu} from '../../../utils/useMenu';
16
- import ToolbarMenuItem from '../../../atoms/ToolbarMenuItem';
17
- import {useToolbarProps} from '../../../atoms/ToolbarItem';
18
- import {useActionSheet} from '../../../utils/useActionSheet';
19
- import {useBreakoutRoom} from '../context/BreakoutRoomContext';
20
- import BreakoutRoomNameRenderer from '../hoc/BreakoutRoomNameRenderer';
21
-
22
- export interface ScreenshareButtonProps {
23
- render?: (onPress: () => void) => JSX.Element;
24
- }
25
-
26
- const ExitBreakoutRoomIconButton = (props: ScreenshareButtonProps) => {
27
- const {label = null, onPress: onPressCustom = null} = useToolbarProps();
28
- const {isOnActionSheet, showLabel} = useActionSheet();
29
- const {exitRoom} = useBreakoutRoom();
30
- const {isToolbarMenuItem} = useToolbarMenu();
31
-
32
- const onPress = () => {
33
- exitRoom();
34
- };
35
-
36
- return (
37
- <BreakoutRoomNameRenderer>
38
- {({breakoutRoomName}) => {
39
- const displayText = breakoutRoomName
40
- ? `Exit ${breakoutRoomName}`
41
- : 'Exit Room';
42
-
43
- let iconButtonProps: IconButtonProps = {
44
- onPress: onPressCustom || onPress,
45
- iconProps: {
46
- name: 'close-room',
47
- tintColor: $config.SECONDARY_ACTION_COLOR,
48
- },
49
- btnTextProps: {
50
- textColor: $config.FONT_COLOR,
51
- text: showLabel ? label || displayText : '',
52
- },
53
- };
54
-
55
- if (isOnActionSheet) {
56
- iconButtonProps.btnTextProps.textStyle = {
57
- color: $config.FONT_COLOR,
58
- marginTop: 8,
59
- fontSize: 12,
60
- fontWeight: '400',
61
- fontFamily: 'Source Sans Pro',
62
- textAlign: 'center',
63
- };
64
- }
65
- iconButtonProps.isOnActionSheet = isOnActionSheet;
66
-
67
- return props?.render ? (
68
- props.render(onPress)
69
- ) : isToolbarMenuItem ? (
70
- <ToolbarMenuItem {...iconButtonProps} />
71
- ) : (
72
- <IconButton {...iconButtonProps} />
73
- );
74
- }}
75
- </BreakoutRoomNameRenderer>
76
- );
77
- };
78
-
79
- export default ExitBreakoutRoomIconButton;