adds next track short animation

This commit is contained in:
2025-08-21 20:43:00 +02:00
parent c710845288
commit b4a037388a
+4
View File
@@ -9,6 +9,7 @@ import { useSession } from "muzak/contexts/SessionContext";
import { getUser, api, Track } from "muzak/data/fetcher"; import { getUser, api, Track } from "muzak/data/fetcher";
import getSessionId from "muzak/data/session"; import getSessionId from "muzak/data/session";
import { useSpotifyIframe } from "muzak/contexts/SpotifyIframe"; import { useSpotifyIframe } from "muzak/contexts/SpotifyIframe";
import { useAnimation } from "muzak/contexts/AnimationContext";
const nunito = Nunito({ const nunito = Nunito({
weight: "900", weight: "900",
@@ -35,6 +36,7 @@ export default function Lobby() {
const [playingPercentage, setPlayingPercentage] = useState(0); const [playingPercentage, setPlayingPercentage] = useState(0);
const [secondsLeft, setSecondsLeft] = useState(30); const [secondsLeft, setSecondsLeft] = useState(30);
const [state, setState] = useState("lobby"); // lobby, playing, waiting, loading const [state, setState] = useState("lobby"); // lobby, playing, waiting, loading
const { isAnimate, setIsAnimate } = useAnimation();
// Main message handler and dispatcher // Main message handler and dispatcher
function onMessage(e) { function onMessage(e) {
@@ -44,6 +46,8 @@ export default function Lobby() {
if (key === "joined") { if (key === "joined") {
addUser(data[key]); addUser(data[key]);
} else if (key == "track") { } else if (key == "track") {
setIsAnimate(false);
setTimeout(() => setIsAnimate(true), 1000);
getTrack(); getTrack();
} else if (key == "voted") { } else if (key == "voted") {
voteUser(data[key]); voteUser(data[key]);