'use client'; import "./globals.css"; import { NostrProvider } from "nostr-react"; import { ThemeProvider } from "@/components/theme-provider"; import { TopNavigation } from "@/components/headerComponents/TopNavigation"; import BottomBar from "@/components/BottomBar"; import { Toaster } from "@/components/ui/toaster" import Umami from "@/components/Umami"; import { useEffect, useState } from "react"; export default function RootLayout({ children, }: Readonly<{ children: React.ReactNode; }>) { const [relayUrls, setRelayUrls] = useState([ "wss://relay.nostr.band", "wss://relay.damus.io", ]); useEffect(() => { // Load custom relays from localStorage try { const customRelays = JSON.parse(localStorage.getItem("customRelays") || "[]"); if (customRelays.length > 0) { // Remove trailing slashes from any relay URLs const sanitizedRelays = customRelays.map((relay: string) => relay.endsWith('/') ? relay.slice(0, -1) : relay ); setRelayUrls(prevRelays => { // Combine default relays with custom relays, removing duplicates const allRelays = [...prevRelays, ...sanitizedRelays]; return Array.from(new Set(allRelays)); // Remove duplicates }); } } catch (error) { console.error("Error loading custom relays:", error); } }, []); return ( LUMINA
{children}
); }