Files
roa2web-service-auto/reports-app/frontend/src/App.vue
Marius Mutu e33dce4f64 feat(css): Phase 3 - Centralize PrimeVue overrides and eliminate anti-patterns
## Objectives Achieved
 Zero :deep() in components (eliminated all 4 instances)
 Centralized DataTable row styling in App.vue
 Replaced CSS hardcoded colors with design tokens
 Documented acceptable !important usage
 Created comprehensive component styling guidelines

## Changes

### Eliminated :deep() Anti-patterns (4 instances → 0)
- **BankCashRegisterView.vue**: Removed :deep(.bank-row) and :deep(.cash-row)
- **InvoicesView.vue**: Removed :deep(.invoice-paid) and :deep(.invoice-overdue)
- Migrated all row styling to global App.vue for consistency

### Centralized DataTable Row Classes (App.vue)
Added global row styling:
- .invoice-paid / .invoice-overdue (migrated from InvoicesView.vue)
- .bank-row / .cash-row (migrated from BankCashRegisterView.vue)

### Replaced Hardcoded Colors with Design Tokens
- **LoginView.vue**:
  - Gradient: #3b82f6, #8b5cf6 → var(--color-primary-light), var(--color-primary)
  - Button: #3b82f6, #2563eb → var(--color-primary-light), var(--color-primary)
- **TelegramView.vue**:
  - Button: #6366f1, #4f46e5 → var(--color-primary-light), var(--color-primary)
- **DashboardView.vue** (@media print):
  - #f5f5f5 → var(--color-bg-muted)
  - #e8e8e8 → var(--color-border)
  - #f0f0f0 → var(--color-bg-secondary)
  - #006600 → var(--color-success)
  - #cc0000 → var(--color-error)

### Documentation
Created `docs/COMPONENT_STYLING.md`:
- PrimeVue styling strategy
- Design tokens reference
- DataTable row styling patterns
- !important usage guidelines
- Common mistakes to avoid

## Impact
- **Zero :deep() instances** in entire codebase
- **Single source of truth** for DataTable row classes (App.vue)
- **Consistent color usage** via design tokens
- **Improved maintainability** with clear styling guidelines
- **Build successful** - 401.26 kB CSS bundle (54.71 kB gzipped)

## Testing
-  Build verification passed (npm run build)
-  Zero breaking changes
-  All PrimeVue components styled correctly
-  Row classes work via global CSS (no :deep needed)

## Technical Notes
- Print styles retain !important (acceptable for @media print)
- PrimeVue overrides in components retain !important (intentional customization)
- Chart.js hardcoded colors in JavaScript configs accepted as technical debt
- CSS hardcoded colors eliminated (only design tokens used)

Phase: 3/7 complete

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 14:30:26 +02:00

182 lines
3.4 KiB
Vue

<template>
<div id="app">
<!-- New Navigation System -->
<DashboardHeader
v-if="authStore.isAuthenticated"
@menu-toggle="handleMenuToggle"
@company-changed="handleCompanyChanged"
/>
<!-- Hamburger Menu -->
<HamburgerMenu
v-if="authStore.isAuthenticated"
:is-open="menuOpen"
@close="handleMenuClose"
/>
<!-- Main Content -->
<main
class="main-content"
:class="{ 'with-navbar': authStore.isAuthenticated }"
>
<router-view />
</main>
<!-- Global Toast Messages - positioned below header to avoid covering company selector -->
<Toast position="top-center" :style="{ top: '80px' }" />
<!-- Global Confirmation Dialog -->
<ConfirmDialog />
</div>
</template>
<script setup>
import { ref, onMounted } from "vue";
import { useRouter } from "vue-router";
import { useAuthStore } from "./stores/auth";
import { useCompanyStore } from "./stores/companies";
import DashboardHeader from "./components/layout/DashboardHeader.vue";
import HamburgerMenu from "./components/layout/HamburgerMenu.vue";
const router = useRouter();
const authStore = useAuthStore();
const companyStore = useCompanyStore();
// Menu state
const menuOpen = ref(false);
// Handle menu toggle
const handleMenuToggle = () => {
menuOpen.value = !menuOpen.value;
};
// Handle menu close
const handleMenuClose = () => {
menuOpen.value = false;
};
// Handle company change
const handleCompanyChanged = (company) => {
console.log('Company changed in App:', company);
};
// Initialize app
onMounted(async () => {
// Check authentication on app start
if (authStore.isAuthenticated) {
try {
// Load companies if authenticated
await companyStore.loadCompanies();
} catch (error) {
console.error("Failed to load companies:", error);
}
}
});
</script>
<style scoped>
#app {
min-height: 100vh;
background-color: var(--surface-ground);
}
.main-content {
transition: all 0.3s ease;
}
.main-content.with-navbar {
margin-top: 0;
min-height: calc(100vh - 70px);
}
.main-content:not(.with-navbar) {
min-height: 100vh;
}
</style>
<style>
/* Global styles */
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family:
"Inter",
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
Oxygen,
Ubuntu,
Cantarell,
sans-serif;
background-color: var(--surface-ground);
}
.app-container {
max-width: 1200px;
margin: 0 auto;
padding: 1rem;
}
/* Responsive design */
@media (max-width: 768px) {
.app-container {
padding: 0.25rem;
max-width: 100%;
}
}
@media (max-width: 480px) {
.main-content {
padding: 0;
}
.app-container {
padding: 0;
max-width: 100vw;
}
}
/* Custom PrimeVue overrides */
.p-button {
font-weight: 500;
}
.p-datatable .p-datatable-tbody > tr.invoice-paid {
background-color: var(--green-50);
color: var(--green-900);
}
.p-datatable .p-datatable-tbody > tr.invoice-overdue {
background-color: var(--red-50);
color: var(--red-900);
}
.p-datatable .p-datatable-tbody > tr.bank-row {
background-color: var(--blue-50);
}
.p-datatable .p-datatable-tbody > tr.cash-row {
background-color: var(--yellow-50);
}
/* Status badges */
.status-paid {
background-color: var(--green-100);
color: var(--green-900);
}
.status-overdue {
background-color: var(--red-100);
color: var(--red-900);
}
.status-pending {
background-color: var(--yellow-100);
color: var(--yellow-900);
}
</style>