From f7187ce2b2ccaf30bad87ae32e24a00df884e5ba Mon Sep 17 00:00:00 2001 From: mr0x50 <24775431+mroxso@users.noreply.github.com> Date: Sat, 15 Feb 2025 21:07:31 +0100 Subject: [PATCH] Revert "Revert "Fix: hydration errors (#45)"" This reverts commit a73746311558bf69e4b70b40c5590162ecc69b8d. --- components/BottomBar.tsx | 44 ++++++++-------- components/ProfileInfoCard.tsx | 10 ++-- components/ReactionButton.tsx | 8 +-- components/ViewCopyButton.tsx | 9 ++-- components/ViewRawButton.tsx | 8 +-- components/ZapButton.tsx | 10 ++-- components/headerComponents/TopNavigation.tsx | 51 +++++++++++++------ 7 files changed, 84 insertions(+), 56 deletions(-) diff --git a/components/BottomBar.tsx b/components/BottomBar.tsx index 2576f6a..c3cd2fd 100644 --- a/components/BottomBar.tsx +++ b/components/BottomBar.tsx @@ -3,38 +3,42 @@ import { BellIcon, GlobeIcon, HomeIcon, RowsIcon, UploadIcon } from "@radix-ui/react-icons" import Link from "next/link" import { FormEvent, JSX, SVGProps, useEffect, useState } from "react" -import { Avatar, AvatarFallback, AvatarImage } from "./ui/avatar" import { useRouter, usePathname } from 'next/navigation' -import { SearchIcon, Upload } from "lucide-react"; -import { - Drawer, - DrawerClose, - DrawerContent, - DrawerDescription, - DrawerFooter, - DrawerHeader, - DrawerTitle, - DrawerTrigger, -} from "@/components/ui/drawer" -import { Button } from "./ui/button"; -import { Textarea } from "./ui/textarea"; -import { useNostr } from "nostr-react"; +import { SearchIcon } from "lucide-react"; export default function BottomBar() { const router = useRouter(); const [pubkey, setPubkey] = useState(null); + const [mounted, setMounted] = useState(false); const pathname = usePathname(); useEffect(() => { - if (typeof window !== 'undefined') { - setPubkey(window.localStorage.getItem('pubkey') ?? null); - } + setMounted(true); + setPubkey(window.localStorage.getItem('pubkey')); }, []); - if (typeof window === 'undefined') return null; - const isActive = (path: string, currentPath: string) => currentPath === path ? 'text-purple-500' : ''; + // Render minimal navigation during SSR and hydration + if (!mounted) { + return ( + + ); + } + return ( ) } \ No newline at end of file