From a73746311558bf69e4b70b40c5590162ecc69b8d Mon Sep 17 00:00:00 2001 From: mr0x50 <24775431+mroxso@users.noreply.github.com> Date: Sat, 15 Feb 2025 20:53:07 +0100 Subject: [PATCH] Revert "Fix: hydration errors (#45)" This reverts commit 8c485fb47e2e9610e78f0332fb1b95be2b198a14. --- 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, 56 insertions(+), 84 deletions(-) diff --git a/components/BottomBar.tsx b/components/BottomBar.tsx index c3cd2fd..2576f6a 100644 --- a/components/BottomBar.tsx +++ b/components/BottomBar.tsx @@ -3,41 +3,37 @@ 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 } from "lucide-react"; +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"; export default function BottomBar() { const router = useRouter(); const [pubkey, setPubkey] = useState(null); - const [mounted, setMounted] = useState(false); const pathname = usePathname(); useEffect(() => { - setMounted(true); - setPubkey(window.localStorage.getItem('pubkey')); + if (typeof window !== 'undefined') { + setPubkey(window.localStorage.getItem('pubkey') ?? null); + } }, []); - const isActive = (path: string, currentPath: string) => currentPath === path ? 'text-purple-500' : ''; + if (typeof window === 'undefined') return null; - // Render minimal navigation during SSR and hydration - if (!mounted) { - return ( - - ); - } + const isActive = (path: string, currentPath: string) => currentPath === path ? 'text-purple-500' : ''; return (