feat: initialize project with Vite + React + TypeScript + Tailwind CSS
- Set up Vite 7 + React 19 + TypeScript 5 + Tailwind CSS 4 - Configure path aliases (@/ -> src/) - Create Layout with Header and Footer components - Create HomePage with hero section and feature highlights - Set up cursor rules for agent-driven development - Create PLAN.md and LESSONS.md for progress tracking Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
28
.cursor/rules/agent-workflow.mdc
Normal file
28
.cursor/rules/agent-workflow.mdc
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
description: Agent workflow rules for 100% agent-driven development
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Agent Workflow
|
||||
|
||||
## Before Making Changes
|
||||
1. Read PLAN.md to understand current phase and priorities
|
||||
2. Check LESSONS.md for relevant past decisions
|
||||
3. Read existing code before editing — never guess at file contents
|
||||
|
||||
## After Making Changes
|
||||
1. Run `npm run build` to verify no errors
|
||||
2. Update PLAN.md checkboxes when a feature is complete
|
||||
3. Add important learnings to LESSONS.md
|
||||
4. Commit with conventional message format
|
||||
|
||||
## When Stuck
|
||||
- Check LESSONS.md for similar past issues
|
||||
- Prefer simple solutions over clever ones
|
||||
- If a decision has trade-offs, document the reasoning in LESSONS.md
|
||||
|
||||
## Code Quality
|
||||
- Fix all TypeScript errors before committing
|
||||
- Fix all linter warnings before committing
|
||||
- No `console.log` in committed code (use only for debugging)
|
||||
- Remove unused imports and variables
|
||||
30
.cursor/rules/project-overview.mdc
Normal file
30
.cursor/rules/project-overview.mdc
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
description: Project overview and conventions for the Diet Reference App
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Diet & Healthy Weight Reference App
|
||||
|
||||
## Project
|
||||
Static SPA — справочник методик похудения и здорового веса. Vite 6 + React 19 + TypeScript 5 + Tailwind CSS 4 + React Router 7.
|
||||
|
||||
## Key Conventions
|
||||
- All code in TypeScript strict mode — no `any`, no `as` casts without justification
|
||||
- Functional components only, prefer named exports
|
||||
- Custom hooks for reusable logic (prefix `use`)
|
||||
- Data lives in `src/data/` as typed TS modules
|
||||
- All user state (theme, bookmarks) via localStorage through custom hooks
|
||||
- Semantic HTML + ARIA attributes for accessibility
|
||||
- Russian language for UI content, English for code (variable names, comments)
|
||||
|
||||
## File Structure
|
||||
- `src/components/` — reusable UI components (Button, Card, Badge, etc.)
|
||||
- `src/pages/` — route-level page components
|
||||
- `src/data/` — static content data (methods, categories)
|
||||
- `src/hooks/` — custom React hooks
|
||||
- `src/utils/` — pure utility functions
|
||||
- `src/types/` — shared TypeScript types and interfaces
|
||||
|
||||
## Commit Style
|
||||
- Atomic commits per feature
|
||||
- Format: `feat: short description` / `fix:` / `refactor:` / `style:` / `docs:`
|
||||
31
.cursor/rules/tailwind-styling.mdc
Normal file
31
.cursor/rules/tailwind-styling.mdc
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
description: Tailwind CSS styling conventions
|
||||
globs: "**/*.tsx"
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Tailwind CSS Styling
|
||||
|
||||
## Approach
|
||||
- Utility-first: use Tailwind classes directly in JSX
|
||||
- Use `clsx` for conditional classes
|
||||
- Extract repeated patterns into components, not CSS classes
|
||||
- Dark mode via `dark:` variant (class strategy)
|
||||
|
||||
## Layout
|
||||
- Mobile-first: default styles for mobile, `sm:` / `md:` / `lg:` for larger
|
||||
- Use `container mx-auto px-4` for page-level wrappers
|
||||
- Flexbox and Grid via Tailwind utilities
|
||||
|
||||
## Colors
|
||||
- Use semantic color names from theme (primary, secondary, accent)
|
||||
- Never hardcode hex colors in className
|
||||
|
||||
## Example
|
||||
```tsx
|
||||
<article className={clsx(
|
||||
"rounded-2xl border p-6 transition-shadow hover:shadow-lg",
|
||||
"bg-white dark:bg-gray-800",
|
||||
isBookmarked && "ring-2 ring-primary-500"
|
||||
)}>
|
||||
```
|
||||
39
.cursor/rules/typescript-react.mdc
Normal file
39
.cursor/rules/typescript-react.mdc
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
description: TypeScript and React patterns for the project
|
||||
globs: "**/*.{ts,tsx}"
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# TypeScript & React Standards
|
||||
|
||||
## Components
|
||||
- Functional components with explicit return types
|
||||
- Props as `interface` (not `type`), suffix with `Props`
|
||||
- Destructure props in function signature
|
||||
- Use `React.FC` is NOT allowed — use plain functions
|
||||
|
||||
```typescript
|
||||
// GOOD
|
||||
interface MethodCardProps {
|
||||
method: DietMethod;
|
||||
onBookmark?: (id: string) => void;
|
||||
}
|
||||
|
||||
export function MethodCard({ method, onBookmark }: MethodCardProps) {
|
||||
return <article>...</article>;
|
||||
}
|
||||
```
|
||||
|
||||
## Hooks
|
||||
- Custom hooks return objects (not arrays) for >2 values
|
||||
- Always handle loading/error states
|
||||
- Prefix with `use`
|
||||
|
||||
## Types
|
||||
- Prefer `interface` for object shapes, `type` for unions/intersections
|
||||
- No enums — use `as const` objects + type inference
|
||||
- Export shared types from `src/types/`
|
||||
|
||||
## Imports
|
||||
- Absolute imports from `@/` (mapped to `src/`)
|
||||
- Group: react → third-party → @/ imports → relative → types
|
||||
Reference in New Issue
Block a user