diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index ec34225..39eca56 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -1,13 +1,25 @@ import ChartSwitcher from './components/ChartSwitcher'; +import EmptyGroupInvite from './components/EmptyGroupInvite'; import LatestExpenses from './components/LatestExpenses'; import SummaryCards from './components/SummaryCards'; +import { useGroupsQuery } from './hooks/ReactQuery/Queries/useGroupsQuery'; function App() { + const { data } = useGroupsQuery(); + + const hasGroups = (data?.groupsLength ?? 0) > 0; + return (
- - - + {hasGroups ? ( + <> + + + + + ) : ( + + )}
); } diff --git a/frontend/src/components/ChartSwitcher/ExpenseChart.jsx b/frontend/src/components/ChartSwitcher/ExpenseChart.jsx index 702964f..b8f4116 100644 --- a/frontend/src/components/ChartSwitcher/ExpenseChart.jsx +++ b/frontend/src/components/ChartSwitcher/ExpenseChart.jsx @@ -66,20 +66,6 @@ export default function ExpenseQuantityDonutChart() { - - {/* Total centralizado */} -
- - {formatBRL(total, { - minimumFractionDigits: 0, - maximumFractionDigits: 0, - style: 'decimal', - })} - - - Total - -
); diff --git a/frontend/src/components/ChartSwitcher/index.jsx b/frontend/src/components/ChartSwitcher/index.jsx index f317697..ebe10cd 100644 --- a/frontend/src/components/ChartSwitcher/index.jsx +++ b/frontend/src/components/ChartSwitcher/index.jsx @@ -3,29 +3,37 @@ import { FaChartLine, FaChartPie } from 'react-icons/fa'; import BalanceChart from './BalanceChart'; import ExpenseChart from './ExpenseChart'; import ButtonUI from '../ui/Button'; +import { useMeDashboardQuery } from '../../hooks/ReactQuery/Queries/useMeDashboardStatsQuery'; export default function ChartSwitcher() { const [activeChart, setActiveChart] = useState('balance'); + const { data: expenseData } = useMeDashboardQuery(); + const total = expenseData?.reduce((sum, item) => sum + item.quantity, 0) || 0; + + const currentYear = new Date().getFullYear(); + const title = + activeChart === 'balance' + ? `Como Você Gastou em ${currentYear}` + : `Despesas por Categoria ( ${total} )`; return (
{/* Cabeçalho */} -
+

- {activeChart === 'balance' - ? `Como Você Gastou em (${new Date().getFullYear()})` - : 'Despesas por Categoria (Geral)'} + {title}

{/* Alternador */}
- {/* Indicador animado */} + {/* Indicador */}
- {/* Opção: Gastos Mensais */} + /> + + {/* Opção: Resumo Anual */} setActiveChart('balance')} className={`relative z-10 w-1/2 flex items-center gap-2 px-4 py-1.5 rounded-full cursor-pointer transition-colors duration-300 ${ @@ -37,10 +45,11 @@ export default function ChartSwitcher() { Resumo Anual - {/* Opção: Saldo Geral */} + + {/* Opção: Divisão de Gastos */} setActiveChart('expense')} - className={`relative z-10 w-1/2 flex items-center gap-2 px-4 py-0.5 rounded-full cursor-pointer transition-colors duration-300 ${ + className={`relative z-10 w-1/2 flex items-center gap-2 px-4 py-1.5 rounded-full cursor-pointer transition-colors duration-300 ${ activeChart === 'expense' ? 'text-white' : 'text-muted-foreground hover:text-text' @@ -53,7 +62,8 @@ export default function ChartSwitcher() {
{/* Área dos gráficos */} -
+
+ {/* BalanceChart */}
+ {/* ExpenseChart */}
+ {/* Ícone grande */} +
+
+ +
+ +

+ Comece Sua Organização Financeira +

+ +

+ Você ainda não criou um grupo. Os grupos são a base para gerenciar + despesas, dividir valores e acompanhar sua saúde financeira. +

+
+ + {/* Mini indicadores financeiros (fake) para dar cara de dashboard */} +
+
+ + Categorias + 0 +
+ +
+ + Participantes + 0 +
+
+ + navigate('/groups?create')} + > + Criar meu primeiro grupo + +
+ ); +} diff --git a/frontend/src/components/forms/GroupForm.jsx b/frontend/src/components/forms/GroupForm.jsx index 59976a8..28c4620 100644 --- a/frontend/src/components/forms/GroupForm.jsx +++ b/frontend/src/components/forms/GroupForm.jsx @@ -66,7 +66,7 @@ export default function GroupForm({ page }) { await mutateAsync(formData); } }, - [isPending, isDisabled, groupName, selectedIcon, mutateAsync] + [isPending, isDisabled, groupName, description, selectedIcon, mutateAsync] ); return ( diff --git a/frontend/src/pages/Expenses/ExpenseDetails/index.jsx b/frontend/src/pages/Expenses/ExpenseDetails/index.jsx index 8b51a29..341c32c 100644 --- a/frontend/src/pages/Expenses/ExpenseDetails/index.jsx +++ b/frontend/src/pages/Expenses/ExpenseDetails/index.jsx @@ -219,7 +219,7 @@ export default function ExpenseDetails() {
@@ -252,7 +252,7 @@ export default function ExpenseDetails() { min={getCurrentDate()} value={formData.deadlineDate} onChange={handleChange} - className="focus:ring-2 bg-white focus:ring-primary/50 transition-all" + className="focus:ring-2 bg-surface focus:ring-primary/50 transition-all" />
diff --git a/frontend/src/pages/Groups/GroupDetails/GroupSettings/index.jsx b/frontend/src/pages/Groups/GroupDetails/GroupSettings/index.jsx index 028c830..0c912df 100644 --- a/frontend/src/pages/Groups/GroupDetails/GroupSettings/index.jsx +++ b/frontend/src/pages/Groups/GroupDetails/GroupSettings/index.jsx @@ -5,7 +5,6 @@ import { FiEdit3, FiFileText, FiSave, - FiSettings, FiUserPlus, FiUsers, } from 'react-icons/fi'; @@ -71,7 +70,7 @@ export default function GroupSettings() { return (
-
+
{/* Cabeçalho */}
@@ -79,7 +78,7 @@ export default function GroupSettings() {
-

+

Configurações de{' '} {group.name}

@@ -93,7 +92,7 @@ export default function GroupSettings() { {/* Formulário principal */}
{/* Informações básicas */} -
+