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

Mv 286 tile switching #182

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Mv 286 tile switching #182

wants to merge 3 commits into from

Conversation

pkrucz00
Copy link
Contributor

@pkrucz00 pkrucz00 commented Jun 16, 2023

This PR adds switching of the Last Recently Spoken person.

The desired state of the unpinned tiles is:

  1. Local tile.
  2. Screensharing tile.
  3. Tiles of the peers that have spoken (are speaking now or in the past). Sorted by the time they have spoken.
  4. Rest of the remote tiles sorted alphabetically.

@pkrucz00 pkrucz00 requested a review from ostatni5 June 16, 2023 10:10
@pkrucz00 pkrucz00 requested a review from bblaszkow06 as a code owner June 16, 2023 10:10
hasSpoken(mediaPlayerId) || isSpeaking ? "speaking" : "rest"
)(remoteTiles);
const newSpeakingTiles = (speaking ?? []).filter(({ mediaPlayerId }) => !hasSpoken(mediaPlayerId));
newSpeakingTiles.map(({ mediaPlayerId }) => mediaPlayerId).forEach(addToHistory);
Copy link
Contributor

Choose a reason for hiding this comment

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

The date is refreshed only for new tiles so "old speaking" participants can be hidden.

const getTimeLastSpoken = useCallback((tileId: string) => speakingHistory.get(tileId) ?? 0, [speakingHistory]);
const addToHistory = useCallback(
(tileId: string) => {
if (!hasSpoken(tileId)) setSpeakingHistory((oldHistory) => new Map(oldHistory).set(tileId, Date.now()));
Copy link
Contributor

Choose a reason for hiding this comment

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

What about the ones who have spoken before? Why you're not updating their "last spoken time"?

};

const { localTiles, remoteTiles, screenshareTiles } = groupBy(({ typeName }: MediaPlayerTileConfig) =>
typeName === "local" ? "localTiles" : typeName === "remote" ? "remoteTiles" : "screenshareTiles"
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO this would be more readable with switch

@skyman503
Copy link

Please make sure to align this change with the agreed design: https://docs.google.com/document/d/1HBr-Qf6IgtYPYMAaw7ZF3RzlElASf15LtKl2eO7EX9I/edit?usp=sharing

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.

4 participants