diff --git a/frontend/src/pages/Categories.jsx b/frontend/src/pages/Categories.jsx
index 966d329..214b4b9 100644
--- a/frontend/src/pages/Categories.jsx
+++ b/frontend/src/pages/Categories.jsx
@@ -250,8 +250,8 @@ const Categories = () => {
const renderCategory = (category, level = 0, parentColor = null) => {
const hasChildren = category.children && category.children.length > 0;
const isExpanded = expandedCategories[category.id];
- // Subcategorias herdam a cor da categoria pai
- const displayColor = level > 0 && parentColor ? parentColor : category.color;
+ // Subcategorias herdam a cor da categoria pai - garantir que sempre use a cor do pai se disponÃvel
+ const displayColor = level > 0 && parentColor ? parentColor : (category.color || '#94a3b8');
return (
@@ -343,7 +343,7 @@ const Categories = () => {
{/* Children */}
{hasChildren && isExpanded && (
- {category.children.map(child => renderCategory(child, level + 1, category.color))}
+ {category.children.map(child => renderCategory(child, level + 1, displayColor))}
)}
diff --git a/frontend/src/pages/Reports.jsx b/frontend/src/pages/Reports.jsx
index 82df9b7..c2570d0 100644
--- a/frontend/src/pages/Reports.jsx
+++ b/frontend/src/pages/Reports.jsx
@@ -35,6 +35,15 @@ const Reports = () => {
const { t } = useTranslation();
const { currency, date: formatDate } = useFormatters();
+ // Mobile detection
+ const [isMobile, setIsMobile] = useState(window.innerWidth < 768);
+
+ useEffect(() => {
+ const handleResize = () => setIsMobile(window.innerWidth < 768);
+ window.addEventListener('resize', handleResize);
+ return () => window.removeEventListener('resize', handleResize);
+ }, []);
+
const [activeTab, setActiveTab] = useState('summary');
const [loading, setLoading] = useState(true);
const [year, setYear] = useState(new Date().getFullYear());
@@ -178,11 +187,11 @@ const Reports = () => {
const monthlyAvgBalance = (summary.current.balance / 12).toFixed(2);
return (
-
+
{/* Year Selector */}
-
+
{t('reports.annualSummary')}
@@ -190,8 +199,12 @@ const Reports = () => {
{[2024, 2025].map(y => (
@@ -201,29 +214,38 @@ const Reports = () => {
{/* Main KPI Cards */}
-
+
-
-
-
-
{t('reports.income')}
-
{currency(summary.current.income, summary.currency)}
-
-
-
+
+
+
+
+ {t('reports.income')}
+
+
+ {currency(summary.current.income, summary.currency)}
+
+ {!isMobile && (
+
+
+
+ )}
{summary.variation.income !== 0 && !isNaN(summary.variation.income) && isFinite(summary.variation.income) && (
- = 0 ? 'bg-white text-success' : 'bg-white text-danger'} px-2 py-1`}>
+ = 0 ? 'bg-white text-success' : 'bg-white text-danger'}`}
+ style={{ fontSize: isMobile ? '0.65rem' : '0.75rem', padding: isMobile ? '0.25rem 0.5rem' : '0.375rem 0.75rem' }}>
= 0 ? 'up' : 'down'} me-1`}>
{Math.abs(summary.variation.income).toFixed(1)}%
- {t('reports.vsLastYear')}
+
+ {t('reports.vsLastYear')}
+
)}
-
+
{t('reports.monthlyAverage')}:
{currency(monthlyAvgIncome, summary.currency)}
@@ -231,29 +253,38 @@ const Reports = () => {
-
+
-
-
-
-
{t('reports.expenses')}
-
{currency(summary.current.expense, summary.currency)}
-
-
-
+
+
+
+
+ {t('reports.expenses')}
+
+
+ {currency(summary.current.expense, summary.currency)}
+
+ {!isMobile && (
+
+
+
+ )}
{summary.variation.expense !== 0 && !isNaN(summary.variation.expense) && isFinite(summary.variation.expense) && (
-
+
= 0 ? 'up' : 'down'} me-1`}>
{Math.abs(summary.variation.expense).toFixed(1)}%
- {t('reports.vsLastYear')}
+
+ {t('reports.vsLastYear')}
+
)}
-
+
{t('reports.monthlyAverage')}:
{currency(monthlyAvgExpense, summary.currency)}
@@ -261,29 +292,38 @@ const Reports = () => {
-
+
-
-
-
-
{t('reports.balance')}
-
{currency(summary.current.balance, summary.currency)}
-
-
-
+
+
+
+
+ {t('reports.balance')}
+
+
+ {currency(summary.current.balance, summary.currency)}
+
+ {!isMobile && (
+
+
+
+ )}
{summary.variation.balance !== 0 && !isNaN(summary.variation.balance) && isFinite(summary.variation.balance) && (
- = 0 ? 'bg-white text-success' : 'bg-white text-danger'} px-2 py-1`}>
+ = 0 ? 'bg-white text-success' : 'bg-white text-danger'}`}
+ style={{ fontSize: isMobile ? '0.65rem' : '0.75rem', padding: isMobile ? '0.25rem 0.5rem' : '0.375rem 0.75rem' }}>
= 0 ? 'up' : 'down'} me-1`}>
{Math.abs(summary.variation.balance).toFixed(1)}%
- {t('reports.vsLastYear')}
+
+ {t('reports.vsLastYear')}
+
)}
-
+
{t('reports.monthlyAverage')}:
{currency(monthlyAvgBalance, summary.currency)}
@@ -1761,28 +1801,34 @@ const Reports = () => {
return (
{/* Header */}
-
+
-
+
{t('reports.title')}
-
{t('reports.subtitle')}
+
+ {t('reports.subtitle')}
+
{/* Tabs */}
-
-
+
+
{tabs.map(tab => (
))}