尚未检测到更新。GitHub 发布版本后会显示在这里。
个人 GitHub 账号下公开仓库的所有者可以登录并验证所有权,自行管理介绍,无需管理员批准。
登录并生成验证文件,在 30 分钟内将其提交到此仓库的默认分支。其他分支或分叉仓库中的文件无效。然后在下方检查文件,即可无需管理员批准直接管理项目。请保留文件以维持管理权限。
如需登录,将前往登录页面。登录后请回到此处,再次点击所选的验证按钮。
在项目文件夹中运行 /nomorevibe verify,即可验证所有权并自行管理介绍。
一分钟完成验证UI for a gamified marketing platform
翻译准备中
取自仓库 README
正在加载完整 README。
查看完整 README ↗Picture and short-definition trivia across many topics. This repository is the web frontend (Next.js).
There are no points, leaderboards, rankings, ads or prize draws.
| Role | Home | What they do |
|---|---|---|
Player (gamer) | /user/dashboard | Play trivia, build custom trivias, upgrade to Pro |
| Brand | /brand/dashboard | Set up a brand profile, build and pay for campaigns, read campaign results |
| Admin | /admin | Manage topics, cards and global settings; moderate campaigns; view revenue |
src/lib/api.ts) with bearer auth and cookie-based token refreshThe frontend never talks to a database. Everything goes through the backend API, whose contract
is documented in docs/frontend-integration.md. That file is the
source of truth for endpoints, payloads, error codes and state machines.
npm install
cp .env.local.example .env.local # then fill it in
npm run dev # http://localhost:3000
The backend must be running and reachable at NEXT_PUBLIC_API_URL.
| Variable | Required | Purpose |
|---|---|---|
NEXT_PUBLIC_API_URL | Yes | Origin of the backend, without a path (for example http://localhost:4000). The app calls {origin}/api/v1/... |
NEXT_PUBLIC_GOOGLE_CLIENT_ID | No | Enables the Google sign-in button. Left out, the button is hidden |
Three routes are linked to from outside the app, so the backend's FRONTEND_URL must point at
wherever this frontend is served:
/q/:slug — shared custom trivia links/payment/verify?reference= — the return page after a Paystack checkout/reset-password?token= — password reset emailsToken refresh uses a refresh_token cookie, so the frontend and the API need to be able to
share cookies (same site, or a cross-site cookie setup on the backend).
| Command | What it does |
|---|---|
npm run dev | Development server |
npm run build / npm start | Production build and server |
npm run lint | ESLint |
npx tsc --noEmit | Typecheck |
npm run test / npm run test:watch | Vitest |
Docker and deployment scripts are described in DEPLOYMENT.md.
src/
├── app/
│ ├── (routes)/
│ │ ├── (private-pages)/ # Login required
│ │ │ ├── trivia/ # Topic picker and setup
│ │ │ ├── play/[sessionId]/ # Quiz → result, for every kind of trivia
│ │ │ ├── my-quizzes/ # Custom trivia list, builder and preview
│ │ │ ├── pro/ # Plan and Pro checkout
│ │ │ ├── user/ # Player home, profile, settings
│ │ │ ├── brand/ # Brand home, campaigns, profile
│ │ │ └── admin/ # Admin pages
│ │ └── (public-pages)/ # Login, register, /q/[slug], /payment/verify, ...
│ └── _utils/ # endpoints.ts, routes.ts, constants.ts
├── atom/user.ts # Logged-in user (persisted to localStorage)
├── components/
│ ├── ui/ # shadcn/ui primitives and shared widgets
│ ├── match/ trivia/ cards/ # Game screens and the shared card editor
│ ├── quizzes/ campaigns/ pro/ admin/
│ └── layout/ auth/
├── hooks/ # Game settings, plan, session start, back-navigation block
├── lib/ # API client, uploads, sound, small helpers
└── types/index.ts # All API types
A few rules shape most of the code:
deadlineAt and
serverTime; the countdown is driven from those, not the device clock. The correct answer is
only returned after a question is settled./play/[sessionId] renders from the server's session status, so a refresh
lands on the same phase and the same question with the time that is left.GET /settings/game; nothing is hard-coded.CAMPAIGN_REQUIRED and the app offers the campaign instead.npm run test covers the trivia quiz (practice pointer, timeout, forward only, resume), the campaign gate, the upgrade prompts and the small validation helpers.
Tests mock @/lib/api and render pages with a fresh query client (see src/test-utils.tsx).
Before a release, walk through docs/qa-checklist.md against a real
backend. It covers what the tests cannot: payments, uploads, sound, and layout on a phone.