From 7031062d4fd8f1ecc7e7ec7ebf0d8296939b3fd4 Mon Sep 17 00:00:00 2001 From: Florens Douwes Date: Sat, 25 Apr 2020 00:12:21 +0200 Subject: [PATCH] implementeer speedFactor --- backend/src/Room.ts | 1 + backend/src/Service.ts | 5 ++++- frontend/src/components/FeedItem.tsx | 3 +-- frontend/src/components/Lobby.tsx | 2 +- frontend/src/components/Player.ts | 7 +++++-- frontend/src/css/{feeditem.sass => feed.sass} | 4 ++-- frontend/src/lib/Connection.ts | 3 ++- frontend/src/types/types.ts | 5 +++-- 8 files changed, 19 insertions(+), 11 deletions(-) rename frontend/src/css/{feeditem.sass => feed.sass} (91%) diff --git a/backend/src/Room.ts b/backend/src/Room.ts index 3f04f4b..f22a8fa 100644 --- a/backend/src/Room.ts +++ b/backend/src/Room.ts @@ -39,6 +39,7 @@ export default class Room { 'timelineName': this.timelineName, 'seekTime': this.seekTime, 'readyToParticipate': user.readyToParticipate || this.leader == user, + 'speedFactor': this.speedFactor } } diff --git a/backend/src/Service.ts b/backend/src/Service.ts index a31789d..8a5456e 100644 --- a/backend/src/Service.ts +++ b/backend/src/Service.ts @@ -55,7 +55,6 @@ export default class Service { onRequestJoin(socket: Socket, roomId: number): boolean { let user = this.getUser(socket); - if (!this.roomIdToRooms.has(roomId)) return false; if (user.room && user.room.id == roomId) return false; if (user.room) { @@ -63,6 +62,10 @@ export default class Service { this.deleteEmptyRooms(); } + if (!this.roomIdToRooms.has(roomId)) { + this.createRoomWithId(roomId); + } + let room = this.roomIdToRooms.get(roomId)!!; room.join(user); diff --git a/frontend/src/components/FeedItem.tsx b/frontend/src/components/FeedItem.tsx index d906719..bbbc881 100644 --- a/frontend/src/components/FeedItem.tsx +++ b/frontend/src/components/FeedItem.tsx @@ -2,7 +2,7 @@ import React, {PureComponent} from 'react'; import {TimestampEvent} from "../types/types"; -import '../css/feeditem.sass' +import '../css/feed.sass' import shot from "../img/shot.png"; import song from "../img/song.png"; import talk from "../img/talk.png"; @@ -14,7 +14,6 @@ const images = { class FeedItem extends PureComponent<{item: TimestampEvent}> { render() { - // console.log('feeditem render'); return (
diff --git a/frontend/src/components/Lobby.tsx b/frontend/src/components/Lobby.tsx index ba5609d..1bb0863 100644 --- a/frontend/src/components/Lobby.tsx +++ b/frontend/src/components/Lobby.tsx @@ -105,7 +105,7 @@ const Lobby = (props: any) => {

We gaan luisteren naar {room && room.timelineName} en {room?.running && zijn al gestart!} - {!room?.running && starten op {room?.seekTime} seconden} + {!room?.running && starten op {(room?.seekTime || 0) / 1000} seconden}