From 5d86086741ae3b48c372f8be2b40b980a841eee2 Mon Sep 17 00:00:00 2001 From: kotto5 Date: Sun, 11 Feb 2024 22:02:11 +0900 Subject: [PATCH] [frontend] display uesr's online status!!! --- frontend/app/layout.tsx | 6 +++++- frontend/app/lib/hooks/useOnlineStatus.ts | 2 +- frontend/app/onlineProviders.tsx | 6 +----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/app/layout.tsx b/frontend/app/layout.tsx index 7cb937f2..2378ae03 100644 --- a/frontend/app/layout.tsx +++ b/frontend/app/layout.tsx @@ -13,6 +13,7 @@ import { Toaster } from "@/components/ui/toaster"; import { getMe } from "@/app/lib/actions"; import { JwtPayload } from "@/app/lib/dtos"; import { OnlineProviders } from "./onlineProviders"; +import Nav from "./ui/nav"; const inter = Inter({ subsets: ["latin"] }); @@ -45,7 +46,10 @@ export default async function RootLayout({ > - {children} +
+
diff --git a/frontend/app/lib/hooks/useOnlineStatus.ts b/frontend/app/lib/hooks/useOnlineStatus.ts index b7c26840..3758080d 100644 --- a/frontend/app/lib/hooks/useOnlineStatus.ts +++ b/frontend/app/lib/hooks/useOnlineStatus.ts @@ -4,7 +4,7 @@ import { useState } from "react"; export function useOnlineStatus() { const [onlineStatus, setOnlineStatus] = useState<{ [key: number]: number }>( - {} + {}, ); return { onlineStatus, setOnlineStatus }; } diff --git a/frontend/app/onlineProviders.tsx b/frontend/app/onlineProviders.tsx index 78ffc31c..11d64384 100644 --- a/frontend/app/onlineProviders.tsx +++ b/frontend/app/onlineProviders.tsx @@ -2,17 +2,13 @@ import { useOnlineStatus } from "./lib/hooks/useOnlineStatus"; import SocketProvider, { OnlineContext } from "./lib/client-socket-provider"; -import Nav from "./ui/nav"; export function OnlineProviders({ children }: { children: React.ReactNode }) { const { onlineStatus, setOnlineStatus } = useOnlineStatus(); return ( <> -
-
+ {children}