Commit Graph

15 Commits

Author SHA1 Message Date
Víctor Falcón 439ec86722
chore: Simplify IndexedDB sync by moving to Inertia shared props (#63)
This PR simplifies the IndexedDB synchronization mechanism by removing
individual sync controllers and services, and instead using Inertia.js
shared props to provide data globally across the application.

## Benefits

1. **Simplified Architecture**: Removed complex sync logic for
static/semi-static data (accounts, categories, banks, labels, automation
rules)
2. **Better Performance**: Data is now shared via Inertia props,
eliminating unnecessary API calls and IndexedDB operations
3. **Reduced Complexity**: Significantly reduced codebase size (~2000
lines removed)
4. **Better UX**: Data is immediately available on page load without
waiting for sync operations
5. **Maintainability**: Fewer moving parts means easier to maintain and
debug

## Migration Notes

- Transaction syncing still uses IndexedDB for offline support
- All other data (accounts, categories, banks, labels, automation rules)
is now fetched via Inertia shared props
- Components automatically receive updated data on navigation without
manual sync operations
2026-01-19 19:15:26 +01:00
Víctor Falcón 0d76913e5d
test: Fix and improve Browser test suite (#62) 2026-01-19 10:04:25 +01:00
Víctor Falcón 4b5d65ba03
feat: add transaction labels feature (#24)
## Summary

Add a labeling system for transactions that differs from categories in
that labels are ephemeral and created on-the-fly when assigned (no
pre-creation required). A transaction can have multiple labels
(many-to-many relationship), and labels can be used for filtering in the
transaction table and as actions in automation rules.

<img width="1372" height="484" alt="image"
src="https://github.com/user-attachments/assets/fd342b11-dafb-44ed-b818-578e1ea856e6"
/>
<img width="1373" height="613" alt="image"
src="https://github.com/user-attachments/assets/aa5cfb8b-50b7-4101-a872-54904924f234"
/>
<img width="1035" height="594" alt="image"
src="https://github.com/user-attachments/assets/ffa946b2-b01f-496b-8cb8-ab55ab5b79ed"
/>


## Changes

### Backend (Laravel)

- Add `labels` table with user_id, name, color, and soft deletes
- Add `label_transaction` pivot table for transaction-label many-to-many
- Add `automation_rule_labels` pivot table for automation rule-label
many-to-many
- Create Label model with relationships to User, Transaction, and
AutomationRule
- Add LabelController for CRUD operations (returns JSON for on-the-fly
creation)
- Add LabelSyncController for frontend sync
- Add LabelPolicy for authorization
- Update TransactionController to handle bulk label updates
- Update AutomationRuleController to handle label actions
- Add validation for label_ids in transactions and automation rules

### Frontend (React/TypeScript)

- Add Label type and color utilities
- Add labels table to IndexedDB (Dexie version 6)
- Create label-sync service with findOrCreate functionality
- Create LabelCombobox component with multi-select and create-on-type
- Add labels column to transactions table
- Add labels filter to transaction filters
- Add bulk label assignment in bulk actions bar
- Add labels action in create automation rule dialog
- Update rule engine to include labels in evaluation results

## Testing

- 11 feature tests for label CRUD
- 3 tests for label sync
- All 241 feature tests pass

## Screenshots

N/A - UI changes can be reviewed in browser
2025-12-13 13:02:19 +01:00
Víctor Falcón dc8978fa66 Add user session management to clear data on user switch
- Add user-session-storage utility to track and manage user IDs in localStorage
- Update SyncProvider to detect user changes and clear IndexedDB/localStorage when switching users
- Pass initial user from app.tsx to SyncProvider for proper initialization
- Reload page after clearing data to ensure clean state for new user
2025-12-11 08:36:49 +01:00
Víctor Falcón 3a6991484a Fix pending operations count an dialog 2025-12-08 16:19:45 +01:00
Víctor Falcón 1236bf093e
Add pending operations dialog and improve sync status UI (#16)
- Add PendingOperationsDialog component to display pending sync
operations
- Replace sync status tooltip with dropdown menu showing pending count
badge
- Add pending operations tracking to sync context with refresh
capability
- Improve sync manager error handling for 404 responses on
updates/deletes
- Only remove successfully synced changes from pending queue

## Images
<img width="100%" height="auto" alt="image"
src="https://github.com/user-attachments/assets/3855a239-aa72-4579-a19e-9cad8027b006"
/>
<img width="100%" height="auto" alt="image"
src="https://github.com/user-attachments/assets/cf14b3e2-fb0e-41fb-ba5e-01013b7a5ce1"
/>
2025-12-06 21:54:11 +01:00
Víctor Falcón a0f44a9144
Dashboard: Net worth Chart (#3)
* Improve net worth chart

* feat: Add current net worth display to dashboard chart

* Handle different currencies

* Add account balance sync service and update SyncProvider

* Remove redundant transaction filters in DashboardAnalyticsController
2025-12-03 08:53:28 +01:00
Víctor Falcón 2fefb64710 Fix CI: Update bun.lock and fix linting errors 2025-12-01 15:16:06 +01:00
Víctor Falcón 0b97570ffd Improve automation rules and sync error handling
- Add null safety checks in rule evaluation
- Improve error messages in sync context with user-friendly formatting
- Add browser test for automation rule application during import
- Update test CSV data to better test rule matching
- Add detailed error logging for failed transaction imports
2025-12-01 10:30:22 +01:00
Víctor Falcón 9a97d8137e Improve transaction sync process 2025-11-28 12:36:48 +01:00
Víctor Falcón e13a19bdde Add some toast notifications 2025-11-11 11:39:28 +00:00
Víctor Falcón d5ce7a24b4 Automation rules 2025-11-10 12:08:58 +00:00
Víctor Falcón 48bce81d9a feat(react): add authentication check in SyncProvider 2025-11-09 10:21:25 +00:00
Víctor Falcón faf6d9146e Sync transactions 2025-11-08 14:17:16 +00:00
Víctor Falcón 9d95f884a0 Offline First: sync bank, accounts, and categories 2025-11-08 11:29:21 +00:00