Initial TubeMart YPP channel market with NOWPayments checkout.
Document local setup, env vars, and API in README; sync to Gitea. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
commit
5559308690
4
.env.example
Normal file
4
.env.example
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
NOWPAYMENTS_API_KEY=
|
||||||
|
NOWPAYMENTS_IPN_SECRET=
|
||||||
|
NOWPAYMENTS_PAYOUT_USDT_TRX=
|
||||||
|
SITE_URL=http://localhost:3000
|
||||||
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
node_modules
|
||||||
|
.next
|
||||||
|
.env.local
|
||||||
|
*.log
|
||||||
|
.DS_Store
|
||||||
74
README.md
Normal file
74
README.md
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
# TubeMart (ecomYB)
|
||||||
|
|
||||||
|
YouTube 色调的单页 SPA:出售已开通 **YPP(YouTube Partner Program)** 的频道,加密货币结账走 **NOWPayments**。
|
||||||
|
|
||||||
|
仓库:https://gitea.dsx2020.com/eric/ecomYB
|
||||||
|
|
||||||
|
## 功能
|
||||||
|
|
||||||
|
- 单页市场:筛选、列表点选、右侧详情
|
||||||
|
- 动效:漂浮 emoji、跑马灯、CountUp、SVG 折线 / 柱状图
|
||||||
|
- 支付:`POST /api/pay/invoice` 创建 NOWPayments 发票并跳转收银台
|
||||||
|
- 回调:`POST /api/pay/ipn` 校验 `x-nowpayments-sig`(HMAC-SHA512)
|
||||||
|
|
||||||
|
## 技术栈
|
||||||
|
|
||||||
|
- Next.js 15(App Router)+ React 19 + TypeScript
|
||||||
|
- 前端:`src/components/SpaApp.tsx`、`Viz.tsx`
|
||||||
|
- 库存数据:`src/lib/channels.ts`
|
||||||
|
- 支付封装:`src/lib/nowpayments.ts`
|
||||||
|
|
||||||
|
## 本地启动
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install
|
||||||
|
cp .env.example .env.local # 填入 NOWPayments 密钥
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
打开 http://localhost:3000
|
||||||
|
|
||||||
|
生产构建:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run build
|
||||||
|
npm start
|
||||||
|
```
|
||||||
|
|
||||||
|
## 环境变量
|
||||||
|
|
||||||
|
| 变量 | 说明 |
|
||||||
|
|------|------|
|
||||||
|
| `NOWPAYMENTS_API_KEY` | NOWPayments API Key |
|
||||||
|
| `NOWPAYMENTS_IPN_SECRET` | IPN 签名密钥 |
|
||||||
|
| `NOWPAYMENTS_PAYOUT_USDT_TRX` | 结算钱包(USDT TRC20,可选备注) |
|
||||||
|
| `SITE_URL` | 站点根 URL;本地用 `http://localhost:3000`,上线须公网 HTTPS(IPN 依赖) |
|
||||||
|
|
||||||
|
`.env.local` 已加入 `.gitignore`,不要提交密钥。
|
||||||
|
|
||||||
|
## 修改库存
|
||||||
|
|
||||||
|
编辑 `src/lib/channels.ts`:名称、niche、订阅数、价格、`trend` / `weekly` 图表数据等。
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
| 方法 | 路径 | 说明 |
|
||||||
|
|------|------|------|
|
||||||
|
| `POST` | `/api/pay/invoice` | Body: `{ "channelId": "ch-xxx" }` → `{ invoiceUrl }` |
|
||||||
|
| `POST` | `/api/pay/ipn` | NOWPayments IPN webhook |
|
||||||
|
|
||||||
|
支付成功跳转:`/success?channel=<id>`
|
||||||
|
|
||||||
|
## 目录结构
|
||||||
|
|
||||||
|
```
|
||||||
|
src/
|
||||||
|
app/ # 页面与 API routes
|
||||||
|
components/ # SpaApp、图表与图标
|
||||||
|
lib/ # channels、nowpayments
|
||||||
|
.env.example # 环境变量模板
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Private — eric / ecomYB
|
||||||
6
next-env.d.ts
vendored
Normal file
6
next-env.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/// <reference types="next" />
|
||||||
|
/// <reference types="next/image-types/global" />
|
||||||
|
/// <reference path="./.next/types/routes.d.ts" />
|
||||||
|
|
||||||
|
// NOTE: This file should not be edited
|
||||||
|
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||||
7
next.config.ts
Normal file
7
next.config.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import type { NextConfig } from 'next';
|
||||||
|
|
||||||
|
const nextConfig: NextConfig = {
|
||||||
|
reactStrictMode: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default nextConfig;
|
||||||
1023
package-lock.json
generated
Normal file
1023
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
21
package.json
Normal file
21
package.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"name": "ypp-market",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"dev": "next dev",
|
||||||
|
"build": "next build",
|
||||||
|
"start": "next start"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"next": "^15.3.3",
|
||||||
|
"react": "^19.1.0",
|
||||||
|
"react-dom": "^19.1.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^22.15.21",
|
||||||
|
"@types/react": "^19.1.5",
|
||||||
|
"@types/react-dom": "^19.1.5",
|
||||||
|
"typescript": "^5.8.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
34
src/app/api/pay/invoice/route.ts
Normal file
34
src/app/api/pay/invoice/route.ts
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import { NextRequest, NextResponse } from 'next/server';
|
||||||
|
import { createChannelInvoice, isNowPaymentsConfigured } from '@/lib/nowpayments';
|
||||||
|
|
||||||
|
export async function POST(req: NextRequest) {
|
||||||
|
if (!isNowPaymentsConfigured()) {
|
||||||
|
return NextResponse.json({ ok: false, error: 'payments not configured' }, { status: 503 });
|
||||||
|
}
|
||||||
|
|
||||||
|
let body: { channelId?: string };
|
||||||
|
try {
|
||||||
|
body = await req.json();
|
||||||
|
} catch {
|
||||||
|
return NextResponse.json({ ok: false, error: 'invalid json' }, { status: 400 });
|
||||||
|
}
|
||||||
|
|
||||||
|
const channelId = String(body.channelId || '');
|
||||||
|
if (!channelId) {
|
||||||
|
return NextResponse.json({ ok: false, error: 'channelId required' }, { status: 400 });
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const invoice = await createChannelInvoice(channelId);
|
||||||
|
return NextResponse.json({
|
||||||
|
ok: true,
|
||||||
|
invoiceUrl: invoice.invoiceUrl,
|
||||||
|
orderId: invoice.orderId,
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
const message = err instanceof Error ? err.message : 'invoice failed';
|
||||||
|
console.error('NOWPayments invoice:', message);
|
||||||
|
const status = message.includes('not found') ? 404 : 502;
|
||||||
|
return NextResponse.json({ ok: false, error: message }, { status });
|
||||||
|
}
|
||||||
|
}
|
||||||
27
src/app/api/pay/ipn/route.ts
Normal file
27
src/app/api/pay/ipn/route.ts
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import { NextRequest, NextResponse } from 'next/server';
|
||||||
|
import { verifyIpnSignature } from '@/lib/nowpayments';
|
||||||
|
|
||||||
|
export async function POST(req: NextRequest) {
|
||||||
|
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 Record<string, unknown>;
|
||||||
|
console.info(
|
||||||
|
'NOWPayments IPN: status=%s order=%s amount=%s currency=%s paid=%s',
|
||||||
|
payload.payment_status,
|
||||||
|
payload.order_id,
|
||||||
|
payload.price_amount,
|
||||||
|
payload.pay_currency,
|
||||||
|
payload.actually_paid,
|
||||||
|
);
|
||||||
|
} catch {
|
||||||
|
// signature already validated structure enough for ack
|
||||||
|
}
|
||||||
|
|
||||||
|
return NextResponse.json({ ok: true });
|
||||||
|
}
|
||||||
944
src/app/globals.css
Normal file
944
src/app/globals.css
Normal file
@ -0,0 +1,944 @@
|
|||||||
|
:root {
|
||||||
|
--yt-red: #ff0000;
|
||||||
|
--yt-red-deep: #cc0000;
|
||||||
|
--yt-bg: #0f0f0f;
|
||||||
|
--yt-elev: #212121;
|
||||||
|
--yt-elev-2: #272727;
|
||||||
|
--yt-line: #3f3f3f;
|
||||||
|
--yt-text: #f1f1f1;
|
||||||
|
--yt-muted: #aaaaaa;
|
||||||
|
--yt-white: #ffffff;
|
||||||
|
--font-display: 'Figtree', sans-serif;
|
||||||
|
--font-body: 'Figtree', sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
scroll-behavior: smooth;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
min-height: 100vh;
|
||||||
|
background: var(--yt-bg);
|
||||||
|
color: var(--yt-text);
|
||||||
|
font-family: var(--font-body);
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
font: inherit;
|
||||||
|
color: inherit;
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spa {
|
||||||
|
position: relative;
|
||||||
|
width: min(1180px, calc(100% - 1.5rem));
|
||||||
|
margin: 0 auto;
|
||||||
|
padding-bottom: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-grid {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
background:
|
||||||
|
radial-gradient(ellipse 80% 50% at 50% -10%, rgba(255, 0, 0, 0.28), transparent 55%),
|
||||||
|
linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
|
||||||
|
linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
|
||||||
|
background-size: auto, 48px 48px, 48px 48px;
|
||||||
|
mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.float-bits {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
overflow: hidden;
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.float-bit {
|
||||||
|
position: absolute;
|
||||||
|
bottom: -10%;
|
||||||
|
opacity: 0.22;
|
||||||
|
animation: floatUp linear infinite;
|
||||||
|
filter: blur(0.2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes floatUp {
|
||||||
|
0% {
|
||||||
|
transform: translateY(0) rotate(0deg);
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
12% {
|
||||||
|
opacity: 0.35;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateY(-120vh) rotate(28deg);
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.topbar,
|
||||||
|
.hero,
|
||||||
|
.market,
|
||||||
|
.flow,
|
||||||
|
.strip,
|
||||||
|
.foot,
|
||||||
|
.section-title {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topbar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 1rem;
|
||||||
|
padding: 1.1rem 0 0.5rem;
|
||||||
|
animation: fadeUp 0.7s ease both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.55rem;
|
||||||
|
font-weight: 800;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
letter-spacing: -0.03em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo .red,
|
||||||
|
.red {
|
||||||
|
color: var(--yt-red);
|
||||||
|
}
|
||||||
|
|
||||||
|
.topbar nav {
|
||||||
|
display: flex;
|
||||||
|
gap: 1.25rem;
|
||||||
|
color: var(--yt-muted);
|
||||||
|
font-size: 0.92rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topbar nav a:hover {
|
||||||
|
color: var(--yt-white);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-pill {
|
||||||
|
background: rgba(255, 0, 0, 0.12);
|
||||||
|
border: 1px solid rgba(255, 0, 0, 0.45);
|
||||||
|
color: #ffb4b4;
|
||||||
|
padding: 0.45rem 0.8rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
font-size: 0.82rem;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1.05fr 0.95fr;
|
||||||
|
gap: 2rem;
|
||||||
|
align-items: center;
|
||||||
|
min-height: calc(100svh - 5rem);
|
||||||
|
padding: 2rem 0 2.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.eyebrow {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.45rem;
|
||||||
|
color: #ff8e8e;
|
||||||
|
font-size: 0.86rem;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 0.9rem;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live-dot {
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--yt-red);
|
||||||
|
box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
|
||||||
|
animation: ping 1.6s infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes ping {
|
||||||
|
0% {
|
||||||
|
box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.55);
|
||||||
|
}
|
||||||
|
70% {
|
||||||
|
box-shadow: 0 0 0 10px rgba(255, 0, 0, 0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
box-shadow: 0 0 0 0 rgba(255, 0, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero h1 {
|
||||||
|
font-size: clamp(2.4rem, 6vw, 4.2rem);
|
||||||
|
line-height: 1.02;
|
||||||
|
letter-spacing: -0.045em;
|
||||||
|
font-weight: 800;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
animation: fadeUp 0.8s 0.05s ease both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero h1 em {
|
||||||
|
font-style: normal;
|
||||||
|
color: var(--yt-red);
|
||||||
|
text-shadow: 0 0 28px rgba(255, 0, 0, 0.35);
|
||||||
|
}
|
||||||
|
|
||||||
|
.lede {
|
||||||
|
color: var(--yt-muted);
|
||||||
|
font-size: 1.05rem;
|
||||||
|
line-height: 1.55;
|
||||||
|
max-width: 34rem;
|
||||||
|
margin-bottom: 1.4rem;
|
||||||
|
animation: fadeUp 0.8s 0.12s ease both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-cta {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.7rem;
|
||||||
|
margin-bottom: 1.6rem;
|
||||||
|
animation: fadeUp 0.8s 0.18s ease both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-yt,
|
||||||
|
.btn-buy {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.45rem;
|
||||||
|
background: var(--yt-red);
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 700;
|
||||||
|
padding: 0.85rem 1.2rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
|
||||||
|
box-shadow: 0 10px 30px rgba(255, 0, 0, 0.28);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-yt:hover,
|
||||||
|
.btn-buy:hover {
|
||||||
|
transform: translateY(-2px) scale(1.02);
|
||||||
|
filter: brightness(1.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-buy:disabled {
|
||||||
|
opacity: 0.7;
|
||||||
|
cursor: wait;
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-ghost {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.4rem;
|
||||||
|
color: var(--yt-muted);
|
||||||
|
padding: 0.85rem 0.9rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
border: 1px solid var(--yt-line);
|
||||||
|
transition: color 0.15s ease, border-color 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-ghost:hover {
|
||||||
|
color: var(--yt-white);
|
||||||
|
border-color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-kpis {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||||
|
gap: 0.75rem;
|
||||||
|
animation: fadeUp 0.8s 0.24s ease both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-kpis strong {
|
||||||
|
display: block;
|
||||||
|
font-size: 1.45rem;
|
||||||
|
font-weight: 800;
|
||||||
|
letter-spacing: -0.03em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-kpis span {
|
||||||
|
color: var(--yt-muted);
|
||||||
|
font-size: 0.78rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-stage {
|
||||||
|
animation: fadeUp 0.9s 0.15s ease both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.yt-window {
|
||||||
|
background: var(--yt-elev);
|
||||||
|
border: 1px solid var(--yt-line);
|
||||||
|
border-radius: 16px;
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
|
||||||
|
transform: perspective(900px) rotateY(-6deg) rotateX(3deg);
|
||||||
|
transition: transform 0.4s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.yt-window:hover {
|
||||||
|
transform: perspective(900px) rotateY(-2deg) rotateX(1deg) scale(1.01);
|
||||||
|
}
|
||||||
|
|
||||||
|
.yt-chrome {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.35rem;
|
||||||
|
padding: 0.7rem 0.85rem;
|
||||||
|
background: #181818;
|
||||||
|
border-bottom: 1px solid var(--yt-line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.yt-chrome > span {
|
||||||
|
width: 9px;
|
||||||
|
height: 9px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
.yt-chrome > span:nth-child(1) {
|
||||||
|
background: #ff5f57;
|
||||||
|
}
|
||||||
|
.yt-chrome > span:nth-child(2) {
|
||||||
|
background: #febc2e;
|
||||||
|
}
|
||||||
|
.yt-chrome > span:nth-child(3) {
|
||||||
|
background: #28c840;
|
||||||
|
}
|
||||||
|
|
||||||
|
.yt-url {
|
||||||
|
margin-left: 0.6rem;
|
||||||
|
flex: 1;
|
||||||
|
background: #0f0f0f;
|
||||||
|
border-radius: 999px;
|
||||||
|
padding: 0.25rem 0.7rem;
|
||||||
|
color: var(--yt-muted);
|
||||||
|
font-size: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.yt-player {
|
||||||
|
position: relative;
|
||||||
|
aspect-ratio: 16 / 9;
|
||||||
|
background:
|
||||||
|
radial-gradient(circle at 50% 45%, rgba(255, 0, 0, 0.35), transparent 45%),
|
||||||
|
linear-gradient(145deg, #1a1a1a, #0a0a0a);
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.big-play {
|
||||||
|
width: 76px;
|
||||||
|
height: 54px;
|
||||||
|
border-radius: 18px / 14px;
|
||||||
|
background: var(--yt-red);
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
color: #fff;
|
||||||
|
animation: pulsePlay 2.2s ease-in-out infinite;
|
||||||
|
box-shadow: 0 12px 40px rgba(255, 0, 0, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pulsePlay {
|
||||||
|
0%,
|
||||||
|
100% {
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
transform: scale(1.06);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.player-meta {
|
||||||
|
position: absolute;
|
||||||
|
left: 0.9rem;
|
||||||
|
bottom: 1.4rem;
|
||||||
|
display: flex;
|
||||||
|
gap: 0.55rem;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.emoji-lg {
|
||||||
|
font-size: 1.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.player-meta b {
|
||||||
|
display: block;
|
||||||
|
font-size: 0.92rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.player-meta small {
|
||||||
|
color: var(--yt-muted);
|
||||||
|
font-size: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
height: 4px;
|
||||||
|
background: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress i {
|
||||||
|
display: block;
|
||||||
|
height: 100%;
|
||||||
|
background: var(--yt-red);
|
||||||
|
animation: scrub 5s ease-in-out infinite alternate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes scrub {
|
||||||
|
from {
|
||||||
|
width: 28%;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
width: 78%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mini-charts {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1.2fr 0.8fr;
|
||||||
|
gap: 0.75rem;
|
||||||
|
padding: 0.85rem;
|
||||||
|
background: #181818;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mini {
|
||||||
|
background: var(--yt-elev-2);
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 0.55rem 0.65rem 0.4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mini > span {
|
||||||
|
display: block;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
color: var(--yt-muted);
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sparkline {
|
||||||
|
width: 100%;
|
||||||
|
height: 42px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spark-line {
|
||||||
|
stroke-dasharray: 240;
|
||||||
|
stroke-dashoffset: 240;
|
||||||
|
animation: drawLine 1.4s ease forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spark-area {
|
||||||
|
opacity: 0;
|
||||||
|
animation: fadeIn 0.8s 0.3s ease forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spark-dot {
|
||||||
|
animation: blink 1.4s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes drawLine {
|
||||||
|
to {
|
||||||
|
stroke-dashoffset: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fadeIn {
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes blink {
|
||||||
|
0%,
|
||||||
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
opacity: 0.35;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.bar-chart {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
gap: 0.35rem;
|
||||||
|
height: 56px;
|
||||||
|
padding-top: 0.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bar-col {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
height: 100%;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 0.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bar {
|
||||||
|
width: 100%;
|
||||||
|
border-radius: 4px 4px 1px 1px;
|
||||||
|
background: linear-gradient(180deg, #ff4d4d, var(--yt-red));
|
||||||
|
transform-origin: bottom;
|
||||||
|
animation: growBar 0.7s ease both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bar-col span {
|
||||||
|
font-size: 0.62rem;
|
||||||
|
color: var(--yt-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes growBar {
|
||||||
|
from {
|
||||||
|
transform: scaleY(0.15);
|
||||||
|
opacity: 0.3;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: scaleY(1);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.strip {
|
||||||
|
margin: 0.5rem 0 1.5rem;
|
||||||
|
border-block: 1px solid var(--yt-line);
|
||||||
|
background: rgba(255, 0, 0, 0.05);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.marquee {
|
||||||
|
overflow: hidden;
|
||||||
|
mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.marquee-track {
|
||||||
|
display: flex;
|
||||||
|
gap: 2rem;
|
||||||
|
width: max-content;
|
||||||
|
padding: 0.85rem 0;
|
||||||
|
animation: marquee 28s linear infinite;
|
||||||
|
color: var(--yt-muted);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.marquee-track span {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes marquee {
|
||||||
|
from {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
margin: 1.5rem 0 1.1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title h2 {
|
||||||
|
font-size: clamp(1.7rem, 3.5vw, 2.35rem);
|
||||||
|
letter-spacing: -0.035em;
|
||||||
|
font-weight: 800;
|
||||||
|
margin-bottom: 0.35rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title p {
|
||||||
|
color: var(--yt-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.filters {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.5rem;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filters button {
|
||||||
|
padding: 0.45rem 0.85rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: var(--yt-elev);
|
||||||
|
border: 1px solid var(--yt-line);
|
||||||
|
color: var(--yt-muted);
|
||||||
|
font-size: 0.88rem;
|
||||||
|
transition: 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filters button.on,
|
||||||
|
.filters button:hover {
|
||||||
|
color: #fff;
|
||||||
|
border-color: rgba(255, 0, 0, 0.55);
|
||||||
|
background: rgba(255, 0, 0, 0.14);
|
||||||
|
}
|
||||||
|
|
||||||
|
.market-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1.15fr 0.85fr;
|
||||||
|
gap: 1rem;
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.channel-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.55rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.channel-row {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: auto 1fr 88px auto;
|
||||||
|
gap: 0.75rem;
|
||||||
|
align-items: center;
|
||||||
|
text-align: left;
|
||||||
|
padding: 0.85rem 0.95rem;
|
||||||
|
background: var(--yt-elev);
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: 14px;
|
||||||
|
transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
|
||||||
|
animation: fadeUp 0.55s ease both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.channel-row:hover {
|
||||||
|
transform: translateX(3px);
|
||||||
|
border-color: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
.channel-row.active {
|
||||||
|
border-color: var(--yt-red);
|
||||||
|
background: linear-gradient(90deg, rgba(255, 0, 0, 0.16), var(--yt-elev));
|
||||||
|
box-shadow: inset 3px 0 0 var(--yt-red);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ch-emoji {
|
||||||
|
font-size: 1.45rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ch-main {
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ch-main b {
|
||||||
|
display: block;
|
||||||
|
font-size: 0.98rem;
|
||||||
|
margin-bottom: 0.15rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ch-main small {
|
||||||
|
color: var(--yt-muted);
|
||||||
|
font-size: 0.78rem;
|
||||||
|
display: block;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ch-spark {
|
||||||
|
height: 34px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ch-spark .sparkline {
|
||||||
|
height: 34px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ch-price {
|
||||||
|
font-weight: 800;
|
||||||
|
color: #fff;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail {
|
||||||
|
position: sticky;
|
||||||
|
top: 1rem;
|
||||||
|
background: var(--yt-elev);
|
||||||
|
border: 1px solid var(--yt-line);
|
||||||
|
border-radius: 18px;
|
||||||
|
padding: 1.1rem;
|
||||||
|
animation: fadeUp 0.5s ease both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-head {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.75rem;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-emoji {
|
||||||
|
font-size: 2.2rem;
|
||||||
|
width: 3.2rem;
|
||||||
|
height: 3.2rem;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
background: #181818;
|
||||||
|
border-radius: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-head h3 {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-head p {
|
||||||
|
color: var(--yt-muted);
|
||||||
|
font-size: 0.86rem;
|
||||||
|
margin-top: 0.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge {
|
||||||
|
display: inline-block;
|
||||||
|
background: rgba(255, 0, 0, 0.15);
|
||||||
|
color: #ff9b9b;
|
||||||
|
border: 1px solid rgba(255, 0, 0, 0.35);
|
||||||
|
border-radius: 999px;
|
||||||
|
padding: 0.1rem 0.45rem;
|
||||||
|
font-size: 0.72rem;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-right: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-stats {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 0.55rem;
|
||||||
|
margin-bottom: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-stats div {
|
||||||
|
background: #181818;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 0.7rem 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-stats strong {
|
||||||
|
display: block;
|
||||||
|
font-size: 1.15rem;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-stats span {
|
||||||
|
color: var(--yt-muted);
|
||||||
|
font-size: 0.74rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-block {
|
||||||
|
background: #181818;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 0.7rem 0.8rem 0.55rem;
|
||||||
|
margin-bottom: 0.65rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-label {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
color: var(--yt-muted);
|
||||||
|
font-size: 0.78rem;
|
||||||
|
margin-bottom: 0.35rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-label em {
|
||||||
|
font-style: normal;
|
||||||
|
color: #3ddc84;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-foot {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.75rem;
|
||||||
|
margin-top: 0.85rem;
|
||||||
|
padding-top: 0.85rem;
|
||||||
|
border-top: 1px solid var(--yt-line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.price-lg {
|
||||||
|
font-size: 1.55rem;
|
||||||
|
font-weight: 800;
|
||||||
|
letter-spacing: -0.03em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-foot small {
|
||||||
|
color: var(--yt-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.err {
|
||||||
|
color: #ff8e8e;
|
||||||
|
font-size: 0.78rem;
|
||||||
|
margin-top: 0.35rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flow {
|
||||||
|
margin-top: 2.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
gap: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps article {
|
||||||
|
background: var(--yt-elev);
|
||||||
|
border: 1px solid var(--yt-line);
|
||||||
|
border-radius: 16px;
|
||||||
|
padding: 1.15rem;
|
||||||
|
transition: transform 0.2s ease, border-color 0.2s ease;
|
||||||
|
animation: fadeUp 0.6s ease both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps article:nth-child(2) {
|
||||||
|
animation-delay: 0.08s;
|
||||||
|
}
|
||||||
|
.steps article:nth-child(3) {
|
||||||
|
animation-delay: 0.16s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps article:hover {
|
||||||
|
transform: translateY(-4px);
|
||||||
|
border-color: rgba(255, 0, 0, 0.45);
|
||||||
|
}
|
||||||
|
|
||||||
|
.step-ico {
|
||||||
|
width: 2.4rem;
|
||||||
|
height: 2.4rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
background: rgba(255, 0, 0, 0.15);
|
||||||
|
color: var(--yt-red);
|
||||||
|
margin-bottom: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps h3 {
|
||||||
|
font-size: 1.05rem;
|
||||||
|
margin-bottom: 0.35rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps p {
|
||||||
|
color: var(--yt-muted);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
line-height: 1.45;
|
||||||
|
}
|
||||||
|
|
||||||
|
.foot {
|
||||||
|
margin-top: 3rem;
|
||||||
|
padding-top: 1.2rem;
|
||||||
|
border-top: 1px solid var(--yt-line);
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 1rem;
|
||||||
|
color: var(--yt-muted);
|
||||||
|
font-size: 0.86rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.foot > div {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.45rem;
|
||||||
|
color: var(--yt-text);
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success-wrap {
|
||||||
|
min-height: 100svh;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success-panel {
|
||||||
|
width: min(420px, 100%);
|
||||||
|
background: var(--yt-elev);
|
||||||
|
border: 1px solid var(--yt-line);
|
||||||
|
border-radius: 18px;
|
||||||
|
padding: 1.5rem;
|
||||||
|
animation: fadeUp 0.7s ease both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success-panel h1 {
|
||||||
|
font-size: 2rem;
|
||||||
|
letter-spacing: -0.03em;
|
||||||
|
margin: 0.8rem 0 0.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success-panel p {
|
||||||
|
color: var(--yt-muted);
|
||||||
|
line-height: 1.5;
|
||||||
|
margin-bottom: 1.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fadeUp {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(16px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 920px) {
|
||||||
|
.hero,
|
||||||
|
.market-grid,
|
||||||
|
.steps {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero {
|
||||||
|
min-height: auto;
|
||||||
|
padding-top: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.yt-window {
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topbar nav {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.channel-row {
|
||||||
|
grid-template-columns: auto 1fr auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ch-spark {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail {
|
||||||
|
position: static;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-kpis {
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
}
|
||||||
|
}
|
||||||
25
src/app/layout.tsx
Normal file
25
src/app/layout.tsx
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import type { Metadata } from 'next';
|
||||||
|
import { Figtree } from 'next/font/google';
|
||||||
|
import './globals.css';
|
||||||
|
|
||||||
|
const figtree = Figtree({
|
||||||
|
subsets: ['latin'],
|
||||||
|
variable: '--font-figtree',
|
||||||
|
display: 'swap',
|
||||||
|
});
|
||||||
|
|
||||||
|
export const metadata: Metadata = {
|
||||||
|
title: 'TubeMart — YPP YouTube Channels for Sale',
|
||||||
|
description: 'Buy monetized YouTube Partner Program channels. Crypto checkout via NOWPayments.',
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
||||||
|
return (
|
||||||
|
<html lang="en" className={figtree.variable}>
|
||||||
|
<body style={{ fontFamily: 'var(--font-figtree), Figtree, sans-serif' }}>
|
||||||
|
<style>{`:root{--font-body:var(--font-figtree),Figtree,sans-serif;--font-display:var(--font-figtree),Figtree,sans-serif}`}</style>
|
||||||
|
{children}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
);
|
||||||
|
}
|
||||||
5
src/app/page.tsx
Normal file
5
src/app/page.tsx
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import SpaApp from '@/components/SpaApp';
|
||||||
|
|
||||||
|
export default function HomePage() {
|
||||||
|
return <SpaApp />;
|
||||||
|
}
|
||||||
37
src/app/success/page.tsx
Normal file
37
src/app/success/page.tsx
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import Link from 'next/link';
|
||||||
|
import { getChannel } from '@/lib/channels';
|
||||||
|
import { YtLogo } from '@/components/Viz';
|
||||||
|
|
||||||
|
export default async function SuccessPage({
|
||||||
|
searchParams,
|
||||||
|
}: {
|
||||||
|
searchParams: Promise<{ channel?: string }>;
|
||||||
|
}) {
|
||||||
|
const params = await searchParams;
|
||||||
|
const channel = params.channel ? getChannel(params.channel) : undefined;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="spa">
|
||||||
|
<div className="bg-grid" aria-hidden />
|
||||||
|
<div className="success-wrap">
|
||||||
|
<div className="success-panel">
|
||||||
|
<div className="logo">
|
||||||
|
<YtLogo />
|
||||||
|
<span>
|
||||||
|
Tube<span className="red">Mart</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<h1>✅ Payment received</h1>
|
||||||
|
<p>
|
||||||
|
{channel
|
||||||
|
? `Thanks — your order for ${channel.emoji} ${channel.name} is confirmed. We’ll send transfer steps next.`
|
||||||
|
: 'Thanks — your crypto payment is confirmed. We’ll send transfer steps next.'}
|
||||||
|
</p>
|
||||||
|
<Link className="btn-yt" href="/#market">
|
||||||
|
Back to market
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
337
src/components/SpaApp.tsx
Normal file
337
src/components/SpaApp.tsx
Normal file
@ -0,0 +1,337 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useMemo, useState } from 'react';
|
||||||
|
import {
|
||||||
|
CHANNELS,
|
||||||
|
formatPrice,
|
||||||
|
formatSubs,
|
||||||
|
marketTotals,
|
||||||
|
type Channel,
|
||||||
|
} from '@/lib/channels';
|
||||||
|
import {
|
||||||
|
BarChart,
|
||||||
|
CheckIcon,
|
||||||
|
CountUp,
|
||||||
|
CryptoIcon,
|
||||||
|
FloatingBits,
|
||||||
|
PlayIcon,
|
||||||
|
Sparkline,
|
||||||
|
YtLogo,
|
||||||
|
} from '@/components/Viz';
|
||||||
|
|
||||||
|
type Filter = 'all' | 'shorts' | 'long';
|
||||||
|
|
||||||
|
function matchesFilter(ch: Channel, f: Filter) {
|
||||||
|
if (f === 'all') return true;
|
||||||
|
if (f === 'shorts') return /shorts|viral/i.test(ch.niche);
|
||||||
|
return !/shorts|viral/i.test(ch.niche);
|
||||||
|
}
|
||||||
|
|
||||||
|
function BuyButton({ channel }: { channel: Channel }) {
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [error, setError] = useState('');
|
||||||
|
|
||||||
|
async function buy() {
|
||||||
|
setLoading(true);
|
||||||
|
setError('');
|
||||||
|
try {
|
||||||
|
const res = await fetch('/api/pay/invoice', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ channelId: channel.id }),
|
||||||
|
});
|
||||||
|
const data = (await res.json()) as { ok?: boolean; invoiceUrl?: string; error?: string };
|
||||||
|
if (!res.ok || !data.ok || !data.invoiceUrl) {
|
||||||
|
throw new Error(data.error || 'Payment unavailable');
|
||||||
|
}
|
||||||
|
window.location.href = data.invoiceUrl;
|
||||||
|
} catch (err) {
|
||||||
|
setError(err instanceof Error ? err.message : 'Payment failed');
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="buy-wrap">
|
||||||
|
<button className="btn-buy" type="button" onClick={buy} disabled={loading}>
|
||||||
|
<PlayIcon size={16} />
|
||||||
|
{loading ? 'Opening…' : 'Buy with crypto'}
|
||||||
|
</button>
|
||||||
|
{error ? <p className="err">{error}</p> : null}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function SpaApp() {
|
||||||
|
const [filter, setFilter] = useState<Filter>('all');
|
||||||
|
const [activeId, setActiveId] = useState(CHANNELS[0]?.id ?? '');
|
||||||
|
const totals = marketTotals();
|
||||||
|
const list = useMemo(() => CHANNELS.filter((c) => matchesFilter(c, filter)), [filter]);
|
||||||
|
const active = CHANNELS.find((c) => c.id === activeId) ?? list[0] ?? CHANNELS[0];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="spa">
|
||||||
|
<div className="bg-grid" aria-hidden />
|
||||||
|
<FloatingBits />
|
||||||
|
|
||||||
|
<header className="topbar">
|
||||||
|
<a className="logo" href="#top">
|
||||||
|
<YtLogo />
|
||||||
|
<span>
|
||||||
|
Tube<span className="red">Mart</span>
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
<nav>
|
||||||
|
<a href="#market">Market</a>
|
||||||
|
<a href="#live">Live board</a>
|
||||||
|
<a href="#flow">Flow</a>
|
||||||
|
</nav>
|
||||||
|
<a className="btn-pill" href="#market">
|
||||||
|
🔴 Live · {CHANNELS.length} YPP
|
||||||
|
</a>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main id="top">
|
||||||
|
<section className="hero">
|
||||||
|
<div className="hero-left">
|
||||||
|
<p className="eyebrow">
|
||||||
|
<span className="live-dot" /> YouTube Partner ready
|
||||||
|
</p>
|
||||||
|
<h1>
|
||||||
|
Buy <em>YPP</em> channels
|
||||||
|
<br />
|
||||||
|
that already earn 💸
|
||||||
|
</h1>
|
||||||
|
<p className="lede">
|
||||||
|
Single marketplace for monetized YouTube channels. Pick a niche, check the charts,
|
||||||
|
pay with crypto — transfer after confirm.
|
||||||
|
</p>
|
||||||
|
<div className="hero-cta">
|
||||||
|
<a className="btn-yt" href="#market">
|
||||||
|
<PlayIcon /> Browse inventory
|
||||||
|
</a>
|
||||||
|
<a className="btn-ghost" href="#flow">
|
||||||
|
<CryptoIcon /> How crypto checkout works
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div className="hero-kpis">
|
||||||
|
<div>
|
||||||
|
<strong>
|
||||||
|
<CountUp to={totals.channels} />
|
||||||
|
</strong>
|
||||||
|
<span>Live listings</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<strong>
|
||||||
|
<CountUp to={Math.round(totals.subs / 1000)} suffix="K+" />
|
||||||
|
</strong>
|
||||||
|
<span>Combined subs</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<strong>
|
||||||
|
<CountUp to={Math.round(totals.views / 100000) / 10} decimals={1} suffix="M" />
|
||||||
|
</strong>
|
||||||
|
<span>30d views</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="hero-stage" aria-hidden>
|
||||||
|
<div className="yt-window">
|
||||||
|
<div className="yt-chrome">
|
||||||
|
<span />
|
||||||
|
<span />
|
||||||
|
<span />
|
||||||
|
<div className="yt-url">youtube.com/@ypp-market</div>
|
||||||
|
</div>
|
||||||
|
<div className="yt-player">
|
||||||
|
<div className="big-play">
|
||||||
|
<PlayIcon size={42} />
|
||||||
|
</div>
|
||||||
|
<div className="player-meta">
|
||||||
|
<span className="emoji-lg">📺</span>
|
||||||
|
<div>
|
||||||
|
<b>YPP Transfer Showcase</b>
|
||||||
|
<small>Monetized · Verified inventory</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="progress">
|
||||||
|
<i style={{ width: '68%' }} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="mini-charts">
|
||||||
|
<div className="mini">
|
||||||
|
<span>📈 Growth</span>
|
||||||
|
<Sparkline data={[40, 48, 45, 60, 72, 70, 88, 96]} />
|
||||||
|
</div>
|
||||||
|
<div className="mini">
|
||||||
|
<span>🔥 This week</span>
|
||||||
|
<BarChart data={[42, 55, 48, 70, 82, 76, 90]} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section className="strip" id="live">
|
||||||
|
<div className="marquee">
|
||||||
|
<div className="marquee-track">
|
||||||
|
{[...CHANNELS, ...CHANNELS].map((c, i) => (
|
||||||
|
<span key={`${c.id}-${i}`}>
|
||||||
|
{c.emoji} {c.name} · {formatSubs(c.subs)} · {formatPrice(c.priceUsd)} · YPP ✅
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section className="market" id="market">
|
||||||
|
<div className="section-title">
|
||||||
|
<h2>
|
||||||
|
🛒 Channel market <span className="red">live</span>
|
||||||
|
</h2>
|
||||||
|
<p>Tap a channel to inspect charts, then checkout with NOWPayments.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="filters">
|
||||||
|
{(
|
||||||
|
[
|
||||||
|
['all', '✨ All'],
|
||||||
|
['long', '🎬 Long-form'],
|
||||||
|
['shorts', '⚡ Shorts'],
|
||||||
|
] as const
|
||||||
|
).map(([key, label]) => (
|
||||||
|
<button
|
||||||
|
key={key}
|
||||||
|
type="button"
|
||||||
|
className={filter === key ? 'on' : ''}
|
||||||
|
onClick={() => setFilter(key)}
|
||||||
|
>
|
||||||
|
{label}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="market-grid">
|
||||||
|
<div className="channel-list">
|
||||||
|
{list.map((ch, idx) => (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
key={ch.id}
|
||||||
|
className={`channel-row ${active?.id === ch.id ? 'active' : ''}`}
|
||||||
|
style={{ animationDelay: `${idx * 60}ms` }}
|
||||||
|
onClick={() => setActiveId(ch.id)}
|
||||||
|
>
|
||||||
|
<span className="ch-emoji">{ch.emoji}</span>
|
||||||
|
<span className="ch-main">
|
||||||
|
<b>{ch.name}</b>
|
||||||
|
<small>
|
||||||
|
{ch.niche} · {ch.notes}
|
||||||
|
</small>
|
||||||
|
</span>
|
||||||
|
<span className="ch-spark">
|
||||||
|
<Sparkline data={ch.trend} />
|
||||||
|
</span>
|
||||||
|
<span className="ch-price">{formatPrice(ch.priceUsd)}</span>
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{active ? (
|
||||||
|
<aside className="detail">
|
||||||
|
<div className="detail-head">
|
||||||
|
<span className="detail-emoji">{active.emoji}</span>
|
||||||
|
<div>
|
||||||
|
<h3>{active.name}</h3>
|
||||||
|
<p>
|
||||||
|
<span className="badge">YPP ✅</span> {active.niche}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="detail-stats">
|
||||||
|
<div>
|
||||||
|
<strong>{formatSubs(active.subs)}</strong>
|
||||||
|
<span>Subscribers</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<strong>{active.viewsLabel}</strong>
|
||||||
|
<span>30d views</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<strong>${active.rpm}</strong>
|
||||||
|
<span>Est. RPM</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<strong>{active.age}</strong>
|
||||||
|
<span>Channel age</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="chart-block">
|
||||||
|
<div className="chart-label">
|
||||||
|
<span>📊 12-mo view trend</span>
|
||||||
|
<em>upward</em>
|
||||||
|
</div>
|
||||||
|
<Sparkline data={active.trend} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="chart-block">
|
||||||
|
<div className="chart-label">
|
||||||
|
<span>📅 Weekly views index</span>
|
||||||
|
</div>
|
||||||
|
<BarChart data={active.weekly} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="detail-foot">
|
||||||
|
<div>
|
||||||
|
<div className="price-lg">{formatPrice(active.priceUsd)}</div>
|
||||||
|
<small>💎 Crypto via NOWPayments</small>
|
||||||
|
</div>
|
||||||
|
<BuyButton channel={active} />
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section className="flow" id="flow">
|
||||||
|
<div className="section-title">
|
||||||
|
<h2>🚀 Three steps to transfer</h2>
|
||||||
|
<p>Same NOWPayments flow as your ebook stack — invoice → pay → IPN confirm.</p>
|
||||||
|
</div>
|
||||||
|
<div className="steps">
|
||||||
|
<article>
|
||||||
|
<div className="step-ico">
|
||||||
|
<PlayIcon />
|
||||||
|
</div>
|
||||||
|
<h3>1. Pick a YPP listing</h3>
|
||||||
|
<p>Compare niches, subs, RPM and weekly charts on the live board.</p>
|
||||||
|
</article>
|
||||||
|
<article>
|
||||||
|
<div className="step-ico">
|
||||||
|
<CryptoIcon />
|
||||||
|
</div>
|
||||||
|
<h3>2. Pay in crypto</h3>
|
||||||
|
<p>USDT and other coins on NOWPayments hosted checkout. Fees paid by buyer.</p>
|
||||||
|
</article>
|
||||||
|
<article>
|
||||||
|
<div className="step-ico">
|
||||||
|
<CheckIcon />
|
||||||
|
</div>
|
||||||
|
<h3>3. Get the account</h3>
|
||||||
|
<p>After on-chain confirm, we send Google login + transfer checklist.</p>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer className="foot">
|
||||||
|
<div>
|
||||||
|
<YtLogo size={22} /> TubeMart
|
||||||
|
</div>
|
||||||
|
<span>© {new Date().getFullYear()} · Settles to USDT TRC20</span>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
175
src/components/Viz.tsx
Normal file
175
src/components/Viz.tsx
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useEffect, useId, useMemo, useRef, useState } from 'react';
|
||||||
|
|
||||||
|
export function CountUp({
|
||||||
|
to,
|
||||||
|
duration = 1400,
|
||||||
|
decimals = 0,
|
||||||
|
prefix = '',
|
||||||
|
suffix = '',
|
||||||
|
}: {
|
||||||
|
to: number;
|
||||||
|
duration?: number;
|
||||||
|
decimals?: number;
|
||||||
|
prefix?: string;
|
||||||
|
suffix?: string;
|
||||||
|
}) {
|
||||||
|
const [val, setVal] = useState(0);
|
||||||
|
const started = useRef(false);
|
||||||
|
const ref = useRef<HTMLSpanElement>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const el = ref.current;
|
||||||
|
if (!el) return;
|
||||||
|
|
||||||
|
const io = new IntersectionObserver(
|
||||||
|
([entry]) => {
|
||||||
|
if (!entry.isIntersecting || started.current) return;
|
||||||
|
started.current = true;
|
||||||
|
const t0 = performance.now();
|
||||||
|
const tick = (now: number) => {
|
||||||
|
const p = Math.min(1, (now - t0) / duration);
|
||||||
|
const eased = 1 - Math.pow(1 - p, 3);
|
||||||
|
setVal(to * eased);
|
||||||
|
if (p < 1) requestAnimationFrame(tick);
|
||||||
|
};
|
||||||
|
requestAnimationFrame(tick);
|
||||||
|
},
|
||||||
|
{ threshold: 0.4 },
|
||||||
|
);
|
||||||
|
io.observe(el);
|
||||||
|
return () => io.disconnect();
|
||||||
|
}, [to, duration]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<span ref={ref}>
|
||||||
|
{prefix}
|
||||||
|
{val.toFixed(decimals)}
|
||||||
|
{suffix}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Sparkline({ data, color = '#FF0000' }: { data: number[]; color?: string }) {
|
||||||
|
const id = useId();
|
||||||
|
const { points, area, last } = useMemo(() => {
|
||||||
|
const max = Math.max(...data);
|
||||||
|
const min = Math.min(...data);
|
||||||
|
const span = max - min || 1;
|
||||||
|
const coords = data.map((v, i) => {
|
||||||
|
const x = (i / (data.length - 1)) * 100;
|
||||||
|
const y = 28 - ((v - min) / span) * 24;
|
||||||
|
return `${x},${y}`;
|
||||||
|
});
|
||||||
|
const line = coords.join(' ');
|
||||||
|
const areaPath = `M0,30 L${line.replace(/ /g, ' L')} L100,30 Z`;
|
||||||
|
return { points: line, area: areaPath, last: data[data.length - 1] };
|
||||||
|
}, [data]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<svg className="sparkline" viewBox="0 0 100 30" preserveAspectRatio="none" aria-hidden>
|
||||||
|
<defs>
|
||||||
|
<linearGradient id={`g-${id}`} x1="0" y1="0" x2="0" y2="1">
|
||||||
|
<stop offset="0%" stopColor={color} stopOpacity="0.45" />
|
||||||
|
<stop offset="100%" stopColor={color} stopOpacity="0" />
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
<path d={area} fill={`url(#g-${id})`} className="spark-area" />
|
||||||
|
<polyline
|
||||||
|
fill="none"
|
||||||
|
stroke={color}
|
||||||
|
strokeWidth="2.2"
|
||||||
|
strokeLinejoin="round"
|
||||||
|
strokeLinecap="round"
|
||||||
|
points={points}
|
||||||
|
vectorEffect="non-scaling-stroke"
|
||||||
|
className="spark-line"
|
||||||
|
/>
|
||||||
|
<circle cx="100" cy={28 - ((last - Math.min(...data)) / (Math.max(...data) - Math.min(...data) || 1)) * 24} r="2.4" fill={color} className="spark-dot" />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function BarChart({ data }: { data: number[] }) {
|
||||||
|
const max = Math.max(...data);
|
||||||
|
const days = ['M', 'T', 'W', 'T', 'F', 'S', 'S'];
|
||||||
|
return (
|
||||||
|
<div className="bar-chart" aria-hidden>
|
||||||
|
{data.map((v, i) => (
|
||||||
|
<div className="bar-col" key={i}>
|
||||||
|
<div className="bar" style={{ height: `${(v / max) * 100}%`, animationDelay: `${i * 70}ms` }} />
|
||||||
|
<span>{days[i]}</span>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function PlayIcon({ size = 22 }: { size?: number }) {
|
||||||
|
return (
|
||||||
|
<svg width={size} height={size} viewBox="0 0 24 24" fill="currentColor" aria-hidden>
|
||||||
|
<path d="M8 5.14v13.72L19 12 8 5.14z" />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function YtLogo({ size = 28 }: { size?: number }) {
|
||||||
|
return (
|
||||||
|
<svg width={size} height={Math.round(size * 0.7)} viewBox="0 0 28 20" aria-hidden>
|
||||||
|
<rect width="28" height="20" rx="5" fill="#FF0000" />
|
||||||
|
<path d="M11 5.5v9l7.5-4.5L11 5.5z" fill="#fff" />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function CryptoIcon() {
|
||||||
|
return (
|
||||||
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" aria-hidden>
|
||||||
|
<circle cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="1.8" />
|
||||||
|
<path d="M8 12h8M12 7v10" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function CheckIcon() {
|
||||||
|
return (
|
||||||
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" aria-hidden>
|
||||||
|
<circle cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="1.8" />
|
||||||
|
<path d="M8 12.5l2.5 2.5L16 9.5" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function FloatingBits() {
|
||||||
|
const bits = useMemo(
|
||||||
|
() =>
|
||||||
|
['▶️', '💰', '📈', '🔴', '✨', '💎', '🎯', '📊'].map((emoji, i) => ({
|
||||||
|
emoji,
|
||||||
|
left: 8 + ((i * 12) % 84),
|
||||||
|
delay: i * 0.7,
|
||||||
|
dur: 10 + (i % 4) * 2,
|
||||||
|
size: 18 + (i % 3) * 6,
|
||||||
|
})),
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="float-bits" aria-hidden>
|
||||||
|
{bits.map((b) => (
|
||||||
|
<span
|
||||||
|
key={b.emoji + b.left}
|
||||||
|
className="float-bit"
|
||||||
|
style={{
|
||||||
|
left: `${b.left}%`,
|
||||||
|
animationDelay: `${b.delay}s`,
|
||||||
|
animationDuration: `${b.dur}s`,
|
||||||
|
fontSize: `${b.size}px`,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{b.emoji}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
141
src/lib/channels.ts
Normal file
141
src/lib/channels.ts
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
export type Channel = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
niche: string;
|
||||||
|
emoji: string;
|
||||||
|
subs: number;
|
||||||
|
views30d: number;
|
||||||
|
viewsLabel: string;
|
||||||
|
age: string;
|
||||||
|
rpm: number;
|
||||||
|
monetized: boolean;
|
||||||
|
priceUsd: number;
|
||||||
|
notes: string;
|
||||||
|
trend: number[];
|
||||||
|
weekly: number[];
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Edit these listings to match your real inventory. */
|
||||||
|
export const CHANNELS: Channel[] = [
|
||||||
|
{
|
||||||
|
id: 'ch-techpulse',
|
||||||
|
name: 'TechPulse Daily',
|
||||||
|
niche: 'Consumer Tech',
|
||||||
|
emoji: '📱',
|
||||||
|
subs: 18400,
|
||||||
|
views30d: 420000,
|
||||||
|
viewsLabel: '420K',
|
||||||
|
age: '2.1 yr',
|
||||||
|
rpm: 4.2,
|
||||||
|
monetized: true,
|
||||||
|
priceUsd: 3200,
|
||||||
|
notes: 'YPP live · AdSense clean · English',
|
||||||
|
trend: [42, 48, 45, 55, 62, 58, 71, 68, 74, 80, 77, 86],
|
||||||
|
weekly: [62, 71, 68, 79, 88, 84, 92],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'ch-clipforge',
|
||||||
|
name: 'ClipForge Shorts',
|
||||||
|
niche: 'Shorts / Viral',
|
||||||
|
emoji: '⚡',
|
||||||
|
subs: 51200,
|
||||||
|
views30d: 2100000,
|
||||||
|
viewsLabel: '2.1M',
|
||||||
|
age: '14 mo',
|
||||||
|
rpm: 1.8,
|
||||||
|
monetized: true,
|
||||||
|
priceUsd: 4800,
|
||||||
|
notes: 'YPP + Shorts fund eligible',
|
||||||
|
trend: [90, 110, 95, 140, 160, 155, 180, 210, 195, 230, 250, 280],
|
||||||
|
weekly: [180, 210, 195, 240, 260, 255, 290],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'ch-nightlane',
|
||||||
|
name: 'Night Lane Gaming',
|
||||||
|
niche: 'Gaming Highlights',
|
||||||
|
emoji: '🎮',
|
||||||
|
subs: 27600,
|
||||||
|
views30d: 680000,
|
||||||
|
viewsLabel: '680K',
|
||||||
|
age: '3.0 yr',
|
||||||
|
rpm: 3.1,
|
||||||
|
monetized: true,
|
||||||
|
priceUsd: 3900,
|
||||||
|
notes: 'Stable RPM · No strikes',
|
||||||
|
trend: [50, 52, 55, 54, 58, 61, 59, 64, 66, 65, 70, 72],
|
||||||
|
weekly: [58, 61, 59, 67, 70, 68, 74],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'ch-kitchenwire',
|
||||||
|
name: 'Kitchen Wire',
|
||||||
|
niche: 'Food / Lifestyle',
|
||||||
|
emoji: '🍜',
|
||||||
|
subs: 22100,
|
||||||
|
views30d: 510000,
|
||||||
|
viewsLabel: '510K',
|
||||||
|
age: '2.4 yr',
|
||||||
|
rpm: 5.6,
|
||||||
|
monetized: true,
|
||||||
|
priceUsd: 3500,
|
||||||
|
notes: 'YPP · Brand-safe catalog',
|
||||||
|
trend: [38, 40, 44, 43, 49, 52, 55, 53, 58, 61, 60, 66],
|
||||||
|
weekly: [49, 52, 55, 57, 61, 59, 65],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'ch-signaldesk',
|
||||||
|
name: 'Signal Desk News',
|
||||||
|
niche: 'News Commentary',
|
||||||
|
emoji: '🛰️',
|
||||||
|
subs: 14900,
|
||||||
|
views30d: 390000,
|
||||||
|
viewsLabel: '390K',
|
||||||
|
age: '1.8 yr',
|
||||||
|
rpm: 6.4,
|
||||||
|
monetized: true,
|
||||||
|
priceUsd: 2900,
|
||||||
|
notes: 'YPP · Mid-tier CPM niche',
|
||||||
|
trend: [30, 34, 32, 38, 41, 39, 45, 48, 46, 52, 55, 58],
|
||||||
|
weekly: [41, 45, 43, 50, 54, 52, 57],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'ch-fitframe',
|
||||||
|
name: 'FitFrame Studio',
|
||||||
|
niche: 'Fitness',
|
||||||
|
emoji: '💪',
|
||||||
|
subs: 33800,
|
||||||
|
views30d: 910000,
|
||||||
|
viewsLabel: '910K',
|
||||||
|
age: '2.7 yr',
|
||||||
|
rpm: 4.8,
|
||||||
|
monetized: true,
|
||||||
|
priceUsd: 5200,
|
||||||
|
notes: 'YPP · High retention series',
|
||||||
|
trend: [60, 64, 70, 68, 75, 82, 80, 88, 92, 90, 98, 105],
|
||||||
|
weekly: [78, 82, 80, 90, 95, 93, 102],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export function getChannel(id: string) {
|
||||||
|
return CHANNELS.find((c) => c.id === id);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function formatSubs(n: number) {
|
||||||
|
if (n >= 1000) return `${(n / 1000).toFixed(n >= 10000 ? 0 : 1)}K`;
|
||||||
|
return String(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function formatPrice(usd: number) {
|
||||||
|
return new Intl.NumberFormat('en-US', {
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'USD',
|
||||||
|
maximumFractionDigits: 0,
|
||||||
|
}).format(usd);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function marketTotals() {
|
||||||
|
return {
|
||||||
|
channels: CHANNELS.length,
|
||||||
|
subs: CHANNELS.reduce((s, c) => s + c.subs, 0),
|
||||||
|
views: CHANNELS.reduce((s, c) => s + c.views30d, 0),
|
||||||
|
};
|
||||||
|
}
|
||||||
103
src/lib/nowpayments.ts
Normal file
103
src/lib/nowpayments.ts
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
import { createHmac, timingSafeEqual } from 'crypto';
|
||||||
|
import { getChannel } from './channels';
|
||||||
|
|
||||||
|
const API_BASE = 'https://api.nowpayments.io/v1';
|
||||||
|
|
||||||
|
export function isNowPaymentsConfigured() {
|
||||||
|
return Boolean(
|
||||||
|
process.env.NOWPAYMENTS_API_KEY?.trim() && process.env.NOWPAYMENTS_IPN_SECRET?.trim(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function apiKey() {
|
||||||
|
const key = process.env.NOWPAYMENTS_API_KEY?.trim();
|
||||||
|
if (!key) throw new Error('NOWPAYMENTS_API_KEY missing');
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ipnSecret() {
|
||||||
|
const secret = process.env.NOWPAYMENTS_IPN_SECRET?.trim();
|
||||||
|
if (!secret) throw new Error('NOWPAYMENTS_IPN_SECRET missing');
|
||||||
|
return secret;
|
||||||
|
}
|
||||||
|
|
||||||
|
function siteUrl() {
|
||||||
|
return (process.env.SITE_URL || 'http://localhost:3000').replace(/\/$/, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function createChannelInvoice(channelId: string) {
|
||||||
|
const channel = getChannel(channelId);
|
||||||
|
if (!channel) throw new Error('channel not found');
|
||||||
|
|
||||||
|
const site = siteUrl();
|
||||||
|
const orderId = `ypp-${channel.id}-${Date.now()}`;
|
||||||
|
|
||||||
|
const res = await fetch(`${API_BASE}/invoice`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'x-api-key': apiKey(),
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
price_amount: channel.priceUsd,
|
||||||
|
price_currency: 'usd',
|
||||||
|
order_id: orderId,
|
||||||
|
order_description: `YPP Channel — ${channel.name}`,
|
||||||
|
ipn_callback_url: `${site}/api/pay/ipn`,
|
||||||
|
success_url: `${site}/success?channel=${encodeURIComponent(channel.id)}`,
|
||||||
|
cancel_url: `${site}/#inventory`,
|
||||||
|
is_fee_paid_by_user: true,
|
||||||
|
}),
|
||||||
|
cache: 'no-store',
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = (await res.json()) as {
|
||||||
|
id?: string | number;
|
||||||
|
invoice_url?: string;
|
||||||
|
message?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!res.ok || !data.invoice_url) {
|
||||||
|
throw new Error(data.message || `NOWPayments invoice failed (${res.status})`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: String(data.id ?? ''),
|
||||||
|
invoiceUrl: data.invoice_url,
|
||||||
|
orderId,
|
||||||
|
channelId: channel.id,
|
||||||
|
amountUsd: channel.priceUsd,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function sortObject(value: unknown): unknown {
|
||||||
|
if (!value || typeof value !== 'object' || Array.isArray(value)) return value;
|
||||||
|
const obj = value as Record<string, unknown>;
|
||||||
|
return Object.keys(obj)
|
||||||
|
.sort()
|
||||||
|
.reduce<Record<string, unknown>>((result, key) => {
|
||||||
|
const item = obj[key];
|
||||||
|
result[key] =
|
||||||
|
item && typeof item === 'object' && !Array.isArray(item) ? sortObject(item) : item;
|
||||||
|
return result;
|
||||||
|
}, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function verifyIpnSignature(rawBody: string, signature: string | null) {
|
||||||
|
if (!signature) return false;
|
||||||
|
let payload: unknown;
|
||||||
|
try {
|
||||||
|
payload = JSON.parse(rawBody);
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const expected = createHmac('sha512', ipnSecret())
|
||||||
|
.update(JSON.stringify(sortObject(payload)))
|
||||||
|
.digest('hex');
|
||||||
|
|
||||||
|
const a = Buffer.from(expected, 'utf8');
|
||||||
|
const b = Buffer.from(signature, 'utf8');
|
||||||
|
if (a.length !== b.length) return false;
|
||||||
|
return timingSafeEqual(a, b);
|
||||||
|
}
|
||||||
21
tsconfig.json
Normal file
21
tsconfig.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2017",
|
||||||
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
|
"allowJs": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"strict": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"module": "esnext",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"jsx": "preserve",
|
||||||
|
"incremental": true,
|
||||||
|
"plugins": [{ "name": "next" }],
|
||||||
|
"paths": { "@/*": ["./src/*"] }
|
||||||
|
},
|
||||||
|
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||||
|
"exclude": ["node_modules"]
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user