Only show the expand button in spotlight layout (#2510)

It has no effect in any layout other than spotlight, and we've decided to hide it rather than spending effort to make it do something.
This commit is contained in:
Robin
2024-07-26 06:57:49 -04:00
committed by GitHub
parent d5faa5ea90
commit a3ce333352
2 changed files with 24 additions and 11 deletions

View File

@@ -285,11 +285,6 @@ export const InCallView: FC<InCallViewProps> = ({
} }
}, [setGridMode]); }, [setGridMode]);
const toggleSpotlightExpanded = useCallback(
() => vm.toggleSpotlightExpanded(),
[vm],
);
const Tile = useMemo( const Tile = useMemo(
() => () =>
forwardRef< forwardRef<
@@ -300,6 +295,9 @@ export const InCallView: FC<InCallViewProps> = ({
ref, ref,
) { ) {
const spotlightExpanded = useObservableEagerState(vm.spotlightExpanded); const spotlightExpanded = useObservableEagerState(vm.spotlightExpanded);
const [onToggleExpanded] = useObservableEagerState(
vm.toggleSpotlightExpanded,
);
const showSpeakingIndicatorsValue = useObservableEagerState( const showSpeakingIndicatorsValue = useObservableEagerState(
vm.showSpeakingIndicators, vm.showSpeakingIndicators,
); );
@@ -324,7 +322,7 @@ export const InCallView: FC<InCallViewProps> = ({
vms={model.vms} vms={model.vms}
maximised={model.maximised} maximised={model.maximised}
expanded={spotlightExpanded} expanded={spotlightExpanded}
onToggleExpanded={toggleSpotlightExpanded} onToggleExpanded={onToggleExpanded}
targetWidth={targetWidth} targetWidth={targetWidth}
targetHeight={targetHeight} targetHeight={targetHeight}
showIndicators={showSpotlightIndicatorsValue} showIndicators={showSpotlightIndicatorsValue}
@@ -333,7 +331,7 @@ export const InCallView: FC<InCallViewProps> = ({
/> />
); );
}), }),
[vm, toggleSpotlightExpanded, openProfile], [vm, openProfile],
); );
const layouts = useMemo(() => { const layouts = useMemo(() => {

View File

@@ -526,10 +526,6 @@ export class CallViewModel extends ViewModel {
shareReplay(1), shareReplay(1),
); );
public toggleSpotlightExpanded(): void {
this.spotlightExpandedToggle.next();
}
private readonly gridModeUserSelection = new Subject<GridMode>(); private readonly gridModeUserSelection = new Subject<GridMode>();
/** /**
* The layout mode of the media tile grid. * The layout mode of the media tile grid.
@@ -665,6 +661,25 @@ export class CallViewModel extends ViewModel {
shareReplay(1), shareReplay(1),
); );
// To work around https://github.com/crimx/observable-hooks/issues/131 we must
// wrap the emitted function here in a non-function wrapper type
public readonly toggleSpotlightExpanded: Observable<
readonly [(() => void) | null]
> = this.layout.pipe(
map(
(l) =>
l.type === "spotlight-landscape" || l.type === "spotlight-expanded",
),
distinctUntilChanged(),
map(
(enabled) =>
[
enabled ? (): void => this.spotlightExpandedToggle.next() : null,
] as const,
),
shareReplay(1),
);
public constructor( public constructor(
// A call is permanently tied to a single Matrix room and LiveKit room // A call is permanently tied to a single Matrix room and LiveKit room
private readonly matrixRoom: MatrixRoom, private readonly matrixRoom: MatrixRoom,