improvement: some files replaced, lots of them i shall say. AGENT.MD file created. some rules and skills added for cursor agent.
This commit is contained in:
47
.cursor/rules/frontend-components.mdc
Normal file
47
.cursor/rules/frontend-components.mdc
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
description: Frontend folder structure — ui vs non-ui, thin pages, feature layout
|
||||
globs: frontend/src/**
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Frontend component structure
|
||||
|
||||
## Rules
|
||||
|
||||
| Kind | Location |
|
||||
|------|----------|
|
||||
| Cross-feature UI | `components/ui/shared/` |
|
||||
| Feature UI | `components/ui/{feature}/` |
|
||||
| Cross-feature non-UI | `components/shared/` |
|
||||
| Feature non-UI | `components/{feature}/` |
|
||||
| Route logic | `components/ui/{feature}/{Feature}Page.tsx` |
|
||||
| App routes | `app/**/page.tsx` — **thin wrapper only** |
|
||||
|
||||
## Thin page pattern
|
||||
|
||||
```tsx
|
||||
'use client';
|
||||
import { PatientsPage } from '@/components/ui/patient/PatientsPage';
|
||||
export default function Page() {
|
||||
return <PatientsPage />;
|
||||
}
|
||||
```
|
||||
|
||||
Reference: `app/.../treatment/page.tsx` + `components/ui/treatment/TreatmentWorkspace.tsx`.
|
||||
|
||||
## Do not
|
||||
|
||||
- Put React components (`.tsx` with JSX) in `components/` outside `ui/`.
|
||||
- Put pure helpers (`.ts`, no JSX) inside `components/ui/`.
|
||||
- Put business logic, API calls, or large forms directly in `app/**/page.tsx`.
|
||||
|
||||
## API & errors
|
||||
|
||||
- API clients: `lib/api/`.
|
||||
- Catch blocks: `getUserFacingError(err, tErrors, fallback)` from `components/shared/formatApiError.ts`.
|
||||
|
||||
## When adding UI
|
||||
|
||||
1. Check `components/ui/shared/` for an existing primitive.
|
||||
2. Check the feature's `ui/{feature}/` folder for an existing pattern.
|
||||
3. Add i18n keys to en, fa, and nl.
|
||||
Reference in New Issue
Block a user