From 7686b6ef82d77f6c618d3d466d420711cb278817 Mon Sep 17 00:00:00 2001 From: Pouria Delfanazari Date: Sat, 26 Oct 2024 19:26:20 -0700 Subject: [PATCH 1/3] Move notification and settings links to aside --- src/app/dashboard/layout.tsx | 10 +---- src/components/actions/signOut/SignOut.tsx | 3 +- src/components/navigational/appBar/AppBar.tsx | 6 +-- src/components/navigational/aside/Aside.tsx | 42 +++++++++++++------ .../navigational/navbar/NavItem.tsx | 10 ++--- src/components/navigational/navbar/Navbar.tsx | 41 +++--------------- .../settingsContainer/SettingsContainer.tsx | 4 +- 7 files changed, 49 insertions(+), 67 deletions(-) diff --git a/src/app/dashboard/layout.tsx b/src/app/dashboard/layout.tsx index 484a2bd1..3303fbec 100644 --- a/src/app/dashboard/layout.tsx +++ b/src/app/dashboard/layout.tsx @@ -21,20 +21,14 @@ export default async function DashboardLayout({ const profile = await getProfile(session?.user.bskySession.handle); return ( -
+
{profile && }
{profile && } {children}
- {profile && ( -
); diff --git a/src/components/actions/signOut/SignOut.tsx b/src/components/actions/signOut/SignOut.tsx index 5cb4c99c..34f6ddc3 100644 --- a/src/components/actions/signOut/SignOut.tsx +++ b/src/components/actions/signOut/SignOut.tsx @@ -1,6 +1,7 @@ "use client"; import { signOut } from "next-auth/react"; +import { BiLogOut } from "react-icons/bi"; export default function SignOut() { return ( @@ -8,7 +9,7 @@ export default function SignOut() { onClick={() => signOut({ callbackUrl: "/" })} className="text-skin-tertiary hover:text-skin-base font-medium" > - Sign out + ); } diff --git a/src/components/navigational/appBar/AppBar.tsx b/src/components/navigational/appBar/AppBar.tsx index 02adbbfd..78c77b0f 100644 --- a/src/components/navigational/appBar/AppBar.tsx +++ b/src/components/navigational/appBar/AppBar.tsx @@ -6,7 +6,7 @@ import { useScrollContext } from "@/app/providers/scroll"; import useAgent from "@/lib/hooks/bsky/useAgent"; import { getUnreadNotificationsCount } from "@/lib/api/bsky/notification"; import { useQuery } from "@tanstack/react-query"; -import { BiCloud, BiHome, BiSolidCloud, BiSolidHome } from "react-icons/bi"; +import { BiHome, BiPlanet, BiSolidHome, BiSolidPlanet } from "react-icons/bi"; import { PiMagnifyingGlassBold, PiMagnifyingGlassFill } from "react-icons/pi"; import { FaRegBell } from "react-icons/fa6"; import { FaBell } from "react-icons/fa"; @@ -51,8 +51,8 @@ export default function AppBar() { /> } - activeIcon={} + icon={} + activeIcon={} title="Feeds" isActive={pathname === "/dashboard/feeds"} /> diff --git a/src/components/navigational/aside/Aside.tsx b/src/components/navigational/aside/Aside.tsx index 97edb53d..9d08234c 100644 --- a/src/components/navigational/aside/Aside.tsx +++ b/src/components/navigational/aside/Aside.tsx @@ -1,28 +1,46 @@ +"use client"; + import Avatar from "@/components/dataDisplay/avatar/Avatar"; import SignOut from "@/components/actions/signOut/SignOut"; import Link from "next/link"; +import NavItem from "../navbar/NavItem"; +import { FaBell, FaRegBell } from "react-icons/fa6"; +import { usePathname } from "next/navigation"; +import useAgent from "@/lib/hooks/bsky/useAgent"; +import { useQuery } from "@tanstack/react-query"; +import { getUnreadNotificationsCount } from "@/lib/api/bsky/notification"; +import { BiCog } from "react-icons/bi"; interface Props { handle: string; - displayName?: string; avatar?: string; } export default function Aside(props: Props) { - const { displayName, handle, avatar } = props; + const { handle, avatar } = props; + const agent = useAgent(); + const { + data: notificationsCount, + error, + isFetching, + } = useQuery({ + queryKey: ["notificationsCount"], + queryFn: () => getUnreadNotificationsCount(agent), + refetchInterval: 10000, + }); return (