4.2 KiB
Frontend Documentation
UI Framework and Library
Framework: React Styling: Tailwind CSS Additional UI Libraries: Headless UI (for accessible components)
Design Philosophy
The application follows a minimalistic, modern design inspired by Apple's design language with:
- Clean, uncluttered interfaces
- Ample white space
- Subtle animations and transitions
- Focus on content and functionality
- Support for both light and dark mode
Navigation Structure
The application uses a sidebar navigation layout with the following primary sections:
- Dashboard - Overview of user activity and saved strategies
- Strategy Builder - Main interface for creating strategies
- My Strategies - Library of saved and generated strategies
- Community - Social features and shared strategies
- Settings - Account management and preferences
Mobile view will use a collapsible hamburger menu to ensure responsiveness.
State Management
Solution: Zustand
Zustand is selected for state management due to its:
- Simplified API compared to Redux
- Strong performance for complex state
- Minimal boilerplate code
- Good compatibility with React's concurrent features
- Ability to handle complex nested state required for strategy configurations
Component Structure
Core Components
-
StrategyBuilder
- Main component for strategy creation
- Contains sub-sections for each framework part
- Houses the visual indicator selection interface
-
IndicatorSelector
- Allows selection from pre-built indicators
- Provides customization controls for indicator parameters
- Displays visual representation of indicator behavior
-
StrategyViewer
- Displays the complete strategy with all selected components
- Provides export options
- Shows educational content about strategy components
-
CodeExporter
- Generates PineScript code
- Toggles between minimal and commented code
- Provides copy functionality
-
AIStrategyGenerator
- Interface for API key management
- Controls for AI-based strategy generation
- Displays generated strategies with explanations
-
StrategyVersionControl
- Manages different versions of strategies
- Provides comparison tools
- Allows reverting to previous versions
Shared Components
-
Header
- App logo and navigation
- User profile and account menu
- Theme toggle (light/dark mode)
-
Sidebar
- Main navigation menu
- Collapsible on mobile devices
-
Modal
- Reusable modal component for alerts, confirmations, etc.
-
Toast
- Notification system for success/error messages
-
Button
- Consistent button styles across the application
- Various states (primary, secondary, disabled)
-
Card
- Container for strategy items and content blocks
Forms and Inputs
-
API Key Management Form
- Secure input for LLM API keys
- Validation for proper key format
- Test connection functionality
-
Strategy Parameters Form
- Number inputs with min/max validation
- Toggle switches for boolean options
- Dropdown selects for pre-defined options
-
Filter and Search Forms
- Used in strategy library and community sections
- Quick filtering by strategy type, performance, etc.
Responsive Design
The application will follow a mobile-first approach with specific breakpoints for:
- Mobile (< 640px)
- Tablet (640px - 1024px)
- Desktop (> 1024px)
Tailwind's responsive classes will be utilized for consistent responsive behavior.
Theme Management
The application will support both light and dark modes:
- System preference detection by default
- User toggle option
- Persistent preference storage
- Smooth transition between themes
Performance Considerations
-
Code Splitting
- Route-based code splitting
- Dynamic imports for heavy components
-
Lazy Loading
- Defer loading of non-critical components
- Implement for community features and advanced settings
-
Memoization
- Use React.memo for complex component renders
- Implement useMemo for expensive calculations
-
Asset Optimization
- Optimize images and icons
- Use SVGs where possible for crisp rendering at all sizes