Skip to content

Commit

Permalink
Add showing avatars in users list
Browse files Browse the repository at this point in the history
  • Loading branch information
AshurovG committed Dec 15, 2024
1 parent 682f975 commit 32fef0f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
11 changes: 11 additions & 0 deletions public/modules/Serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,14 @@ export const serializeSavedMovies = (savedMovies: any) => {
return serializeSavedMovie(savedMovie);
});
};

export const serializeUsersList = (users: any) => {
return users.map((user: any) => {
return {
id: user.id,
username: user.username,
email: user.email,
avatar: HOST + user.avatar_url,
};
});
};
8 changes: 6 additions & 2 deletions public/store/RoomPageStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import { User } from 'types/user';
import { apiClient } from 'modules/ApiClient';
import { router } from 'modules/Router';
import { Emitter } from 'modules/Emmiter';
import { serializeRoom, serializeMovieDetailed } from 'modules/Serializer';
import {
serializeRoom,
serializeMovieDetailed,
serializeUsersList,
} from 'modules/Serializer';

const roomPage = new RoomPage();

Expand Down Expand Up @@ -145,7 +149,7 @@ class RoomPageStore {
this.setState(serializeRoom(messageData));
roomPage.render();
} else if (Array.isArray(messageData)) {
roomPage.renderUsersList(messageData);
roomPage.renderUsersList(serializeUsersList(messageData));
} else if (messageData.timeCode) {
if (messageData.timeCode - roomPage.getCurrentVideoTime() > 2) {
roomPage.setVideoTime(messageData.timeCode);
Expand Down

0 comments on commit 32fef0f

Please sign in to comment.