From 11e707f8502f6987d82b104c7fc71877cc2750e8 Mon Sep 17 00:00:00 2001 From: Hannah Storer Date: Tue, 14 Apr 2026 15:31:45 -0400 Subject: [PATCH 1/2] Added logout button to nav bar --- .../navigation/app-navbar/index.tsx | 53 +++++++++++++++---- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/web/src/components/navigation/app-navbar/index.tsx b/web/src/components/navigation/app-navbar/index.tsx index 4f283d12..27f6193c 100644 --- a/web/src/components/navigation/app-navbar/index.tsx +++ b/web/src/components/navigation/app-navbar/index.tsx @@ -6,6 +6,10 @@ import { usePathname } from "next/navigation"; import { icons } from "@/components/icons"; import { Protected } from "@/components/rbac/Protected"; import { cn } from "@/lib/utils"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import { authClient } from "@/lib/auth-client"; +import { LogOut } from "lucide-react"; type NavItem = { id: number; @@ -56,7 +60,7 @@ const AppNavBarItem = ({ : "bg-primary-dark hover:bg-accent" } group-hover:-translate-y-2`} > - + { const isBroadcastsActive = pathname.startsWith("/broadcasts"); const isCreateBroadcastActive = pathname.startsWith("/broadcasts/new"); + const router = useRouter(); + const [isSigningOut, setIsSigningOut] = useState(false); + + const handleSignOut = async () => { + setIsSigningOut(true); + const res = await authClient.signOut(); + if (res.error) { + setIsSigningOut(false); + return; + } + router.replace("/login"); + }; + const circleButtonClasses = - "group relative flex h-12 w-12 shrink-0 items-center justify-center rounded-full border-2 transition-colors duration-200 overflow-visible"; + "group relative flex h-11 w-11 shrink-0 items-center justify-center rounded-full border-2 transition-colors duration-200 overflow-visible"; return ( From c47f36b878214d856b5e9fb25661f00797171fa2 Mon Sep 17 00:00:00 2001 From: Hannah Storer Date: Tue, 14 Apr 2026 16:46:12 -0400 Subject: [PATCH 2/2] Fixed checks --- .../navigation/app-navbar/index.tsx | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/web/src/components/navigation/app-navbar/index.tsx b/web/src/components/navigation/app-navbar/index.tsx index 27f6193c..9616f5cb 100644 --- a/web/src/components/navigation/app-navbar/index.tsx +++ b/web/src/components/navigation/app-navbar/index.tsx @@ -1,15 +1,14 @@ "use client"; +import { LogOut } from "lucide-react"; import type { Route } from "next"; import Image from "next/image"; import Link from "next/link"; -import { usePathname } from "next/navigation"; +import { usePathname, useRouter } from "next/navigation"; +import { useState } from "react"; import { icons } from "@/components/icons"; import { Protected } from "@/components/rbac/Protected"; -import { cn } from "@/lib/utils"; -import { useRouter } from "next/navigation"; -import { useState } from "react"; import { authClient } from "@/lib/auth-client"; -import { LogOut } from "lucide-react"; +import { cn } from "@/lib/utils"; type NavItem = { id: number; @@ -95,7 +94,7 @@ export const AppNavBar = ({ className, onNavigate }: AppNavBarProps = {}) => { const handleSignOut = async () => { setIsSigningOut(true); - const res = await authClient.signOut(); + const res = await authClient.signOut(); if (res.error) { setIsSigningOut(false); return; @@ -144,7 +143,9 @@ export const AppNavBar = ({ className, onNavigate }: AppNavBarProps = {}) => {
-
+
+ {" "} + { - { Active Broadcasts - { Help - { - {