corrad-bp/.cursor/rules/state-management.mdc
Md Afiq Iskandar 7fca97912f Add Documentation for Backend Services, Components, Database Models, Development Guidelines, Form Handling, Project Overview, Project Structure, Routing, and State Management
- Created comprehensive documentation files for backend services, detailing API endpoints, database access, authentication, and middleware.
- Added documentation for Rose UI components and custom FormKit components, including descriptions and usage.
- Documented database models defined in Prisma, outlining core and supporting models with their fields and relationships.
- Established development guidelines for component and form development, state management, API development, and styling.
- Included details on FormKit integration for form handling, plugins, and the form builder feature.
- Provided an overview of the project structure, key configuration files, and routing system with main routes and middleware usage.
- Enhanced state management documentation with key stores and usage guidelines for Pinia.
2025-04-23 08:19:14 +08:00

36 lines
1.1 KiB
Plaintext

---
description:
globs:
alwaysApply: false
---
# State Management
The project uses Pinia for state management. Key stores include:
## Stores
- **[formBuilder.js](mdc:stores/formBuilder.js)**: Manages state for the form builder feature
- Handles form components, properties, and history
- Controls drag-and-drop operations
- Manages form validation and submission
- **[user.js](mdc:stores/user.js)**: Manages user authentication and profile
- Stores user information
- Handles login/logout operations
- Manages user permissions
- **[theme.js](mdc:stores/theme.js)**: Controls application theming
- Manages light/dark mode
- Stores user theme preferences
- **[layout.js](mdc:stores/layout.js)**: Controls application layout
- Manages sidebar state
- Controls responsive layout changes
## Usage Guidelines
- Use Pinia stores for shared state that needs to be accessed across components
- Keep component-specific state within components using Vue's Composition API
- For form state, prefer FormKit's built-in state management
- Use persisted state (localStorage) for user preferences