Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unified grid layout #2325

Merged
merged 2 commits into from
Jul 12, 2024
Merged

Conversation

robintown
Copy link
Member

@robintown robintown commented Apr 18, 2024

Here I've implemented an MVP for the new unified grid layout, which scales smoothly up to arbitrarily many participants. It doesn't yet have a special 1:1 layout, so in spotlight mode and 1:1s, we will still fall back to the legacy grid systems.

Things that happened along the way:

  • The part of VideoTile that is common to both spotlight and grid tiles, I refactored into MediaView
  • VideoTile renamed to GridTile
  • Added SpotlightTile for the new, glassy spotlight designs
  • NewVideoGrid renamed to Grid, and refactored to be even more generic
  • I extracted the media name logic into a custom React hook
  • Deleted the BigGrid experiment

Closes #1613
Closes #1203
Closes #1210
Closes #1154
Closes #1133
Closes #597

@robintown robintown marked this pull request as ready for review May 2, 2024 23:01
@robintown robintown requested a review from a team as a code owner May 2, 2024 23:01
@robintown robintown changed the base branch from livekit to new-call-layouts June 7, 2024 14:48
Here I've implemented an MVP for the new unified grid layout, which scales smoothly up to arbitrarily many participants. It doesn't yet have a special 1:1 layout, so in spotlight mode and 1:1s, we will still fall back to the legacy grid systems.

Things that happened along the way:
- The part of VideoTile that is common to both spotlight and grid tiles, I refactored into MediaView
- VideoTile renamed to GridTile
- Added SpotlightTile for the new, glassy spotlight designs
- NewVideoGrid renamed to Grid, and refactored to be even more generic
- I extracted the media name logic into a custom React hook
- Deleted the BigGrid experiment
src/grid/Grid.module.css Show resolved Hide resolved
src/useReactiveState.ts Outdated Show resolved Hide resolved
src/room/InCallView.tsx Outdated Show resolved Hide resolved
const SpotlightTileView = useMemo(
() =>
forwardRef<HTMLDivElement, TileProps<MediaViewModel[], HTMLDivElement>>(
function SpotlightTileView(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick, I think this can be an anonymous function

Suggested change
function SpotlightTileView(
function (

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can't unfortunately, because then the component will be missing a display name for React devtools (which the linter rightfully complains about)

items: TileDescriptor<T>[];
layout: Layout;
disableAnimations: boolean;
layoutStates: LayoutStatesMap;
children: (props: ChildrenProperties<T>) => ReactNode;
Tile: ComponentType<TileProps<T, R>>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick, should Tile be lower-cased when it's a field name? This would also avoid confusion with the Tile type on line 58.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to be a React convention to capitalize names that refer to components, even field names or prop names. Part of the reason is that a camel case name can't be used to refer to a component in JSX, or else React will think you're trying to reference an "intrinsic element" like div, button, etc.

@@ -154,11 +154,11 @@ class UserMedia {
this.vm = new UserMediaViewModel(id, member, participant, callEncrypted);

this.speaker = this.vm.speaking.pipeState(
// Require 1 s of continuous speaking to become a speaker, and 10 s of
// Require 1 s of continuous speaking to become a speaker, and 60 s of
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was 10 seconds really too short? 60 feels like a lot

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It did seem to be too short in practice. In our team meetings for example, speakers often hold the floor for 30s at a time. I don't think we're at risk of the speaker section becoming overly large in large calls, because the number of people that speak during any given minute has a somewhat low upper limit - and I do think 60s has been feeling pretty good IMO!

@robintown robintown merged commit f847692 into element-hq:new-call-layouts Jul 12, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants