Commit Graph

61 Commits

Author SHA1 Message Date
hailin d49200e876 feat: Wire all view components to Next.js App Router routes
- Create (admin) route group with AdminLayout wrapper
- Add page.tsx route files for all 25 view pages (dashboard, issuers,
  users, trading, risk, compliance, system, disputes, coupons, finance,
  chain, reports, merchant, agent, insurance, analytics sub-pages,
  compliance sub-pages)
- Update AdminLayout to use Next.js usePathname/useRouter for real
  URL-based navigation instead of internal state
- Add 'use client' directive to view components using useState hooks
- Fix 404 on /dashboard by creating proper App Router route structure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 05:37:28 -08:00
hailin 9ce42ed5ac chore: Switch domain from admin.gogenex.com to admin.gogenex.cn
使用国内 .cn 域名用于 ICP 备案,支持国内 IP 直连加速。
国际域名 gogenex.com 保留在 Namecheap 不受影响。

变更:
- deploy.sh: 默认域名/邮箱改为 admin.gogenex.cn
- nginx 配置: 重命名为 admin.gogenex.cn.conf,替换所有域名引用
- DEPLOY.md: 更新所有域名引用

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 05:18:22 -08:00
hailin a2a42ebf23 docs: Add deployment guide for admin-web (DEPLOY.md)
完整的部署文档,涵盖:
- 环境要求与项目结构
- 3 步快速部署流程
- deploy.sh 全部命令参考 (Docker + Nginx + SSL)
- 自定义域名部署说明
- Docker 三阶段构建说明
- SSL 证书管理 (自动续期、手动续期、强制重申)
- Nginx HTTPS 配置特性说明
- 常见问题排查 (端口占用、构建失败、SSL 失败、日志查看)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 02:00:40 -08:00
hailin 51f4c60fe5 feat: Add Nginx + Let's Encrypt SSL support to admin-web deploy.sh
deploy.sh 新增 nginx 子命令,支持一键安装 Nginx 反向代理和
Let's Encrypt SSL 证书,参考 rwadurian api-gateway 的实现模式。

新增命令:
  - nginx install [domain] [email]: 完整安装流程 (5步)
    1. 自动安装 nginx + certbot 依赖
    2. 部署 HTTP 临时配置 (含 ACME 验证路径)
    3. certbot webroot 方式申请 SSL 证书
    4. 部署 HTTPS 完整配置 (从 nginx/ 目录读取)
    5. 配置证书自动续期钩子 (renew hook)
  - nginx ssl [domain] [email]: 仅申请/续期证书
  - nginx status: 查看 Nginx 服务和证书状态
  - nginx reload: 重载 Nginx 配置

新增文件:
  - nginx/admin.gogenex.com.conf: HTTPS 配置模板
    含 HTTP→HTTPS 重定向、TLS 1.2/1.3、HSTS、Gzip、
    安全头、Next.js 静态资源长缓存、反向代理到 :3000

默认域名: admin.gogenex.com
默认邮箱: admin@gogenex.com

使用方式:
  1. ./deploy.sh start              # 先启动 Docker 容器
  2. sudo ./deploy.sh nginx install # 安装 Nginx + SSL
  3. 访问 https://admin.gogenex.com

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 01:58:07 -08:00
hailin 29958602db fix: Move src/pages/ to src/views/ to avoid Next.js Pages Router conflict
Next.js treats `src/pages/` as the Pages Router and requires every file
to have a default export. Our page components use named exports
(e.g. `export const DashboardPage`) since they are UI view components,
not Next.js route handlers.

Rename to `src/views/` so Next.js only uses the App Router (`src/app/`).
The App Router page.tsx files will import from `@/views/` as needed.

24 files moved: src/pages/**/*.tsx → src/views/**/*.tsx

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 01:48:23 -08:00
hailin b2c81090f8 fix: Resolve TypeScript strict-mode error in IpoReadinessPage
The milestones array only had 'progress' and 'pending' status values,
causing TS to infer the status type as 'progress' | 'pending'. The
template code then compared m.status === 'done' which TS flagged as
unreachable. Fix by explicitly typing the array to include all three
possible status values: 'done' | 'progress' | 'pending'.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 01:46:24 -08:00
hailin 79689c5f95 fix: Make Dockerfile tolerant of missing package-lock.json
The initial project has no node_modules or package-lock.json yet.
Use wildcard COPY for lock file and fallback to `npm install`
when lock file doesn't exist. Once lock file is generated and
committed, it will automatically use the faster `npm ci`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 01:39:14 -08:00
hailin 6b90d61199 chore: Add Next.js project config and app entry for admin-web
The previous deploy.sh commit included Dockerfile and docker-compose
but was missing the actual Next.js project files needed for `npm ci`
and `npm run build` to succeed. This adds the complete project skeleton.

