Add complete planning documentation for CSS architecture refactoring project: - 7-phase implementation plan (92-120 hours) - 123 detailed tasks across all phases - Target: ~3,260 lines CSS reduction (40-50%) - Complete requirements analysis - Progress tracking system - Phase-by-phase breakdown with acceptance criteria Documentation structure: - features/README.md - Project overview and quick start - features/CSS_REFACTORING_PLAN.md - Implementation strategy - features/CSS_REFACTORING_REQUIREMENTS.md - Detailed requirements - features/PROGRESS_TRACKER.md - Live progress tracking - features/phases/*.md - 7 phase documents with tasks Ready to begin Phase 1: Forms Standardization 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
10 KiB
ROA2WEB Frontend CSS Refactoring - Requirements & Analysis
Created: 2025-11-18 Status: Planning Phase Priority: High Estimated Effort: 92-120 hours (5-6 weeks)
Executive Summary
The ROA2WEB Vue.js frontend has a well-designed CSS foundation but suffers from severe style duplication in component scoped styles. An estimated 70-80% of scoped styles can be eliminated by properly utilizing the existing CSS system.
Critical Statistics
- Total Vue files analyzed: 24 components (4,353 lines)
- CSS system files: 17 organized stylesheets
- Estimated reduction: ~3,260 lines of CSS (40-50%)
- Biggest problem: DashboardView.vue with 2,010 lines of scoped CSS
Current State Analysis
✅ Strengths
-
Professional CSS Architecture
- Location:
/reports-app/frontend/src/assets/css/ - 17 well-organized files (core, layout, components, utilities)
- 181 lines of design tokens in
variables.css - 460 lines comprehensive form system in
forms.css - 430 lines button system in
buttons.css
- Location:
-
Design Tokens System
/* Excellent foundation */ --space-xs through --space-3xl /* 8 spacing values */ --text-xs through --text-4xl /* 8 typography sizes */ --color-primary, --color-success /* Semantic colors */ --shadow-sm through --shadow-xl /* 4 shadow levels */ --radius-sm through --radius-full /* Border radius scale */
❌ Critical Issues
1. DashboardView.vue - THE BIGGEST PROBLEM
File: src/views/DashboardView.vue
Lines 787-2010: 2,010 lines of scoped CSS (47% of component)
Problems:
- Duplicates
containers.csspatterns - Duplicates
cards.csspatterns - Duplicates
tables.csspatterns - 4 separate responsive breakpoints (600 lines)
- Loading spinner repeated (also in 3 other files)
- Table styles (400 lines) should use
tables.css
Target: Reduce to ~300 lines (85% reduction = 1,710 lines eliminated)
2. Card Components - Massive Duplication
| Component | Total CSS | Duplicated | Target |
|---|---|---|---|
| MetricCard.vue | 331 lines | ~250 lines | 80 lines |
| CashFlowMetricCard.vue | 179 lines | ~120 lines | 60 lines |
| ClientiBalanceCard.vue | 260 lines | ~170 lines | 90 lines |
| FurnizoriBalanceCard.vue | ~260 lines | ~170 lines | 90 lines |
| TreasuryDualCard.vue | ~200 lines | ~140 lines | 60 lines |
Repeated Patterns (in all 5 files):
/* Card base styles */
.metric-card {
background: var(--color-bg);
border: 1px solid var(--color-border);
border-radius: var(--card-radius);
/* ... 20 more identical properties ... */
}
/* Hover effects */
.metric-card:hover {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
transform: translateY(-2px);
/* ... identical across all files ... */
}
/* Sparkline containers */
.sparkline-container { /* Repeated 4 times */ }
/* Breakdown patterns */
.breakdown-header { /* Repeated 3 times */ }
/* Trend indicators */
.trend-up, .trend-down, .trend-neutral { /* Repeated 5 times */ }
3. Inconsistent Form Patterns
Problem: Each view reinvents forms differently:
| View | Field Wrapper | Label Class | Status |
|---|---|---|---|
| LoginView.vue | .field |
.field-label |
❌ Custom |
| InvoicesView.vue | .filter-group |
.filter-label |
❌ Custom |
| forms.css (correct) | .form-group |
.form-label |
✅ Standard |
Impact:
- Inconsistent user experience
- 3 different implementations
- forms.css (460 lines) is underutilized
4. PrimeVue Anti-Patterns
LoginView.vue example (lines 269-283):
<style scoped>
:deep(.p-inputtext),
:deep(.p-password input) {
border: 2px solid #e5e7eb !important; /* Hardcoded color */
padding: 12px !important; /* Hardcoded value */
font-size: 16px !important; /* Not using --text-base */
transition: all 0.3s ease !important;
border-radius: 8px !important; /* Not using --radius-md */
}
:deep(.p-inputtext:focus) {
border-color: #3b82f6 !important; /* Hardcoded primary color */
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}
</style>
Issues:
- 50+ instances of
:deep()with!important - Hardcoded colors (#3b82f6) instead of
var(--color-primary) - Specificity wars
- Breaks component encapsulation
- Maintenance nightmare
5. Loading Spinner Duplication
Repeated in 4+ files:
.loading-spinner {
width: 40px;
height: 40px;
border: 4px solid var(--color-border);
border-top-color: var(--color-primary);
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
Found in:
- DashboardView.vue (lines 1409-1428)
- MetricCard.vue
- InvoicesView.vue
- TelegramView.vue
Requirements
Functional Requirements
-
No Visual Changes
- All refactoring must maintain identical appearance
- User experience remains unchanged
- No functionality breakage
-
Form Standardization
- Single form pattern across all views
- Consistent field structure:
.form-group+.form-label - Utilize existing
forms.css(460 lines) - Eliminate custom form implementations
-
PrimeVue Integration
- Centralize all PrimeVue overrides
- Eliminate
:deep()from component scoped styles - Use design tokens instead of hardcoded values
- Single source of truth for PrimeVue styling
-
Pattern Reusability
- Extract common patterns to global CSS
- Create reusable component classes
- Document patterns for future development
-
Responsive Consistency
- Consolidate responsive breakpoints
- Use global responsive utilities
- Reduce component-specific media queries
Non-Functional Requirements
-
Performance
- CSS bundle size reduction: -30%
- Page load time improvement: -15%
- Lighthouse performance score: +10 points
-
Maintainability
- New component creation time: 2h → 30min
- Clear separation: global vs component-specific CSS
- Comprehensive documentation
-
Code Quality
- Eliminate CSS duplication: 70% → 20%
- Remove hardcoded values: ~150 → ~20 instances
- Zero
:deep()overrides in components - Consistent design token usage
-
Testing
- Visual regression tests (Playwright snapshots)
- Manual testing checklist (desktop/tablet/mobile)
- No functional regressions
Constraints
-
Technology Stack
- Plain CSS only (no SCSS/SASS available)
- Vue.js 3 with scoped styles
- PrimeVue component library (saga-blue theme)
- Vite build tool
-
Development
- Cannot break existing functionality
- Must maintain backward compatibility
- All changes in feature branch
- Phased implementation approach
-
Testing
- Playwright for visual regression
- Manual testing between phases
- No automated CSS testing tools currently
Success Metrics
Code Metrics
| Metric | Current | Target | Measurement |
|---|---|---|---|
| Total scoped CSS lines | ~6,000 | ~2,500 | Line count |
| DashboardView.vue CSS | 2,010 lines | 300 lines | Line count |
| CSS duplication | ~70% | ~20% | Manual audit |
| Hardcoded values | ~150 | ~20 | Grep search |
:deep() overrides |
~50 | 0 | Grep search |
| Form patterns | 3 different | 1 standard | Manual review |
Performance Metrics
| Metric | Target | Measurement |
|---|---|---|
| CSS bundle size | -30% | Build output |
| Page load time | -15% | Lighthouse |
| First Contentful Paint | -10% | Lighthouse |
| Lighthouse Performance | +10 points | Lighthouse |
Quality Metrics
| Metric | Target | Measurement |
|---|---|---|
| Accessibility score | 95+/100 | Lighthouse |
| Visual consistency | 95+/100 | Manual review |
| Mobile responsiveness | 100/100 | Device testing |
| Cross-browser compatibility | 100/100 | BrowserStack |
Risks & Mitigation
High Risks
| Risk | Probability | Impact | Mitigation |
|---|---|---|---|
| Visual regressions | High | High | Playwright snapshots before/after each phase |
| PrimeVue conflicts | Medium | High | Test all PrimeVue components after global overrides |
| Mobile breakage | Medium | High | Test on real devices, not just browser resize |
| DashboardView errors | High | Very High | Extensive testing, careful incremental changes |
Medium Risks
| Risk | Probability | Impact | Mitigation |
|---|---|---|---|
| Scope creep | High | Medium | Stick to phase plan, defer enhancements |
| Incomplete testing | Medium | High | Comprehensive test checklist per phase |
| Z-index conflicts | Medium | Low | Use design tokens z-index scale consistently |
Low Risks
| Risk | Probability | Impact | Mitigation |
|---|---|---|---|
| Performance degradation | Low | Medium | Measure CSS bundle size before/after |
| Documentation gaps | Medium | Medium | Write docs as you go, not at the end |
| Developer confusion | Medium | Low | Clear guidelines and examples |
Dependencies
External
- PrimeVue component library (must remain compatible)
- Existing design tokens in
variables.css - Playwright testing framework
Internal
- Existing CSS system in
/assets/css/ - Vue.js component structure
- Current responsive breakpoints
Out of Scope
The following are explicitly NOT included in this refactoring:
- Adding SCSS/SASS compilation
- Changing PrimeVue theme (saga-blue)
- Redesigning UI/UX
- Adding new features or functionality
- Refactoring JavaScript/TypeScript logic
- Database or backend changes
- Adding CSS-in-JS libraries
- Implementing CSS modules
Stakeholders
- Development Team: Implementation and maintenance
- End Users: No visible changes, improved performance
- QA Team: Testing and validation
- Product Owner: Approval and sign-off
Approval Criteria
Before proceeding to implementation:
- Plan reviewed and approved
- Phased approach agreed upon
- Testing strategy confirmed
- Timeline acceptable
- Resources allocated
- Risks acknowledged
References
- Analysis report: Full ULTRATHINK analysis (37,661 tokens)
- Existing CSS system:
/reports-app/frontend/src/assets/css/ - PrimeVue docs: https://primevue.org/
- Design tokens:
assets/css/core/variables.css
Last Updated: 2025-11-18 Document Version: 1.0 Status: Awaiting Approval