Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion components/layout/sidebar/WebSidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
"use client";

import { usePathname } from "next/navigation";
import { useEffect, useRef, useState } from "react";
import { useEffect, useMemo, useRef, useState } from "react";
import { Tooltip as ReactTooltip } from "react-tooltip";
import { useIdentity } from "../../../hooks/useIdentity";
import { useAuth } from "../../auth/Auth";
import { useSeizeConnectContext } from "../../auth/SeizeConnectContext";
import HeaderShare from "../../header/share/HeaderShare";
import WebSidebarHeader from "./WebSidebarHeader";
import WebSidebarNav from "./WebSidebarNav";
import WebSidebarNavItem from "./nav/WebSidebarNavItem";
import WebSidebarUser from "./WebSidebarUser";
import { UserIcon } from "@heroicons/react/24/outline";

interface WebSidebarProps {
readonly isCollapsed: boolean;
Expand All @@ -32,10 +35,16 @@ function WebSidebar({
const navRef = useRef<{ closeSubmenu: () => void }>(null);
const pathname = usePathname();
const { address } = useSeizeConnectContext();
const { connectedProfile } = useAuth();
const { profile } = useIdentity({
handleOrWallet: address || "",
initialProfile: null,
});
const profilePath = useMemo(() => {
if (connectedProfile?.handle) return `/${connectedProfile.handle}`;
if (address) return `/${address}`;
return null;
}, [connectedProfile?.handle, address]);

const [isTouchScreen, setIsTouchScreen] = useState(false);
useEffect(() => {
Expand Down Expand Up @@ -166,6 +175,19 @@ function WebSidebar({
<WebSidebarNav ref={navRef} isCollapsed={shouldShowCollapsed} />
</div>

{profilePath && (
<div className="tw-px-3 tw-pt-2">
<WebSidebarNavItem
href={profilePath}
icon={UserIcon}
iconSizeClass="tw-h-6 tw-w-6"
active={pathname === profilePath}
collapsed={shouldShowCollapsed}
label="Profile"
/>
</div>
)}

<HeaderShare isCollapsed={shouldShowCollapsed} />

<WebSidebarUser
Expand Down
24 changes: 2 additions & 22 deletions components/layout/sidebar/WebSidebarNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import { useAppWallets } from "@/components/app-wallets/AppWalletsContext";
import { useAuth } from "@/components/auth/Auth";
import { useSeizeConnectContext } from "@/components/auth/SeizeConnectContext";
import BellIcon from "@/components/common/icons/BellIcon";
import ChatBubbleIcon from "@/components/common/icons/ChatBubbleIcon";
import DiscoverIcon from "@/components/common/icons/DiscoverIcon";
Expand All @@ -16,7 +15,7 @@ import useCapacitor from "@/hooks/useCapacitor";
import { useSectionMap, useSidebarSections } from "@/hooks/useSidebarSections";
import { useUnreadIndicator } from "@/hooks/useUnreadIndicator";
import { useUnreadNotifications } from "@/hooks/useUnreadNotifications";
import { MagnifyingGlassIcon, UserIcon } from "@heroicons/react/24/outline";
import { MagnifyingGlassIcon } from "@heroicons/react/24/outline";
import { usePathname } from "next/navigation";
import React, {
useCallback,
Expand All @@ -41,7 +40,6 @@ const WebSidebarNav = React.forwardRef<
const pathname = usePathname();
const capacitor = useCapacitor();
const { country } = useCookieConsent();
const { address } = useSeizeConnectContext();
const { connectedProfile } = useAuth();
const { appWalletsSupported } = useAppWallets();
const { haveUnreadNotifications } = useUnreadNotifications(
Expand All @@ -68,12 +66,6 @@ const WebSidebarNav = React.forwardRef<
{ event: "keydown" }
);

const profilePath = useMemo(() => {
if (connectedProfile?.handle) return `/${connectedProfile.handle}`;
if (address) return `/${address}`;
return null;
}, [connectedProfile?.handle, address]);

const sections = useSidebarSections(
appWalletsSupported,
capacitor.isIos,
Expand Down Expand Up @@ -308,19 +300,6 @@ const WebSidebarNav = React.forwardRef<
/>
</li>

{profilePath && (
<li>
<WebSidebarNavItem
href={profilePath}
icon={UserIcon}
iconSizeClass="tw-h-6 tw-w-6"
active={pathname === profilePath}
collapsed={isCollapsed}
label="Profile"
/>
</li>
)}

<li>
<WebSidebarNavItem
onClick={(event?: React.MouseEvent) => {
Expand Down Expand Up @@ -357,6 +336,7 @@ const WebSidebarNav = React.forwardRef<
{renderCollapsedSubmenu(section.key)}
</li>
))}

</ul>
</nav>

Expand Down