Some checks failed
Deploy / deploy (push) Has been cancelled
Full-stack web application for Telegram management - Frontend: Vue 3 + Vben Admin - Backend: NestJS - Features: User management, group broadcast, statistics 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
203 lines
5.5 KiB
Markdown
203 lines
5.5 KiB
Markdown
# Mobile Responsive Support
|
|
|
|
This document describes the mobile responsive implementation for the Marketing Agent System frontend.
|
|
|
|
## Overview
|
|
|
|
The frontend has been enhanced with comprehensive mobile responsive support, providing an optimized experience across all device sizes.
|
|
|
|
## Features
|
|
|
|
### 1. Responsive Layout System
|
|
|
|
- **Automatic Layout Switching**: The application automatically detects device type and switches between desktop and mobile layouts
|
|
- **Breakpoints**:
|
|
- Mobile: < 768px
|
|
- Tablet: 768px - 1024px
|
|
- Desktop: > 1024px
|
|
|
|
### 2. Mobile-Specific Components
|
|
|
|
#### Mobile Layout (`LayoutMobile.vue`)
|
|
- Hamburger menu for navigation
|
|
- Bottom navigation bar for quick access to main features
|
|
- Optimized header with essential actions
|
|
- Slide-out sidebar for full menu access
|
|
|
|
#### Mobile Dashboard (`DashboardMobile.vue`)
|
|
- Compact stat cards in 2-column grid
|
|
- Optimized charts with mobile-friendly options
|
|
- Quick action floating button
|
|
- Touch-friendly interface elements
|
|
|
|
#### Mobile Campaign List (`CampaignListMobile.vue`)
|
|
- Card-based layout for better readability
|
|
- Swipe actions for quick operations
|
|
- Load more pagination instead of traditional pagination
|
|
- Inline stats and progress indicators
|
|
|
|
#### Mobile Analytics (`AnalyticsMobile.vue`)
|
|
- Scrollable metric cards
|
|
- Responsive charts with touch interactions
|
|
- Collapsible sections for better organization
|
|
- Export options via floating action button
|
|
|
|
### 3. Responsive Utilities
|
|
|
|
#### `useResponsive` Composable
|
|
```javascript
|
|
import { useResponsive } from '@/composables/useResponsive'
|
|
|
|
const { isMobile, isTablet, isDesktop, screenWidth, screenHeight } = useResponsive()
|
|
```
|
|
|
|
### 4. Mobile-Optimized Styles
|
|
|
|
- Touch-friendly button sizes (minimum 44px height)
|
|
- Larger input fields to prevent zoom on iOS
|
|
- Optimized spacing for mobile screens
|
|
- Smooth scrolling with momentum
|
|
- Bottom safe area padding for iOS devices
|
|
|
|
### 5. Performance Optimizations
|
|
|
|
- Lazy loading for mobile components
|
|
- Reduced data fetching on mobile
|
|
- Optimized images and assets
|
|
- Simplified animations for better performance
|
|
|
|
## Implementation Guide
|
|
|
|
### Using Responsive Components
|
|
|
|
1. **In Views**: Components automatically detect mobile and render appropriate version
|
|
```vue
|
|
<template>
|
|
<DashboardMobile v-if="isMobile" />
|
|
<div v-else>
|
|
<!-- Desktop content -->
|
|
</div>
|
|
</template>
|
|
```
|
|
|
|
2. **Responsive Classes**: Use Tailwind responsive prefixes
|
|
```html
|
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4">
|
|
<!-- Responsive grid -->
|
|
</div>
|
|
```
|
|
|
|
3. **Mobile-First Approach**: Design for mobile first, then enhance for larger screens
|
|
|
|
### Touch Interactions
|
|
|
|
- Swipe gestures for navigation and actions
|
|
- Pull-to-refresh on scrollable lists
|
|
- Long press for context menus
|
|
- Pinch-to-zoom disabled on UI elements
|
|
|
|
### Navigation Patterns
|
|
|
|
1. **Bottom Navigation**: Primary navigation for most-used features
|
|
2. **Hamburger Menu**: Full navigation access via slide-out menu
|
|
3. **Floating Action Buttons**: Quick access to primary actions
|
|
4. **Breadcrumbs**: Simplified on mobile, showing only current location
|
|
|
|
## Best Practices
|
|
|
|
### 1. Content Prioritization
|
|
- Show most important information first
|
|
- Use progressive disclosure for details
|
|
- Minimize cognitive load with clear hierarchy
|
|
|
|
### 2. Touch Targets
|
|
- Minimum 44x44px for all interactive elements
|
|
- Adequate spacing between clickable items
|
|
- Clear visual feedback for touch interactions
|
|
|
|
### 3. Forms
|
|
- Use appropriate input types (email, tel, number)
|
|
- Single column layout for forms
|
|
- Clear labels and error messages
|
|
- Auto-focus management for better UX
|
|
|
|
### 4. Performance
|
|
- Minimize JavaScript execution on scroll
|
|
- Use CSS transforms for animations
|
|
- Lazy load images and components
|
|
- Reduce API calls with smart caching
|
|
|
|
### 5. Accessibility
|
|
- Proper ARIA labels for screen readers
|
|
- Sufficient color contrast
|
|
- Focus management for keyboard navigation
|
|
- Touch-friendly alternatives for hover states
|
|
|
|
## Testing
|
|
|
|
### Device Testing
|
|
Test on real devices when possible:
|
|
- iOS Safari (iPhone/iPad)
|
|
- Android Chrome
|
|
- Android Firefox
|
|
- Various screen sizes and orientations
|
|
|
|
### Browser DevTools
|
|
- Use responsive mode in Chrome/Firefox DevTools
|
|
- Test touch events and gestures
|
|
- Verify performance on throttled connections
|
|
|
|
### Automated Testing
|
|
- Viewport-specific tests
|
|
- Touch event simulation
|
|
- Performance budgets for mobile
|
|
|
|
## Known Limitations
|
|
|
|
1. **Complex Tables**: Simplified on mobile with essential columns only
|
|
2. **Advanced Filters**: Moved to dedicated modal on mobile
|
|
3. **Drag & Drop**: Touch-friendly alternatives provided
|
|
4. **Hover States**: Replaced with tap interactions
|
|
|
|
## Future Enhancements
|
|
|
|
1. **Progressive Web App (PWA)**
|
|
- Offline support
|
|
- Install to home screen
|
|
- Push notifications
|
|
|
|
2. **Advanced Gestures**
|
|
- Swipe between views
|
|
- Pull-to-refresh on all lists
|
|
- Gesture-based shortcuts
|
|
|
|
3. **Adaptive Loading**
|
|
- Lower quality images on slow connections
|
|
- Reduced data mode
|
|
- Progressive enhancement based on device capabilities
|
|
|
|
## Troubleshooting
|
|
|
|
### Common Issues
|
|
|
|
1. **iOS Zoom on Input Focus**
|
|
- Solution: Set font-size to 16px on inputs
|
|
|
|
2. **Bottom Bar Overlap on iOS**
|
|
- Solution: Use `env(safe-area-inset-bottom)`
|
|
|
|
3. **Horizontal Scroll**
|
|
- Solution: Check for elements exceeding viewport width
|
|
|
|
4. **Performance Issues**
|
|
- Solution: Profile with Chrome DevTools, reduce re-renders
|
|
|
|
### Debug Mode
|
|
|
|
Enable mobile debug mode in development:
|
|
```javascript
|
|
// In .env.development
|
|
VITE_MOBILE_DEBUG=true
|
|
```
|
|
|
|
This will show device info and performance metrics on mobile devices. |