"use client"; import { useEffect, useRef } from "react"; const PORTALS = [ { id: "nav", href: "https://nav.hackrobot.cn/", emoji: "🧭", name: "出海导航", main: false, }, { id: "book", href: "https://nomadweb.nomadro.com/book", emoji: "📖", name: "数字游民小册", main: false, }, { id: "community", href: "https://nomadweb.nomadro.com", emoji: "🌏", name: "旅居社群", main: true, }, ] as const; function LogoIcon() { return ( ); } function GlobeVisual() { return (
🏝️ 巴厘岛
☕ 里斯本
🏔️ 清迈
); } function ParticleCanvas() { const canvasRef = useRef(null); useEffect(() => { const canvas = canvasRef.current; if (!canvas) return; const ctx = canvas.getContext("2d"); if (!ctx) return; let particles: { x: number; y: number; r: number; vx: number; vy: number; a: number; }[] = []; let w = 0; let h = 0; let raf = 0; let running = true; const resize = () => { w = canvas.width = window.innerWidth; h = canvas.height = window.innerHeight; const n = Math.min(60, Math.floor((w * h) / 22000)); particles = Array.from({ length: n }, () => ({ x: Math.random() * w, y: Math.random() * h, r: Math.random() * 1.6 + 0.4, vx: (Math.random() - 0.5) * 0.3, vy: (Math.random() - 0.5) * 0.3, a: Math.random() * 0.4 + 0.15, })); }; const draw = () => { if (!running) return; ctx.clearRect(0, 0, w, h); particles.forEach((p, i) => { p.x += p.vx; p.y += p.vy; if (p.x < 0 || p.x > w) p.vx *= -1; if (p.y < 0 || p.y > h) p.vy *= -1; ctx.beginPath(); ctx.arc(p.x, p.y, p.r, 0, Math.PI * 2); ctx.fillStyle = `rgba(255,255,255,${p.a})`; ctx.fill(); for (let j = i + 1; j < particles.length; j++) { const q = particles[j]!; const d = Math.hypot(p.x - q.x, p.y - q.y); if (d < 110) { ctx.beginPath(); ctx.moveTo(p.x, p.y); ctx.lineTo(q.x, q.y); ctx.strokeStyle = `rgba(78,205,196,${0.16 * (1 - d / 110)})`; ctx.stroke(); } } }); raf = requestAnimationFrame(draw); }; resize(); draw(); window.addEventListener("resize", resize); return () => { running = false; cancelAnimationFrame(raf); window.removeEventListener("resize", resize); }; }, []); return ( ); } function HubLoader() { const ref = useRef(null); useEffect(() => { const hide = () => ref.current?.classList.add("hidden"); const onLoad = () => setTimeout(hide, 1200); const fallback = setTimeout(hide, 2200); if (document.readyState === "complete") { onLoad(); } else { window.addEventListener("load", onLoad); } return () => { clearTimeout(fallback); window.removeEventListener("load", onLoad); }; }, []); return (

nomadro

); } export function Hero() { const navRef = useRef(null); useEffect(() => { const nav = navRef.current; const onScroll = () => nav?.classList.toggle("scrolled", window.scrollY > 24); window.addEventListener("scroll", onScroll, { passive: true }); onScroll(); const reveals = document.querySelectorAll(".hub-reveal"); let io: IntersectionObserver | null = null; if ("IntersectionObserver" in window) { io = new IntersectionObserver( (entries) => { entries.forEach((e) => { if (e.isIntersecting) { e.target.classList.add("visible"); io?.unobserve(e.target); } }); }, { threshold: 0.12 }, ); reveals.forEach((el) => io!.observe(el)); } else { reveals.forEach((el) => el.classList.add("visible")); } return () => { window.removeEventListener("scroll", onScroll); io?.disconnect(); }; }, []); return (

随处工作
自由生活

{PORTALS.map((portal) => ( {portal.emoji} {portal.name} ))}
); }