Skip to content

Commit

Permalink
Fix features bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
AshurovG committed Dec 16, 2024
1 parent 0844231 commit d57cf09
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 38 deletions.
8 changes: 4 additions & 4 deletions public/assets/icons/sendMessageIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion public/components/Slider/Slider.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
&__track {
display: flex;
height: auto;
align-items: center;

gap: 50px;
transition: transform 0.5s ease;
Expand Down
18 changes: 10 additions & 8 deletions public/pages/MoviePage/MoviePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,17 @@ export class MoviePage {
season?: number,
series?: number,
) {
if (timeCode > duration * 0.95 || timeCode < duration * 0.05) {
Actions.deleteLastMovie();
return;
}
if (duration) {
if (timeCode > duration * 0.95 || timeCode < duration * 0.05) {
Actions.deleteLastMovie();
return;
}

if (!this.#movie?.isSerial) {
Actions.setLastMovies(timeCode, duration);
} else {
Actions.setLastMovies(timeCode, duration, season, series);
if (!this.#movie?.isSerial) {
Actions.setLastMovies(timeCode, duration);
} else {
Actions.setLastMovies(timeCode, duration, season, series);
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions public/pages/RoomPage/RoomPage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@

&_button {
cursor: pointer;
width: 36px;
height: 36px;
width: 37px;
height: 37px;
}

&_block {
Expand Down
19 changes: 19 additions & 0 deletions public/pages/RoomPage/RoomPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,25 @@ export class RoomPage {
) as HTMLButtonElement;
sendMessageButton.addEventListener('click', () => this.sendMessage());
this.handleChangeMovieClick();

const messageInput = document.getElementById(
'messages-input',
) as HTMLInputElement;

const handleEnterKey = (event: KeyboardEvent) => {
if (event.key === 'Enter') {
event.preventDefault();
this.sendMessage();
}
};

messageInput.addEventListener('focus', () => {
messageInput.addEventListener('keydown', handleEnterKey);
});

messageInput.addEventListener('blur', () => {
messageInput.removeEventListener('keydown', handleEnterKey);
});
} else {
this.#loader.render();
}
Expand Down
47 changes: 24 additions & 23 deletions public/store/MoviePageStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ class MoviePageStore {
foundMovie.season = season;
foundMovie.series = series;
foundMovie.albumImage = seriesImage as string;
foundMovie.savingSeconds = Date.now();
} else {
this.#lastMovies.push({
id: this.#movie.id,
Expand Down Expand Up @@ -313,35 +314,35 @@ class MoviePageStore {
}
break;
case ActionTypes.SET_LAST_MOVIES:
if (userStore.getUser().username) {
// TODO: Расскомментировать после мержа
// this.setLastMoviesRequest({
// ...action.payload,
// id: this.#movie?.id,
// title: this.#movie?.title,
// albumImage: this.#movie?.albumImage,
// savingSeconds: Date.now(),
// });
} else {
this.setLastMoviesToLocalStorage(
action.payload.timeCode,
action.payload.duration,
action.payload.season,
action.payload.series,
);
}
// if (userStore.getUser().username) {
// TODO: Расскомментировать после мержа
// this.setLastMoviesRequest({
// ...action.payload,
// id: this.#movie?.id,
// title: this.#movie?.title,
// albumImage: this.#movie?.albumImage,
// savingSeconds: Date.now(),
// });
// } else {
this.setLastMoviesToLocalStorage(
action.payload.timeCode,
action.payload.duration,
action.payload.season,
action.payload.series,
);
// }
break;
case ActionTypes.COPY_LAST_MOVIES:
// TODO: Расскомментировать после мержа
// this.setLastMoviesRequest();
break;
case ActionTypes.DELETE_LAST_MOVIE:
if (userStore.getUser().username) {
// TODO: Расскомментировать после мержа
// this.deleteLastMovieRequest();
} else {
this.deleteLastMovieFromLocalStorage();
}
// if (userStore.getUser().username) {
// TODO: Расскомментировать после мержа
// this.deleteLastMovieRequest();
// } else {
this.deleteLastMovieFromLocalStorage();
// }
break;
case ActionTypes.RATE_MOVIE:
this.rateMovieRequest(action.payload.rating);
Expand Down

0 comments on commit d57cf09

Please sign in to comment.