Mount nav/book/community as native App Router routes in one Next process.
Replace reverse-proxy/iframe approach with @ebook/@community/@navmini imports under /nav /book /community so localhost:3000 serves all three products directly. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
d93a355fd5
commit
9928c5185b
11
app/book/admin/page.tsx
Normal file
11
app/book/admin/page.tsx
Normal file
@ -0,0 +1,11 @@
|
||||
import 'antd/dist/reset.css';
|
||||
import { AdminConsole } from '@ebook/components/AdminConsole';
|
||||
|
||||
export const metadata = {
|
||||
title: 'Admin Console',
|
||||
robots: { index: false, follow: false },
|
||||
};
|
||||
|
||||
export default function AdminPage() {
|
||||
return <AdminConsole />;
|
||||
}
|
||||
17
app/book/api/creem/checkout/route.ts
Normal file
17
app/book/api/creem/checkout/route.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { createCreemCheckout, isCreemConfigured } from '@ebook/lib/creem';
|
||||
|
||||
export async function POST() {
|
||||
if (!isCreemConfigured()) {
|
||||
return NextResponse.json({ ok: false, error: 'creem not configured' }, { status: 503 });
|
||||
}
|
||||
|
||||
try {
|
||||
const checkout = await createCreemCheckout();
|
||||
return NextResponse.json({ ok: true, checkoutUrl: checkout.checkoutUrl });
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : 'checkout failed';
|
||||
console.error('Creem checkout', message);
|
||||
return NextResponse.json({ ok: false, error: 'checkout failed' }, { status: 502 });
|
||||
}
|
||||
}
|
||||
88
app/book/api/creem/webhook/route.ts
Normal file
88
app/book/api/creem/webhook/route.ts
Normal file
@ -0,0 +1,88 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { verifyCreemSignature } from '@ebook/lib/creem';
|
||||
|
||||
// Creem webhook payload shape per docs
|
||||
// https://docs.creem.io/code/webhooks
|
||||
type CreemCheckoutObject = {
|
||||
id: string;
|
||||
object: 'checkout';
|
||||
request_id?: string;
|
||||
status: string;
|
||||
order?: {
|
||||
id: string;
|
||||
customer: string;
|
||||
product: string;
|
||||
amount: number;
|
||||
currency: string;
|
||||
status: string;
|
||||
};
|
||||
product?: { id: string; name: string };
|
||||
customer?: { id: string; email: string; name?: string };
|
||||
subscription?: { id: string; status: string };
|
||||
metadata?: Record<string, string>;
|
||||
};
|
||||
|
||||
type CreemWebhookEvent = {
|
||||
id: string;
|
||||
eventType: string;
|
||||
created_at: number;
|
||||
object: CreemCheckoutObject | Record<string, unknown>;
|
||||
};
|
||||
|
||||
export async function POST(req: Request) {
|
||||
const raw = await req.text();
|
||||
// Creem always uses "creem-signature" header (HMAC-SHA256)
|
||||
const signature = req.headers.get('creem-signature');
|
||||
|
||||
if (!verifyCreemSignature(raw, signature)) {
|
||||
console.warn('Creem webhook: invalid signature');
|
||||
return NextResponse.json({ ok: false }, { status: 401 });
|
||||
}
|
||||
|
||||
let payload: CreemWebhookEvent;
|
||||
try {
|
||||
payload = JSON.parse(raw) as CreemWebhookEvent;
|
||||
} catch {
|
||||
return NextResponse.json({ ok: false }, { status: 400 });
|
||||
}
|
||||
|
||||
const { eventType, object: obj } = payload;
|
||||
const checkout = obj as CreemCheckoutObject;
|
||||
|
||||
console.info('Creem webhook received', {
|
||||
id: payload.id,
|
||||
eventType,
|
||||
objectId: checkout.id,
|
||||
status: checkout.status,
|
||||
email: checkout.customer?.email,
|
||||
orderId: checkout.order?.id,
|
||||
amount: checkout.order?.amount,
|
||||
currency: checkout.order?.currency,
|
||||
});
|
||||
|
||||
switch (eventType) {
|
||||
case 'checkout.completed':
|
||||
// One-time ebook purchase confirmed — add post-purchase logic here
|
||||
// e.g. send download email, unlock content, record in DB
|
||||
console.info('Creem: checkout completed', {
|
||||
checkoutId: checkout.id,
|
||||
email: checkout.customer?.email,
|
||||
orderId: checkout.order?.id,
|
||||
});
|
||||
break;
|
||||
|
||||
case 'refund.created':
|
||||
console.info('Creem: refund created', { objectId: checkout.id });
|
||||
break;
|
||||
|
||||
case 'dispute.created':
|
||||
console.warn('Creem: dispute created', { objectId: checkout.id });
|
||||
break;
|
||||
|
||||
default:
|
||||
// subscription.* events — not relevant for one-time product, log and ignore
|
||||
break;
|
||||
}
|
||||
|
||||
return NextResponse.json({ ok: true });
|
||||
}
|
||||
35
app/book/api/feedback/route.ts
Normal file
35
app/book/api/feedback/route.ts
Normal file
@ -0,0 +1,35 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { getBook } from '@ebook/lib/book.server';
|
||||
import { getSiteConfig } from '@ebook/lib/site-config.server';
|
||||
|
||||
export async function POST(req: Request) {
|
||||
try {
|
||||
const body = (await req.json()) as { email?: string; message?: string };
|
||||
const message = body.message?.trim();
|
||||
if (!message || message.length < 4) {
|
||||
return NextResponse.json({ ok: false, error: 'message required' }, { status: 400 });
|
||||
}
|
||||
|
||||
const book = getBook();
|
||||
const site = getSiteConfig();
|
||||
const payload = {
|
||||
book: book.title,
|
||||
email: body.email?.trim() || '',
|
||||
message,
|
||||
at: new Date().toISOString(),
|
||||
};
|
||||
|
||||
const webhook = process.env.FEEDBACK_WEBHOOK_URL?.trim();
|
||||
if (webhook) {
|
||||
await fetch(webhook, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
}
|
||||
|
||||
return NextResponse.json({ ok: true });
|
||||
} catch {
|
||||
return NextResponse.json({ ok: false }, { status: 500 });
|
||||
}
|
||||
}
|
||||
27
app/book/api/pay/invoice/route.ts
Normal file
27
app/book/api/pay/invoice/route.ts
Normal file
@ -0,0 +1,27 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import {
|
||||
createSupportInvoice,
|
||||
isAllowedSupportAmount,
|
||||
isNowPaymentsConfigured,
|
||||
} from '@ebook/lib/nowpayments';
|
||||
|
||||
export async function POST(req: Request) {
|
||||
if (!isNowPaymentsConfigured()) {
|
||||
return NextResponse.json({ ok: false, error: 'payments not configured' }, { status: 503 });
|
||||
}
|
||||
|
||||
try {
|
||||
const body = (await req.json()) as { amount?: number };
|
||||
const amount = Number(body.amount);
|
||||
if (!isAllowedSupportAmount(amount)) {
|
||||
return NextResponse.json({ ok: false, error: 'invalid amount' }, { status: 400 });
|
||||
}
|
||||
|
||||
const invoice = await createSupportInvoice(amount);
|
||||
return NextResponse.json({ ok: true, invoiceUrl: invoice.invoiceUrl });
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : 'invoice failed';
|
||||
console.error('NOWPayments invoice', message);
|
||||
return NextResponse.json({ ok: false, error: 'invoice failed' }, { status: 502 });
|
||||
}
|
||||
}
|
||||
34
app/book/api/pay/ipn/route.ts
Normal file
34
app/book/api/pay/ipn/route.ts
Normal file
@ -0,0 +1,34 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { verifyIpnSignature } from '@ebook/lib/nowpayments';
|
||||
|
||||
export async function POST(req: Request) {
|
||||
const raw = await req.text();
|
||||
const signature = req.headers.get('x-nowpayments-sig');
|
||||
|
||||
if (!verifyIpnSignature(raw, signature)) {
|
||||
return NextResponse.json({ ok: false }, { status: 401 });
|
||||
}
|
||||
|
||||
try {
|
||||
const payload = JSON.parse(raw) as {
|
||||
payment_status?: string;
|
||||
order_id?: string;
|
||||
price_amount?: number;
|
||||
pay_currency?: string;
|
||||
actually_paid?: number;
|
||||
invoice_id?: string | number;
|
||||
};
|
||||
console.info('NOWPayments IPN', {
|
||||
status: payload.payment_status,
|
||||
orderId: payload.order_id,
|
||||
amount: payload.price_amount,
|
||||
payCurrency: payload.pay_currency,
|
||||
paid: payload.actually_paid,
|
||||
invoiceId: payload.invoice_id,
|
||||
});
|
||||
} catch {
|
||||
return NextResponse.json({ ok: false }, { status: 400 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ ok: true });
|
||||
}
|
||||
61
app/book/layout.tsx
Normal file
61
app/book/layout.tsx
Normal file
@ -0,0 +1,61 @@
|
||||
import { AntdRegistry } from "@ant-design/nextjs-registry";
|
||||
import { Providers } from "@ebook/components/Providers";
|
||||
import { getSiteConfig } from "@ebook/lib/site-config.server";
|
||||
import { getServerFeatures } from "@ebook/lib/features.server";
|
||||
import { getLocale } from "@ebook/lib/i18n/server";
|
||||
import "@ebook/app/globals.css";
|
||||
|
||||
export default async function BookLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const locale = await getLocale();
|
||||
const site = getSiteConfig();
|
||||
const f = getServerFeatures();
|
||||
|
||||
return (
|
||||
<div className="ebook-root" data-locale={locale}>
|
||||
<AntdRegistry>
|
||||
<Providers locale={locale}>
|
||||
{f.analytics.enabled ? <AnalyticsLazy /> : null}
|
||||
{f.ads.enabled && f.ads.clientId ? <AdSenseLazy /> : null}
|
||||
{children}
|
||||
{f.feedback.enabled ? (
|
||||
<FeedbackLazy
|
||||
title={f.feedback.title}
|
||||
subtitle={f.feedback.subtitle}
|
||||
contactEmail={site.brand.contactEmail}
|
||||
xHandle={site.brand.xHandle}
|
||||
/>
|
||||
) : null}
|
||||
</Providers>
|
||||
</AntdRegistry>
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `window.__EBOOK_FEATURES__=${JSON.stringify(f).replace(/</g, "\\u003c")};window.__LOCALE__=${JSON.stringify(locale)};`,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function AnalyticsLazy() {
|
||||
const { AnalyticsProvider } = require("@ebook/components/AnalyticsProvider");
|
||||
return <AnalyticsProvider />;
|
||||
}
|
||||
|
||||
function AdSenseLazy() {
|
||||
const { AdSenseScript } = require("@ebook/components/AdSlot");
|
||||
return <AdSenseScript />;
|
||||
}
|
||||
|
||||
function FeedbackLazy(props: {
|
||||
title: string;
|
||||
subtitle: string;
|
||||
contactEmail: string;
|
||||
xHandle: string;
|
||||
}) {
|
||||
const { FeedbackPanel } = require("@ebook/components/FeedbackPanel");
|
||||
return <FeedbackPanel {...props} />;
|
||||
}
|
||||
98
app/book/opengraph-image.tsx
Normal file
98
app/book/opengraph-image.tsx
Normal file
@ -0,0 +1,98 @@
|
||||
import { ImageResponse } from 'next/og';
|
||||
import { getBook } from '@ebook/lib/book.server';
|
||||
|
||||
export const runtime = 'nodejs';
|
||||
export const dynamic = 'force-dynamic';
|
||||
export const alt = 'Ebook cover';
|
||||
export const size = { width: 1200, height: 630 };
|
||||
export const contentType = 'image/png';
|
||||
|
||||
async function loadFont() {
|
||||
const urls = [
|
||||
'https://cdn.jsdelivr.net/fontsource/fonts/noto-sans-sc@5.0.0/chinese-simplified-700-normal.woff',
|
||||
'https://fonts.gstatic.com/s/inter/v13/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuFuYAZ9hiJ-Ek-_EeA.woff2',
|
||||
];
|
||||
for (const url of urls) {
|
||||
try {
|
||||
const res = await fetch(url, { cache: 'force-cache' });
|
||||
if (res.ok) return { data: await res.arrayBuffer(), name: url.includes('noto') ? 'Noto Sans SC' : 'Inter' };
|
||||
} catch {
|
||||
/* try next */
|
||||
}
|
||||
}
|
||||
const inter = await fetch(
|
||||
'https://fonts.gstatic.com/s/inter/v13/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuFuYAZ9hiJ-Ek-_EeA.woff2'
|
||||
);
|
||||
return { data: await inter.arrayBuffer(), name: 'Inter' };
|
||||
}
|
||||
|
||||
export default async function OgImage() {
|
||||
const book = getBook();
|
||||
const font = await loadFont();
|
||||
|
||||
return new ImageResponse(
|
||||
(
|
||||
<div
|
||||
style={{
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'space-between',
|
||||
padding: '56px 64px',
|
||||
background: 'linear-gradient(135deg, #1a0b2e 0%, #5b21b6 42%, #db2777 78%, #ea580c 100%)',
|
||||
color: '#fff',
|
||||
fontFamily: font ? font.name : 'sans-serif',
|
||||
}}
|
||||
>
|
||||
<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap' }}>
|
||||
{book.viralTags.slice(0, 4).map((tag) => (
|
||||
<span
|
||||
key={tag}
|
||||
style={{
|
||||
fontSize: 22,
|
||||
padding: '8px 18px',
|
||||
borderRadius: 999,
|
||||
background: 'rgba(255,255,255,0.14)',
|
||||
border: '1px solid rgba(255,255,255,0.22)',
|
||||
}}
|
||||
>
|
||||
#{tag}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
|
||||
<div style={{ fontSize: 28, opacity: 0.75, letterSpacing: 4 }}>FREE EBOOK</div>
|
||||
<div style={{ fontSize: 72, fontWeight: 700, lineHeight: 1.1, maxWidth: 980 }}>
|
||||
{book.title}
|
||||
</div>
|
||||
<div style={{ fontSize: 34, opacity: 0.88, maxWidth: 900 }}>{book.subtitle}</div>
|
||||
<div style={{ fontSize: 26, opacity: 0.72, maxWidth: 860 }}>{book.tagline}</div>
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end' }}>
|
||||
<div style={{ fontSize: 24, opacity: 0.7 }}>
|
||||
{book.chapters.length} 章 · 约 {book.readingMinutes} 分钟 · by {book.author}
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
fontSize: 22,
|
||||
padding: '14px 28px',
|
||||
borderRadius: 999,
|
||||
background: '#fff',
|
||||
color: '#4c1d95',
|
||||
fontWeight: 700,
|
||||
}}
|
||||
>
|
||||
点击免费阅读 →
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
{
|
||||
...size,
|
||||
fonts: [{ name: font.name, data: font.data, style: 'normal', weight: 700 }],
|
||||
}
|
||||
);
|
||||
}
|
||||
31
app/book/page.tsx
Normal file
31
app/book/page.tsx
Normal file
@ -0,0 +1,31 @@
|
||||
import type { Metadata } from 'next';
|
||||
import { getAllChapters, getBook } from '@ebook/lib/book.server';
|
||||
import { CoverPage } from '@ebook/components/CoverPage';
|
||||
import { buildBookMetadata } from '@ebook/lib/metadata';
|
||||
import { getSiteConfig, getAdSlot } from '@ebook/lib/site-config.server';
|
||||
import { getServerFeatures } from '@ebook/lib/features.server';
|
||||
import { getLocale } from '@ebook/lib/i18n/server';
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const locale = await getLocale();
|
||||
return buildBookMetadata(locale);
|
||||
}
|
||||
|
||||
export default async function HomePage() {
|
||||
const locale = await getLocale();
|
||||
const book = getBook(locale);
|
||||
const site = getSiteConfig();
|
||||
const f = getServerFeatures();
|
||||
const chapterMinutes = Object.fromEntries(
|
||||
getAllChapters(locale).map((chapter) => [chapter.slug, chapter.readingMinutes])
|
||||
);
|
||||
|
||||
return (
|
||||
<CoverPage
|
||||
book={book}
|
||||
site={site}
|
||||
chapterMinutes={chapterMinutes}
|
||||
coverAdSlot={f.ads.enabled ? getAdSlot('coverSlot') : ''}
|
||||
/>
|
||||
);
|
||||
}
|
||||
10
app/book/purchase/thanks/page.tsx
Normal file
10
app/book/purchase/thanks/page.tsx
Normal file
@ -0,0 +1,10 @@
|
||||
import { PurchaseThanksContent } from '@ebook/components/SupportThanksContent';
|
||||
|
||||
export const metadata = {
|
||||
title: 'Thank you for your purchase',
|
||||
robots: { index: false, follow: false },
|
||||
};
|
||||
|
||||
export default function PurchaseThanksPage() {
|
||||
return <PurchaseThanksContent />;
|
||||
}
|
||||
30
app/book/read/[slug]/page.tsx
Normal file
30
app/book/read/[slug]/page.tsx
Normal file
@ -0,0 +1,30 @@
|
||||
import { notFound, redirect } from 'next/navigation';
|
||||
import { getChapter, getChapterSlugs } from '@ebook/lib/book.server';
|
||||
import { buildChapterMetadata } from '@ebook/lib/metadata';
|
||||
import { getLocale } from '@ebook/lib/i18n/server';
|
||||
|
||||
export function generateStaticParams() {
|
||||
return getChapterSlugs().map((slug) => ({ slug }));
|
||||
}
|
||||
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ slug: string }>;
|
||||
}) {
|
||||
const { slug } = await params;
|
||||
const locale = await getLocale();
|
||||
return buildChapterMetadata(slug, locale);
|
||||
}
|
||||
|
||||
export default async function ReadSlugRedirect({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ slug: string }>;
|
||||
}) {
|
||||
const { slug } = await params;
|
||||
const locale = await getLocale();
|
||||
const chapter = getChapter(slug, locale);
|
||||
if (!chapter) notFound();
|
||||
redirect(`/book/read#${slug}`);
|
||||
}
|
||||
49
app/book/read/opengraph-image.tsx
Normal file
49
app/book/read/opengraph-image.tsx
Normal file
@ -0,0 +1,49 @@
|
||||
import { ImageResponse } from 'next/og';
|
||||
import { getBook } from '@ebook/lib/book.server';
|
||||
|
||||
export const runtime = 'nodejs';
|
||||
export const dynamic = 'force-dynamic';
|
||||
export const alt = 'Read ebook';
|
||||
export const size = { width: 1200, height: 630 };
|
||||
export const contentType = 'image/png';
|
||||
|
||||
async function loadFont() {
|
||||
const res = await fetch(
|
||||
'https://fonts.gstatic.com/s/inter/v13/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuFuYAZ9hiJ-Ek-_EeA.woff2'
|
||||
);
|
||||
return { data: await res.arrayBuffer(), name: 'Inter' };
|
||||
}
|
||||
|
||||
export default async function ReadOgImage() {
|
||||
const book = getBook();
|
||||
const font = await loadFont();
|
||||
|
||||
return new ImageResponse(
|
||||
(
|
||||
<div
|
||||
style={{
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
padding: 64,
|
||||
background: 'linear-gradient(155deg, #120f1d, #4c1d95 55%, #db2777)',
|
||||
color: '#fff',
|
||||
fontFamily: font.name,
|
||||
}}
|
||||
>
|
||||
<div style={{ fontSize: 28, opacity: 0.7, marginBottom: 20 }}>正在阅读</div>
|
||||
<div style={{ fontSize: 64, fontWeight: 700, lineHeight: 1.15 }}>{book.title}</div>
|
||||
<div style={{ fontSize: 30, opacity: 0.85, marginTop: 16 }}>{book.tagline}</div>
|
||||
<div style={{ fontSize: 22, opacity: 0.65, marginTop: 32 }}>
|
||||
连续滚动 · {book.chapters.length} 章 · 沉浸阅读体验
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
{
|
||||
...size,
|
||||
fonts: [{ name: font.name, data: font.data, style: 'normal', weight: 700 }],
|
||||
}
|
||||
);
|
||||
}
|
||||
31
app/book/read/page.tsx
Normal file
31
app/book/read/page.tsx
Normal file
@ -0,0 +1,31 @@
|
||||
import { getBook, getAllChapters } from '@ebook/lib/book.server';
|
||||
import { ScrollReaderShell } from '@ebook/components/ScrollReaderShell';
|
||||
import { buildBookMetadata } from '@ebook/lib/metadata';
|
||||
import { getAdSlot } from '@ebook/lib/site-config.server';
|
||||
import { getServerFeatures } from '@ebook/lib/features.server';
|
||||
import { getLocale } from '@ebook/lib/i18n/server';
|
||||
import type { Metadata } from 'next';
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const locale = await getLocale();
|
||||
return buildBookMetadata(locale);
|
||||
}
|
||||
|
||||
export default async function ScrollReadPage() {
|
||||
const locale = await getLocale();
|
||||
const book = getBook(locale);
|
||||
const chapters = getAllChapters(locale);
|
||||
const f = getServerFeatures();
|
||||
|
||||
return (
|
||||
<ScrollReaderShell
|
||||
book={book}
|
||||
chapters={chapters}
|
||||
affiliateRules={f.affiliate.enabled ? f.affiliate.rules : []}
|
||||
adSlots={{
|
||||
mid: f.ads.enabled ? getAdSlot('readerMidSlot') : '',
|
||||
end: f.ads.enabled ? getAdSlot('readerEndSlot') : '',
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
10
app/book/support/thanks/page.tsx
Normal file
10
app/book/support/thanks/page.tsx
Normal file
@ -0,0 +1,10 @@
|
||||
import { SupportThanksContent } from '@ebook/components/SupportThanksContent';
|
||||
|
||||
export const metadata = {
|
||||
title: 'Thank you — Support',
|
||||
robots: { index: false, follow: false },
|
||||
};
|
||||
|
||||
export default function SupportThanksPage() {
|
||||
return <SupportThanksContent />;
|
||||
}
|
||||
11
app/community/about/page.tsx
Normal file
11
app/community/about/page.tsx
Normal file
@ -0,0 +1,11 @@
|
||||
import type { Metadata } from "next";
|
||||
import AboutClient from "@community/components/AboutClient";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "关于 nomadro · About",
|
||||
description: "nomadro —— 用一行代码环游世界,数字游民旅居指南",
|
||||
};
|
||||
|
||||
export default function AboutPage() {
|
||||
return <AboutClient />;
|
||||
}
|
||||
20
app/community/ai/page.tsx
Normal file
20
app/community/ai/page.tsx
Normal file
@ -0,0 +1,20 @@
|
||||
import type { Metadata } from "next";
|
||||
import { api } from "@community/lib/api";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import AiAssistantClient from "@community/components/AiAssistantClient";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "AI 旅居助手 · nomadro",
|
||||
description: "智能推荐下一站游民城市",
|
||||
};
|
||||
|
||||
export const revalidate = 60;
|
||||
|
||||
export default async function AiPage() {
|
||||
const destinations = await api.getDestinations().catch(() => []);
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<AiAssistantClient destinations={destinations} />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
27
app/community/blog/[slug]/page.tsx
Normal file
27
app/community/blog/[slug]/page.tsx
Normal file
@ -0,0 +1,27 @@
|
||||
import { api } from "@community/lib/api";
|
||||
import { notFound } from "next/navigation";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import BlogReadingProgress from "@community/components/BlogReadingProgress";
|
||||
import BlogDetailClient from "@community/components/BlogDetailClient";
|
||||
|
||||
export default async function BlogDetailPage({ params }: { params: Promise<{ slug: string }> }) {
|
||||
const { slug } = await params;
|
||||
let post;
|
||||
let allPosts;
|
||||
try {
|
||||
[post, allPosts] = await Promise.all([api.getBlogPost(slug), api.getBlog()]);
|
||||
} catch {
|
||||
notFound();
|
||||
}
|
||||
|
||||
const related = allPosts
|
||||
.filter((p) => p.slug !== slug && p.tags.some((tag) => post.tags.includes(tag)))
|
||||
.slice(0, 3);
|
||||
|
||||
return (
|
||||
<SiteShell>
|
||||
<BlogReadingProgress />
|
||||
<BlogDetailClient post={post} related={related} />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
3187
app/community/book/ebook-globals.css
Normal file
3187
app/community/book/ebook-globals.css
Normal file
File diff suppressed because it is too large
Load Diff
64
app/community/book/layout.tsx
Normal file
64
app/community/book/layout.tsx
Normal file
@ -0,0 +1,64 @@
|
||||
import type { Metadata } from "next";
|
||||
import { AntdRegistry } from "@ant-design/nextjs-registry";
|
||||
import { Providers } from "@community/components/ebook/Providers";
|
||||
import { buildBookMetadata } from "@community/lib/ebook/metadata";
|
||||
import { getSiteConfig } from "@community/lib/ebook/site-config.server";
|
||||
import { getServerFeatures } from "@community/lib/ebook/features.server";
|
||||
import { getLocale } from "@community/lib/ebook/i18n/server";
|
||||
import "./ebook-globals.css";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const locale = await getLocale();
|
||||
return buildBookMetadata(locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Book section is a self-contained surface inside nomadweb:
|
||||
* - Own visual system (ebook-globals), isolated under .ebook-section
|
||||
* - Locale bridged with main-site cookie/localStorage via getLocale + LocaleProvider
|
||||
* - Theme driven by ThemeProvider on <html> (not a forced .dark wrapper)
|
||||
* - No main Navbar / SiteShell — immersive like book.nomadro.com
|
||||
* - Entry from main nav `/book`; escape via cover "← nomadro"
|
||||
*/
|
||||
export default async function BookLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const locale = await getLocale();
|
||||
const site = getSiteConfig();
|
||||
const f = getServerFeatures();
|
||||
|
||||
return (
|
||||
<div className="ebook-section" data-ebook-root>
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `window.__EBOOK_FEATURES__=${JSON.stringify(f).replace(/</g, "\\u003c")};window.__LOCALE__=${JSON.stringify(locale)};(function(){try{var t=localStorage.getItem("theme");if(t==="light"||t==="sepia"||t==="dark"){document.documentElement.classList.remove("light","dark","sepia");document.documentElement.classList.add(t);}else{document.documentElement.classList.add("dark");}}catch(e){document.documentElement.classList.add("dark");}document.documentElement.style.scrollPaddingTop="0";})();`,
|
||||
}}
|
||||
/>
|
||||
<AntdRegistry>
|
||||
<Providers locale={locale}>
|
||||
{children}
|
||||
{f.feedback.enabled && (
|
||||
<FeedbackLazy
|
||||
title={f.feedback.title}
|
||||
subtitle={f.feedback.subtitle}
|
||||
contactEmail={site.brand.contactEmail}
|
||||
xHandle={site.brand.xHandle}
|
||||
/>
|
||||
)}
|
||||
</Providers>
|
||||
</AntdRegistry>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function FeedbackLazy(props: {
|
||||
title: string;
|
||||
subtitle: string;
|
||||
contactEmail: string;
|
||||
xHandle: string;
|
||||
}) {
|
||||
const { FeedbackPanel } = require("@community/components/ebook/FeedbackPanel");
|
||||
return <FeedbackPanel {...props} />;
|
||||
}
|
||||
7
app/community/book/loading.tsx
Normal file
7
app/community/book/loading.tsx
Normal file
@ -0,0 +1,7 @@
|
||||
export default function BookLoading() {
|
||||
return (
|
||||
<div className="ebook-section" data-ebook-root style={{ minHeight: "100vh", display: "grid", placeItems: "center" }}>
|
||||
<p style={{ color: "#b4a9c8", fontSize: "0.9rem", letterSpacing: "0.08em" }}>…</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
98
app/community/book/opengraph-image.tsx
Normal file
98
app/community/book/opengraph-image.tsx
Normal file
@ -0,0 +1,98 @@
|
||||
import { ImageResponse } from "next/og";
|
||||
import { getBook } from "@community/lib/ebook/book.server";
|
||||
|
||||
export const runtime = "nodejs";
|
||||
export const dynamic = "force-dynamic";
|
||||
export const alt = "Ebook cover";
|
||||
export const size = { width: 1200, height: 630 };
|
||||
export const contentType = "image/png";
|
||||
|
||||
async function loadFont() {
|
||||
const urls = [
|
||||
"https://cdn.jsdelivr.net/fontsource/fonts/noto-sans-sc@5.0.0/chinese-simplified-700-normal.woff",
|
||||
"https://fonts.gstatic.com/s/inter/v13/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuFuYAZ9hiJ-Ek-_EeA.woff2",
|
||||
];
|
||||
for (const url of urls) {
|
||||
try {
|
||||
const res = await fetch(url, { cache: "force-cache" });
|
||||
if (res.ok) return { data: await res.arrayBuffer(), name: url.includes("noto") ? "Noto Sans SC" : "Inter" };
|
||||
} catch {
|
||||
/* try next */
|
||||
}
|
||||
}
|
||||
const inter = await fetch(
|
||||
"https://fonts.gstatic.com/s/inter/v13/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuFuYAZ9hiJ-Ek-_EeA.woff2"
|
||||
);
|
||||
return { data: await inter.arrayBuffer(), name: "Inter" };
|
||||
}
|
||||
|
||||
export default async function OgImage() {
|
||||
const book = getBook();
|
||||
const font = await loadFont();
|
||||
|
||||
return new ImageResponse(
|
||||
(
|
||||
<div
|
||||
style={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
justifyContent: "space-between",
|
||||
padding: "56px 64px",
|
||||
background: "linear-gradient(135deg, #1a0b2e 0%, #5b21b6 42%, #db2777 78%, #ea580c 100%)",
|
||||
color: "#fff",
|
||||
fontFamily: font ? font.name : "sans-serif",
|
||||
}}
|
||||
>
|
||||
<div style={{ display: "flex", gap: 12, flexWrap: "wrap" }}>
|
||||
{book.viralTags.slice(0, 4).map((tag) => (
|
||||
<span
|
||||
key={tag}
|
||||
style={{
|
||||
fontSize: 22,
|
||||
padding: "8px 18px",
|
||||
borderRadius: 999,
|
||||
background: "rgba(255,255,255,0.14)",
|
||||
border: "1px solid rgba(255,255,255,0.22)",
|
||||
}}
|
||||
>
|
||||
#{tag}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div style={{ display: "flex", flexDirection: "column", gap: 16 }}>
|
||||
<div style={{ fontSize: 28, opacity: 0.75, letterSpacing: 4 }}>FREE EBOOK</div>
|
||||
<div style={{ fontSize: 72, fontWeight: 700, lineHeight: 1.1, maxWidth: 980 }}>
|
||||
{book.title}
|
||||
</div>
|
||||
<div style={{ fontSize: 34, opacity: 0.88, maxWidth: 900 }}>{book.subtitle}</div>
|
||||
<div style={{ fontSize: 26, opacity: 0.72, maxWidth: 860 }}>{book.tagline}</div>
|
||||
</div>
|
||||
|
||||
<div style={{ display: "flex", justifyContent: "space-between", alignItems: "flex-end" }}>
|
||||
<div style={{ fontSize: 24, opacity: 0.7 }}>
|
||||
{book.chapters.length} 章 · 约 {book.readingMinutes} 分钟 · by {book.author}
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
fontSize: 22,
|
||||
padding: "14px 28px",
|
||||
borderRadius: 999,
|
||||
background: "#fff",
|
||||
color: "#4c1d95",
|
||||
fontWeight: 700,
|
||||
}}
|
||||
>
|
||||
点击免费阅读 →
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
{
|
||||
...size,
|
||||
fonts: [{ name: font.name, data: font.data, style: "normal" as const, weight: 700 }],
|
||||
}
|
||||
);
|
||||
}
|
||||
31
app/community/book/page.tsx
Normal file
31
app/community/book/page.tsx
Normal file
@ -0,0 +1,31 @@
|
||||
import type { Metadata } from "next";
|
||||
import { getAllChapters, getBook } from "@community/lib/ebook/book.server";
|
||||
import { CoverPage } from "@community/components/ebook/CoverPage";
|
||||
import { buildBookMetadata } from "@community/lib/ebook/metadata";
|
||||
import { getSiteConfig, getAdSlot } from "@community/lib/ebook/site-config.server";
|
||||
import { getServerFeatures } from "@community/lib/ebook/features.server";
|
||||
import { getLocale } from "@community/lib/ebook/i18n/server";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const locale = await getLocale();
|
||||
return buildBookMetadata(locale);
|
||||
}
|
||||
|
||||
export default async function BookCoverPage() {
|
||||
const locale = await getLocale();
|
||||
const book = getBook(locale);
|
||||
const site = getSiteConfig();
|
||||
const f = getServerFeatures();
|
||||
const chapterMinutes = Object.fromEntries(
|
||||
getAllChapters(locale).map((chapter) => [chapter.slug, chapter.readingMinutes])
|
||||
);
|
||||
|
||||
return (
|
||||
<CoverPage
|
||||
book={book}
|
||||
site={site}
|
||||
chapterMinutes={chapterMinutes}
|
||||
coverAdSlot={f.ads.enabled ? getAdSlot("coverSlot") : ""}
|
||||
/>
|
||||
);
|
||||
}
|
||||
31
app/community/book/read/[slug]/page.tsx
Normal file
31
app/community/book/read/[slug]/page.tsx
Normal file
@ -0,0 +1,31 @@
|
||||
import { notFound, redirect } from "next/navigation";
|
||||
import { getChapter, getChapterSlugs } from "@community/lib/ebook/book.server";
|
||||
import { buildChapterMetadata } from "@community/lib/ebook/metadata";
|
||||
import { getLocale } from "@community/lib/ebook/i18n/server";
|
||||
import { ebookPath } from "@community/lib/ebook/paths";
|
||||
|
||||
export function generateStaticParams() {
|
||||
return getChapterSlugs().map((slug) => ({ slug }));
|
||||
}
|
||||
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ slug: string }>;
|
||||
}) {
|
||||
const { slug } = await params;
|
||||
const locale = await getLocale();
|
||||
return buildChapterMetadata(slug, locale);
|
||||
}
|
||||
|
||||
export default async function ReadSlugRedirect({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ slug: string }>;
|
||||
}) {
|
||||
const { slug } = await params;
|
||||
const locale = await getLocale();
|
||||
const chapter = getChapter(slug, locale);
|
||||
if (!chapter) notFound();
|
||||
redirect(`${ebookPath("/read")}#${slug}`);
|
||||
}
|
||||
31
app/community/book/read/page.tsx
Normal file
31
app/community/book/read/page.tsx
Normal file
@ -0,0 +1,31 @@
|
||||
import { getBook, getAllChapters } from "@community/lib/ebook/book.server";
|
||||
import { ScrollReaderShell } from "@community/components/ebook/ScrollReaderShell";
|
||||
import { buildBookMetadata } from "@community/lib/ebook/metadata";
|
||||
import { getAdSlot } from "@community/lib/ebook/site-config.server";
|
||||
import { getServerFeatures } from "@community/lib/ebook/features.server";
|
||||
import { getLocale } from "@community/lib/ebook/i18n/server";
|
||||
import type { Metadata } from "next";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const locale = await getLocale();
|
||||
return buildBookMetadata(locale);
|
||||
}
|
||||
|
||||
export default async function BookReadPage() {
|
||||
const locale = await getLocale();
|
||||
const book = getBook(locale);
|
||||
const chapters = getAllChapters(locale);
|
||||
const f = getServerFeatures();
|
||||
|
||||
return (
|
||||
<ScrollReaderShell
|
||||
book={book}
|
||||
chapters={chapters}
|
||||
affiliateRules={f.affiliate.enabled ? f.affiliate.rules : []}
|
||||
adSlots={{
|
||||
mid: f.ads.enabled ? getAdSlot("readerMidSlot") : "",
|
||||
end: f.ads.enabled ? getAdSlot("readerEndSlot") : "",
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
137
app/community/book/thanks/page.tsx
Normal file
137
app/community/book/thanks/page.tsx
Normal file
@ -0,0 +1,137 @@
|
||||
"use client";
|
||||
|
||||
import { Suspense, useEffect, useMemo, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import { useAuth } from "@community/lib/auth";
|
||||
import { useI18n } from "@community/lib/i18n";
|
||||
import { api } from "@community/lib/api";
|
||||
|
||||
type DlFile = { format: string; label: string; url: string };
|
||||
|
||||
function isRealDownload(f: DlFile) {
|
||||
const fmt = (f.format || "").toLowerCase();
|
||||
return fmt === "pdf" || fmt === "epub" || (Boolean(f.url) && !f.url.startsWith("/book/read"));
|
||||
}
|
||||
|
||||
function BookThanksInner() {
|
||||
const { token } = useAuth();
|
||||
const { t } = useI18n();
|
||||
const b = t.bookThanks;
|
||||
const router = useRouter();
|
||||
const params = useSearchParams();
|
||||
const [status, setStatus] = useState<"checking" | "ok" | "pending" | "need-login">("checking");
|
||||
const [files, setFiles] = useState<DlFile[]>([]);
|
||||
const [msg, setMsg] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
if (!token) {
|
||||
setStatus("need-login");
|
||||
return;
|
||||
}
|
||||
const orderId = params.get("order_id") || localStorage.getItem("nomadro-ebook-order") || "";
|
||||
let cancelled = false;
|
||||
(async () => {
|
||||
try {
|
||||
if (orderId) {
|
||||
await api.completePayment(token, orderId).catch(() => null);
|
||||
}
|
||||
for (let i = 0; i < 5; i++) {
|
||||
if (cancelled) return;
|
||||
const st = await api.ebookStatus(token);
|
||||
if (st.owned) {
|
||||
const dl = await api.ebookDownloads(token);
|
||||
if (cancelled) return;
|
||||
setFiles(dl.files || []);
|
||||
setStatus("ok");
|
||||
localStorage.removeItem("nomadro-ebook-order");
|
||||
return;
|
||||
}
|
||||
await new Promise((r) => setTimeout(r, 1000));
|
||||
}
|
||||
if (!cancelled) {
|
||||
setStatus("pending");
|
||||
setMsg(b.pending);
|
||||
}
|
||||
} catch (e) {
|
||||
if (!cancelled) {
|
||||
setStatus("pending");
|
||||
setMsg(e instanceof Error ? e.message : b.statusFail);
|
||||
}
|
||||
}
|
||||
})();
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [token, params, b.pending, b.statusFail]);
|
||||
|
||||
const downloads = useMemo(() => files.filter(isRealDownload), [files]);
|
||||
const hasOnlineOnly = status === "ok" && downloads.length === 0;
|
||||
|
||||
return (
|
||||
<div className="container" style={{ padding: "48px 24px", maxWidth: 560 }}>
|
||||
<nav className="detail-nav">
|
||||
<Link href="/book">← {t.nav.ebook}</Link>
|
||||
</nav>
|
||||
<h1>{b.title}</h1>
|
||||
{status === "need-login" && (
|
||||
<p>
|
||||
{b.needLogin}{" "}
|
||||
<Link href="/community/login?next=/book/thanks">{t.nav.login}</Link>
|
||||
</p>
|
||||
)}
|
||||
{status === "checking" && <p>{b.checking}</p>}
|
||||
{status === "pending" && (
|
||||
<div>
|
||||
<p>{msg}</p>
|
||||
<button type="button" className="btn btn-primary" onClick={() => router.refresh()}>
|
||||
{b.refresh}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
{hasOnlineOnly && (
|
||||
<div>
|
||||
<p>{b.confirmedNoFiles}</p>
|
||||
<p className="section-desc">{b.confirmedHint}</p>
|
||||
<div className="dating-empty-actions">
|
||||
<Link href="/book/read" className="btn btn-primary">
|
||||
{b.continueRead}
|
||||
</Link>
|
||||
<Link href="/community/feedback" className="btn btn-ghost">
|
||||
{b.contact}
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{status === "ok" && downloads.length > 0 && (
|
||||
<div>
|
||||
<p>{b.ready}</p>
|
||||
<ul className="ebook-download-list">
|
||||
{downloads.map((f) => (
|
||||
<li key={f.format}>
|
||||
<a href={f.url} className="btn btn-primary btn-sm" target="_blank" rel="noreferrer">
|
||||
{f.label}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<p style={{ marginTop: 16 }}>
|
||||
<Link href="/book/read">{b.continueRead} →</Link>
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function BookThanksPage() {
|
||||
const { t } = useI18n();
|
||||
return (
|
||||
<SiteShell>
|
||||
<Suspense fallback={<div className="container" style={{ padding: 48 }}>{t.bookThanks.checking}</div>}>
|
||||
<BookThanksInner />
|
||||
</Suspense>
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
10
app/community/careers/page.tsx
Normal file
10
app/community/careers/page.tsx
Normal file
@ -0,0 +1,10 @@
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import StaticPage from "@community/components/StaticPage";
|
||||
import { STATIC_PAGES } from "@community/lib/staticPages";
|
||||
|
||||
const page = STATIC_PAGES.careers;
|
||||
export const metadata: Metadata = { title: `${page.title} · nomadro` };
|
||||
export default function CareersPage() {
|
||||
return <SiteShell showFooter><StaticPage page={page} /></SiteShell>;
|
||||
}
|
||||
526
app/community/changelog/page.tsx
Normal file
526
app/community/changelog/page.tsx
Normal file
@ -0,0 +1,526 @@
|
||||
import Link from "next/link";
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "更新日志 · nomadro",
|
||||
description: "nomadro 产品更新与功能迭代记录",
|
||||
};
|
||||
|
||||
const LOGS = [
|
||||
{
|
||||
date: "2026-09-04",
|
||||
tag: "转化/信任打磨",
|
||||
items: [
|
||||
"订阅条中英校验与说明;Join 保存资料后直达匹配;定价免费 CTA 改走完善资料",
|
||||
"VIP/电子书支付说明更诚实(支付宝微信、无文件时写清在线解锁);登录可接 Google(需配置 Client ID)",
|
||||
"移动端隐藏易裁切的 hero 浮卡;活动后下一步补齐私信入口",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-04",
|
||||
tag: "首页/关于页",
|
||||
items: [
|
||||
"首页恢复「游民一天」与「游民心声」区块,中英文化并直达七天指南/活动/社区",
|
||||
"关于页改为可切换语言,CTA 指向下一站、社区与旅居计划;静态帮助页主按钮高亮",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-04",
|
||||
tag: "学院/博客/社区/电子书",
|
||||
items: [
|
||||
"每日指南打通 7 天并中英导航;博客详情与电子书购买页中英文化",
|
||||
"社区回复支持 Ctrl+Enter、字数与滚动定位;点赞失败可提示;假下载改为在线阅读引导",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-04",
|
||||
tag: "全站闭环增强",
|
||||
items: [
|
||||
"签证向导中英文化 + 结果直达城市/计划/咨询;课程跨模块上下一课;岗位申请改走赏金页",
|
||||
"赏金申请通知发布者;视频去掉无效外链;探索导航增加游民地图入口",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-04",
|
||||
tag: "直播报名 · 私信角标",
|
||||
items: [
|
||||
"线上直播需登录并报名后进入;支持一键报名进房;显示活动时间;手机默认视频布局",
|
||||
"右上角私信图标显示未读数",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-04",
|
||||
tag: "直播 iframe 修复",
|
||||
items: [
|
||||
"修复 MiroTalk/Lounge 被上游 CSP 拦截导致直播页空白;可新窗口打开视频/聊天",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-04",
|
||||
tag: "匹配资料 · 报名日历",
|
||||
items: [
|
||||
"匹配卡片可「查看资料」;喜欢页标题改为中性「喜欢」",
|
||||
"线下报名成功自动下载日历;个人中心每场 RSVP 可加入日历",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-04",
|
||||
tag: "导航精简",
|
||||
items: [
|
||||
"私信与通知移出 Connect 菜单/页脚/个人中心快捷入口,统一用右上角 ✉️ / 🔔 图标进入",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-04",
|
||||
tag: "活动报名 · Connect 数据",
|
||||
items: [
|
||||
"报名成功 toast:线上/混合直达直播间,线下引导导出日历;报名确认写入通知箱",
|
||||
"个人中心新增 Connect 数据条(喜欢我的 / 互相喜欢 / 已报名),可点进对应页面",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-04",
|
||||
tag: "匹配资料 · 私信头",
|
||||
items: [
|
||||
"会员页支持候选档案 /members/u1,可回赞并直达聊天;私信线程显示对方头像与资料入口",
|
||||
"登录即注入匹配来赞与演示私信;会话 peer 字段规范化避免列表 500",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-04",
|
||||
tag: "匹配滑动 · 喜欢我的",
|
||||
items: [
|
||||
"匹配卡片支持左右/上滑手势与方向键;喜欢页区分「喜欢我的 / 我喜欢的」",
|
||||
"加入匹配时自动注入演示私信与来赞,讨论回复补全",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-04",
|
||||
tag: "匹配页修复",
|
||||
items: [
|
||||
"修复 /dating 因后端错误检查不存在的 _profiles 而一直卡在「一键加入匹配」",
|
||||
"登录后自动创建匹配资料并进入滑卡;VIP 状态读取同步修正",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-04",
|
||||
tag: "业务数据充实",
|
||||
items: [
|
||||
"目的地增至 12 城,签证/博客/活动/讨论/零活/岗位/视频/服务/会员地图全面扩容(均 10+)",
|
||||
"种子 12 个演示账号(密码 demo123)含收藏与旅居计划;修复社区空库不重灌的问题",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-03",
|
||||
tag: "城市工具决策出口",
|
||||
items: [
|
||||
"命运转盘、网速、住宿、机票、周末灵感、落地清单、城市笔记结果区可写入计划并深链活动",
|
||||
"落地清单 Meetup 任务直达同城活动;最近浏览补同城活动与计划入口;匹配器关闭清除 #matcher",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-03",
|
||||
tag: "工具转化 · 登录 CTA · 快捷键",
|
||||
items: [
|
||||
"启动金目标 / 签证停留倒计时可写入计划并深链城市;下一站加入计划区分已在行程",
|
||||
"登录成功 toast 可直达回流页;悬浮反馈支持 Esc;站内 M 键打开首页智能匹配(/#matcher)",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-03",
|
||||
tag: "登录回流 · 匹配器体验",
|
||||
items: [
|
||||
"登录页识别数字游民/视频/岗位/AI/下一站/地图等回流目标,不再误标成个人中心",
|
||||
"跑道计算器套用城市后可写入计划;首页智能匹配预加载 + 加载壳,支持 Esc 关闭",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-03",
|
||||
tag: "计算器 · 视频 · 分享回流",
|
||||
items: [
|
||||
"费用/对比/首月成本工具结果可写入计划并深链城市详情与同城活动",
|
||||
"视频详情按城市接活动环;岗位收藏 toast、分享复制 toast、私信空态补下一跳",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-03",
|
||||
tag: "报告 · 工具 · 发布回流",
|
||||
items: [
|
||||
"数据报告:快照 toast 去下一站;排名/会员城市深链计划与同城活动",
|
||||
"工具运行页结果旁增加计划/下一站/活动出口;afterTools 补活动环",
|
||||
"发布赏金/发起活动/报名/加入匹配成功 toast 接回数字游民、社区或匹配;课程末课接赏金与活动",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-03",
|
||||
tag: "对比 · 收藏 · 反馈回流",
|
||||
items: [
|
||||
"对比写入计划 / 收藏城市 / 个人中心收藏入计划:toast 可打开计划或我的收藏",
|
||||
"反馈、投稿、悬浮反馈成功后可去社区;视频稍后再看空态与收藏 toast 回流",
|
||||
"通知页登录门补活动与社区出口;旅居助手写入计划 toast 可打开计划中心",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-03",
|
||||
tag: "地图 · 匹配 · 会员资料",
|
||||
items: [
|
||||
"智能匹配 / 下一站 / 世界地图写入计划后 toast 可打开计划中心;地图面板增加同城活动",
|
||||
"会员资料与游民地图城市深链同城活动;加入资料 / 服务咨询成功 toast 接回匹配或社区",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-03",
|
||||
tag: "Toast CTA · Connect/Grow 出口",
|
||||
items: [
|
||||
"Toast 支持行动链接(写入计划/报名/发帖后可直达下一站);城市页加入计划可打开计划中心",
|
||||
"社区帖文识别城市名深链同城活动;匹配/私信空态与登录门增加活动与社区出口",
|
||||
"Grow 环:赏金→计划/活动,数字游民学院用 afterDigital 接回探索",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-03",
|
||||
tag: "Explore ↔ Connect 漏斗",
|
||||
items: [
|
||||
"城市页/对比/计划/下一站深链到同城活动;线上活动直达直播间",
|
||||
"对比胜出城市一键活动 + 计划;NextStop / Live / 计划 RingNext 按情境分流",
|
||||
"报名后展示同城社交建议;首页紧凑「接着探索」摘要(无足迹时隐藏)",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-03",
|
||||
tag: "工具箱 · AI 草稿",
|
||||
items: [
|
||||
"工具箱目录与分类标签支持中英切换;全局搜索工具结果随语言匹配",
|
||||
"页脚品牌标语与下一站预算单位接入 i18n;旅居助手提问草稿本机保存",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-03",
|
||||
tag: "智能匹配 · 首页 chrome",
|
||||
items: [
|
||||
"首页智能匹配向导步骤/选项/结果与写入计划 toast 全面中英文化",
|
||||
"快捷键帮助、游民小贴士、Cookie 条、新手引导、FAQ 空态接入 i18n",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-03",
|
||||
tag: "全局搜索 · 反馈 · 草稿",
|
||||
items: [
|
||||
"全局搜索:触发器/占位/结果类型与路径快捷入口全面中英文化",
|
||||
"悬浮反馈、分享/收藏按钮、地图加计划 toast、登录校验接入 i18n",
|
||||
"私信与服务咨询支持本机草稿;反馈 FAB 与反馈页共用草稿键",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-03",
|
||||
tag: "个人中心 · 计划导出",
|
||||
items: [
|
||||
"个人中心:成就徽章、统计、收藏/行程空态、快捷入口与头像提示全面中英文化",
|
||||
"旅居计划:Markdown/纯文本导出与签证字段标签随语言切换",
|
||||
"讨论回复支持本机草稿;匹配加入表单默认城市改为空白占位",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-03",
|
||||
tag: "城市深度 · 草稿 · 计划",
|
||||
items: [
|
||||
"城市详情深度区块(指南/画像/成本/评价等)全面中英文化;快照模板随语言切换",
|
||||
"发起活动与意见反馈表单支持本机草稿自动保存",
|
||||
"下一站匹配理由、对比快照、计划空态/排序按钮、私信线程 RingNext 补齐 i18n",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-03",
|
||||
tag: "下一站 · 社区 · 城市",
|
||||
items: [
|
||||
"下一站决策:预算/网速/气候/标签偏好本机记住;标签与气候中英展示",
|
||||
"社区分类筛选与发帖分类中英标签;讨论回复提示与空态接入 i18n",
|
||||
"城市详情:加入计划/分享/超预算提示与操作按钮全面中英文化",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-03",
|
||||
tag: "匹配 · 岗位 · 会员",
|
||||
items: [
|
||||
"远程岗位支持搜索/标签筛选与本机收藏",
|
||||
"匹配意图、配额、空态与私信列表全面中英文化",
|
||||
"会员资料表单草稿自动保存",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-03",
|
||||
tag: "赏金 · 服务 · 报告",
|
||||
items: [
|
||||
"赏金可收藏、申请说明本机草稿;发布赏金/内容投稿自动保存草稿",
|
||||
"服务咨询与数据报告空态文案中英齐全;报告支持复制快照",
|
||||
"赏金/投稿/服务校验提示全面接入 i18n",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-03",
|
||||
tag: "摘要 · 稍后再看 · 草稿",
|
||||
items: [
|
||||
"视频「稍后再看」本机收藏;列表与详情可一键存取",
|
||||
"个人中心「今日游民摘要」汇总计划就绪、报名、视频与最近 AI 提问",
|
||||
"社区发帖草稿自动保存;通知/反馈/地图/视频空态文案中英齐全",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-03",
|
||||
tag: "日历 · 对比 · 搜索",
|
||||
items: [
|
||||
"活动报名可导出 ICS(整表/单场);个人中心 RSVP 一键导入日历",
|
||||
"城市对比:最近对比记录可恢复、复制对比快照",
|
||||
"全局搜索空态展示最近浏览城市;通知设置补齐 RingNext 与文案",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-03",
|
||||
tag: "继续探索与个人中心",
|
||||
items: [
|
||||
"最近浏览城市:详情页自动记录,首页与个人中心可续看、一键对比",
|
||||
"个人中心展示已报名活动(含直播入口)与环导航",
|
||||
"旅居助手:本地提问历史、中英文案与对比/写入计划闭环",
|
||||
"城市详情「复制快照」;VIP 支付成功页补齐下一步",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-09-01",
|
||||
tag: "环导航与文案",
|
||||
items: [
|
||||
"工具详情、发起活动、会员定价、学院课时、喜欢列表、成员主页补齐 RingNext",
|
||||
"直播间门禁/布局、工具箱空态与搜索、活动登录提示接入中英文案",
|
||||
"私信空态与发送失败提示、学院 VIP 提示与每日指南 i18n",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-08-30",
|
||||
tag: "决策与发现闭环",
|
||||
items: [
|
||||
"首页挂载快捷工具条;地图选城可对比/加计划;下一站活动按推荐城市筛选",
|
||||
"赏金未登录直接引导登录;活动页支持 ?city= 筛选;视频详情 RingNext",
|
||||
"电子书感谢页无下载链时引导在线阅读;社区发帖/发赏金/通知设置登录门",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-08-30",
|
||||
tag: "三环登录与导航",
|
||||
items: [
|
||||
"Connect:个人中心三环快捷入口、匹配加载态、发起活动/发赏金登录门、私信与登录提示",
|
||||
"Explore:全站快捷键、首页 hash 锚点、对比空态、AI 推荐真正写入计划",
|
||||
"Grow:导航补全服务/投稿、表单校验、学院空态与 VIP 课时直达开通",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-08-30",
|
||||
tag: "三环可用深化",
|
||||
items: [
|
||||
"产品信息架构:Explore / Connect / Grow 渐进披露,导航与空态对齐三条环",
|
||||
"Connect:RSVP 需登录、通知铃铛、匹配配额、私信与 VIP 支付加固",
|
||||
"Grow:学院 VIP 课时客户端解锁、赏金/投稿表单校验、电子书购买闭环",
|
||||
"Explore:目的地对比入口、AI 快捷提问、计划空态、周报订阅诚实提示",
|
||||
"边缘体验:404/错误页环导航、sitemap 补全、匹配空态、快捷键与贴士持久化",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-08-29",
|
||||
tag: "电子书融合",
|
||||
items: [
|
||||
"电子书封面改用独立 cover-* 布局 CSS,避免主站全局样式打乱双栏排版",
|
||||
"语言与主站 nomadro-locale 互通;封面保留「← nomadro」返回入口",
|
||||
"恢复「继续阅读」主 CTA + 进度卡并排,对齐 book.nomadro.com 构图",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-08-29",
|
||||
tag: "电子书融入",
|
||||
items: [
|
||||
"导航新增「电子书」,接入《游牧代码》完整阅读体验(/book)",
|
||||
"支持封面、连续阅读、章节锚点、书签划线与中英切换",
|
||||
"内容来自 ebook 项目,与主站语言偏好同步",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-08-29",
|
||||
tag: "首页聚焦发现",
|
||||
items: [
|
||||
"首页移除计划与对比模块,专注探索:地图 → 目的地 → 签证 → 内容",
|
||||
"路径条改为探索 → 智能匹配 → 签证 → 工具箱;计划/对比保留在导航栏独立页面",
|
||||
"登录页重写:跳转目标显示中文名称而非 / 路径,默认进入个人中心",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-08-29",
|
||||
tag: "首页收敛",
|
||||
items: [
|
||||
"首页从超长工具墙收成短路径,微工具全部下沉到 /tools",
|
||||
"新增 Journey 路径条,Hero 主 CTA 收敛为探索 + 智能匹配",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-08-29",
|
||||
tag: "漏斗打磨",
|
||||
items: [
|
||||
"路径条提前到 Hero 下方,先看清步骤再探索",
|
||||
"目的地默认展示 8 城可展开,卡片支持收藏与详情",
|
||||
"签证/博客/FAQ 折叠展示;地图/目的地/签证等壳层文案中英双语",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-08-29",
|
||||
tag: "体验升级",
|
||||
items: [
|
||||
"PC / H5 响应式增强:语言切换、计划与对比台、底部安全区与触控目标",
|
||||
"PWA:可安装到主屏幕,离线可打开计划 / 对比入口(manifest + Service Worker)",
|
||||
"中英双语:默认中文,导航一键切换英语;计划 / 对比 / 登录 / 工具箱壳层文案同步",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-08-29",
|
||||
tag: "产品打磨",
|
||||
items: [
|
||||
"Hero / 导航 / 底栏 / 快捷条 / 新手引导统一导向计划与对比",
|
||||
"登录支持 ?next= 回流,默认进入计划中心并强调云端同步",
|
||||
"Sitemap 与 OG 补齐 /plan /compare;目的地页补 generateMetadata",
|
||||
"首页对比直达对比台;行程区收束为计划中心入口",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-08-29",
|
||||
tag: "性能优化",
|
||||
items: [
|
||||
"首页行程/计算器等中屏板块改为视口内按需加载;匹配弹窗与对比弹窗按需拆包",
|
||||
"闲时再挂载引导/反馈等 chrome;去掉全局 MutationObserver 开销",
|
||||
"粒子画布延后启动、去掉连线计算;Loader 更快退出",
|
||||
"Outfit 自托管 + 系统中文字体,去掉阻塞的 Google Fonts 外链",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-08-29",
|
||||
tag: "计划深化",
|
||||
items: [
|
||||
"修复停留签证提醒(中英文国家名对齐),超期站点醒目提示",
|
||||
"计划页接入签证目录:按行程国家展示游民签证方案与收入/审批信息",
|
||||
"导出日历(.ics):设出发月后可导入手机 / Google Calendar",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-08-29",
|
||||
tag: "账号同步",
|
||||
items: [
|
||||
"登录后旅居计划(城市+预算+清单)云端同步,本地与账号自动合并",
|
||||
"账号与收藏/计划落盘持久化,服务重启不丢演示数据",
|
||||
"个人中心升级为计划仪表盘:就绪度、预算、收藏写入计划、行程对比",
|
||||
"目的地详情:停留月数、签证提醒、预算对照、同区对比",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-08-29",
|
||||
tag: "决策闭环",
|
||||
items: [
|
||||
"智能匹配:偏好本地保存;Top 3 一键写入旅居计划;单城「+ 计划」;对比 Top 结果",
|
||||
"全新「城市对比台」/compare:可分享 URL、并排指标、推荐城/全部写入计划",
|
||||
"首页对比条与计划中心可跳转完整对比页",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-08-29",
|
||||
tag: "核心功能",
|
||||
items: [
|
||||
"全新「旅居计划中心」/plan:多城时间轴、出发月推算、站内备注、停留签证提醒",
|
||||
"月预算上限对照、出发就绪清单、行程内城市对比、分享/导出 Markdown",
|
||||
"导航与目的地「加入计划」、个人中心、全局搜索统一指向计划中心",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-08-29",
|
||||
tag: "大更新",
|
||||
items: [
|
||||
"一次上新 14 个工具:周末灵感、雨天备选、远程日规划、睡眠周期、心情签到、饮水打卡",
|
||||
"聚餐分账、收款汇率、小费速查、洗衣预算、机场接驳、合租看房问题、押金退还清单、当地防坑",
|
||||
"工具箱推荐位与快捷条同步更新,可搜索全部新工具",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-08-29",
|
||||
tag: "新工具",
|
||||
items: [
|
||||
"落地首月成本、流量预算、签证停留倒计时、办公点成本对比",
|
||||
"日照办公窗、行李重量、旅居跑道、会议黄金时段",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-08-29",
|
||||
tag: "体验优化",
|
||||
items: [
|
||||
"首页视口内按需挂载;粒子减负;Loader 更快;原生 systemd 部署",
|
||||
"全局搜索覆盖工具与页面;行程 Markdown 导出",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-08-29",
|
||||
tag: "工具箱",
|
||||
items: [
|
||||
"新增 /tools 工具聚合页,按分类快速跳转",
|
||||
"精简首页章节导航,核心入口更清晰",
|
||||
"新增 ATM 取现避坑指南",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-08-29",
|
||||
tag: "实用工具",
|
||||
items: [
|
||||
"电源插座、紧急联系、城市笔记、专注时钟",
|
||||
"税居天数、到站清单、咖啡馆推荐、新手引导",
|
||||
"保险指南、支出账本、SIM/eSIM 方案",
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2026-08-28",
|
||||
tag: "品牌",
|
||||
items: [
|
||||
"品牌统一为 nomadro",
|
||||
"命运转盘、机票估算、活动日历、隐私政策",
|
||||
"签证智能匹配、联合办公、行李清单",
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export default function ChangelogPage() {
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<div className="legal-page">
|
||||
<nav className="detail-nav">
|
||||
<Link href="/community">← 返回首页</Link>
|
||||
</nav>
|
||||
<article className="legal-content">
|
||||
<span className="section-tag">📜 CHANGELOG</span>
|
||||
<h1>更新日志</h1>
|
||||
<p className="legal-updated">记录 nomadro 的每一次出发</p>
|
||||
|
||||
<div className="changelog-list">
|
||||
{LOGS.map((log) => (
|
||||
<section key={log.date + log.tag} className="changelog-item">
|
||||
<div className="changelog-meta">
|
||||
<time>{log.date}</time>
|
||||
<span className="changelog-tag">{log.tag}</span>
|
||||
</div>
|
||||
<ul>
|
||||
{log.items.map((item) => (
|
||||
<li key={item}>{item}</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="about-actions">
|
||||
<Link href="/community/tools" className="btn btn-primary">打开工具箱 🛠️</Link>
|
||||
<Link href="/community/about" className="btn btn-ghost">关于 nomadro</Link>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
16
app/community/chat/[id]/page.tsx
Normal file
16
app/community/chat/[id]/page.tsx
Normal file
@ -0,0 +1,16 @@
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import ChatThreadClient from "@community/components/ChatThreadClient";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "对话 · nomadro",
|
||||
};
|
||||
|
||||
export default async function ChatThreadPage({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<ChatThreadClient convId={id} />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
16
app/community/chat/page.tsx
Normal file
16
app/community/chat/page.tsx
Normal file
@ -0,0 +1,16 @@
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import ChatClient from "@community/components/ChatClient";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "私信 · nomadro",
|
||||
description: "与匹配成功的游民私信聊天。",
|
||||
};
|
||||
|
||||
export default function ChatPage() {
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<ChatClient />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
37
app/community/community/[id]/page.tsx
Normal file
37
app/community/community/[id]/page.tsx
Normal file
@ -0,0 +1,37 @@
|
||||
import type { Metadata } from "next";
|
||||
import { notFound } from "next/navigation";
|
||||
import { api } from "@community/lib/api";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import DiscussionDetailClient from "@community/components/DiscussionDetailClient";
|
||||
|
||||
export const revalidate = 60;
|
||||
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ id: string }>;
|
||||
}): Promise<Metadata> {
|
||||
const { id } = await params;
|
||||
try {
|
||||
const d = await api.getDiscussion(id);
|
||||
return { title: `${d.title} · nomadro 社区` };
|
||||
} catch {
|
||||
return { title: "讨论 · nomadro" };
|
||||
}
|
||||
}
|
||||
|
||||
export default async function DiscussionPage({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ id: string }>;
|
||||
}) {
|
||||
const { id } = await params;
|
||||
const discussion = await api.getDiscussion(id).catch(() => null);
|
||||
if (!discussion) notFound();
|
||||
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<DiscussionDetailClient discussionId={id} initial={discussion} />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
10
app/community/community/new/page.tsx
Normal file
10
app/community/community/new/page.tsx
Normal file
@ -0,0 +1,10 @@
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import CommunityNewClient from "@community/components/CommunityNewClient";
|
||||
|
||||
export default function CommunityNewPage() {
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<CommunityNewClient />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
24
app/community/community/page.tsx
Normal file
24
app/community/community/page.tsx
Normal file
@ -0,0 +1,24 @@
|
||||
import type { Metadata } from "next";
|
||||
import { api } from "@community/lib/api";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import CommunityHubClient from "@community/components/CommunityHubClient";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "社区讨论 · nomadro",
|
||||
description: "签证、远程工作、住宿与安全 —— 和游民们交流真实经验。",
|
||||
};
|
||||
|
||||
export const revalidate = 60;
|
||||
|
||||
export default async function CommunityPage() {
|
||||
const discussions = await api.getDiscussions().catch(() => []);
|
||||
const featured = discussions[0]
|
||||
? await api.getDiscussion(discussions[0].id).catch(() => null)
|
||||
: null;
|
||||
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<CommunityHubClient discussions={discussions} featured={featured} />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
41
app/community/compare/page.tsx
Normal file
41
app/community/compare/page.tsx
Normal file
@ -0,0 +1,41 @@
|
||||
import { Suspense } from "react";
|
||||
import type { Metadata } from "next";
|
||||
import { api } from "@community/lib/api";
|
||||
import type { Destination } from "@community/lib/types";
|
||||
import CompareClient from "@community/components/CompareClient";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "城市对比 · nomadro",
|
||||
description: "并排对比旅居城市费用、网速、气候与评分,决定后写入旅居计划",
|
||||
openGraph: {
|
||||
title: "城市对比台 · nomadro",
|
||||
description: "最多 4 城并排对比,推荐城一键写入旅居计划",
|
||||
url: "/compare",
|
||||
type: "website",
|
||||
},
|
||||
twitter: {
|
||||
card: "summary_large_image",
|
||||
title: "城市对比台 · nomadro",
|
||||
description: "最多 4 城并排对比,推荐城一键写入旅居计划",
|
||||
},
|
||||
};
|
||||
|
||||
export const revalidate = 60;
|
||||
|
||||
export default async function ComparePage() {
|
||||
let destinations: Destination[] = [];
|
||||
try {
|
||||
destinations = await api.getDestinations();
|
||||
} catch {
|
||||
destinations = [];
|
||||
}
|
||||
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<Suspense fallback={<div className="compare-page"><div className="container"><p className="plan-loading">加载对比台…</p></div></div>}>
|
||||
<CompareClient destinations={destinations} />
|
||||
</Suspense>
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
19
app/community/contact/page.tsx
Normal file
19
app/community/contact/page.tsx
Normal file
@ -0,0 +1,19 @@
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import StaticPage from "@community/components/StaticPage";
|
||||
import { STATIC_PAGES } from "@community/lib/staticPages";
|
||||
|
||||
const page = STATIC_PAGES.contact;
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: `${page.title} · nomadro`,
|
||||
description: page.subtitle || page.title,
|
||||
};
|
||||
|
||||
export default function ContactPage() {
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<StaticPage page={page} />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
10
app/community/cookies/page.tsx
Normal file
10
app/community/cookies/page.tsx
Normal file
@ -0,0 +1,10 @@
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import StaticPage from "@community/components/StaticPage";
|
||||
import { STATIC_PAGES } from "@community/lib/staticPages";
|
||||
|
||||
const page = STATIC_PAGES.cookies;
|
||||
export const metadata: Metadata = { title: `${page.title} · nomadro` };
|
||||
export default function CookiesPage() {
|
||||
return <SiteShell showFooter><StaticPage page={page} /></SiteShell>;
|
||||
}
|
||||
16
app/community/dating/likes/page.tsx
Normal file
16
app/community/dating/likes/page.tsx
Normal file
@ -0,0 +1,16 @@
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import DatingLikesClient from "@community/components/DatingLikesClient";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "我喜欢的 · nomadro",
|
||||
description: "查看你右滑喜欢的游民卡片。",
|
||||
};
|
||||
|
||||
export default function DatingLikesPage() {
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<DatingLikesClient />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
16
app/community/dating/page.tsx
Normal file
16
app/community/dating/page.tsx
Normal file
@ -0,0 +1,16 @@
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import DatingClient from "@community/components/DatingClient";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "游民匹配 · nomadro",
|
||||
description: "按意图滑动匹配同路游民,交朋友、找室友、联创伙伴。",
|
||||
};
|
||||
|
||||
export default function DatingPage() {
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<DatingClient />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
76
app/community/destinations/[slug]/page.tsx
Normal file
76
app/community/destinations/[slug]/page.tsx
Normal file
@ -0,0 +1,76 @@
|
||||
import Link from "next/link";
|
||||
import type { Metadata } from "next";
|
||||
import { api } from "@community/lib/api";
|
||||
import { notFound } from "next/navigation";
|
||||
import FavoriteButton from "@community/components/FavoriteButton";
|
||||
import DestinationDetailClient from "@community/components/DestinationDetailClient";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
|
||||
export async function generateMetadata(
|
||||
{ params }: { params: Promise<{ slug: string }> }
|
||||
): Promise<Metadata> {
|
||||
const { slug } = await params;
|
||||
try {
|
||||
const dest = await api.getDestination(slug);
|
||||
const title = `${dest.emoji} ${dest.name}, ${dest.country} · nomadro`;
|
||||
const description = `${dest.description.slice(0, 120)}… 月费约 ¥${dest.cost.toLocaleString()} · 网速 ${dest.speed}Mbps`;
|
||||
return {
|
||||
title,
|
||||
description,
|
||||
openGraph: { title, description, url: `/destinations/${slug}` },
|
||||
twitter: { card: "summary_large_image", title, description },
|
||||
};
|
||||
} catch {
|
||||
return { title: "目的地 · nomadro" };
|
||||
}
|
||||
}
|
||||
|
||||
export default async function DestinationPage({ params }: { params: Promise<{ slug: string }> }) {
|
||||
const { slug } = await params;
|
||||
let dest;
|
||||
let allDestinations;
|
||||
try {
|
||||
[dest, allDestinations] = await Promise.all([
|
||||
api.getDestination(slug),
|
||||
api.getDestinations(),
|
||||
]);
|
||||
} catch {
|
||||
notFound();
|
||||
}
|
||||
|
||||
return (
|
||||
<SiteShell>
|
||||
<div className="detail-page">
|
||||
<nav className="detail-nav">
|
||||
<Link href="/community/#destinations">← 返回目的地</Link>
|
||||
</nav>
|
||||
<div className="dest-detail">
|
||||
<div className="dest-detail-hero" style={{ background: `linear-gradient(135deg,hsl(${dest.hue},60%,20%),hsl(${dest.hue + 40},50%,30%))` }}>
|
||||
<span className="dest-detail-emoji">{dest.emoji}</span>
|
||||
</div>
|
||||
<div className="dest-detail-body">
|
||||
<div className="dest-detail-top">
|
||||
<div>
|
||||
<span className="modal-tag">{dest.tag}</span>
|
||||
<h1>{dest.name}, {dest.country}</h1>
|
||||
</div>
|
||||
<FavoriteButton slug={dest.slug} />
|
||||
</div>
|
||||
<p className="dest-detail-desc">{dest.description}</p>
|
||||
<div className="modal-stats">
|
||||
<div className="modal-stat"><span className="stat-emoji">💰</span><strong>¥{dest.cost.toLocaleString()}</strong><span>月生活费</span></div>
|
||||
<div className="modal-stat"><span className="stat-emoji">📶</span><strong>{dest.speed}Mbps</strong><span>网速</span></div>
|
||||
<div className="modal-stat"><span className="stat-emoji">🌡️</span><strong>{dest.temperature}°C</strong><span>均温</span></div>
|
||||
<div className="modal-stat"><span className="stat-emoji">⭐</span><strong>{dest.rating}</strong><span>评分</span></div>
|
||||
</div>
|
||||
<div className="modal-highlights">
|
||||
<h4>✨ 亮点特色</h4>
|
||||
<ul>{dest.highlights.map((h) => <li key={h}>{h}</li>)}</ul>
|
||||
</div>
|
||||
<DestinationDetailClient dest={dest} allDestinations={allDestinations} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
22
app/community/digital/course/[m]/[l]/page.tsx
Normal file
22
app/community/digital/course/[m]/[l]/page.tsx
Normal file
@ -0,0 +1,22 @@
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import DigitalLessonClient from "@community/components/DigitalLessonClient";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "课程 · nomadro 学院",
|
||||
};
|
||||
|
||||
export default async function DigitalLessonPage({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ m: string; l: string }>;
|
||||
}) {
|
||||
const { m, l } = await params;
|
||||
const mi = Number(m);
|
||||
const li = Number(l);
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<DigitalLessonClient moduleIndex={mi} lessonIndex={li} />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
19
app/community/digital/course/page.tsx
Normal file
19
app/community/digital/course/page.tsx
Normal file
@ -0,0 +1,19 @@
|
||||
import type { Metadata } from "next";
|
||||
import { api } from "@community/lib/api";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import DigitalCourseClient from "@community/components/DigitalCourseClient";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "课程目录 · nomadro 学院",
|
||||
};
|
||||
|
||||
export const revalidate = 300;
|
||||
|
||||
export default async function DigitalCoursePage() {
|
||||
const course = await api.getDigitalCourse();
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<DigitalCourseClient course={course} />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
23
app/community/digital/day/[id]/page.tsx
Normal file
23
app/community/digital/day/[id]/page.tsx
Normal file
@ -0,0 +1,23 @@
|
||||
import type { Metadata } from "next";
|
||||
import { notFound } from "next/navigation";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import DigitalDayClient from "@community/components/DigitalDayClient";
|
||||
import { api } from "@community/lib/api";
|
||||
|
||||
export async function generateMetadata({ params }: { params: Promise<{ id: string }> }): Promise<Metadata> {
|
||||
const { id } = await params;
|
||||
const day = await api.getDigitalDay(id).catch(() => null);
|
||||
return { title: day ? `${day.title} · nomadro` : "Daily guide · nomadro" };
|
||||
}
|
||||
|
||||
export default async function DigitalDayPage({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
const day = await api.getDigitalDay(id).catch(() => null);
|
||||
if (!day) notFound();
|
||||
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<DigitalDayClient id={id} title={day.title} body={day.body} />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
19
app/community/digital/jobs/page.tsx
Normal file
19
app/community/digital/jobs/page.tsx
Normal file
@ -0,0 +1,19 @@
|
||||
import type { Metadata } from "next";
|
||||
import { api } from "@community/lib/api";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import DigitalJobsClient from "@community/components/DigitalJobsClient";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "远程岗位 · nomadro",
|
||||
};
|
||||
|
||||
export const revalidate = 300;
|
||||
|
||||
export default async function DigitalJobsPage() {
|
||||
const jobs = await api.getDigitalJobs();
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<DigitalJobsClient jobs={jobs} />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
20
app/community/digital/page.tsx
Normal file
20
app/community/digital/page.tsx
Normal file
@ -0,0 +1,20 @@
|
||||
import type { Metadata } from "next";
|
||||
import { api } from "@community/lib/api";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import DigitalHomeClient from "@community/components/DigitalHomeClient";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "数字游民学院 · nomadro",
|
||||
description: "课程、电子书与远程岗位 —— nomadro 数字游民成长站。",
|
||||
};
|
||||
|
||||
export const revalidate = 300;
|
||||
|
||||
export default async function DigitalPage() {
|
||||
const course = await api.getDigitalCourse();
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<DigitalHomeClient course={course} />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
40
app/community/error.tsx
Normal file
40
app/community/error.tsx
Normal file
@ -0,0 +1,40 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
import Link from "next/link";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
|
||||
export default function GlobalError({
|
||||
error,
|
||||
reset,
|
||||
}: {
|
||||
error: Error & { digest?: string };
|
||||
reset: () => void;
|
||||
}) {
|
||||
useEffect(() => {
|
||||
console.error(error);
|
||||
}, [error]);
|
||||
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<div className="not-found-page">
|
||||
<h1 className="not-found-title" style={{ fontSize: "2.5rem" }}>
|
||||
出错了
|
||||
</h1>
|
||||
<p>页面暂时无法加载,可以重试或换一条航线</p>
|
||||
<p className="not-found-sub">{error.digest ? `参考码 ${error.digest}` : "请稍后再试"}</p>
|
||||
<div className="not-found-actions">
|
||||
<button type="button" className="btn btn-primary" onClick={reset}>
|
||||
重试
|
||||
</button>
|
||||
<Link href="/community" className="btn">
|
||||
首页
|
||||
</Link>
|
||||
<Link href="/community/feedback" className="btn btn-ghost">
|
||||
反馈问题
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
16
app/community/feedback/page.tsx
Normal file
16
app/community/feedback/page.tsx
Normal file
@ -0,0 +1,16 @@
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import FeedbackClient from "@community/components/FeedbackClient";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "反馈 · nomadro",
|
||||
description: "向 nomadro 提交问题反馈与功能建议",
|
||||
};
|
||||
|
||||
export default function FeedbackPage() {
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<FeedbackClient />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
14
app/community/gigs/page.tsx
Normal file
14
app/community/gigs/page.tsx
Normal file
@ -0,0 +1,14 @@
|
||||
import { api } from "@community/lib/api";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import GigsClient from "@community/components/GigsClient";
|
||||
|
||||
export const revalidate = 60;
|
||||
|
||||
export default async function GigsPage() {
|
||||
const gigs = await api.getGigs().catch(() => []);
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<GigsClient gigs={gigs} />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
15
app/community/gigs/post/page.tsx
Normal file
15
app/community/gigs/post/page.tsx
Normal file
@ -0,0 +1,15 @@
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import GigPostClient from "@community/components/GigPostClient";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "发布赏金 · nomadro",
|
||||
};
|
||||
|
||||
export default function GigPostPage() {
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<GigPostClient />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
19
app/community/guidelines/page.tsx
Normal file
19
app/community/guidelines/page.tsx
Normal file
@ -0,0 +1,19 @@
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import StaticPage from "@community/components/StaticPage";
|
||||
import { STATIC_PAGES } from "@community/lib/staticPages";
|
||||
|
||||
const page = STATIC_PAGES.guidelines;
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: `${page.title} · nomadro`,
|
||||
description: "nomadro 社区行为准则",
|
||||
};
|
||||
|
||||
export default function GuidelinesPage() {
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<StaticPage page={page} />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
19
app/community/help/page.tsx
Normal file
19
app/community/help/page.tsx
Normal file
@ -0,0 +1,19 @@
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import StaticPage from "@community/components/StaticPage";
|
||||
import { STATIC_PAGES } from "@community/lib/staticPages";
|
||||
|
||||
const page = STATIC_PAGES.help;
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: `${page.title} · nomadro`,
|
||||
description: "nomadro 帮助中心与常见问题",
|
||||
};
|
||||
|
||||
export default function HelpPage() {
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<StaticPage page={page} />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
16
app/community/join/page.tsx
Normal file
16
app/community/join/page.tsx
Normal file
@ -0,0 +1,16 @@
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import JoinClient from "@community/components/JoinClient";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "加入会员 · nomadro",
|
||||
description: "完善游民资料,开通 VIP 解锁匹配、直播与课程。",
|
||||
};
|
||||
|
||||
export default function JoinPage() {
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<JoinClient />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
18
app/community/join/paid/page.tsx
Normal file
18
app/community/join/paid/page.tsx
Normal file
@ -0,0 +1,18 @@
|
||||
import { Suspense } from "react";
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import JoinPaidClient from "@community/components/JoinPaidClient";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "支付完成 · nomadro",
|
||||
};
|
||||
|
||||
export default function JoinPaidPage() {
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<Suspense fallback={<div className="join-page"><div className="container"><p className="plan-loading">处理中…</p></div></div>}>
|
||||
<JoinPaidClient />
|
||||
</Suspense>
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
24
app/community/layout.tsx
Normal file
24
app/community/layout.tsx
Normal file
@ -0,0 +1,24 @@
|
||||
import { AuthProvider } from "@community/lib/auth";
|
||||
import { ToastProvider } from "@community/lib/toast";
|
||||
import { I18nProvider } from "@community/lib/i18n";
|
||||
import PwaRegister from "@community/components/PwaRegister";
|
||||
import "@community/app/globals.css";
|
||||
|
||||
export default function CommunityLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<div className="community-root">
|
||||
<I18nProvider>
|
||||
<AuthProvider>
|
||||
<ToastProvider>
|
||||
{children}
|
||||
<PwaRegister />
|
||||
</ToastProvider>
|
||||
</AuthProvider>
|
||||
</I18nProvider>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
8
app/community/loading.tsx
Normal file
8
app/community/loading.tsx
Normal file
@ -0,0 +1,8 @@
|
||||
export default function Loading() {
|
||||
return (
|
||||
<div className="page-loading">
|
||||
<div className="page-loading-spinner" />
|
||||
<p>加载中... 🌍</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
185
app/community/login/page.tsx
Normal file
185
app/community/login/page.tsx
Normal file
@ -0,0 +1,185 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import { Suspense } from "react";
|
||||
import { useAuth } from "@community/lib/auth";
|
||||
import { useToast } from "@community/lib/toast";
|
||||
import { useI18n } from "@community/lib/i18n";
|
||||
import { resolveAuthNext } from "@community/lib/authNext";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import { GoogleSignInButton } from "@community/components/GoogleSignInButton";
|
||||
|
||||
function LoginForm() {
|
||||
const { login, register, demoLogin, googleLogin } = useAuth();
|
||||
const { toast } = useToast();
|
||||
const { t } = useI18n();
|
||||
const router = useRouter();
|
||||
const searchParams = useSearchParams();
|
||||
const meta = resolveAuthNext(searchParams.get("next"), t.login);
|
||||
|
||||
const [mode, setMode] = useState<"login" | "register">("login");
|
||||
const [email, setEmail] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
const [name, setName] = useState("");
|
||||
const [showPwd, setShowPwd] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const goAfterAuth = (msg: string) => {
|
||||
toast(msg, "success", { href: meta.path, label: meta.label });
|
||||
setTimeout(() => { router.replace(meta.path); }, 400);
|
||||
};
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
setError("");
|
||||
if (mode === "register") {
|
||||
if (!name.trim() || name.trim().length < 2) {
|
||||
setError(t.login.nameMin);
|
||||
return;
|
||||
}
|
||||
if (password.length < 6) {
|
||||
setError(t.login.pwdMin);
|
||||
return;
|
||||
}
|
||||
}
|
||||
setLoading(true);
|
||||
const ok = mode === "login"
|
||||
? await login(email, password)
|
||||
: await register(email, password, name.trim());
|
||||
setLoading(false);
|
||||
if (ok) {
|
||||
goAfterAuth(
|
||||
mode === "login" ? meta.welcomeToast : t.login.registerToast
|
||||
);
|
||||
} else {
|
||||
setError(mode === "login" ? t.login.loginError : t.login.registerError);
|
||||
}
|
||||
};
|
||||
|
||||
const handleDemo = async () => {
|
||||
setLoading(true);
|
||||
const ok = await demoLogin();
|
||||
setLoading(false);
|
||||
if (ok) goAfterAuth(t.login.demoToast);
|
||||
};
|
||||
|
||||
const handleGoogle = async (idToken: string) => {
|
||||
setError("");
|
||||
setLoading(true);
|
||||
const ok = await googleLogin(idToken);
|
||||
setLoading(false);
|
||||
if (ok) goAfterAuth(meta.welcomeToast);
|
||||
else setError(t.login.googleFail);
|
||||
};
|
||||
|
||||
const headerHint = mode === "login" ? meta.hint : t.login.registerHint;
|
||||
|
||||
return (
|
||||
<div className="auth-page">
|
||||
<div className="auth-bg-shapes" aria-hidden="true">
|
||||
<span className="auth-shape auth-shape-1">🌍</span>
|
||||
<span className="auth-shape auth-shape-2">✈️</span>
|
||||
<span className="auth-shape auth-shape-3">🏝️</span>
|
||||
</div>
|
||||
<div className="auth-card">
|
||||
<Link href="/community" className="auth-back">{t.common.backHome}</Link>
|
||||
<div className="auth-header">
|
||||
<span className="auth-logo-emoji">🌍</span>
|
||||
<h1>{mode === "login" ? t.login.welcome : t.login.join}</h1>
|
||||
<p>{headerHint}</p>
|
||||
</div>
|
||||
|
||||
{meta.showRedirect && (
|
||||
<div className="auth-redirect-card">
|
||||
{meta.showPlanMerge && (
|
||||
<p className="auth-redirect-merge">{t.login.planMergeNote}</p>
|
||||
)}
|
||||
<p className="auth-redirect-dest">
|
||||
<span>{t.login.redirectTo}</span>
|
||||
<strong className="auth-redirect-badge">{meta.label}</strong>
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="auth-tabs">
|
||||
<button className={mode === "login" ? "active" : ""} onClick={() => { setMode("login"); setError(""); }}>{t.login.tabLogin}</button>
|
||||
<button className={mode === "register" ? "active" : ""} onClick={() => { setMode("register"); setError(""); }}>{t.login.tabRegister}</button>
|
||||
</div>
|
||||
|
||||
<form onSubmit={handleSubmit} className="auth-form">
|
||||
{mode === "register" && (
|
||||
<div className="calc-field">
|
||||
<label>{t.login.nickname}</label>
|
||||
<input value={name} onChange={(e) => setName(e.target.value)} placeholder={t.login.nickPlaceholder} required />
|
||||
</div>
|
||||
)}
|
||||
<div className="calc-field">
|
||||
<label>{t.login.email}</label>
|
||||
<input type="email" value={email} onChange={(e) => setEmail(e.target.value)} placeholder="you@example.com" required autoComplete="email" />
|
||||
</div>
|
||||
<div className="calc-field">
|
||||
<label>{t.login.password}</label>
|
||||
<div className="auth-pwd-wrap">
|
||||
<input
|
||||
type={showPwd ? "text" : "password"}
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
placeholder={t.login.pwdPlaceholder}
|
||||
required
|
||||
minLength={6}
|
||||
autoComplete={mode === "login" ? "current-password" : "new-password"}
|
||||
/>
|
||||
<button type="button" className="auth-pwd-toggle" onClick={() => setShowPwd(!showPwd)} aria-label={t.login.showPwd}>
|
||||
{showPwd ? "🙈" : "👁️"}
|
||||
</button>
|
||||
</div>
|
||||
{mode === "register" && (
|
||||
<p className="auth-pwd-hint">
|
||||
{password.length === 0
|
||||
? t.login.pwdHint
|
||||
: password.length < 6
|
||||
? t.login.pwdNeed.replace("{n}", String(6 - password.length))
|
||||
: password.length < 10
|
||||
? t.login.pwdOk
|
||||
: t.login.pwdStrong}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
{error && <p className="auth-error">{error}</p>}
|
||||
<button type="submit" className="btn btn-primary auth-submit" disabled={loading}>
|
||||
{loading ? <span className="auth-loading">{t.login.processing}</span> : (mode === "login" ? meta.submitLogin : t.login.submitRegister)}
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<div className="auth-divider"><span>{t.login.or}</span></div>
|
||||
<GoogleSignInButton disabled={loading} onCredential={handleGoogle} />
|
||||
<button className="btn btn-ghost auth-demo-btn" type="button" onClick={handleDemo} disabled={loading}>
|
||||
{t.login.demo}
|
||||
</button>
|
||||
<p className="auth-hint">{meta.demoHint}</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function LoginFallback() {
|
||||
const { t } = useI18n();
|
||||
return (
|
||||
<div className="auth-page">
|
||||
<p className="plan-loading">{t.common.loading}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function LoginPage() {
|
||||
return (
|
||||
<SiteShell>
|
||||
<Suspense fallback={<LoginFallback />}>
|
||||
<LoginForm />
|
||||
</Suspense>
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
27
app/community/manifest.ts
Normal file
27
app/community/manifest.ts
Normal file
@ -0,0 +1,27 @@
|
||||
import type { MetadataRoute } from "next";
|
||||
|
||||
export default function manifest(): MetadataRoute.Manifest {
|
||||
return {
|
||||
name: "nomadro",
|
||||
short_name: "nomadro",
|
||||
description: "Digital nomad move planning — destinations, compare, and trip plans",
|
||||
start_url: "/",
|
||||
scope: "/",
|
||||
display: "standalone",
|
||||
orientation: "any",
|
||||
background_color: "#0a0e17",
|
||||
theme_color: "#4ECDC4",
|
||||
lang: "zh-CN",
|
||||
categories: ["travel", "lifestyle", "productivity"],
|
||||
icons: [
|
||||
{ src: "/icons/icon-192.png", sizes: "192x192", type: "image/png", purpose: "any" },
|
||||
{ src: "/icons/icon-512.png", sizes: "512x512", type: "image/png", purpose: "any" },
|
||||
{ src: "/icons/icon-512.png", sizes: "512x512", type: "image/png", purpose: "maskable" },
|
||||
{ src: "/icons/icon.svg", sizes: "any", type: "image/svg+xml", purpose: "any" },
|
||||
],
|
||||
shortcuts: [
|
||||
{ name: "Move plan / 旅居计划", short_name: "Plan", url: "/plan", icons: [{ src: "/icons/icon-192.png", sizes: "192x192" }] },
|
||||
{ name: "Compare / 对比", short_name: "Compare", url: "/compare", icons: [{ src: "/icons/icon-192.png", sizes: "192x192" }] },
|
||||
],
|
||||
};
|
||||
}
|
||||
16
app/community/map/page.tsx
Normal file
16
app/community/map/page.tsx
Normal file
@ -0,0 +1,16 @@
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import MemberMapClient from "@community/components/MemberMapClient";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Nomad map · 游民地图 · nomadro",
|
||||
description: "Global nomad heatmap and live city weather · 全球游民分布与目的地实时天气",
|
||||
};
|
||||
|
||||
export default function MapPage() {
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<MemberMapClient />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
25
app/community/meetups/[id]/live/page.tsx
Normal file
25
app/community/meetups/[id]/live/page.tsx
Normal file
@ -0,0 +1,25 @@
|
||||
import type { Metadata } from "next";
|
||||
import { api } from "@community/lib/api";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import MeetupLiveClient from "@community/components/MeetupLiveClient";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "活动直播 · nomadro",
|
||||
};
|
||||
|
||||
export default async function MeetupLivePage({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
const meetup = await api.getMeetup(id).catch(() => null);
|
||||
const title = meetup?.title || "游民活动直播";
|
||||
|
||||
return (
|
||||
<SiteShell showFooter={false}>
|
||||
<MeetupLiveClient
|
||||
meetupId={id}
|
||||
title={title}
|
||||
date={meetup?.date || ""}
|
||||
time={meetup?.time || ""}
|
||||
/>
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
10
app/community/meetups/host/page.tsx
Normal file
10
app/community/meetups/host/page.tsx
Normal file
@ -0,0 +1,10 @@
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import MeetupsHostClient from "@community/components/MeetupsHostClient";
|
||||
|
||||
export default function MeetupsHostPage() {
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<MeetupsHostClient />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
24
app/community/meetups/page.tsx
Normal file
24
app/community/meetups/page.tsx
Normal file
@ -0,0 +1,24 @@
|
||||
import { Suspense } from "react";
|
||||
import type { Metadata } from "next";
|
||||
import { api } from "@community/lib/api";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import MeetupsClient from "@community/components/MeetupsClient";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "游民活动 · nomadro",
|
||||
description: "线上圆桌、线下聚会与混合活动 —— 和全球数字游民一起连接。",
|
||||
};
|
||||
|
||||
export const revalidate = 60;
|
||||
|
||||
export default async function MeetupsPage() {
|
||||
const meetups = await api.getMeetups().catch(() => []);
|
||||
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<Suspense fallback={<div className="container"><p className="dest-empty">加载活动…</p></div>}>
|
||||
<MeetupsClient meetups={meetups} />
|
||||
</Suspense>
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
18
app/community/members/[id]/page.tsx
Normal file
18
app/community/members/[id]/page.tsx
Normal file
@ -0,0 +1,18 @@
|
||||
import { Suspense } from "react";
|
||||
import { notFound } from "next/navigation";
|
||||
import { api } from "@community/lib/api";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import MemberProfileClient from "@community/components/MemberProfileClient";
|
||||
|
||||
export default async function MemberPage({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
const profile = await api.getMemberProfile(id).catch(() => null);
|
||||
if (!profile) notFound();
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<Suspense fallback={<div className="container dest-empty">…</div>}>
|
||||
<MemberProfileClient profile={profile} />
|
||||
</Suspense>
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
29
app/community/next-stop/page.tsx
Normal file
29
app/community/next-stop/page.tsx
Normal file
@ -0,0 +1,29 @@
|
||||
import type { Metadata } from "next";
|
||||
import { api } from "@community/lib/api";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import NextStopClient from "@community/components/NextStopClient";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "下一站决策 · nomadro",
|
||||
description: "根据预算、网络、气候和偏好,智能推荐下一座旅居城市与路线。",
|
||||
};
|
||||
|
||||
export const revalidate = 60;
|
||||
|
||||
export default async function NextStopPage() {
|
||||
const [destinations, meetups, routes] = await Promise.all([
|
||||
api.getDestinations().catch(() => []),
|
||||
api.getMeetups().catch(() => []),
|
||||
api.getRoutes().catch(() => []),
|
||||
]);
|
||||
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<NextStopClient
|
||||
destinations={destinations}
|
||||
initialMeetups={meetups}
|
||||
initialRoutes={routes}
|
||||
/>
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
35
app/community/not-found.tsx
Normal file
35
app/community/not-found.tsx
Normal file
@ -0,0 +1,35 @@
|
||||
import Link from "next/link";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
|
||||
export default function NotFound() {
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<div className="not-found-page">
|
||||
<div className="not-found-compass" aria-hidden="true">
|
||||
<span className="compass-ring">🧭</span>
|
||||
<span className="compass-plane">✈️</span>
|
||||
</div>
|
||||
<h1 className="not-found-title">404</h1>
|
||||
<p>哎呀,这片海域没有标记的岛屿</p>
|
||||
<p className="not-found-sub">你可能走错了航线,从三条产品环任选一条继续</p>
|
||||
<div className="not-found-actions">
|
||||
<Link href="/community" className="btn btn-primary">
|
||||
返回首页
|
||||
</Link>
|
||||
<Link href="/community/next-stop" className="btn">
|
||||
智能下一站
|
||||
</Link>
|
||||
<Link href="/community/meetups" className="btn">
|
||||
游民活动
|
||||
</Link>
|
||||
<Link href="/community/digital" className="btn">
|
||||
游民学院
|
||||
</Link>
|
||||
<Link href="/community/help" className="btn btn-ghost">
|
||||
帮助中心
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
10
app/community/notifications/page.tsx
Normal file
10
app/community/notifications/page.tsx
Normal file
@ -0,0 +1,10 @@
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import NotificationsClient from "@community/components/NotificationsClient";
|
||||
|
||||
export default function NotificationsPage() {
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<NotificationsClient />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
60
app/community/page.tsx
Normal file
60
app/community/page.tsx
Normal file
@ -0,0 +1,60 @@
|
||||
import { api } from "@community/lib/api";
|
||||
import HomeClient from "@community/components/HomeClient";
|
||||
|
||||
export const revalidate = 60;
|
||||
|
||||
export default async function Home() {
|
||||
try {
|
||||
const [stats, ticker, destinations, visas, faqs, testimonials, tools, blog, cost, speed, growth, radar] =
|
||||
await Promise.all([
|
||||
api.getStats(),
|
||||
api.getTicker(),
|
||||
api.getDestinations(),
|
||||
api.getVisas(),
|
||||
api.getFaqs(),
|
||||
api.getTestimonials(),
|
||||
api.getTools(),
|
||||
api.getBlog(),
|
||||
api.getChartCost(),
|
||||
api.getChartSpeed(),
|
||||
api.getChartGrowth(),
|
||||
api.getChartRadar(),
|
||||
]);
|
||||
|
||||
return (
|
||||
<HomeClient
|
||||
stats={stats}
|
||||
ticker={ticker.messages}
|
||||
destinations={destinations}
|
||||
visas={visas}
|
||||
faqs={faqs}
|
||||
testimonials={testimonials}
|
||||
tools={tools}
|
||||
blog={blog}
|
||||
charts={{ cost, speed, growth, radar }}
|
||||
/>
|
||||
);
|
||||
} catch {
|
||||
// Minimal fallback if API completely unavailable
|
||||
const stats = await api.getStats();
|
||||
const ticker = await api.getTicker();
|
||||
return (
|
||||
<HomeClient
|
||||
stats={stats}
|
||||
ticker={ticker.messages}
|
||||
destinations={[]}
|
||||
visas={[]}
|
||||
faqs={[]}
|
||||
testimonials={[]}
|
||||
tools={[]}
|
||||
blog={[]}
|
||||
charts={{
|
||||
cost: { labels: [], datasets: [{ data: [] }] },
|
||||
speed: { labels: [], datasets: [{ data: [] }] },
|
||||
growth: { labels: [], datasets: [{ data: [] }] },
|
||||
radar: { labels: [], datasets: [] },
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
43
app/community/plan/page.tsx
Normal file
43
app/community/plan/page.tsx
Normal file
@ -0,0 +1,43 @@
|
||||
import type { Metadata } from "next";
|
||||
import { api } from "@community/lib/api";
|
||||
import type { Destination, Visa } from "@community/lib/types";
|
||||
import MovePlanClient from "@community/components/MovePlanClient";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "旅居计划中心 · nomadro",
|
||||
description: "多城时间轴、预算与月均、签证停留提醒、出发就绪清单、日历导出——一页做完旅居规划",
|
||||
openGraph: {
|
||||
title: "旅居计划中心 · nomadro",
|
||||
description: "时间轴、签证、预算与就绪清单——真正能执行的旅居计划",
|
||||
url: "/plan",
|
||||
type: "website",
|
||||
},
|
||||
twitter: {
|
||||
card: "summary_large_image",
|
||||
title: "旅居计划中心 · nomadro",
|
||||
description: "时间轴、签证、预算与就绪清单——真正能执行的旅居计划",
|
||||
},
|
||||
};
|
||||
|
||||
export const revalidate = 60;
|
||||
|
||||
export default async function PlanPage() {
|
||||
let destinations: Destination[] = [];
|
||||
let visas: Visa[] = [];
|
||||
try {
|
||||
[destinations, visas] = await Promise.all([api.getDestinations(), api.getVisas()]);
|
||||
} catch {
|
||||
try {
|
||||
destinations = await api.getDestinations();
|
||||
} catch {
|
||||
destinations = [];
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<MovePlanClient destinations={destinations} visas={visas} />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
10
app/community/press/page.tsx
Normal file
10
app/community/press/page.tsx
Normal file
@ -0,0 +1,10 @@
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import StaticPage from "@community/components/StaticPage";
|
||||
import { STATIC_PAGES } from "@community/lib/staticPages";
|
||||
|
||||
const page = STATIC_PAGES.press;
|
||||
export const metadata: Metadata = { title: `${page.title} · nomadro` };
|
||||
export default function PressPage() {
|
||||
return <SiteShell showFooter><StaticPage page={page} /></SiteShell>;
|
||||
}
|
||||
10
app/community/pricing/page.tsx
Normal file
10
app/community/pricing/page.tsx
Normal file
@ -0,0 +1,10 @@
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import PricingClient from "@community/components/PricingClient";
|
||||
|
||||
export default function PricingPage() {
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<PricingClient />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
54
app/community/privacy/page.tsx
Normal file
54
app/community/privacy/page.tsx
Normal file
@ -0,0 +1,54 @@
|
||||
import Link from "next/link";
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "隐私政策 · nomadro",
|
||||
description: "nomadro 隐私政策与 Cookie 使用说明",
|
||||
};
|
||||
|
||||
export default function PrivacyPage() {
|
||||
return (
|
||||
<SiteShell>
|
||||
<div className="legal-page">
|
||||
<nav className="detail-nav">
|
||||
<Link href="/community">← 返回首页</Link>
|
||||
</nav>
|
||||
<article className="legal-content">
|
||||
<span className="section-tag">🔒 PRIVACY</span>
|
||||
<h1>隐私政策</h1>
|
||||
<p className="legal-updated">最后更新:2026-08-28</p>
|
||||
|
||||
<section>
|
||||
<h2>我们收集什么</h2>
|
||||
<p>
|
||||
nomadro 可能收集你主动提供的信息(如邮箱订阅、注册账号),以及必要的技术信息(浏览器类型、访问页面)用于改进体验。
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>Cookie 使用</h2>
|
||||
<p>
|
||||
我们使用 Cookie / localStorage 记住主题偏好、行程规划、行李清单勾选状态与 Cookie 同意选择。这些数据仅保存在你的设备本地,不会上传用于广告追踪。
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>第三方服务</h2>
|
||||
<p>
|
||||
网站可能嵌入图表 CDN、地图相关资源等第三方脚本。请参考对应服务商的隐私政策。我们不会出售你的个人信息。
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>联系我们</h2>
|
||||
<p>
|
||||
如有隐私相关问题,请联系:
|
||||
<a href="mailto:hello@nomadro.com"> hello@nomadro.com</a>
|
||||
</p>
|
||||
</section>
|
||||
</article>
|
||||
</div>
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
468
app/community/profile/page.tsx
Normal file
468
app/community/profile/page.tsx
Normal file
@ -0,0 +1,468 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useAuth } from "@community/lib/auth";
|
||||
import { api } from "@community/lib/api";
|
||||
import type { Destination, Meetup, ProfileStats, TripItem } from "@community/lib/types";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import FavoriteButton from "@community/components/FavoriteButton";
|
||||
import RecentlyViewed from "@community/components/RecentlyViewed";
|
||||
import NomadDigest from "@community/components/NomadDigest";
|
||||
import RingNext from "@community/components/RingNext";
|
||||
import { useRingSteps } from "@community/lib/rings";
|
||||
import { useI18n } from "@community/lib/i18n";
|
||||
import type { Dict } from "@community/lib/i18n";
|
||||
import { loadTrip } from "@community/lib/tripStorage";
|
||||
import { loadPlanMeta, MOVE_CHECKLIST, type PlanMeta } from "@community/lib/planMeta";
|
||||
import { PLAN_SYNC_EVENT } from "@community/lib/planSync";
|
||||
import { mergeDestinationsIntoTrip } from "@community/lib/tripActions";
|
||||
import { useToast } from "@community/lib/toast";
|
||||
import { buildMeetupIcs, downloadMeetupIcs } from "@community/lib/meetupIcs";
|
||||
|
||||
interface Badge {
|
||||
emoji: string;
|
||||
label: string;
|
||||
desc: string;
|
||||
earned: boolean;
|
||||
}
|
||||
|
||||
function getBadges(
|
||||
p: Dict["profile"],
|
||||
stats: ProfileStats | null,
|
||||
trip: TripItem[],
|
||||
favCount: number,
|
||||
readiness: number
|
||||
): Badge[] {
|
||||
const tripMonths = trip.reduce((s, item) => s + item.months, 0);
|
||||
return [
|
||||
{ emoji: "🌱", label: p.badgeNewbie, desc: p.badgeNewbieDesc, earned: true },
|
||||
{ emoji: "❤️", label: p.badgeCollector, desc: p.badgeCollectorDesc, earned: favCount >= 3 },
|
||||
{ emoji: "🗺️", label: p.badgePlanner, desc: p.badgePlannerDesc, earned: trip.length >= 3 },
|
||||
{ emoji: "📅", label: p.badgeLongStay, desc: p.badgeLongStayDesc, earned: tripMonths >= 6 },
|
||||
{ emoji: "✅", label: p.badgeReady, desc: p.badgeReadyDesc, earned: readiness >= 50 },
|
||||
{
|
||||
emoji: "🌍",
|
||||
label: p.badgeGlobal,
|
||||
desc: p.badgeGlobalDesc,
|
||||
earned: (stats?.destinations_explored ?? 0) >= 5,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
export default function ProfilePage() {
|
||||
const { user, token, favorites, logout, planSyncStatus, refreshUser } = useAuth();
|
||||
const router = useRouter();
|
||||
const { toast } = useToast();
|
||||
const { t } = useI18n();
|
||||
const rings = useRingSteps();
|
||||
const [stats, setStats] = useState<ProfileStats | null>(null);
|
||||
const [favoriteDests, setFavoriteDests] = useState<Destination[]>([]);
|
||||
const [rsvps, setRsvps] = useState<Meetup[]>([]);
|
||||
const [connect, setConnect] = useState({ likes: 0, matches: 0 });
|
||||
const [trip, setTrip] = useState<TripItem[]>([]);
|
||||
const [meta, setMeta] = useState<PlanMeta | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [uploadingAvatar, setUploadingAvatar] = useState(false);
|
||||
const [vip, setVip] = useState(false);
|
||||
|
||||
const onAvatarChange = async (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const file = e.target.files?.[0];
|
||||
e.target.value = "";
|
||||
if (!file || !token) return;
|
||||
if (file.size > 5 * 1024 * 1024) {
|
||||
toast(t.profile.avatarTooBig, "error");
|
||||
return;
|
||||
}
|
||||
setUploadingAvatar(true);
|
||||
try {
|
||||
const uploaded = await api.uploadMedia(token, file, "avatar");
|
||||
await api.updateProfile(token, { avatar: uploaded.url });
|
||||
await refreshUser?.();
|
||||
toast(t.profile.avatarOk, "success");
|
||||
} catch (err) {
|
||||
toast(err instanceof Error ? err.message : t.profile.avatarFail, "error");
|
||||
} finally {
|
||||
setUploadingAvatar(false);
|
||||
}
|
||||
};
|
||||
|
||||
const refreshPlan = () => {
|
||||
setTrip(loadTrip<TripItem>());
|
||||
setMeta(loadPlanMeta());
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!token) {
|
||||
router.push("/community/login?next=/profile");
|
||||
return;
|
||||
}
|
||||
setLoading(true);
|
||||
Promise.all([
|
||||
api.getProfileStats(token),
|
||||
favorites.length > 0 ? api.getFavoriteDestinations(token) : Promise.resolve([]),
|
||||
api.getVipStatus(token).catch(() => ({ vip: false, expires_at: 0 })),
|
||||
Promise.all([
|
||||
api.getMyRsvps(token).catch(() => ({ ids: [] as string[] })),
|
||||
api.getMeetups().catch(() => [] as Meetup[]),
|
||||
]).then(([mine, all]) => {
|
||||
const idSet = new Set(mine.ids || []);
|
||||
return all.filter((m) => idSet.has(m.id)).slice(0, 6);
|
||||
}),
|
||||
Promise.all([
|
||||
api.getMatchLikesReceived(token).catch(() => []),
|
||||
api.getMutualMatches(token).catch(() => ({ items: [] })),
|
||||
]).then(([likes, matches]) => ({
|
||||
likes: likes.length,
|
||||
matches: matches.items?.length ?? 0,
|
||||
})),
|
||||
]).then(([s, f, v, myMeetups, connectStats]) => {
|
||||
setStats(s);
|
||||
setFavoriteDests(f);
|
||||
setVip(Boolean(v.vip));
|
||||
setRsvps(myMeetups);
|
||||
setConnect(connectStats);
|
||||
}).catch(() => {}).finally(() => setLoading(false));
|
||||
|
||||
refreshPlan();
|
||||
window.addEventListener(PLAN_SYNC_EVENT, refreshPlan);
|
||||
return () => window.removeEventListener(PLAN_SYNC_EVENT, refreshPlan);
|
||||
}, [token, favorites, router]);
|
||||
|
||||
const totalMonths = trip.reduce((s, item) => s + item.months, 0);
|
||||
const totalCost = trip.reduce((s, item) => s + item.cost * item.months, 0);
|
||||
const avgMonth = totalMonths > 0 ? Math.round(totalCost / totalMonths) : 0;
|
||||
const checked = MOVE_CHECKLIST.filter((c) => meta?.checklist[c.id]).length;
|
||||
const readiness = Math.round((checked / MOVE_CHECKLIST.length) * 100);
|
||||
const budgetOk = !meta || meta.monthlyBudget <= 0 || avgMonth <= 0 || avgMonth <= meta.monthlyBudget;
|
||||
|
||||
const badges = useMemo(
|
||||
() => getBadges(t.profile, stats, trip, favoriteDests.length, readiness),
|
||||
[t.profile, stats, trip, favoriteDests.length, readiness]
|
||||
);
|
||||
const earnedCount = badges.filter((b) => b.earned).length;
|
||||
|
||||
const favsNotInTrip = favoriteDests.filter((d) => !trip.some((item) => item.slug === d.slug));
|
||||
|
||||
const addFavsToPlan = () => {
|
||||
if (favsNotInTrip.length === 0) {
|
||||
toast(t.profile.favsAlready, "info", { href: "/plan", label: t.profile.openPlan });
|
||||
return;
|
||||
}
|
||||
const { added } = mergeDestinationsIntoTrip(favsNotInTrip, 1);
|
||||
refreshPlan();
|
||||
toast(t.profile.favsAdded.replace("{n}", String(added)), "success", {
|
||||
href: "/plan",
|
||||
label: t.profile.openPlan,
|
||||
});
|
||||
};
|
||||
|
||||
const planTitle =
|
||||
meta?.title && meta.title !== "我的旅居计划" ? meta.title : t.plan.defaultTitle;
|
||||
|
||||
if (!user) return null;
|
||||
|
||||
return (
|
||||
<SiteShell>
|
||||
<div className="profile-page">
|
||||
<div className="profile-header">
|
||||
<div className="profile-avatar-wrap">
|
||||
{user.avatar?.startsWith("http") ? (
|
||||
// eslint-disable-next-line @next/next/no-img-element
|
||||
<img src={user.avatar} alt="" className="profile-avatar-img" />
|
||||
) : (
|
||||
<div className="profile-avatar">{user.avatar || "🧑💻"}</div>
|
||||
)}
|
||||
<label className="profile-avatar-upload">
|
||||
{uploadingAvatar ? t.profile.uploading : t.profile.changeAvatar}
|
||||
<input
|
||||
type="file"
|
||||
accept="image/jpeg,image/png,image/webp,image/gif"
|
||||
hidden
|
||||
disabled={uploadingAvatar}
|
||||
onChange={onAvatarChange}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<div className="profile-info">
|
||||
<h1>{user.name}</h1>
|
||||
<p>{user.email}</p>
|
||||
<div className="profile-badges-row">
|
||||
{stats && <span className="profile-level">{stats.nomad_level}</span>}
|
||||
{vip && <span className="profile-vip-badge">✨ VIP</span>}
|
||||
</div>
|
||||
<span className={`plan-sync-pill ${planSyncStatus}`} style={{ marginTop: 8, display: "inline-flex" }}>
|
||||
{planSyncStatus === "syncing" && t.profile.syncing}
|
||||
{planSyncStatus === "synced" && t.profile.synced}
|
||||
{planSyncStatus === "offline" && t.profile.offline}
|
||||
{planSyncStatus === "idle" && t.profile.loggedIn}
|
||||
</span>
|
||||
</div>
|
||||
<button className="btn btn-ghost" onClick={() => { logout(); router.push("/community"); }}>
|
||||
{t.profile.logout}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{stats && (
|
||||
<div className="profile-stats-grid">
|
||||
<div className="profile-stat-card">
|
||||
<span className="stat-emoji">❤️</span>
|
||||
<strong>{stats.favorites_count}</strong>
|
||||
<span>{t.profile.statFavs}</span>
|
||||
</div>
|
||||
<div className="profile-stat-card">
|
||||
<span className="stat-emoji">🗓️</span>
|
||||
<strong>{trip.length}</strong>
|
||||
<span>{t.profile.statCities}</span>
|
||||
</div>
|
||||
<div className="profile-stat-card">
|
||||
<span className="stat-emoji">✅</span>
|
||||
<strong>{readiness}%</strong>
|
||||
<span>{t.profile.statReady}</span>
|
||||
</div>
|
||||
<div className="profile-stat-card">
|
||||
<span className="stat-emoji">🏅</span>
|
||||
<strong>{earnedCount}/{badges.length}</strong>
|
||||
<span>{t.profile.statBadges}</span>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="profile-connect-block">
|
||||
<h2 className="profile-connect-title">{t.profile.connectStrip}</h2>
|
||||
<div className="profile-stats-grid profile-connect-stats">
|
||||
<Link href="/community/dating/likes" className="profile-stat-card profile-stat-link">
|
||||
<span className="stat-emoji">💕</span>
|
||||
<strong>{connect.likes}</strong>
|
||||
<span>{t.profile.statLikes}</span>
|
||||
</Link>
|
||||
<Link href="/community/dating/likes" className="profile-stat-card profile-stat-link">
|
||||
<span className="stat-emoji">✨</span>
|
||||
<strong>{connect.matches}</strong>
|
||||
<span>{t.profile.statMatches}</span>
|
||||
</Link>
|
||||
<Link href="/community/meetups" className="profile-stat-card profile-stat-link">
|
||||
<span className="stat-emoji">🎉</span>
|
||||
<strong>{rsvps.length}</strong>
|
||||
<span>{t.profile.statRsvps}</span>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<NomadDigest rsvpCount={rsvps.length} upcoming={rsvps} />
|
||||
|
||||
<section className="profile-trip">
|
||||
<div className="profile-section-head">
|
||||
<h2>🗓️ {planTitle}</h2>
|
||||
<Link href="/community/plan" className="btn btn-primary btn-sm">{t.profile.openPlan}</Link>
|
||||
</div>
|
||||
{trip.length === 0 ? (
|
||||
<div className="profile-empty">
|
||||
<span style={{ fontSize: "2.5rem" }}>🗺️</span>
|
||||
<p>{t.profile.tripEmpty}</p>
|
||||
<Link href="/community/plan" className="btn btn-primary">{t.profile.goPlan}</Link>
|
||||
</div>
|
||||
) : (
|
||||
<div className="profile-trip-list">
|
||||
{(meta?.startMonth || meta?.monthlyBudget) && (
|
||||
<div className="profile-plan-meta">
|
||||
{meta?.startMonth && (
|
||||
<span>{t.profile.startLabel.replace("{month}", meta.startMonth)}</span>
|
||||
)}
|
||||
{meta && meta.monthlyBudget > 0 && (
|
||||
<span className={!budgetOk ? "plan-warn-text" : undefined}>
|
||||
{t.profile.budgetLabel.replace("{budget}", meta.monthlyBudget.toLocaleString())}
|
||||
{avgMonth > 0 &&
|
||||
t.profile.avgMonthLabel.replace("{avg}", avgMonth.toLocaleString())}
|
||||
</span>
|
||||
)}
|
||||
<span>
|
||||
{t.profile.readyCount
|
||||
.replace("{checked}", String(checked))
|
||||
.replace("{total}", String(MOVE_CHECKLIST.length))}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
{trip.map((item, i) => (
|
||||
<div key={item.slug} className="profile-trip-item">
|
||||
<span className="trip-item-num">{i + 1}</span>
|
||||
<span>{item.emoji}</span>
|
||||
<div>
|
||||
<strong>{item.name}, {item.country}</strong>
|
||||
<span>
|
||||
{t.profile.monthsCost
|
||||
.replace("{months}", String(item.months))
|
||||
.replace("{cost}", (item.cost * item.months).toLocaleString())}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
<div className="profile-trip-total">
|
||||
{t.profile.totalLine}{" "}
|
||||
<strong>
|
||||
{totalMonths} {t.profile.monthsUnit}
|
||||
</strong>{" "}
|
||||
·
|
||||
<strong className="gradient-text"> ¥{totalCost.toLocaleString()}</strong>
|
||||
</div>
|
||||
<div className="profile-trip-actions">
|
||||
{trip.length >= 2 && (
|
||||
<Link
|
||||
href={`/compare?cities=${trip.map((item) => item.slug).slice(0, 4).join(",")}`}
|
||||
className="btn btn-ghost btn-sm"
|
||||
>
|
||||
{t.profile.compareTrip}
|
||||
</Link>
|
||||
)}
|
||||
<Link href="/community/plan" className="btn btn-ghost btn-sm">{t.profile.keepEditing}</Link>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
|
||||
<section className="profile-badges">
|
||||
<h2>{t.profile.achievements}</h2>
|
||||
<div className="badge-grid">
|
||||
{badges.map((b) => (
|
||||
<div key={b.label} className={`badge-card${b.earned ? " earned" : " locked"}`} title={b.desc}>
|
||||
<span className="badge-emoji">{b.earned ? b.emoji : "🔒"}</span>
|
||||
<strong>{b.label}</strong>
|
||||
<small>{b.desc}</small>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="profile-favorites">
|
||||
<div className="profile-section-head">
|
||||
<h2>{t.profile.myFavs}</h2>
|
||||
{favsNotInTrip.length > 0 && (
|
||||
<button type="button" className="btn btn-ghost btn-sm" onClick={addFavsToPlan}>
|
||||
{t.profile.favsToPlan.replace("{n}", String(favsNotInTrip.length))}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{loading ? (
|
||||
<p className="profile-loading">{t.profile.loading}</p>
|
||||
) : favoriteDests.length === 0 ? (
|
||||
<div className="profile-empty">
|
||||
<span style={{ fontSize: "3rem" }}>🌍</span>
|
||||
<p>{t.profile.favsEmpty}</p>
|
||||
<Link href="/community/#destinations" className="btn btn-primary">{t.profile.goExplore}</Link>
|
||||
</div>
|
||||
) : (
|
||||
<div className="profile-fav-grid">
|
||||
{favoriteDests.map((d) => (
|
||||
<div key={d.slug} className="profile-fav-card">
|
||||
<Link href={`/destinations/${d.slug}`}>
|
||||
<span className="fav-emoji">{d.emoji}</span>
|
||||
<h3>{d.name}, {d.country}</h3>
|
||||
<p>
|
||||
💰 ¥{d.cost.toLocaleString()}
|
||||
{t.profile.perMonth} · ⭐ {d.rating}
|
||||
</p>
|
||||
</Link>
|
||||
<FavoriteButton slug={d.slug} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
|
||||
<section className="profile-rsvps">
|
||||
<div className="profile-section-head">
|
||||
<h2>🎉 {t.profile.myRsvps}</h2>
|
||||
<div className="profile-section-actions">
|
||||
{rsvps.length > 0 && (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-ghost btn-sm"
|
||||
onClick={() => {
|
||||
const ics = buildMeetupIcs(rsvps, "nomadro RSVPs");
|
||||
if (!ics) {
|
||||
toast(t.meetups.exportCalFail, "info");
|
||||
return;
|
||||
}
|
||||
downloadMeetupIcs("nomadro-rsvps.ics", ics);
|
||||
toast(t.meetups.exportCalDone);
|
||||
}}
|
||||
>
|
||||
📅 {t.profile.exportRsvps}
|
||||
</button>
|
||||
)}
|
||||
<Link href="/community/meetups" className="btn btn-ghost btn-sm">{t.nav.meetups}</Link>
|
||||
</div>
|
||||
</div>
|
||||
{rsvps.length === 0 ? (
|
||||
<div className="profile-empty">
|
||||
<p>{t.profile.rsvpEmpty}</p>
|
||||
<Link href="/community/meetups" className="btn btn-primary btn-sm">{t.profile.goMeetups}</Link>
|
||||
</div>
|
||||
) : (
|
||||
<div className="profile-rsvp-list">
|
||||
{rsvps.map((m) => (
|
||||
<div key={m.id} className="profile-rsvp-card">
|
||||
<span aria-hidden>{m.emoji}</span>
|
||||
<div>
|
||||
<strong>{m.title}</strong>
|
||||
<p>
|
||||
{m.city} · {m.date} {m.time}
|
||||
</p>
|
||||
</div>
|
||||
<div className="profile-rsvp-actions">
|
||||
{(m.mode === "online" || m.mode === "hybrid") && (
|
||||
<Link href={`/meetups/${m.id}/live`} className="btn btn-sm btn-primary">
|
||||
{t.profile.openLive}
|
||||
</Link>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-sm btn-ghost"
|
||||
onClick={() => {
|
||||
const ics = buildMeetupIcs([m], m.title);
|
||||
if (!ics) {
|
||||
toast(t.meetups.exportCalFail, "info");
|
||||
return;
|
||||
}
|
||||
downloadMeetupIcs(`nomadro-${m.id}.ics`, ics);
|
||||
toast(t.meetups.exportCalDone);
|
||||
}}
|
||||
>
|
||||
{t.meetups.addToCal}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
|
||||
<RecentlyViewed compact />
|
||||
|
||||
<section className="profile-quick">
|
||||
<h2>{t.profile.quickLinks}</h2>
|
||||
<div className="profile-quick-grid">
|
||||
<Link href="/community/#destinations" className="quick-card">{t.profile.qDest}</Link>
|
||||
<Link href="/community/plan" className="quick-card">{t.profile.qPlan}</Link>
|
||||
<Link href="/community/compare" className="quick-card">{t.profile.qCompare}</Link>
|
||||
<Link href="/community/next-stop" className="quick-card">{t.profile.qNext}</Link>
|
||||
<Link href="/community/meetups" className="quick-card">{t.profile.qMeetups}</Link>
|
||||
<Link href="/community/dating" className="quick-card">{t.profile.qDating}</Link>
|
||||
<Link href="/community/join" className="quick-card">{vip ? t.profile.qVipMember : t.profile.qVip}</Link>
|
||||
<Link href="/community/digital" className="quick-card">{t.profile.qDigital}</Link>
|
||||
<Link href="/community/ai" className="quick-card">{t.profile.qAi}</Link>
|
||||
<Link href="/community/tools" className="quick-card">{t.profile.qTools}</Link>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<RingNext
|
||||
steps={[
|
||||
...rings.afterDiscover,
|
||||
{ href: "/dating", emoji: "💕", label: t.ring.dating, desc: t.ring.datingDesc },
|
||||
].slice(0, 3)}
|
||||
/>
|
||||
</div>
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
16
app/community/report/page.tsx
Normal file
16
app/community/report/page.tsx
Normal file
@ -0,0 +1,16 @@
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import ReportClient from "@community/components/ReportClient";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "数据报告 · nomadro",
|
||||
description: "游民城市排名与会员分布",
|
||||
};
|
||||
|
||||
export default function ReportPage() {
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<ReportClient />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
10
app/community/robots.ts
Normal file
10
app/community/robots.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import type { MetadataRoute } from "next";
|
||||
|
||||
const SITE = process.env.NEXT_PUBLIC_SITE_URL || "https://nomadweb.nomadro.com";
|
||||
|
||||
export default function robots(): MetadataRoute.Robots {
|
||||
return {
|
||||
rules: { userAgent: "*", allow: "/" },
|
||||
sitemap: `${SITE}/sitemap.xml`,
|
||||
};
|
||||
}
|
||||
19
app/community/safety/page.tsx
Normal file
19
app/community/safety/page.tsx
Normal file
@ -0,0 +1,19 @@
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import StaticPage from "@community/components/StaticPage";
|
||||
import { STATIC_PAGES } from "@community/lib/staticPages";
|
||||
|
||||
const page = STATIC_PAGES.safety;
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: `${page.title} · nomadro`,
|
||||
description: "nomadro 社区安全指南",
|
||||
};
|
||||
|
||||
export default function SafetyPage() {
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<StaticPage page={page} />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
18
app/community/services/page.tsx
Normal file
18
app/community/services/page.tsx
Normal file
@ -0,0 +1,18 @@
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import ServicesClient from "@community/components/ServicesClient";
|
||||
import { api } from "@community/lib/api";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "游民服务 · nomadro",
|
||||
description: "签证咨询、税务评估、落地陪跑等认证服务",
|
||||
};
|
||||
|
||||
export default async function ServicesPage() {
|
||||
const services = await api.getServices().catch(() => []);
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<ServicesClient services={services} />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
15
app/community/settings/notifications/page.tsx
Normal file
15
app/community/settings/notifications/page.tsx
Normal file
@ -0,0 +1,15 @@
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import NotificationSettingsClient from "@community/components/NotificationSettingsClient";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "通知设置 · nomadro",
|
||||
};
|
||||
|
||||
export default function NotificationSettingsPage() {
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<NotificationSettingsClient />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
74
app/community/sitemap.ts
Normal file
74
app/community/sitemap.ts
Normal file
@ -0,0 +1,74 @@
|
||||
import type { MetadataRoute } from "next";
|
||||
|
||||
const SITE = process.env.NEXT_PUBLIC_SITE_URL || "https://nomadweb.nomadro.com";
|
||||
const DESTINATIONS = ["bali", "lisbon", "chiangmai", "mexico", "barcelona", "tokyo"];
|
||||
const BLOGS = ["chiangmai-guide-2026", "portugal-d7-visa", "nomad-tax-basics"];
|
||||
|
||||
export default function sitemap(): MetadataRoute.Sitemap {
|
||||
const now = new Date();
|
||||
|
||||
return [
|
||||
{ url: SITE, lastModified: now, changeFrequency: "weekly", priority: 1 },
|
||||
{ url: `${SITE}/plan`, lastModified: now, changeFrequency: "weekly", priority: 0.95 },
|
||||
{ url: `${SITE}/compare`, lastModified: now, changeFrequency: "weekly", priority: 0.9 },
|
||||
{ url: `${SITE}/tools`, lastModified: now, changeFrequency: "weekly", priority: 0.8 },
|
||||
{ url: `${SITE}/next-stop`, lastModified: now, changeFrequency: "weekly", priority: 0.9 },
|
||||
{ url: `${SITE}/meetups`, lastModified: now, changeFrequency: "weekly", priority: 0.85 },
|
||||
{ url: `${SITE}/community`, lastModified: now, changeFrequency: "weekly", priority: 0.85 },
|
||||
{ url: `${SITE}/dating`, lastModified: now, changeFrequency: "weekly", priority: 0.85 },
|
||||
{ url: `${SITE}/chat`, lastModified: now, changeFrequency: "weekly", priority: 0.8 },
|
||||
{ url: `${SITE}/gigs`, lastModified: now, changeFrequency: "weekly", priority: 0.8 },
|
||||
{ url: `${SITE}/pricing`, lastModified: now, changeFrequency: "monthly", priority: 0.7 },
|
||||
{ url: `${SITE}/notifications`, lastModified: now, changeFrequency: "weekly", priority: 0.6 },
|
||||
{ url: `${SITE}/community/new`, lastModified: now, changeFrequency: "weekly", priority: 0.75 },
|
||||
{ url: `${SITE}/meetups/host`, lastModified: now, changeFrequency: "weekly", priority: 0.75 },
|
||||
{ url: `${SITE}/dating/likes`, lastModified: now, changeFrequency: "weekly", priority: 0.7 },
|
||||
{ url: `${SITE}/ai`, lastModified: now, changeFrequency: "monthly", priority: 0.7 },
|
||||
{ url: `${SITE}/videos`, lastModified: now, changeFrequency: "weekly", priority: 0.75 },
|
||||
{ url: `${SITE}/services`, lastModified: now, changeFrequency: "weekly", priority: 0.75 },
|
||||
{ url: `${SITE}/map`, lastModified: now, changeFrequency: "weekly", priority: 0.7 },
|
||||
{ url: `${SITE}/report`, lastModified: now, changeFrequency: "weekly", priority: 0.65 },
|
||||
{ url: `${SITE}/feedback`, lastModified: now, changeFrequency: "monthly", priority: 0.5 },
|
||||
{ url: `${SITE}/submit`, lastModified: now, changeFrequency: "monthly", priority: 0.5 },
|
||||
{ url: `${SITE}/gigs/post`, lastModified: now, changeFrequency: "weekly", priority: 0.7 },
|
||||
{ url: `${SITE}/settings/notifications`, lastModified: now, changeFrequency: "monthly", priority: 0.5 },
|
||||
{ url: `${SITE}/contact`, lastModified: now, changeFrequency: "yearly", priority: 0.4 },
|
||||
{ url: `${SITE}/help`, lastModified: now, changeFrequency: "yearly", priority: 0.4 },
|
||||
{ url: `${SITE}/terms`, lastModified: now, changeFrequency: "yearly", priority: 0.3 },
|
||||
{ url: `${SITE}/digital`, lastModified: now, changeFrequency: "weekly", priority: 0.85 },
|
||||
{ url: `${SITE}/digital/course`, lastModified: now, changeFrequency: "weekly", priority: 0.8 },
|
||||
{ url: `${SITE}/digital/jobs`, lastModified: now, changeFrequency: "weekly", priority: 0.75 },
|
||||
{ url: `${SITE}/digital/day/1`, lastModified: now, changeFrequency: "monthly", priority: 0.55 },
|
||||
{ url: `${SITE}/digital/day/2`, lastModified: now, changeFrequency: "monthly", priority: 0.55 },
|
||||
{ url: `${SITE}/digital/day/3`, lastModified: now, changeFrequency: "monthly", priority: 0.55 },
|
||||
{ url: `${SITE}/digital/day/4`, lastModified: now, changeFrequency: "monthly", priority: 0.55 },
|
||||
{ url: `${SITE}/digital/day/5`, lastModified: now, changeFrequency: "monthly", priority: 0.55 },
|
||||
{ url: `${SITE}/digital/day/6`, lastModified: now, changeFrequency: "monthly", priority: 0.55 },
|
||||
{ url: `${SITE}/digital/day/7`, lastModified: now, changeFrequency: "monthly", priority: 0.55 },
|
||||
{ url: `${SITE}/book`, lastModified: now, changeFrequency: "weekly", priority: 0.85 },
|
||||
{ url: `${SITE}/book/read`, lastModified: now, changeFrequency: "weekly", priority: 0.8 },
|
||||
{ url: `${SITE}/support`, lastModified: now, changeFrequency: "monthly", priority: 0.5 },
|
||||
{ url: `${SITE}/careers`, lastModified: now, changeFrequency: "monthly", priority: 0.45 },
|
||||
{ url: `${SITE}/safety`, lastModified: now, changeFrequency: "yearly", priority: 0.4 },
|
||||
{ url: `${SITE}/guidelines`, lastModified: now, changeFrequency: "yearly", priority: 0.4 },
|
||||
{ url: `${SITE}/cookies`, lastModified: now, changeFrequency: "yearly", priority: 0.3 },
|
||||
{ url: `${SITE}/press`, lastModified: now, changeFrequency: "yearly", priority: 0.35 },
|
||||
{ url: `${SITE}/login`, lastModified: now, changeFrequency: "monthly", priority: 0.5 },
|
||||
{ url: `${SITE}/privacy`, lastModified: now, changeFrequency: "yearly", priority: 0.3 },
|
||||
{ url: `${SITE}/about`, lastModified: now, changeFrequency: "monthly", priority: 0.5 },
|
||||
{ url: `${SITE}/changelog`, lastModified: now, changeFrequency: "weekly", priority: 0.4 },
|
||||
{ url: `${SITE}/profile`, lastModified: now, changeFrequency: "monthly", priority: 0.4 },
|
||||
...DESTINATIONS.map((slug) => ({
|
||||
url: `${SITE}/destinations/${slug}`,
|
||||
lastModified: now,
|
||||
changeFrequency: "weekly" as const,
|
||||
priority: 0.8,
|
||||
})),
|
||||
...BLOGS.map((slug) => ({
|
||||
url: `${SITE}/blog/${slug}`,
|
||||
lastModified: now,
|
||||
changeFrequency: "monthly" as const,
|
||||
priority: 0.7,
|
||||
})),
|
||||
];
|
||||
}
|
||||
15
app/community/submit/page.tsx
Normal file
15
app/community/submit/page.tsx
Normal file
@ -0,0 +1,15 @@
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import ContentSubmitClient from "@community/components/ContentSubmitClient";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "内容投稿 · nomadro",
|
||||
};
|
||||
|
||||
export default function SubmitPage() {
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<ContentSubmitClient />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
10
app/community/support/page.tsx
Normal file
10
app/community/support/page.tsx
Normal file
@ -0,0 +1,10 @@
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import StaticPage from "@community/components/StaticPage";
|
||||
import { STATIC_PAGES } from "@community/lib/staticPages";
|
||||
|
||||
const page = STATIC_PAGES.support;
|
||||
export const metadata: Metadata = { title: `${page.title} · nomadro` };
|
||||
export default function SupportPage() {
|
||||
return <SiteShell showFooter><StaticPage page={page} /></SiteShell>;
|
||||
}
|
||||
19
app/community/terms/page.tsx
Normal file
19
app/community/terms/page.tsx
Normal file
@ -0,0 +1,19 @@
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import StaticPage from "@community/components/StaticPage";
|
||||
import { STATIC_PAGES } from "@community/lib/staticPages";
|
||||
|
||||
const page = STATIC_PAGES.terms;
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: `${page.title} · nomadro`,
|
||||
description: "nomadro 服务条款",
|
||||
};
|
||||
|
||||
export default function TermsPage() {
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<StaticPage page={page} />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
44
app/community/tools/[id]/page.tsx
Normal file
44
app/community/tools/[id]/page.tsx
Normal file
@ -0,0 +1,44 @@
|
||||
import type { Metadata } from "next";
|
||||
import { notFound } from "next/navigation";
|
||||
import { api } from "@community/lib/api";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import ToolRunnerClient from "@community/components/ToolRunnerClient";
|
||||
import { TOOL_LINKS } from "@community/lib/tools";
|
||||
import { isRunnableTool } from "@community/lib/toolsRegistry";
|
||||
|
||||
export const revalidate = 60;
|
||||
|
||||
export function generateStaticParams() {
|
||||
return TOOL_LINKS.filter((t) => isRunnableTool(t.id)).map((t) => ({ id: t.id }));
|
||||
}
|
||||
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ id: string }>;
|
||||
}): Promise<Metadata> {
|
||||
const { id } = await params;
|
||||
const tool = TOOL_LINKS.find((t) => t.id === id);
|
||||
if (!tool) return { title: "工具 · nomadro" };
|
||||
return {
|
||||
title: `${tool.title} · nomadro 工具箱`,
|
||||
description: tool.desc,
|
||||
};
|
||||
}
|
||||
|
||||
export default async function ToolPage({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ id: string }>;
|
||||
}) {
|
||||
const { id } = await params;
|
||||
if (!isRunnableTool(id)) notFound();
|
||||
|
||||
const destinations = await api.getDestinations().catch(() => []);
|
||||
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<ToolRunnerClient toolId={id} destinations={destinations} />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
135
app/community/tools/page.tsx
Normal file
135
app/community/tools/page.tsx
Normal file
@ -0,0 +1,135 @@
|
||||
"use client";
|
||||
|
||||
import { useMemo, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { useI18n } from "@community/lib/i18n";
|
||||
import { localizedToolCategories, localizedToolLinks } from "@community/lib/toolCopy";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import RingNext from "@community/components/RingNext";
|
||||
import { useRingSteps } from "@community/lib/rings";
|
||||
|
||||
const FEATURED = ["weekend", "day-plan", "bill-split", "mood", "scam-alerts", "deposit-return"];
|
||||
|
||||
/** Utility drawer — not a product mega-menu. */
|
||||
export default function ToolsHubPage() {
|
||||
const { t, locale } = useI18n();
|
||||
const rings = useRingSteps();
|
||||
const [filter, setFilter] = useState("all");
|
||||
const [q, setQ] = useState("");
|
||||
const [showAll, setShowAll] = useState(false);
|
||||
|
||||
const tools = useMemo(() => localizedToolLinks(locale), [locale]);
|
||||
const categories = useMemo(() => localizedToolCategories(locale), [locale]);
|
||||
|
||||
const featured = useMemo(
|
||||
() => FEATURED.map((id) => tools.find((tool) => tool.id === id)).filter((tool): tool is NonNullable<typeof tool> => !!tool),
|
||||
[tools]
|
||||
);
|
||||
|
||||
const filtered = useMemo(() => {
|
||||
let list = filter === "all" ? tools : tools.filter((tool) => tool.category === filter);
|
||||
if (q.trim()) {
|
||||
const s = q.toLowerCase();
|
||||
list = list.filter((tool) => tool.title.toLowerCase().includes(s) || tool.desc.toLowerCase().includes(s));
|
||||
}
|
||||
return list;
|
||||
}, [filter, q, tools]);
|
||||
|
||||
const visible = showAll || q.trim() || filter !== "all" ? filtered : filtered.slice(0, 12);
|
||||
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<div className="tools-hub-page">
|
||||
<div className="container">
|
||||
<nav className="detail-nav">
|
||||
<Link href="/community">{t.common.backHome}</Link>
|
||||
</nav>
|
||||
<div className="section-header">
|
||||
<span className="section-tag">{t.tools.tag}</span>
|
||||
<h1>{t.tools.title}</h1>
|
||||
<p>{t.tools.subtitle}</p>
|
||||
</div>
|
||||
|
||||
<RingNext title={t.ring.continue} steps={rings.afterTools} />
|
||||
|
||||
<div className="tools-featured">
|
||||
<div className="tools-featured-head">
|
||||
<strong>✨ {t.tools.tag}</strong>
|
||||
<span>{featured.length} · {t.tools.featuredHint}</span>
|
||||
</div>
|
||||
<div className="tools-featured-grid tools-featured-grid-compact">
|
||||
{featured.map((tool) => (
|
||||
<Link key={tool.id} href={tool.href} className="tools-featured-card">
|
||||
<span>{tool.emoji}</span>
|
||||
<div>
|
||||
<h3>{tool.title}</h3>
|
||||
<p>{tool.desc}</p>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="tools-hub-toolbar">
|
||||
<input
|
||||
className="tools-hub-search"
|
||||
placeholder={t.tools.searchPlaceholder}
|
||||
value={q}
|
||||
onChange={(e) => setQ(e.target.value)}
|
||||
/>
|
||||
<div className="tools-hub-filters">
|
||||
{categories.map((c) => (
|
||||
<button
|
||||
key={c.key}
|
||||
className={`filter-btn${filter === c.key ? " active" : ""}`}
|
||||
onClick={() => setFilter(c.key)}
|
||||
>
|
||||
{c.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="tools-hub-grid">
|
||||
{visible.map((tool) => (
|
||||
<Link key={tool.id} href={tool.href} className="tools-hub-card">
|
||||
<span className="tools-hub-emoji">{tool.emoji}</span>
|
||||
<h3>{tool.title}</h3>
|
||||
<p>{tool.desc}</p>
|
||||
<span className="tools-hub-go">{t.tools.open}</span>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
{!showAll && !q.trim() && filter === "all" && filtered.length > 12 && (
|
||||
<div className="tools-hub-more">
|
||||
<button type="button" className="btn btn-ghost" onClick={() => setShowAll(true)}>
|
||||
{t.tools.showAll.replace("{n}", String(filtered.length))}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
{filtered.length === 0 && (
|
||||
<div className="notif-empty">
|
||||
<p className="dest-empty">{t.tools.empty}</p>
|
||||
<div className="dating-empty-actions">
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-sm"
|
||||
onClick={() => {
|
||||
setQ("");
|
||||
setFilter("all");
|
||||
setShowAll(false);
|
||||
}}
|
||||
>
|
||||
{t.tools.clearFilter}
|
||||
</button>
|
||||
<Link href="/community/next-stop" className="btn btn-primary btn-sm">
|
||||
{t.tools.goNextStop}
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
22
app/community/videos/[slug]/page.tsx
Normal file
22
app/community/videos/[slug]/page.tsx
Normal file
@ -0,0 +1,22 @@
|
||||
import type { Metadata } from "next";
|
||||
import { notFound } from "next/navigation";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import VideoDetailClient from "@community/components/VideoDetailClient";
|
||||
import { api } from "@community/lib/api";
|
||||
|
||||
export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> {
|
||||
const { slug } = await params;
|
||||
const video = await api.getVideo(slug).catch(() => null);
|
||||
return { title: video ? `${video.title} · nomadro` : "视频 · nomadro" };
|
||||
}
|
||||
|
||||
export default async function VideoDetailPage({ params }: { params: Promise<{ slug: string }> }) {
|
||||
const { slug } = await params;
|
||||
const video = await api.getVideo(slug).catch(() => null);
|
||||
if (!video) notFound();
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<VideoDetailClient video={video} />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
18
app/community/videos/page.tsx
Normal file
18
app/community/videos/page.tsx
Normal file
@ -0,0 +1,18 @@
|
||||
import type { Metadata } from "next";
|
||||
import SiteShell from "@community/components/SiteShell";
|
||||
import VideosClient from "@community/components/VideosClient";
|
||||
import { api } from "@community/lib/api";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "游民访谈 · nomadro",
|
||||
description: "数字游民真实旅居访谈与实录",
|
||||
};
|
||||
|
||||
export default async function VideosPage() {
|
||||
const videos = await api.getVideos().catch(() => []);
|
||||
return (
|
||||
<SiteShell showFooter>
|
||||
<VideosClient videos={videos} />
|
||||
</SiteShell>
|
||||
);
|
||||
}
|
||||
5
app/nav/layout.tsx
Normal file
5
app/nav/layout.tsx
Normal file
@ -0,0 +1,5 @@
|
||||
import "@navmini/styles/global.css";
|
||||
|
||||
export default function NavLayout({ children }: { children: React.ReactNode }) {
|
||||
return <div className="navmini-root">{children}</div>;
|
||||
}
|
||||
7
app/nav/page.tsx
Normal file
7
app/nav/page.tsx
Normal file
@ -0,0 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import NavApp from "@navmini/App";
|
||||
|
||||
export default function NavPage() {
|
||||
return <NavApp />;
|
||||
}
|
||||
@ -1,47 +1,19 @@
|
||||
# Vertical apps inside nomadro portal
|
||||
# Vertical apps — native App Router mounts (no iframe / no proxy)
|
||||
|
||||
本目录迁入三个垂直项目,由门户首页三个入口打开**同站子路径**(外链跳转已屏蔽,代码保留)。
|
||||
| 入口 | URL | 源码 | 小程序 |
|
||||
|------|-----|------|--------|
|
||||
| 出海导航 | `/nav` | `apps/navmini` + `app/nav` | weapp / tt / xhs |
|
||||
| 数字游民小册 | `/book` | `apps/ebook` + `app/book` | wemini / dymini / redmini |
|
||||
| 旅居社群 | `/community` | `apps/nomadweb` + `app/community` | wemini / dymini / redmini |
|
||||
|
||||
| 入口 | 路径 | 源目录 | Web | 微信 | 抖音 | 小红书 |
|
||||
|------|------|--------|-----|------|------|--------|
|
||||
| 出海导航 | `/nav` | `apps/navmini` | Vite H5/PC | `weapp/` | `tt/` | `xhs/`(纯前端小工具) |
|
||||
| 数字游民小册 | `/book` | `apps/ebook` | Next.js + FastAPI | `wemini/` | `dymini/` | `redmini/`(纯前端) |
|
||||
| 旅居社群 | `/community` | `apps/nomadweb` | Next.js + FastAPI + PB | `wemini/` | `dymini/` | `redmini/`(纯前端) |
|
||||
门户 `pnpm dev`(`:3000`)一次启动即可打开三个入口。别名:`@ebook/*`、`@community/*`、`@navmini/*`。
|
||||
|
||||
## 本地联调
|
||||
|
||||
在仓库根目录:
|
||||
外链跳转仍在 `components/sections/hero.tsx` 的 `EXTERNAL_*`(默认关闭)。
|
||||
|
||||
```bash
|
||||
# 终端 1 — 门户 :3000(会把 /nav /book /community reverse-proxy 到下游)
|
||||
pnpm install
|
||||
pnpm dev
|
||||
|
||||
# 终端 2 — 导航
|
||||
cd apps/navmini && npm i && npm run dev
|
||||
|
||||
# 终端 3 — 电子书(端口 3001)
|
||||
cd apps/ebook && npm i --legacy-peer-deps && npx next dev -p 3001
|
||||
|
||||
# 终端 4 — 社群前端(端口 3002;另起 backend :8000)
|
||||
cd apps/nomadweb/frontend && npm i --legacy-peer-deps && npx next dev -p 3002
|
||||
# http://localhost:3000/nav
|
||||
# http://localhost:3000/book
|
||||
# http://localhost:3000/community
|
||||
```
|
||||
|
||||
也可先构建导航静态资源到门户 `public/nav`(不依赖 Vite 进程):
|
||||
|
||||
```bash
|
||||
pnpm build:nav
|
||||
```
|
||||
|
||||
## 环境变量(门户)
|
||||
|
||||
| 变量 | 默认 | 含义 |
|
||||
|------|------|------|
|
||||
| `NAV_UPSTREAM` | `http://127.0.0.1:5173` | navmini |
|
||||
| `BOOK_UPSTREAM` | `http://127.0.0.1:3001` | ebook |
|
||||
| `COMMUNITY_UPSTREAM` | `http://127.0.0.1:3002` | nomadweb frontend |
|
||||
|
||||
生产建议用 Caddy 做路径反代(见 `deploy/caddy/nomadro-portal.Caddyfile`),比 Next rewrite 更稳。
|
||||
|
||||
## 恢复外链跳转
|
||||
|
||||
编辑 `components/sections/hero.tsx`,将 `EXTERNAL_JUMP_ENABLED` 改为 `true`(勿删 `EXTERNAL_PORTALS`)。
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
/** Standalone ebook deploy only — portal uses apps/ebook/src via @ebook/* */
|
||||
const nextConfig = {
|
||||
output: 'standalone',
|
||||
basePath: '/book',
|
||||
// Portal (or Caddy) proxies https://host/book → this app
|
||||
output: "standalone",
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import 'antd/dist/reset.css';
|
||||
import { AdminConsole } from '@/components/AdminConsole';
|
||||
import { AdminConsole } from '@ebook/components/AdminConsole';
|
||||
|
||||
export const metadata = {
|
||||
title: 'Admin Console',
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { createCreemCheckout, isCreemConfigured } from '@/lib/creem';
|
||||
import { createCreemCheckout, isCreemConfigured } from '@ebook/lib/creem';
|
||||
|
||||
export async function POST() {
|
||||
if (!isCreemConfigured()) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { verifyCreemSignature } from '@/lib/creem';
|
||||
import { verifyCreemSignature } from '@ebook/lib/creem';
|
||||
|
||||
// Creem webhook payload shape per docs
|
||||
// https://docs.creem.io/code/webhooks
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { getBook } from '@/lib/book.server';
|
||||
import { getSiteConfig } from '@/lib/site-config.server';
|
||||
import { getBook } from '@ebook/lib/book.server';
|
||||
import { getSiteConfig } from '@ebook/lib/site-config.server';
|
||||
|
||||
export async function POST(req: Request) {
|
||||
try {
|
||||
|
||||
@ -3,7 +3,7 @@ import {
|
||||
createSupportInvoice,
|
||||
isAllowedSupportAmount,
|
||||
isNowPaymentsConfigured,
|
||||
} from '@/lib/nowpayments';
|
||||
} from '@ebook/lib/nowpayments';
|
||||
|
||||
export async function POST(req: Request) {
|
||||
if (!isNowPaymentsConfigured()) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { verifyIpnSignature } from '@/lib/nowpayments';
|
||||
import { verifyIpnSignature } from '@ebook/lib/nowpayments';
|
||||
|
||||
export async function POST(req: Request) {
|
||||
const raw = await req.text();
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import type { Metadata } from 'next';
|
||||
import { AntdRegistry } from '@ant-design/nextjs-registry';
|
||||
import { Providers } from '@/components/Providers';
|
||||
import { buildBookMetadata } from '@/lib/metadata';
|
||||
import { getSiteConfig } from '@/lib/site-config.server';
|
||||
import { getServerFeatures } from '@/lib/features.server';
|
||||
import { getLocale } from '@/lib/i18n/server';
|
||||
import { Providers } from '@ebook/components/Providers';
|
||||
import { buildBookMetadata } from '@ebook/lib/metadata';
|
||||
import { getSiteConfig } from '@ebook/lib/site-config.server';
|
||||
import { getServerFeatures } from '@ebook/lib/features.server';
|
||||
import { getLocale } from '@ebook/lib/i18n/server';
|
||||
import './globals.css';
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
@ -61,12 +61,12 @@ export default async function RootLayout({
|
||||
}
|
||||
|
||||
function AnalyticsLazy() {
|
||||
const { AnalyticsProvider } = require('@/components/AnalyticsProvider');
|
||||
const { AnalyticsProvider } = require('@ebook/components/AnalyticsProvider');
|
||||
return <AnalyticsProvider />;
|
||||
}
|
||||
|
||||
function AdSenseLazy() {
|
||||
const { AdSenseScript } = require('@/components/AdSlot');
|
||||
const { AdSenseScript } = require('@ebook/components/AdSlot');
|
||||
return <AdSenseScript />;
|
||||
}
|
||||
|
||||
@ -76,6 +76,6 @@ function FeedbackLazy(props: {
|
||||
contactEmail: string;
|
||||
xHandle: string;
|
||||
}) {
|
||||
const { FeedbackPanel } = require('@/components/FeedbackPanel');
|
||||
const { FeedbackPanel } = require('@ebook/components/FeedbackPanel');
|
||||
return <FeedbackPanel {...props} />;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ImageResponse } from 'next/og';
|
||||
import { getBook } from '@/lib/book.server';
|
||||
import { getBook } from '@ebook/lib/book.server';
|
||||
|
||||
export const runtime = 'nodejs';
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import type { Metadata } from 'next';
|
||||
import { getAllChapters, getBook } from '@/lib/book.server';
|
||||
import { CoverPage } from '@/components/CoverPage';
|
||||
import { buildBookMetadata } from '@/lib/metadata';
|
||||
import { getSiteConfig, getAdSlot } from '@/lib/site-config.server';
|
||||
import { getServerFeatures } from '@/lib/features.server';
|
||||
import { getLocale } from '@/lib/i18n/server';
|
||||
import { getAllChapters, getBook } from '@ebook/lib/book.server';
|
||||
import { CoverPage } from '@ebook/components/CoverPage';
|
||||
import { buildBookMetadata } from '@ebook/lib/metadata';
|
||||
import { getSiteConfig, getAdSlot } from '@ebook/lib/site-config.server';
|
||||
import { getServerFeatures } from '@ebook/lib/features.server';
|
||||
import { getLocale } from '@ebook/lib/i18n/server';
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const locale = await getLocale();
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { PurchaseThanksContent } from '@/components/SupportThanksContent';
|
||||
import { PurchaseThanksContent } from '@ebook/components/SupportThanksContent';
|
||||
|
||||
export const metadata = {
|
||||
title: 'Thank you for your purchase',
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { notFound, redirect } from 'next/navigation';
|
||||
import { getChapter, getChapterSlugs } from '@/lib/book.server';
|
||||
import { buildChapterMetadata } from '@/lib/metadata';
|
||||
import { getLocale } from '@/lib/i18n/server';
|
||||
import { getChapter, getChapterSlugs } from '@ebook/lib/book.server';
|
||||
import { buildChapterMetadata } from '@ebook/lib/metadata';
|
||||
import { getLocale } from '@ebook/lib/i18n/server';
|
||||
|
||||
export function generateStaticParams() {
|
||||
return getChapterSlugs().map((slug) => ({ slug }));
|
||||
@ -26,5 +26,5 @@ export default async function ReadSlugRedirect({
|
||||
const locale = await getLocale();
|
||||
const chapter = getChapter(slug, locale);
|
||||
if (!chapter) notFound();
|
||||
redirect(`/read#${slug}`);
|
||||
redirect(`/book/read#${slug}`);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ImageResponse } from 'next/og';
|
||||
import { getBook } from '@/lib/book.server';
|
||||
import { getBook } from '@ebook/lib/book.server';
|
||||
|
||||
export const runtime = 'nodejs';
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { getBook, getAllChapters } from '@/lib/book.server';
|
||||
import { ScrollReaderShell } from '@/components/ScrollReaderShell';
|
||||
import { buildBookMetadata } from '@/lib/metadata';
|
||||
import { getAdSlot } from '@/lib/site-config.server';
|
||||
import { getServerFeatures } from '@/lib/features.server';
|
||||
import { getLocale } from '@/lib/i18n/server';
|
||||
import { getBook, getAllChapters } from '@ebook/lib/book.server';
|
||||
import { ScrollReaderShell } from '@ebook/components/ScrollReaderShell';
|
||||
import { buildBookMetadata } from '@ebook/lib/metadata';
|
||||
import { getAdSlot } from '@ebook/lib/site-config.server';
|
||||
import { getServerFeatures } from '@ebook/lib/features.server';
|
||||
import { getLocale } from '@ebook/lib/i18n/server';
|
||||
import type { Metadata } from 'next';
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { SupportThanksContent } from '@/components/SupportThanksContent';
|
||||
import { SupportThanksContent } from '@ebook/components/SupportThanksContent';
|
||||
|
||||
export const metadata = {
|
||||
title: 'Thank you — Support',
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user