The comparison `type === 'weekly'` was causing a type error because the type of `type` was `BudgetPeriod`, which includes `"monthly"` and `"weekly"`. The code was attempting to directly assign `"monthly"` to `type` after this comparison, which is not allowed. To fix this, a new variable `period` of type `BudgetPeriod` is created and assigned the value of `type`. The comparison is then performed on `period`, and if it is equal to `"weekly"`, `period` is set to `"monthly"`. Finally, `period` is used in the subsequent logic.
The budget update logic was modified to ensure that all budget updates are applied to the monthly budget, regardless of the selected tab. This resolves inconsistencies in budget calculations and data storage.
- Fix the budget display issue where monthly budgets were showing four amounts instead of one.
- Resolve the functionality of the "Edit Budget" button.
Splits the `useBudgetDataState` hook into smaller, more manageable hooks for state management, data loading, and event handling. This improves code organization and maintainability while preserving existing functionality.
Refactor budgetUtils.ts to improve code organization and maintainability by splitting the logic into multiple files. The functionality remains the same.
Addresses issues where budget data wasn't displaying correctly after input and ensures correct automatic calculation of daily/weekly budgets from monthly input.
Addresses problems with budget display and data reset:
- Ensures budget data is correctly displayed after initialization.
- Fixes issue where daily and weekly budget data were missing.
- Corrects data reset to properly clear transaction data.
- Fix issue where budget input for transportation and other categories were not saved correctly.
- Fix issue where total budget amount was calculated incorrectly.
- Fix issue where daily and weekly budgets were not displayed correctly.
The `useBudget` hook was being called outside of a `BudgetProvider`, leading to an error. This commit ensures that the `useBudget` hook is only called within the `BudgetProvider` context.
The BudgetContext.tsx file was throwing an error because it was trying to import `BudgetPeriod` from the wrong location. Changed the import path to correctly reference the `BudgetPeriod` type.
- Fix TS2353: Object literal may only specify known properties, and 'paymentMethod' does not exist in type 'Transaction'.
- Fix TS1205: Re-exporting a type when 'isolatedModules' is enabled requires using 'export type'.
- Fix TS2741: Property 'getPaymentMethodStats' is missing in type '{ transactions: Transaction[]; budgetData: BudgetData; categoryBudgets: Record<string, number>; selectedTab: BudgetPeriod; setSelectedTab: React.Dispatch<...>; ... 5 more ...; resetBudgetData: () => void; }' but required in type 'BudgetContextType'.
The `useBudget` hook was being called outside of the `BudgetProvider` context in the `Index` component. This commit ensures that the `Index` component and its children are wrapped with the `BudgetProvider` in `App.tsx` to resolve the error.
Adds a payment method selection (Credit Card, Cash) to the expense form and includes a line separator. Also requests to add a graph showing the proportion of credit card and cash usage in expense analytics, but this part is not implemented in this commit.
The type `Transaction` was missing the `localTimestamp` property, causing TypeScript errors in `downloadTransaction.ts` and `uploadTransaction.ts`. This commit adds the `localTimestamp` property to the `Transaction` interface to resolve these errors.
- Resolve Typescript isolatedModules error by using 'export type' when re-exporting types.
- Fix module ambiguity by explicitly re-exporting 'BudgetContextType'.
- Correct import paths for useAuth hook in transaction-related files.
Fixes an issue where entering a monthly budget resulted in incorrect daily, weekly, and monthly budget calculations, leading to incorrect display on the spending and analytics screens.
The settings page was reloading slowly after a data reset. This commit addresses the issue by preventing the unnecessary reload after the reset operation.
The application was displaying duplicate toast notifications due to events being triggered multiple times. This commit prevents duplicate notifications.