diff --git a/client/package-lock.json b/client/package-lock.json index 7610e6e..a79f6cb 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -17,6 +17,7 @@ "class-variance-authority": "^0.7.0", "client": "file:", "clsx": "^2.1.1", + "framer-motion": "^11.11.17", "lucide-react": "^0.456.0", "react": "^18.3.1", "react-dom": "^18.3.1", @@ -2852,6 +2853,30 @@ "url": "https://github.com/sponsors/rawify" } }, + "node_modules/framer-motion": { + "version": "11.11.17", + "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-11.11.17.tgz", + "integrity": "sha512-O8QzvoKiuzI5HSAHbcYuL6xU+ZLXbrH7C8Akaato4JzQbX2ULNeniqC2Vo5eiCtFktX9XsJ+7nUhxcl2E2IjpA==", + "dependencies": { + "tslib": "^2.4.0" + }, + "peerDependencies": { + "@emotion/is-prop-valid": "*", + "react": "^18.0.0", + "react-dom": "^18.0.0" + }, + "peerDependenciesMeta": { + "@emotion/is-prop-valid": { + "optional": true + }, + "react": { + "optional": true + }, + "react-dom": { + "optional": true + } + } + }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", diff --git a/client/package.json b/client/package.json index bc6b827..93faea3 100644 --- a/client/package.json +++ b/client/package.json @@ -19,6 +19,7 @@ "class-variance-authority": "^0.7.0", "client": "file:", "clsx": "^2.1.1", + "framer-motion": "^11.11.17", "lucide-react": "^0.456.0", "react": "^18.3.1", "react-dom": "^18.3.1", diff --git a/client/src/components/PlayGround.tsx b/client/src/components/PlayGround.tsx index b0d4a5a..363fc1c 100644 --- a/client/src/components/PlayGround.tsx +++ b/client/src/components/PlayGround.tsx @@ -4,7 +4,6 @@ import { PlayerList } from "./PlayerList"; import { Whiteboard } from "./Whiteboard"; import { useEffect, useRef, useState } from "react"; import { useNavigate, useParams } from "react-router-dom"; -import { Dialog, DialogContent, DialogHeader, DialogTitle } from "./ui/dialog"; export default function Playground() { const socket = useSocket(); @@ -230,56 +229,18 @@ export default function Playground() { ); }; - const WinnerOverlay = ({ - winner, - word, - isOpen, - onClose, - }: { - winner: string | null; - word: string; - isOpen: boolean; - onClose: () => void; - }) => { - // Automatically close after 4 seconds when the overlay is opened - useEffect(() => { - if (isOpen) { - const timer = setTimeout(() => { - onClose(); - }, 4000); // 4 seconds - return () => clearTimeout(timer); // Clear timeout if component unmounts or isOpen changes - } - }, [isOpen, onClose]); - return ( - - ); - }; + if (!socket) return