diff --git a/packages/client/src/components/Header.tsx b/packages/client/src/components/Header.tsx index fdfa58b..2089c35 100644 --- a/packages/client/src/components/Header.tsx +++ b/packages/client/src/components/Header.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import { User } from "./Header/User"; export const Header = () => { return ( @@ -6,13 +6,7 @@ export const Header = () => {
-
-
-
-
-
- User Avatar -
+
); diff --git a/packages/client/src/components/Header/User.tsx b/packages/client/src/components/Header/User.tsx new file mode 100644 index 0000000..4dd87c2 --- /dev/null +++ b/packages/client/src/components/Header/User.tsx @@ -0,0 +1,17 @@ +import { useAppContext } from "../../contexts/AppContext"; + +export const User = () => { + const { user } = useAppContext(); + + return user ? ( +
+
+
{user.user.username}
+
{user.service.instance.hostname}
+
+ User Avatar +
+ ) : ( + <> + ); +}; diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts index fcd9bf0..a1c29e3 100644 --- a/packages/server/src/index.ts +++ b/packages/server/src/index.ts @@ -3,6 +3,7 @@ import expressSession from "express-session"; import http from "node:http"; import { Server } from "socket.io"; import { + AuthSession, CPixelPacket, PacketAck, SCanvasPacket, @@ -51,7 +52,7 @@ const io = new Server< ) => void; }, { - user: (user: SUserPacket) => void; + user: (user: AuthSession) => void; config: (config: any) => void; pixel: (data: SPixelPacket) => void; canvas: (pixels: string[]) => void; @@ -103,11 +104,7 @@ io.on("connection", (socket) => { console.log("connection", socket.request.session.user); if (socket.request.session.user) - socket.emit("user", { - type: "user", - user: socket.request.session.user, - _direction: "server->client", - }); + socket.emit("user", socket.request.session.user); socket.emit("config", { pallete: {