© {new Date().getFullYear()} NodeByte LTD. {t("footer.copyright")}
@@ -267,10 +268,12 @@ export function Footer() {
rel="noopener noreferrer"
className="opacity-70 hover:opacity-100 transition-opacity"
>
-
•
@@ -317,16 +320,12 @@ function StatusIndicator() {
useEffect(() => {
let mounted = true
;(async () => {
- try {
- const res = await fetch("/api/instatus")
- if (!res.ok) throw new Error(`Status ${res.status}`)
+ const res = await fetch("/api/instatus")
+ if (res.ok) {
const data = await res.json()
- if (!mounted) return
- setStatus(data)
- } catch (err) {
- if (!mounted) return
- // Fallback to UP status on error
- setStatus({
+ if (mounted) setStatus(data)
+ } else {
+ if (mounted) setStatus({
status: "UP",
url: "https://nodebytestat.us",
hasIncidents: false,
@@ -334,10 +333,8 @@ function StatusIndicator() {
incidents: [],
maintenances: [],
})
- } finally {
- if (!mounted) return
- setLoading(false)
}
+ if (mounted) setLoading(false)
})()
return () => {
mounted = false
diff --git a/packages/ui/components/Static/navigation.tsx b/packages/ui/components/Static/navigation.tsx
index f2cbd5f..b808848 100644
--- a/packages/ui/components/Static/navigation.tsx
+++ b/packages/ui/components/Static/navigation.tsx
@@ -1,6 +1,6 @@
"use client"
-import { useState, useEffect, useRef, useMemo } from "react"
+import { useState, useEffect, useRef } from "react"
import { Button } from "@/packages/ui/components/ui/button"
import {
DropdownMenu,
@@ -24,8 +24,7 @@ export function Navigation() {
const t = useTranslations()
const mountedRef = useRef(false)
- // Memoize menu items to prevent recreation on every render
- const company = useMemo(() => [
+ const company = [
{
title: t("company.about.title"),
href: "/about",
@@ -51,9 +50,9 @@ export function Navigation() {
icon: ExternalLink,
external: true,
},
- ], [t])
+ ]
- const services = useMemo(() => [
+ const services = [
{
title: t("services.minecraft.title"),
href: "/games/minecraft",
@@ -89,9 +88,9 @@ export function Navigation() {
icon: Server,
section: "vps",
},
- ], [t])
+ ]
- const resources = useMemo(() => [
+ const resources = [
{
title: t("resources.clientArea.title"),
href: LINKS.billing.login,
@@ -127,7 +126,7 @@ export function Navigation() {
icon: Sparkles,
external: false
},
- ], [t])
+ ]
const [isScrolled, setIsScrolled] = useState(false)
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false)
@@ -140,7 +139,7 @@ export function Navigation() {
const closeTimerRef = useRef
| null>(null)
const pathname = usePathname()
- const navLabels = useMemo(() => ({
+ const navLabels = {
company: t("nav.company"),
services: t("nav.services"),
resources: t("nav.resources"),
@@ -150,7 +149,7 @@ export function Navigation() {
currency: t("nav.currency"),
theme: t("nav.theme"),
joinDiscord: t("nav.joinDiscord"),
- }), [t])
+ }
useEffect(() => {
mountedRef.current = true
@@ -181,23 +180,18 @@ export function Navigation() {
}
useEffect(() => {
- if (!mountedRef.current) return
const handleScroll = () => {
setIsScrolled(window.scrollY > 20)
}
window.addEventListener("scroll", handleScroll, { passive: true })
return () => {
window.removeEventListener("scroll", handleScroll)
- // Clean up any pending close timer on unmount
if (closeTimerRef.current) clearTimeout(closeTimerRef.current)
}
}, [])
useEffect(() => {
- setIsMobileMenuOpen(false)
- setMobileCompanyOpen(false)
- setMobileServicesOpen(false)
- setMobileResourcesOpen(false)
+ queueMicrotask(() => setIsMobileMenuOpen(false))
}, [pathname])
// Prevent body scroll when mobile menu is open.
@@ -284,7 +278,7 @@ export function Navigation() {
onMouseLeave={() => closeDropdown(setCompanyOpen)}
>
-