Rename color_index to participant_index

Co-authored-by: Conrad <conrad@zed.dev>
This commit is contained in:
Max Brunsfeld 2023-09-28 11:18:29 -07:00
parent 545b5e0161
commit 0f39b63801
17 changed files with 97 additions and 80 deletions

View file

@ -3,7 +3,7 @@ use call::ActiveCall;
use channel::{Channel, ChannelBuffer, ChannelBufferEvent, ChannelId};
use client::{
proto::{self, PeerId},
Collaborator,
Collaborator, ParticipantIndex,
};
use collections::HashMap;
use editor::{CollaborationHub, Editor};
@ -359,7 +359,10 @@ impl CollaborationHub for ChannelBufferCollaborationHub {
self.0.read(cx).collaborators()
}
fn user_color_indices<'a>(&self, cx: &'a AppContext) -> &'a HashMap<u64, theme::ColorIndex> {
self.0.read(cx).user_store().read(cx).color_indices()
fn user_participant_indices<'a>(
&self,
cx: &'a AppContext,
) -> &'a HashMap<u64, ParticipantIndex> {
self.0.read(cx).user_store().read(cx).participant_indices()
}
}

View file

@ -923,15 +923,18 @@ impl CollabTitlebarItem {
.background_color
.unwrap_or_default();
let color_index = self
let participant_index = self
.user_store
.read(cx)
.color_indices()
.participant_indices()
.get(&user_id)
.copied();
if let Some(color_index) = color_index {
if let Some(participant_index) = participant_index {
if followed_by_self {
let selection = theme.editor.replica_selection_style(color_index).selection;
let selection = theme
.editor
.selection_style_for_room_participant(participant_index.0)
.selection;
background_color = Color::blend(selection, background_color);
background_color.a = 255;
}
@ -996,10 +999,12 @@ impl CollabTitlebarItem {
.contained()
.with_style(theme.titlebar.leader_selection);
if let Some(color_index) = color_index {
if let Some(participant_index) = participant_index {
if followed_by_self {
let color =
theme.editor.replica_selection_style(color_index).selection;
let color = theme
.editor
.selection_style_for_room_participant(participant_index.0)
.selection;
container = container.with_background_color(color);
}
}
@ -1007,8 +1012,11 @@ impl CollabTitlebarItem {
container
}))
.with_children((|| {
let color_index = color_index?;
let color = theme.editor.replica_selection_style(color_index).cursor;
let participant_index = participant_index?;
let color = theme
.editor
.selection_style_for_room_participant(participant_index.0)
.cursor;
Some(
AvatarRibbon::new(color)
.constrained()