Skip to content

Commit

Permalink
Fix modal empty state
Browse files Browse the repository at this point in the history
  • Loading branch information
AshurovG committed Dec 15, 2024
1 parent 91b53bd commit f3dbc05
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
6 changes: 2 additions & 4 deletions public/pages/RoomPage/RoomPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ export class RoomPage {
});
}

videoPlay(timeCode: number) {
// TODO: согласовать, зачем нужен timeCode
console.log('TIMECODE FROM VIDEO PLAY HANDLER', timeCode);
videoPlay() {
this.#video.videoPlay();
}

Expand Down Expand Up @@ -339,7 +337,7 @@ export class RoomPage {
this.videoRewind(this.#room.timeCode);

if (this.#room.status === 'playing') {
this.videoPlay(this.#room.timeCode);
this.videoPlay();
}

const invitationBtn = document.getElementById(
Expand Down
25 changes: 12 additions & 13 deletions public/store/RoomPageStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
serializeMovieDetailed,
serializeUsersList,
} from 'modules/Serializer';
import { mainPageStore } from './MainPageStore';

const roomPage = new RoomPage();

Expand Down Expand Up @@ -74,6 +75,7 @@ class RoomPageStore {
isModalConfirm
) {
this.wsInit();
mainPageStore.getCollection();
}
}

Expand Down Expand Up @@ -143,10 +145,10 @@ class RoomPageStore {

ws.onmessage = (event) => {
const messageData = JSON.parse(event.data);
if ((messageData.movie && messageData.movie.id) || messageData.id) {
// console.log('RECEIVED ROOM DATA', messageData);
// messageData.movie.video_url =
// '/static/movies_all/how-you-see-me/movie.mp4';
if (
(messageData.movie && messageData.movie.id && !messageData.name) ||
messageData.id
) {
this.setState(serializeRoom(messageData));
roomPage.render();
} else if (Array.isArray(messageData)) {
Expand All @@ -158,7 +160,7 @@ class RoomPageStore {
} else {
switch (messageData.name) {
case 'play':
roomPage.videoPlay(messageData.time_code);
roomPage.videoPlay();
break;
case 'pause':
roomPage.videoPause(messageData.time_code);
Expand Down Expand Up @@ -187,17 +189,13 @@ class RoomPageStore {
}
}
break;
default:
// TODO: проверить на новом формате прихода измененного фильма
// console.log('serialized movie', this.#room.movie);

console.log('MSG DATA', messageData);
case 'change_movie':
if (
this.#room &&
messageData['movie '] &&
messageData['movie '].id !== this.#room.movie.id
messageData['movie'] &&
messageData['movie'].id !== this.#room.movie.id
) {
this.#room.movie = serializeMovieDetailed(messageData['movie ']);
this.#room.movie = serializeMovieDetailed(messageData['movie']);
if (this.#room.movie.seasons && this.#room.movie.seasons.length) {
roomPage.renderVideo(
this.#room.movie.seasons[0].episodes[0].video,
Expand All @@ -216,6 +214,7 @@ class RoomPageStore {
this.#room.movie.shortDescription,
);
}
break;
}
}
};
Expand Down

0 comments on commit f3dbc05

Please sign in to comment.