Files
no-whatever/.cursor/rules/project-conventions.mdc
T
kurihada 14b0aaece4 feat: 盲盒房间体系重构 — 强制登录、独立房间、用户归属
- 新增 BlindBoxRoom/BlindBoxMember 模型,BlindBoxIdea 增加 userId/drawnById
- 新增房间 API(创建/加入/列表/详情),所有盲盒 API 增加认证和成员校验
- 新建盲盒大厅页面(三层引导式设计:未登录氛围页/首次创建引导/房间列表)
- 新建盲盒房间页面(成员校验/邀请分享/用户归属展示/自动聚焦)
- 首页删除契约画廊和 localStorage 盲盒逻辑,周末契约跳转到 /blindbox
- 清理旧路由 /room/[id]/blindbox
- 提取共享工具 src/lib/blindbox.ts(错误响应/房间号生成/成员校验)
- AuthModal 支持 defaultTab 参数
- 更新项目规范:新项目原则、代码优雅和复用优先
2026-02-26 12:25:32 +08:00

45 lines
1.5 KiB
Plaintext

---
description: Project-wide coding conventions for NoWhatever
alwaysApply: true
---
# NoWhatever Project Conventions
## Philosophy
- This is a **new project** — never worry about backward compatibility or legacy code migration
- Prioritize **code elegance and reuse** over quick hacks
- Extract shared logic into reusable utilities (`src/lib/`) and components (`src/components/`)
- DRY: if the same pattern appears twice, extract it
## Tech Stack
- **Framework**: Next.js App Router (all pages are `"use client"`)
- **Database**: Prisma + SQLite
- **Styling**: Tailwind CSS v4 (use `bg-linear-to-*` NOT `bg-gradient-to-*`)
- **Animation**: framer-motion
- **Icons**: lucide-react
- **Effects**: canvas-confetti
## Tailwind v4 Syntax
- Gradients: `bg-linear-to-br` (not `bg-gradient-to-br`)
- Arbitrary values: prefer Tailwind built-in classes over `[]` when possible (e.g. `max-w-20` not `max-w-[5rem]`)
## Component Patterns
- Page components export `default function PageName()`
- Use `useCallback` for event handlers passed as props
- Use `motion.*` from framer-motion for animated elements
- Mobile-first, `min-h-dvh` for full-height pages
- `overflow-y-auto scrollbar-none` for scrollable pages
- Extract reusable UI patterns into shared components (modals, cards, empty states)
## API Routes
- Located in `src/app/api/`
- Return `NextResponse.json()` with appropriate status codes
- Always handle errors with try/catch
- Extract common validation (userId, membership) into utility functions in `src/lib/`
- Use consistent error response shape: `{ error: string }`