## Project configuration files

### package.json
- Next.js 15.1.11, React 18, TypeScript 5.9
- Dependencies: @reduxjs/toolkit, @tanstack/react-query,
  @tanstack/react-table, axios, recharts, zustand, dayjs, clsx
- Scripts: dev, build, start, lint, format, type-check

### next.config.ts
- output: 'standalone' — required for Docker multi-stage build
- / redirects to /dashboard
- Remote image patterns enabled

### tsconfig.json
- Strict mode, bundler module resolution
- Path alias: @/* → ./src/*
- Incremental compilation enabled

### .gitignore / .dockerignore
- Standard Next.js ignores (node_modules, .next, out, coverage)
- Docker build excludes dev files, docs, git, IDE configs

## App Router entry files

### src/app/layout.tsx — Root layout
- HTML lang="zh-CN", imports globals.css + design-tokens.css
- Wraps children with Providers (placeholder for Redux/RQ/Auth)

### src/app/providers.tsx — Client-side providers wrapper
- Placeholder for Redux Provider, React Query, Theme, Auth

### src/app/page.tsx — Root page
- Redirects to /dashboard via next.config.ts

### src/app/globals.css — Global styles
- Imports design-tokens.css, box-sizing reset
- Custom scrollbar styling with design tokens
- Selection color using primary-container

### src/app/api/health/route.ts — Health check endpoint
- GET /api/health returns { status, service, timestamp }
- Used by Docker healthcheck and load balancers

### public/favicon.ico — Placeholder favicon

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 01:35:19 -08:00
hailin 8042160f83 . 2026-02-11 09:30:54 +00:00
hailin bae342f1bd chore: Add Docker deployment config for admin-web
Add complete deployment toolchain for the Genex Admin Web (React + Next.js),
mirroring the proven deployment pattern from the rwadurian project.

## Files added

### deploy.sh — One-click deployment script
- Commands: build / start / stop / restart / logs / status / clean
- Auto-detects `docker compose` vs `docker-compose`
- Port conflict detection with auto-stop of old service
- Health check verification after startup
- Supports PORT env override (default: 3000)

### Dockerfile — Multi-stage production build
- Stage 1 (deps): node:20-alpine, npm ci for deterministic installs
- Stage 2 (builder): Next.js production build with telemetry disabled
- Stage 3 (runner): Minimal runtime with standalone output
- Non-root user (nextjs:nodejs) for security
- curl installed for container health checks

### docker-compose.yml — Container orchestration
- Service: genex-admin-web on genex-network bridge
- Health check: GET /api/health every 30s, 3 retries
- Auto-restart: unless-stopped policy
- Timezone: Asia/Shanghai

### .env.development — Local dev environment
- API: http://localhost:8080/api

### .env.production — Production environment
- API: https://api.gogenex.com/api

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 01:22:22 -08:00
hailin e450bef7cd feat: Complete all 4 frontend UI prototypes covering guides 00-04
Add 116 UI prototype files across 4 frontend applications, achieving
~95% coverage of all functional requirements from development guides.

## mobile/ (Flutter Consumer + Merchant App) — 48 files
- Auth: welcome, login, register, forgot-password
- Coupons: home, market, search, detail, my-coupons, my-coupon-detail,
  order-confirm, payment, payment-success, redeem-qr
- Trading: trading, sell-order (AI pricing), transfer
- Wallet: wallet, deposit, withdraw, transaction-records
- Profile: profile, kyc (L0-L3), settings, payment-management, pro-mode
  (WalletConnect, chain address, tx hash, track selection)
- AI Agent: agent-chat, ai-fab (floating button with unread count)
- Merchant: merchant-home (scanner, confirm, success, history, dashboard),
  merchant-ai-assistant (redeem assist, traffic prediction, anomaly alerts)
- Message: message-list, message-detail
- Issuer: issuer-main-page
- Shared widgets: coupon-card, price-tag, credit-badge, kyc-badge,
  status-tag, empty-state, skeleton-loader, confirm-sheet, genex-button,
  ai-confirm-dialog (3-level risk confirmation)
- Theme: app-colors, app-typography, app-spacing, app-theme
- i18n: zh-CN, en-US, ja-JP

## admin-app/ (Flutter Issuer Console) — 27 files
- Auth: issuer-login
- Onboarding: 5-step enterprise onboarding with AI compliance check
- Dashboard: issuer-dashboard (stats, AI insight, credit/quota),
  user-portrait (age/geo/preference/repurchase/AI insight)
- Coupon management: list, create (template-based, AI pricing),
  detail (recall/delist), batch-operations (issue/recall/price-adjust)
- Redemption: scan-to-redeem with offline mode
- Finance: overview, reconciliation (auto-reconcile, export PDF/Excel),
  financing-analysis (cost-benefit, liquidity, risk indicators, AI strategy)
- Credit: credit-scoring (4-factor, tier progress, AI suggestions),
  quota-management (usage gauge, type breakdown, tier upgrade, increase requests)
- AI Agent: full conversation UI with quick actions
- Settings: account, notification, support, tier display
- Store management: hierarchy (HQ/regional/store), employee roles
- Shared: ai-suggestion-card
- Theme: app-colors, app-theme, app-typography, app-spacing
- i18n: zh-CN, en-US, ja-JP

## admin-web/ (React + Next.js Platform Admin) — 26 files
- Layout: AdminLayout with collapsible sidebar, 10 nav sections
- Dashboard: key metrics, transaction feed, system health
- Users: user management with KYC filtering, risk tags
- Issuers: issuer review with AI pre-screening, credit rating display
- Trading: real-time monitor, order book, abnormal detection
- Risk: risk dashboard, AI warnings, suspicious transactions, OFAC logs
- Compliance: SAR/CTR management, audit logs, AI report generation
- SEC Filing: S-1/10-K/10-Q/8-K tracker, filing timeline, auto-disclosure
- License management: FinCEN MSB, BitLicense, MTL (48 states), renewal alerts
- SOX compliance: ICFR/ITGC/access/change-mgmt controls, deficiency tracking
- Tax compliance: Federal + 4 states, 8 IRS forms, tax calendar
- IPO readiness: 28-item checklist (legal/financial/SOX/governance/insurance),
  blocker tracking, milestone timeline, category progress, key contacts
- Finance: fee revenue, settlement queue, breakage tracking
- Disputes: case management with SLA countdown, chain evidence
- Analytics: user (DAU/MAU, cohort retention, geographic), coupon (category,
  breakage, secondary market), market-maker (TVL, spread, health, risk alerts),
  consumer-protection (complaints, CSAT, fund utilization, non-compliant issuers)
- Insurance: consumer protection fund, claims, IPO checklist overview
- Chain monitor: smart contract status, blockchain metrics
- Reports: platform-wide report center
- AI Agent panel: session stats, top questions, module accuracy
- Merchant redemption: stats, store ranking, real-time feed
- Design tokens: CSS custom properties (colors, typography, spacing, shadows)
- i18n: zh-CN, en-US, ja-JP

## miniapp/ (Taro Mini Program + H5) — 15 files
- Pages: home, detail, purchase, orders, my-coupons, login, redeem, profile
- H5 pages: h5-share, h5-activity (countdown, featured coupons),
  h5-register (benefits, phone/SMS form, WeChat login)
- Components: coupon-card, ai-guide (recommendation bar + purchase bubble),
  share-card (brand header, QR code, coupon info)
- i18n: zh-CN, en-US, ja-JP

## Design System
- Primary: #6C5CE7 (innovation purple), Material 3 style
- Consistent design tokens across all platforms
- Zero blockchain terminology — "我的券" not "NFT", "订单号" not "TX Hash"
- Utility Track MVP only; Securities Track reserved as "coming soon"

## Not included (by design)
- Data/Domain layers (API, state management, business logic) — UI prototypes only
- Securities Track full UI — MVP focuses on Utility Track
- P2 "求购" (want-to-buy) feature — marked as optional

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 01:16:44 -08:00