@@ -28,6 +28,7 @@ import {
28
28
UserProfileIcon ,
29
29
ExpandIcon ,
30
30
VolumeOffSolidIcon ,
31
+ SwitchCameraSolidIcon ,
31
32
} from "@vector-im/compound-design-tokens/assets/web/icons" ;
32
33
import {
33
34
ContextMenu ,
@@ -64,6 +65,7 @@ interface UserMediaTileProps extends TileProps {
64
65
vm : UserMediaViewModel ;
65
66
mirror : boolean ;
66
67
locallyMuted : boolean ;
68
+ primaryButton ?: ReactNode ;
67
69
menuStart ?: ReactNode ;
68
70
menuEnd ?: ReactNode ;
69
71
}
@@ -73,6 +75,7 @@ const UserMediaTile: FC<UserMediaTileProps> = ({
73
75
vm,
74
76
showSpeakingIndicators,
75
77
locallyMuted,
78
+ primaryButton,
76
79
menuStart,
77
80
menuEnd,
78
81
className,
@@ -159,20 +162,22 @@ const UserMediaTile: FC<UserMediaTileProps> = ({
159
162
}
160
163
displayName = { displayName }
161
164
primaryButton = {
162
- < Menu
163
- open = { menuOpen }
164
- onOpenChange = { setMenuOpen }
165
- title = { displayName }
166
- trigger = {
167
- < button aria-label = { t ( "common.options" ) } >
168
- < OverflowHorizontalIcon aria-hidden width = { 20 } height = { 20 } />
169
- </ button >
170
- }
171
- side = "left"
172
- align = "start"
173
- >
174
- { menu }
175
- </ Menu >
165
+ primaryButton ?? (
166
+ < Menu
167
+ open = { menuOpen }
168
+ onOpenChange = { setMenuOpen }
169
+ title = { displayName }
170
+ trigger = {
171
+ < button aria-label = { t ( "common.options" ) } >
172
+ < OverflowHorizontalIcon aria-hidden width = { 20 } height = { 20 } />
173
+ </ button >
174
+ }
175
+ side = "left"
176
+ align = "start"
177
+ >
178
+ { menu }
179
+ </ Menu >
180
+ )
176
181
}
177
182
raisedHandTime = { handRaised ?? undefined }
178
183
currentReaction = { reaction ?? undefined }
@@ -207,6 +212,8 @@ const LocalUserMediaTile: FC<LocalUserMediaTileProps> = ({
207
212
const { t } = useTranslation ( ) ;
208
213
const mirror = useObservableEagerState ( vm . mirror$ ) ;
209
214
const alwaysShow = useObservableEagerState ( vm . alwaysShow$ ) ;
215
+ const switchCamera = useObservableEagerState ( vm . switchCamera$ ) ;
216
+
210
217
const latestAlwaysShow = useLatest ( alwaysShow ) ;
211
218
const onSelectAlwaysShow = useCallback (
212
219
( e : Event ) => {
@@ -222,6 +229,17 @@ const LocalUserMediaTile: FC<LocalUserMediaTileProps> = ({
222
229
vm = { vm }
223
230
locallyMuted = { false }
224
231
mirror = { mirror }
232
+ primaryButton = {
233
+ switchCamera === null ? undefined : (
234
+ < button
235
+ className = { styles . switchCamera }
236
+ aria-label = { t ( "switch_camera" ) }
237
+ onClick = { switchCamera }
238
+ >
239
+ < SwitchCameraSolidIcon aria-hidden width = { 20 } height = { 20 } />
240
+ </ button >
241
+ )
242
+ }
225
243
menuStart = {
226
244
< ToggleMenuItem
227
245
Icon = { VisibilityOnIcon }
0 commit comments