Rebuild homepage to match nomadHub PC/H5 portal landing.

EOF

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
eric 2026-09-28 01:59:49 -05:00
parent acc0a81ab9
commit 5569904bff
6 changed files with 1004 additions and 141 deletions

View File

@ -1,8 +1,8 @@
@import "tailwindcss";
:root {
--background: #f8f7fc;
--foreground: #171717;
--background: #0a0e17;
--foreground: #f1f5f9;
--safe-top: env(safe-area-inset-top, 0px);
--safe-bottom: env(safe-area-inset-bottom, 0px);
}
@ -10,13 +10,14 @@
@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--font-sans: var(--font-geist-sans), ui-sans-serif, system-ui, "PingFang SC",
"Microsoft YaHei", sans-serif;
--font-mono: var(--font-geist-mono), ui-monospace, monospace;
--font-sans: var(--font-outfit), var(--font-noto-sc), ui-sans-serif,
system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
--font-mono: ui-monospace, monospace;
}
html {
height: 100%;
scroll-behavior: smooth;
}
body {

613
app/hub.css Normal file
View File

@ -0,0 +1,613 @@
/* nomadHub homepage — PC + H5 */
.hub-root {
--hub-bg: #0a0e17;
--hub-bg-card: rgba(17, 24, 39, 0.7);
--hub-bg-glass: rgba(255, 255, 255, 0.05);
--hub-text: #f1f5f9;
--hub-accent-1: #ff6b6b;
--hub-accent-2: #ffe66d;
--hub-accent-3: #4ecdc4;
--hub-gradient-text: linear-gradient(135deg, #ff6b6b 0%, #ffe66d 50%, #4ecdc4 100%);
--hub-shadow-glow: 0 0 40px rgba(78, 205, 196, 0.15);
--hub-shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
--hub-border: 1px solid rgba(255, 255, 255, 0.08);
--hub-radius-md: 16px;
--hub-font-display: var(--font-outfit), var(--font-noto-sc), sans-serif;
--hub-font-body: var(--font-noto-sc), var(--font-outfit), sans-serif;
--hub-nav-height: 72px;
--hub-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
position: relative;
min-height: 100dvh;
font-family: var(--hub-font-body);
background: var(--hub-bg);
color: var(--hub-text);
line-height: 1.6;
overflow-x: hidden;
}
.hub-root a {
color: inherit;
text-decoration: none;
}
.hub-particle-canvas {
position: fixed;
inset: 0;
z-index: 0;
pointer-events: none;
}
/* Loader */
.hub-loader {
position: fixed;
inset: 0;
z-index: 9999;
display: grid;
place-items: center;
background: #0a0e17;
transition: opacity 0.6s ease, visibility 0.6s;
}
.hub-loader.hidden {
opacity: 0;
visibility: hidden;
pointer-events: none;
}
.hub-loader-inner {
text-align: center;
}
.hub-loader-globe {
width: 64px;
height: 64px;
margin: 0 auto 12px;
}
.hub-loader-ring {
transform-origin: center;
animation: hub-spin 1.1s linear infinite;
}
@keyframes hub-spin {
to {
transform: rotate(360deg);
}
}
.hub-loader-text {
font-family: var(--hub-font-display);
font-weight: 700;
background: var(--hub-gradient-text);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
/* Nav */
.hub-navbar {
position: fixed;
top: 0;
left: 0;
right: 0;
height: var(--hub-nav-height);
z-index: 100;
transition: background var(--hub-transition), border-color var(--hub-transition);
}
.hub-navbar.scrolled {
background: rgba(10, 14, 23, 0.85);
backdrop-filter: blur(20px);
border-bottom: var(--hub-border);
}
.hub-nav-container {
width: min(1200px, calc(100% - clamp(2rem, 6vw, 5rem)));
margin: 0 auto;
height: 100%;
display: flex;
align-items: center;
justify-content: space-between;
}
.hub-logo {
display: flex;
align-items: center;
gap: 10px;
font-family: var(--hub-font-display);
font-weight: 700;
font-size: 1.2rem;
}
.hub-logo-icon {
width: 34px;
height: 34px;
animation: hub-spin 20s linear infinite;
}
/* Hero */
.hub-hero {
position: relative;
z-index: 1;
width: 100%;
min-height: 100svh;
overflow: hidden;
}
.hub-hero-bg-shapes {
position: absolute;
inset: 0;
pointer-events: none;
z-index: 0;
}
.hub-hero-bg-shapes .hub-shape {
position: absolute;
border-radius: 50%;
filter: blur(90px);
opacity: 0.45;
animation: hub-float-shape 8s ease-in-out infinite;
}
.hub-shape-1 {
width: min(52vw, 620px);
height: min(52vw, 620px);
background: var(--hub-accent-1);
top: -8%;
left: -8%;
}
.hub-shape-2 {
width: min(46vw, 560px);
height: min(46vw, 560px);
background: var(--hub-accent-3);
top: 28%;
right: -10%;
animation-delay: -3s;
}
.hub-shape-3 {
width: min(38vw, 480px);
height: min(38vw, 480px);
background: var(--hub-accent-2);
bottom: -12%;
left: 32%;
animation-delay: -5s;
}
@keyframes hub-float-shape {
0%,
100% {
transform: translate(0, 0) scale(1);
}
33% {
transform: translate(24px, -24px) scale(1.05);
}
66% {
transform: translate(-16px, 16px) scale(0.96);
}
}
.hub-hero-inner {
position: relative;
z-index: 1;
width: min(1200px, calc(100% - clamp(2rem, 6vw, 5rem)));
margin: 0 auto;
min-height: 100svh;
display: grid;
grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
grid-template-areas:
"title visual"
"portals visual";
align-content: center;
align-items: center;
column-gap: clamp(1.5rem, 4vw, 3.5rem);
row-gap: 1.75rem;
padding: calc(var(--hub-nav-height) + clamp(1.5rem, 4vh, 2.5rem)) 0
clamp(2rem, 5vh, 3.5rem);
}
.hub-hero-title {
grid-area: title;
align-self: end;
font-family: var(--hub-font-display);
font-size: clamp(2.4rem, 5vw, 3.8rem);
font-weight: 800;
line-height: 1.15;
letter-spacing: -0.02em;
}
.hub-hero-visual {
grid-area: visual;
position: relative;
z-index: 1;
display: flex;
justify-content: center;
align-items: center;
min-width: 0;
padding: clamp(0.75rem, 2vw, 1.5rem);
align-self: center;
}
.hub-portal-grid {
grid-area: portals;
align-self: start;
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 12px;
max-width: 520px;
margin-top: 0;
}
.hub-gradient-text {
background: var(--hub-gradient-text);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
background-size: 200% auto;
animation: hub-gradient-shift 4s ease-in-out infinite;
}
@keyframes hub-gradient-shift {
0%,
100% {
background-position: 0% center;
}
50% {
background-position: 100% center;
}
}
.hub-portal-card {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 14px;
padding: 20px 16px;
background: var(--hub-bg-card);
border: var(--hub-border);
border-radius: var(--hub-radius-md);
backdrop-filter: blur(18px);
box-shadow: var(--hub-shadow-card);
transition: transform var(--hub-transition), box-shadow var(--hub-transition),
border-color var(--hub-transition);
}
.hub-portal-card:hover {
transform: translateY(-4px);
box-shadow: var(--hub-shadow-glow), var(--hub-shadow-card);
border-color: rgba(78, 205, 196, 0.35);
}
.hub-portal-card--main {
background: linear-gradient(
160deg,
rgba(255, 107, 107, 0.12),
rgba(78, 205, 196, 0.08)
),
var(--hub-bg-card);
border-color: rgba(255, 107, 107, 0.22);
}
.hub-portal-ico {
width: 40px;
height: 40px;
display: grid;
place-items: center;
border-radius: 12px;
background: var(--hub-bg-glass);
border: var(--hub-border);
font-size: 1.15rem;
}
.hub-portal-name {
font-family: var(--hub-font-display);
font-size: clamp(0.92rem, 1.4vw, 1.05rem);
font-weight: 800;
letter-spacing: -0.02em;
line-height: 1.25;
white-space: nowrap;
}
.hub-portal-card--main .hub-portal-name {
background: var(--hub-gradient-text);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.hub-globe-container {
position: relative;
width: min(100%, 440px);
aspect-ratio: 1;
margin-inline: auto;
}
.hub-globe-svg {
display: block;
width: 100%;
height: 100%;
overflow: visible;
animation: hub-globe-float 6s ease-in-out infinite;
}
@keyframes hub-globe-float {
0%,
100% {
transform: translateY(0);
}
50% {
transform: translateY(-12px);
}
}
.hub-orbit-ring,
.hub-orbit-ring-2 {
transform-box: fill-box;
transform-origin: center;
animation: hub-orbit-spin 20s linear infinite;
}
.hub-orbit-ring-2 {
animation-direction: reverse;
animation-duration: 15s;
}
@keyframes hub-orbit-spin {
to {
transform: rotate(360deg);
}
}
.hub-continent {
animation: hub-continent-pulse 4s ease-in-out infinite;
}
@keyframes hub-continent-pulse {
0%,
100% {
opacity: 0.7;
}
50% {
opacity: 1;
}
}
.hub-pulse-dot {
animation: hub-dot-pulse 2s ease-in-out infinite;
}
.hub-pulse-dot:nth-of-type(2) {
animation-delay: 0.5s;
}
.hub-pulse-dot:nth-of-type(3) {
animation-delay: 1s;
}
@keyframes hub-dot-pulse {
0%,
100% {
r: 5;
opacity: 1;
}
50% {
r: 8;
opacity: 0.6;
}
}
.hub-flight-path {
animation: hub-dash-move 3s linear infinite;
}
@keyframes hub-dash-move {
to {
stroke-dashoffset: -20;
}
}
.hub-float-card {
position: absolute;
z-index: 2;
padding: 10px 14px;
background: var(--hub-bg-card);
border: var(--hub-border);
border-radius: var(--hub-radius-md);
font-size: 0.8rem;
font-weight: 600;
backdrop-filter: blur(20px);
box-shadow: var(--hub-shadow-card);
animation: hub-card-float 4s ease-in-out infinite;
white-space: nowrap;
pointer-events: none;
}
.hub-fc-1 {
top: 6%;
right: 0;
}
.hub-fc-2 {
top: 58%;
left: 0;
animation-delay: -1.5s;
}
.hub-fc-3 {
bottom: 4%;
right: 6%;
animation-delay: -3s;
}
@keyframes hub-card-float {
0%,
100% {
transform: translateY(0);
}
50% {
transform: translateY(-8px);
}
}
.hub-reveal {
opacity: 0;
transform: translateY(24px);
transition: opacity 0.8s ease, transform 0.8s ease;
}
.hub-reveal.visible {
opacity: 1;
transform: none;
}
/* Tablet / H5 */
@media (max-width: 960px) {
.hub-hero-inner {
grid-template-columns: 1fr;
grid-template-areas:
"visual"
"title"
"portals";
align-content: start;
justify-items: stretch;
min-height: 100svh;
gap: 0.85rem;
padding-top: calc(var(--hub-nav-height) + 0.85rem);
padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
}
.hub-hero-title {
align-self: start;
text-align: center;
font-size: clamp(2.35rem, 11vw, 3.2rem);
letter-spacing: -0.04em;
}
.hub-hero-visual {
width: 100%;
padding: 0.25rem 0.5rem 0.5rem;
}
.hub-globe-container {
width: min(62vw, 300px);
}
.hub-portal-grid {
max-width: none;
width: 100%;
margin-top: 0.35rem;
}
.hub-fc-1 {
right: -2%;
font-size: 0.72rem;
padding: 8px 10px;
}
.hub-fc-2 {
left: -2%;
font-size: 0.72rem;
padding: 8px 10px;
}
.hub-fc-3 {
font-size: 0.72rem;
padding: 8px 10px;
}
}
@media (max-width: 640px) {
.hub-hero-inner {
min-height: 100svh;
gap: 0.65rem;
padding-top: calc(var(--hub-nav-height) + 0.65rem);
}
.hub-hero-title {
font-size: clamp(2.2rem, 10.5vw, 2.85rem);
}
.hub-globe-container {
width: min(64vw, 250px);
}
.hub-globe-svg {
animation-duration: 7s;
}
.hub-portal-grid {
gap: 8px;
}
.hub-portal-card {
padding: 14px 10px;
gap: 10px;
align-items: center;
text-align: center;
}
.hub-portal-ico {
width: 32px;
height: 32px;
font-size: 0.95rem;
}
.hub-portal-name {
font-size: 0.78rem;
letter-spacing: -0.03em;
}
.hub-fc-1 {
top: 4%;
right: 0;
}
.hub-fc-2 {
top: 54%;
left: 0;
}
.hub-fc-3 {
bottom: 2%;
right: 2%;
}
}
@media (max-width: 380px) {
.hub-portal-grid {
gap: 6px;
}
.hub-portal-card {
padding: 12px 6px;
}
.hub-portal-name {
font-size: 0.7rem;
}
}
@media (prefers-reduced-motion: reduce) {
.hub-reveal {
opacity: 1;
transform: none;
transition: none;
}
.hub-loader {
display: none;
}
.hub-globe-svg,
.hub-orbit-ring,
.hub-orbit-ring-2,
.hub-float-card,
.hub-continent,
.hub-pulse-dot,
.hub-flight-path,
.hub-logo-icon {
animation: none !important;
}
}

View File

@ -1,7 +1,8 @@
import "./globals.css";
import "./hub.css";
import { type Metadata, type Viewport } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import { Noto_Sans_SC, Outfit } from "next/font/google";
import { LocaleProvider } from "~/components/locale-provider";
import { UmamiAnalytics } from "~/components/umami-analytics";
@ -10,50 +11,53 @@ export const viewport: Viewport = {
initialScale: 1,
maximumScale: 5,
viewportFit: "cover",
themeColor: "#f8f7fc",
themeColor: "#0a0e17",
};
export const metadata: Metadata = {
metadataBase: new URL("https://nomadro.com"),
title: "Nomadro | 中文数字游民操作系统",
description:
"从城市探索到远程收入,从 AI 自动化到直播变现。游民导航、地理套利、直播工具箱,一站开启你的自由生活。",
title: "nomadro",
description: "数字游民入口 · 出海导航 · 数字游民小册 · 旅居社群",
keywords: [
"数字游民",
"远程工作",
"旅居",
"自由职业",
"直播工具箱",
"地理套利",
"学习路径",
"会员社区",
"出海导航",
"旅居社群",
],
openGraph: {
title: "Nomadro | 中文数字游民操作系统",
description:
"从城市探索到远程收入,从 AI 自动化到直播变现,一站开启你的自由生活。",
title: "nomadro",
description: "随处工作,自由生活。出海导航 · 数字游民小册 · 旅居社群",
type: "website",
url: "https://nomadro.live",
url: "https://nomadro.com",
},
icons: [{ rel: "icon", url: "/favicon.ico" }],
};
const geist = Geist({
const outfit = Outfit({
subsets: ["latin"],
variable: "--font-geist-sans",
weight: ["400", "500", "600", "700", "800"],
variable: "--font-outfit",
display: "swap",
});
const geistMono = Geist_Mono({
const notoSansSC = Noto_Sans_SC({
subsets: ["latin"],
variable: "--font-geist-mono",
weight: ["300", "400", "500", "700"],
variable: "--font-noto-sc",
display: "swap",
});
export default function RootLayout({
children,
}: Readonly<{ children: React.ReactNode }>) {
return (
<html lang="zh-CN" className={`${geist.variable} ${geistMono.variable}`}>
<body className="font-sans antialiased">
<html
lang="zh-CN"
className={`${outfit.variable} ${notoSansSC.variable}`}
>
<body className="antialiased">
<UmamiAnalytics />
<LocaleProvider>{children}</LocaleProvider>
</body>

View File

@ -2,27 +2,12 @@
import { Hero } from "~/components/sections/hero";
import { LanguageSwitcher } from "~/components/language-switcher";
import { useLocale } from "~/components/locale-provider";
export default function HomePage() {
const { t } = useLocale();
const year = new Date().getFullYear();
return (
<div
className="relative flex min-h-dvh flex-col"
style={{ minHeight: "100dvh" }}
>
<LanguageSwitcher />
<main className="flex flex-1 flex-col">
<Hero />
</main>
<footer
className="shrink-0 py-5 text-center text-[11px] text-neutral-400"
style={{ paddingBottom: "max(1.25rem, var(--safe-bottom))" }}
>
{t.copyright.replace("{year}", String(year))}
</footer>
</div>
<>
<LanguageSwitcher className="text-slate-300" />
<Hero />
</>
);
}

View File

@ -67,13 +67,13 @@ export function LanguageSwitcher({ className = "" }: { className?: string }) {
/>
{visible ? (
<label className="relative z-10 mr-4 mt-2 inline-flex items-center gap-2 text-xs text-neutral-500">
<label className="relative z-10 mr-4 mt-2 inline-flex items-center gap-2 text-xs text-slate-400">
<span className="sr-only">{t.languageLabel}</span>
<select
value={locale}
onChange={(event) => setLocale(event.target.value as Locale)}
aria-label={t.languageLabel}
className="appearance-none rounded-lg border border-neutral-200 bg-white px-2.5 py-1.5 pr-7 text-xs font-medium text-neutral-700 shadow-sm outline-none transition hover:border-neutral-300 focus:border-neutral-400"
className="appearance-none rounded-lg border border-white/10 bg-[#111827]/90 px-2.5 py-1.5 pr-7 text-xs font-medium text-slate-200 shadow-sm outline-none backdrop-blur transition hover:border-white/20 focus:border-teal-400/40"
style={{
backgroundImage:
"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a3a3a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E\")",

View File

@ -1,106 +1,366 @@
"use client";
import Link from "next/link";
import { ChevronRight } from "lucide-react";
import { ENTRY_CARDS } from "~/lib/data";
import { useLocale } from "~/components/locale-provider";
import { useEffect, useRef } from "react";
const CARD_STYLE = {
blue: {
border: "border-blue-200/80",
bar: "bg-blue-500",
emoji: "bg-blue-50",
const PORTALS = [
{
id: "nav",
href: "https://nav.hackrobot.cn/",
emoji: "🧭",
name: "出海导航",
main: false,
},
emerald: {
border: "border-emerald-200/80",
bar: "bg-emerald-500",
emoji: "bg-emerald-50",
{
id: "book",
href: "https://nomadweb.nomadro.com/book",
emoji: "📖",
name: "数字游民小册",
main: false,
},
rose: {
border: "border-rose-200/80",
bar: "bg-rose-500",
emoji: "bg-rose-50",
{
id: "community",
href: "https://nomadweb.nomadro.com",
emoji: "🌏",
name: "旅居社群",
main: true,
},
} as const;
export function Hero() {
const { t } = useLocale();
] as const;
function LogoIcon() {
return (
<section
className="flex flex-1 flex-col justify-center px-5 pb-8"
style={{
paddingTop: "max(2rem, calc(1.5rem + var(--safe-top)))",
paddingBottom: "max(2rem, calc(1.5rem + var(--safe-bottom)))",
}}
>
<div className="mx-auto w-full max-w-md sm:max-w-lg">
<div className="text-center">
<h1 className="text-[2rem] font-bold leading-tight sm:text-5xl">
<span className="text-gradient">{t.brandSubtitle}</span>
</h1>
<p className="mt-2 text-lg font-medium tracking-[0.2em] text-neutral-400 sm:text-xl">
nomadro
</p>
<p className="mx-auto mt-4 max-w-xs text-[13px] leading-relaxed text-neutral-500 sm:max-w-sm sm:text-sm">
{t.heroTagline}
<br />
{t.heroTaglineLine2}
</p>
</div>
<div className="mt-10 flex flex-col gap-3">
{ENTRY_CARDS.map((card) => {
const style = CARD_STYLE[card.accent];
const copy = t.entryCards[card.id] ?? {
label: card.label,
title: card.title,
description: card.description,
};
return (
<Link
key={card.id}
href={card.href}
target="_blank"
rel="noopener noreferrer"
className={`group relative flex items-center gap-3.5 overflow-hidden rounded-2xl border bg-white p-4 shadow-sm transition-all active:scale-[0.98] active:shadow-none sm:gap-4 sm:p-5 ${style.border}`}
>
<span
className={`absolute left-0 top-0 h-full w-1 ${style.bar}`}
/>
<span
className={`flex h-12 w-12 shrink-0 items-center justify-center rounded-xl text-2xl ${style.emoji}`}
>
{card.emoji}
</span>
<div className="min-w-0 flex-1 pr-1">
<div className="flex flex-wrap items-center gap-x-2 gap-y-0.5">
<h2 className="text-[15px] font-semibold text-neutral-900 sm:text-base">
{copy.label}
</h2>
{card.id === "live" && (
<span className="rounded bg-rose-500 px-1.5 py-px text-[10px] font-semibold leading-4 text-white">
{t.liveBadge}
</span>
)}
</div>
<p className="mt-0.5 text-sm font-medium text-neutral-700">
{copy.title}
</p>
<p className="mt-1 line-clamp-2 text-xs leading-relaxed text-neutral-400">
{copy.description}
</p>
</div>
<ChevronRight className="h-5 w-5 shrink-0 text-neutral-300" />
</Link>
);
})}
</div>
</div>
</section>
<svg className="hub-logo-icon" viewBox="0 0 40 40" fill="none" aria-hidden>
<circle cx="20" cy="20" r="18" stroke="url(#hubLogoGrad)" strokeWidth="2.5" />
<path
d="M12 22c4-8 12-8 16 0"
stroke="url(#hubLogoGrad)"
strokeWidth="2"
strokeLinecap="round"
/>
<circle cx="28" cy="14" r="3" fill="url(#hubLogoGrad)" />
<defs>
<linearGradient id="hubLogoGrad" x1="0" y1="0" x2="40" y2="40">
<stop offset="0%" stopColor="#FF6B6B" />
<stop offset="50%" stopColor="#FFE66D" />
<stop offset="100%" stopColor="#4ECDC4" />
</linearGradient>
</defs>
</svg>
);
}
function GlobeVisual() {
return (
<div className="hub-globe-container">
<svg
className="hub-globe-svg"
viewBox="0 0 400 400"
xmlns="http://www.w3.org/2000/svg"
aria-hidden
>
<defs>
<radialGradient id="hubGlobeGlow" cx="50%" cy="50%" r="50%">
<stop offset="0%" stopColor="#4ECDC4" stopOpacity="0.3" />
<stop offset="100%" stopColor="#4ECDC4" stopOpacity="0" />
</radialGradient>
<linearGradient id="hubOrbitGrad" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stopColor="#FF6B6B" />
<stop offset="100%" stopColor="#4ECDC4" />
</linearGradient>
</defs>
<circle cx="200" cy="200" r="160" fill="url(#hubGlobeGlow)" />
<circle
cx="200"
cy="200"
r="120"
fill="none"
stroke="rgba(78,205,196,0.2)"
strokeWidth="1"
/>
<circle
cx="200"
cy="200"
r="90"
fill="none"
stroke="rgba(78,205,196,0.15)"
strokeWidth="1"
/>
<ellipse
cx="200"
cy="200"
rx="120"
ry="40"
fill="none"
stroke="rgba(78,205,196,0.3)"
strokeWidth="1.5"
className="hub-orbit-ring"
/>
<ellipse
cx="200"
cy="200"
rx="40"
ry="120"
fill="none"
stroke="rgba(255,107,107,0.3)"
strokeWidth="1.5"
className="hub-orbit-ring hub-orbit-ring-2"
/>
<path
d="M160 140 Q180 130 200 135 Q220 128 240 140 Q250 155 245 170 Q235 185 220 190 Q200 195 185 188 Q165 180 160 165 Z"
fill="rgba(78,205,196,0.4)"
className="hub-continent"
/>
<path
d="M130 210 Q145 200 160 215 Q155 235 140 240 Q125 235 130 210 Z"
fill="rgba(78,205,196,0.3)"
className="hub-continent"
/>
<path
d="M250 200 Q270 195 280 210 Q275 230 260 235 Q245 228 250 200 Z"
fill="rgba(78,205,196,0.35)"
className="hub-continent"
/>
<circle cx="180" cy="155" r="5" fill="#FF6B6B" className="hub-pulse-dot" />
<circle cx="260" cy="215" r="5" fill="#FFE66D" className="hub-pulse-dot" />
<circle cx="145" cy="225" r="5" fill="#4ECDC4" className="hub-pulse-dot" />
<path
d="M180 155 Q220 140 260 215"
fill="none"
stroke="url(#hubOrbitGrad)"
strokeWidth="2"
strokeDasharray="6 4"
className="hub-flight-path"
/>
</svg>
<div className="hub-floating-cards" aria-hidden>
<div className="hub-float-card hub-fc-1">🏝️ 巴厘岛</div>
<div className="hub-float-card hub-fc-2">☕ 里斯本</div>
<div className="hub-float-card hub-fc-3">🏔️ 清迈</div>
</div>
</div>
);
}
function ParticleCanvas() {
const canvasRef = useRef<HTMLCanvasElement>(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 (
<canvas
ref={canvasRef}
id="particle-canvas"
className="hub-particle-canvas"
aria-hidden
/>
);
}
function HubLoader() {
const ref = useRef<HTMLDivElement>(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 (
<div className="hub-loader" ref={ref} id="loader">
<div className="hub-loader-inner">
<svg className="hub-loader-globe" viewBox="0 0 80 80" fill="none" aria-hidden>
<circle
cx="40"
cy="40"
r="35"
stroke="url(#hubLoaderGrad)"
strokeWidth="3"
strokeDasharray="60 160"
className="hub-loader-ring"
/>
<defs>
<linearGradient id="hubLoaderGrad" x1="0" y1="0" x2="80" y2="80">
<stop offset="0%" stopColor="#FF6B6B" />
<stop offset="100%" stopColor="#4ECDC4" />
</linearGradient>
</defs>
</svg>
<p className="hub-loader-text">nomadro</p>
</div>
</div>
);
}
export function Hero() {
const navRef = useRef<HTMLElement>(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 (
<div className="hub-root">
<HubLoader />
<ParticleCanvas />
<header className="hub-navbar" id="navbar" ref={navRef}>
<div className="hub-nav-container">
<a href="/" className="hub-logo">
<LogoIcon />
<span>nomadro</span>
</a>
</div>
</header>
<main>
<section className="hub-hero">
<div className="hub-hero-bg-shapes" aria-hidden>
<div className="hub-shape hub-shape-1" />
<div className="hub-shape hub-shape-2" />
<div className="hub-shape hub-shape-3" />
</div>
<div className="hub-hero-inner">
<h1 className="hub-hero-title hub-reveal">
随处工作
<br />
<span className="hub-gradient-text">自由生活</span>
</h1>
<div className="hub-hero-visual hub-reveal">
<GlobeVisual />
</div>
<div className="hub-portal-grid hub-reveal">
{PORTALS.map((portal) => (
<a
key={portal.id}
className={`hub-portal-card${portal.main ? " hub-portal-card--main" : ""}`}
href={portal.href}
target="_blank"
rel="noopener noreferrer"
>
<span className="hub-portal-ico" aria-hidden>
{portal.emoji}
</span>
<span className="hub-portal-name">{portal.name}</span>
</a>
))}
</div>
</div>
</section>
</main>
</div>
);
}