Skip to main content

IncomeBudgetSection / AllocBudgetSection

Deux panneaux composites qui orchestrent les listes de lignes budgétaires (BudgetIncomeRow / BudgetAllocRow) avec affichage du total et ajout de ligne.

Source : src/components/ui/budget-section.tsx

IncomeBudgetSection

Panneau des sources de revenus avec total en temps réel.

<IncomeBudgetSection
budgetPlanId="plan-id"
items={incomeSources}
onChange={setIncomeSources}
/>

Props

PropTypeDescription
budgetPlanIdstring?ID du plan — requis pour persister
itemsIncomeItem[]{ id, label, type: IncomeType, expectedMonthly }[]
onChangeDispatch<SetStateAction<IncomeItem[]>>Setter React — compatible avec fonctions updater

AllocBudgetSection

Panneau des allocations configurable par type.

<AllocBudgetSection
budgetPlanId="plan-id"
title="Charges fixes"
items={fixedExpenses}
defaultType="FIXED_EXPENSE"
addLabel="Ajouter une charge"
onChange={setFixedExpenses}
/>

Props

PropTypeDescription
budgetPlanIdstring?ID du plan
titlestringTitre du panneau
itemsAllocItem[]{ id, label, type: AllocationType, targetAmount }[]
defaultTypeAllocationTypeType assigné aux nouvelles lignes
addLabelstringLibellé du bouton d'ajout
onChangeDispatch<SetStateAction<AllocItem[]>>Setter React

Gestion des nouvelles lignes

Une nouvelle ligne est créée avec un ID temporaire new-<timestamp>. Après persistance, onSaved remplace l'ID temporaire par l'ID réel de la base — sans re-render visible de la liste.

Voir aussi