diff --git a/package-lock.json b/package-lock.json index bc934fa..acb3776 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4767,9 +4767,10 @@ } }, "node_modules/prettier": { - "version": "3.2.4", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", "dev": true, - "license": "MIT", "bin": { "prettier": "bin/prettier.cjs" }, @@ -4782,8 +4783,9 @@ }, "node_modules/prettier-plugin-tailwindcss": { "version": "0.5.11", + "resolved": "https://registry.npmjs.org/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.5.11.tgz", + "integrity": "sha512-AvI/DNyMctyyxGOjyePgi/gqj5hJYClZ1avtQvLlqMT3uDZkRbi4HhGUpok3DRzv9z7Lti85Kdj3s3/1CeNI0w==", "dev": true, - "license": "MIT", "engines": { "node": ">=14.21.3" }, @@ -6269,8 +6271,8 @@ "eslint": "^8.54.0", "eslint-config-next": "^14.0.4", "postcss": "^8.4.31", - "prettier": "^3.1.0", - "prettier-plugin-tailwindcss": "^0.5.7", + "prettier": "^3.2.5", + "prettier-plugin-tailwindcss": "^0.5.11", "tailwindcss": "^3.3.5", "typescript": "^5.1.6" } diff --git a/packages/client/package.json b/packages/client/package.json index 57a8c66..9b4f732 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -18,9 +18,9 @@ "next": "^14.0.4", "react": "18.2.0", "react-dom": "18.2.0", + "sharp": "^0.33.2", "socket.io-client": "^4.7.4", - "zod": "^3.22.4", - "sharp": "^0.33.2" + "zod": "^3.22.4" }, "devDependencies": { "@types/eslint": "^8.44.7", @@ -33,8 +33,8 @@ "eslint": "^8.54.0", "eslint-config-next": "^14.0.4", "postcss": "^8.4.31", - "prettier": "^3.1.0", - "prettier-plugin-tailwindcss": "^0.5.7", + "prettier": "^3.2.5", + "prettier-plugin-tailwindcss": "^0.5.11", "tailwindcss": "^3.3.5", "typescript": "^5.1.6" }, diff --git a/packages/client/src/app/page.tsx b/packages/client/src/app/page.tsx index 0a7085a..bc5d9c2 100644 --- a/packages/client/src/app/page.tsx +++ b/packages/client/src/app/page.tsx @@ -6,7 +6,7 @@ import { useEffect, useState } from "react"; import background from "../assets/background.png"; import logo from "../assets/logo.png"; import { Canvas } from "./canvas"; -import { getRandomUsername } from '@viper-vortex/shared'; +import { getRandomUsername } from "@viper-vortex/shared"; export default function HomePage() { const [serverUrl, setServerUrl] = useState("http://localhost:4000"); const [username, setUsername] = useState(""); @@ -16,34 +16,36 @@ export default function HomePage() { if (process.env.NODE_ENV === "production") { setServerUrl("sr.mael.app"); } - }, []) - + }, []); useEffect(() => { - setUsername(getRandomUsername()) - }, []) - + setUsername(getRandomUsername()); + }, []); - if (!api.isConnected) return + if (!api.isConnected) + return ( + + ); return (
-
-

Leaderboard

-
+
+

Leaderboard

+
{api.scores?.map((player) => ( -
-
- - {player.name} - +
+
+ {player.name}
-
+
{Math.round(player.score)}
@@ -63,61 +65,86 @@ function Login(props: { setUsername: (username: string) => void; }) { return ( -
- Viper Vortex +
+ Viper Vortex
{ e.preventDefault(); props.api.connect(props.serverUrl, props.username); }} > Viper Vortex -

- Viper Vortex -

+

Viper Vortex

- Collect points by eating food and other players. If your head touches another player, you will explode and die. + Collect points by eating food and other players. If your head touches + another player, you will explode and die.

-
+
+ className="pointer-events-none absolute left-0 top-0 px-4 py-2 text-sm text-white/50 transition-all" + > + Username + props.setUsername(e.target.value)} - className="px-4 pb-2 pt-6 bg-transparent w-full rounded-lg" + className="w-full rounded-lg bg-transparent px-4 pb-2 pt-6" type="text" placeholder="Your username" />
-
+
+ className="pointer-events-none absolute left-0 top-0 px-4 py-2 text-sm text-white/50 transition-all" + > + Server + props.setServerUrl(e.target.value)} - className="px-4 pb-2 pt-6 bg-transparent w-full rounded-lg" + className="w-full rounded-lg bg-transparent px-4 pb-2 pt-6" type="text" placeholder="Server URL" />
- - + + + +
);