diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 6855555..304218e 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -18,6 +18,7 @@ const App = () => { setStarted(true); await player.current.play(); + player.current.volume = 0; }); socket.on('seek', async (sec: number) => { diff --git a/frontend/src/components/Feed.tsx b/frontend/src/components/Feed.tsx index 46f9cfb..b37a9f0 100644 --- a/frontend/src/components/Feed.tsx +++ b/frontend/src/components/Feed.tsx @@ -1,26 +1,46 @@ import React, {useEffect, useState} from 'react'; -import {Col, Row} from "antd" +import {Col, Timeline} from "antd" import socket from "../util/socket"; -import {Tick} from "../types/types"; +import {Tick, TimestampEvent} from "../types/types"; +import shot from "../img/shot.png"; +import song from "../img/song.png"; +import talk from "../img/talk.png"; +import time from "../img/time.png"; +const images = { + shot, song, talk, time +}; + +interface Event extends TimestampEvent { + key: number +} const Feed = () => { - const [count, setCount] = useState(0); - const [feedItems, setFeedItems] = useState([{ - title: "Ha1", body: "Doei", key: -1 - }]); + const [feedItems, setFeedItems] = useState([]); useEffect(() => { socket.on("tick_event", (tick: Tick) => { + if (!tick.next) { + return; + } + + if (tick.current === tick.next.timestamp) { + const newItems = tick.next.events as Event[]; + + const limit = Math.min(8, feedItems.length) + for (let i = 0; i < limit; i++) { + newItems.push(feedItems[i]); + } - // console.log("Shot:", tick.nextShot?.timestamp, tick.nextShot?.count) - // setCount(c => c + 1); - // const newItems = feedItems; - // newItems.push({ - // title: "Ha1", body: "Doei", key: count - // }); - // - // setFeedItems(newItems); + for (let j = 0; j < newItems.length; j++) { + newItems[j].key = j; + } + + setFeedItems(newItems); + console.log(newItems) + } + + console.log(feedItems) }); return () => { @@ -29,15 +49,27 @@ const Feed = () => { }); return ( - - {feedItems.map(o => - - Tijd - {o.title} - Icoon - {o.body} - - )} + // + // {feedItems.map(o => + // + // Tijd + // {o.title} + // Icoon + // {o.body} + // + // )} + // + + + {feedItems.map(item => + + {/*dot={logo}>*/} + {/*{item.text[0]} - {item.text[1]}*/} + {item} + + )} + + ); }; diff --git a/frontend/src/components/Lobby.tsx b/frontend/src/components/Lobby.tsx index 0727576..8f7b2ee 100644 --- a/frontend/src/components/Lobby.tsx +++ b/frontend/src/components/Lobby.tsx @@ -2,7 +2,7 @@ import React, {useEffect, useState} from 'react'; import {Card, Col, InputNumber, Row} from "antd" import socket, {emit} from "../util/socket"; import "../css/lobby.css"; -import beer1 from "../img/beer1.png" +import beer from "../img/beer.png" const Lobby = () => { const [lobbyId, setLobbyId] = useState(undefined); @@ -42,7 +42,7 @@ const Lobby = () => {
-

Centurion! beer

+

Centurion! beer

diff --git a/frontend/src/components/NextShot.tsx b/frontend/src/components/NextShot.tsx index b46b494..4be590b 100644 --- a/frontend/src/components/NextShot.tsx +++ b/frontend/src/components/NextShot.tsx @@ -11,7 +11,6 @@ const NextShot = () => { useEffect(() => { socket.on("tick_event", (tick: Tick) => { - console.log("TICK EVENT?", tick); if (!tick.nextShot || !tick.next) { setRemaining(0); return; diff --git a/frontend/src/img/beer.png b/frontend/src/img/beer.png new file mode 100644 index 0000000..f5d4557 Binary files /dev/null and b/frontend/src/img/beer.png differ diff --git a/frontend/src/img/shot.png b/frontend/src/img/shot.png new file mode 100644 index 0000000..5f62ffe Binary files /dev/null and b/frontend/src/img/shot.png differ diff --git a/frontend/src/img/song.png b/frontend/src/img/song.png new file mode 100644 index 0000000..2844345 Binary files /dev/null and b/frontend/src/img/song.png differ diff --git a/frontend/src/img/talk.png b/frontend/src/img/talk.png new file mode 100644 index 0000000..fcdf0c3 Binary files /dev/null and b/frontend/src/img/talk.png differ diff --git a/frontend/src/img/time.png b/frontend/src/img/time.png new file mode 100644 index 0000000..b66e607 Binary files /dev/null and b/frontend/src/img/time.png differ