feat: billing UI — balance in header + /billing transactions page

- Header: Coins badge с кредитами, ссылка на /billing
- app/billing/page.js: баланс, план, стоимость операций, история транзакций
- app/api/billing/balance/route.js, transactions/route.js — прокси к engine
- lib/engine.js: getBillingBalance, getTransactions, getBillingPlans, adminCreditUser
This commit is contained in:
Ник (Claude)
2026-06-11 18:28:56 +03:00
parent a8df9acbcb
commit 1cce478f27
5 changed files with 215 additions and 6 deletions
+14
View File
@@ -0,0 +1,14 @@
import { NextResponse } from 'next/server';
import { requireUser } from '@/lib/session';
import { engine } from '@/lib/engine';
export async function GET(req) {
const user = await requireUser();
if (!user) return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
try {
const data = await engine.getBillingBalance(user.id);
return NextResponse.json(data);
} catch (err) {
return NextResponse.json({ error: err.message }, { status: 500 });
}
}