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