Skip to content

Commit

Permalink
[frontend] display uesr's online status!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
kotto5 committed Feb 11, 2024
1 parent 15990b6 commit e46653c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 5 additions & 1 deletion frontend/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"] });

Expand Down Expand Up @@ -45,7 +46,10 @@ export default async function RootLayout({
>
<AuthProvider payload={payload as JwtPayload} user={user}>
<Toaster />
<OnlineProviders>{children}</OnlineProviders>
<div className="flex flex-col px-16 h-[100vh]">
<Nav />
<OnlineProviders>{children}</OnlineProviders>
</div>
</AuthProvider>
</ThemeProvider>
</body>
Expand Down
6 changes: 1 addition & 5 deletions frontend/app/onlineProviders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<>
<OnlineContext.Provider value={onlineStatus}>
<div className="flex flex-col px-16 h-[100vh]">
<Nav />
{children}
</div>
{children}
<SocketProvider setOnlineStatus={setOnlineStatus} />
</OnlineContext.Provider>
</>
Expand Down

0 comments on commit e46653c

Please sign in to comment.