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>
5.5 KiB
5.5 KiB
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
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
- In Views: Components automatically detect mobile and render appropriate version
<template>
<DashboardMobile v-if="isMobile" />
<div v-else>
<!-- Desktop content -->
</div>
</template>
- Responsive Classes: Use Tailwind responsive prefixes
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4">
<!-- Responsive grid -->
</div>
- 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
- Bottom Navigation: Primary navigation for most-used features
- Hamburger Menu: Full navigation access via slide-out menu
- Floating Action Buttons: Quick access to primary actions
- 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
- Complex Tables: Simplified on mobile with essential columns only
- Advanced Filters: Moved to dedicated modal on mobile
- Drag & Drop: Touch-friendly alternatives provided
- Hover States: Replaced with tap interactions
Future Enhancements
-
Progressive Web App (PWA)
- Offline support
- Install to home screen
- Push notifications
-
Advanced Gestures
- Swipe between views
- Pull-to-refresh on all lists
- Gesture-based shortcuts
-
Adaptive Loading
- Lower quality images on slow connections
- Reduced data mode
- Progressive enhancement based on device capabilities
Troubleshooting
Common Issues
-
iOS Zoom on Input Focus
- Solution: Set font-size to 16px on inputs
-
Bottom Bar Overlap on iOS
- Solution: Use
env(safe-area-inset-bottom)
- Solution: Use
-
Horizontal Scroll
- Solution: Check for elements exceeding viewport width
-
Performance Issues
- Solution: Profile with Chrome DevTools, reduce re-renders
Debug Mode
Enable mobile debug mode in development:
// In .env.development
VITE_MOBILE_DEBUG=true
This will show device info and performance metrics on mobile devices.