Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Mv 286 limit displayed video tiles #132

Closed
wants to merge 4 commits into from

Conversation

pkrucz00
Copy link
Contributor

No description provided.

@pkrucz00 pkrucz00 force-pushed the MV-286-limit-displayed-video-tiles branch from 1835058 to 4f1fff7 Compare February 20, 2023 12:58
@pkrucz00 pkrucz00 marked this pull request as ready for review February 21, 2023 07:18
Comment on lines 5 to 7
export const mapOtherToElement = ({ initialsFront, initialsBack, noLeftUsers }: OthersTileConfig): JSX.Element => (
<OthersTile key="others" initialsFront={initialsFront} initialsBack={initialsBack} numberOfLeftTiles={noLeftUsers} />
);
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. This function is actually a component. It gets some props and returns JSX.Element
  2. key="other" is unnecessary because it is not a list
  3. It is a simple wrapper over OtherTile. You could remove the key attribute and then inline this wrapper.

@@ -42,41 +43,46 @@ type Props = {
const PinnedTilesSection: FC<Props> = ({ pinnedTiles, unpin, webrtc, showSimulcast }: Props) => {
const gridConfig = getGridConfig(pinnedTiles.length);

const mapMediaTileConfigToElement = (pinnedTile: MediaPlayerTileConfig) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. It's a valid component, it gets some props and returns JSX
  2. I would suggest extracting it outside current component
    2.a Have a look: https://www.youtube.com/watch?v=2sAdzy90GtE
    2.b It's easier to reason about functional components declared as separate functions than this one because it's not clear which parameters are required. For now, it's a closure that have reference to gridConfig, unpin, showSimulcast and webrtc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What about making a component PinnedTile with all the properties outside of the PinnedTilesSection component but with PartialPinnedTile nested component that uses closure and only takes MediaTileConfig as an argument? This should clear the code out of unnecessary props drowning while not allowing new bugs to appear 🐞

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ad. 2a - isn't this important only if the component has it's own independent state? If it's a simple "map" like the example above, I don't think the placement of the component makes any difference.

@@ -48,43 +48,48 @@ const UnpinnedTilesSection: FC<Props> = ({

const tileSize = tileConfigs.length >= 7 ? "M" : "L";

const mapMediaTileConfigToElement = (config: MediaPlayerTileConfig): JSX.Element => {
Copy link
Contributor

Choose a reason for hiding this comment

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

same as mapMediaTileConfigToElement in PinnedTilesSection.tsx

@bblaszkow06 bblaszkow06 marked this pull request as draft March 3, 2023 14:59
@bblaszkow06
Copy link
Contributor

Converted to draft as it is blocked by MV-288

@bblaszkow06
Copy link
Contributor

Closed in favour of #182

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants