Skip to content

Commit b0fd51f

Browse files
committed
working colro changes on user tracking
1 parent c938fee commit b0fd51f

File tree

2 files changed

+7
-20
lines changed

2 files changed

+7
-20
lines changed

app/src/components/left/RoomsContainer.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ const RoomsContainer = () => {
162162
return userName.length === 0 || roomCode.length === 0;
163163
}
164164

165+
const userColors = ['#FC00BD', '#D0FC00', '#00DBFC', '#FD98B8', '#FCAA00', '#9267FF'];
166+
165167
return (
166168
<div>
167169
<Stack //stack styling for container
@@ -178,7 +180,7 @@ const RoomsContainer = () => {
178180
<Typography variant="h5" color={'#f2fbf8'}>
179181
Live Room: {roomCode}
180182
</Typography>
181-
<Typography variant="h6" color={'#70d8be'}>
183+
<Typography variant="h6" color={userColors[userList.indexOf(userName)]}>
182184
Nickname: {userName}
183185
</Typography>
184186
{/* Set up condition rendering depends on if user joined a room then render leave button if not render join button */}
@@ -221,9 +223,9 @@ const RoomsContainer = () => {
221223
<ListItem
222224
key={index}
223225
sx={{
224-
color: '#f2fbf8',
225226
textAlign: 'center',
226-
width: '100%'
227+
width: '100%',
228+
color: '#f2fbf8'
227229
}}
228230
>
229231
<ListItemText

app/src/components/main/Canvas.tsx

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -222,22 +222,7 @@ function Canvas(props: {}): JSX.Element {
222222
currentComponent.style
223223
);
224224

225-
// const userColors = ['#FC00BD', '#D0FC00', '#00DBFC', '#FD98B8', '#FCAA00', '#9267FF']
226-
// // const colorMaker = () => {
227-
// // let i = Math.floor(Math.random() * userColors.length);
228-
// // let color = userColors[i];
229-
// // userColors.splice(i, 1)
230-
// // return color
231-
// // }
232-
// const colorSelect = (index = 0) => {
233-
// let color = userColors[index];
234-
// index++
235-
// return color
236-
// }
237-
// let setColor = colorSelect()
238-
//or set as object and add key value pair of that username or id, for/of the object to pull the correct color
239-
240-
225+
const userColors = ['#FC00BD', '#D0FC00', '#00DBFC', '#FD98B8', '#FCAA00', '#9267FF'];
241226

242227
return (
243228
<div
@@ -259,7 +244,7 @@ function Canvas(props: {}): JSX.Element {
259244
top: remoteCursor.y - 68 + 'px',
260245
//cursor style
261246
fontSize: '2em',
262-
color: '#FC00BD'
247+
color: userColors[userList.indexOf(remoteCursor.remoteUserName)]
263248
}}
264249
>
265250
{<GiBoba />}

0 commit comments

Comments
 (0)