Skip to content

Conversation

@Tsopic
Copy link
Member

@Tsopic Tsopic commented Jan 22, 2026

Summary

Create shared utilities and components to eliminate code duplication across invoices, quotes, and orders pages.

  • Add formatting.ts with currency, date, and line item calculation utilities
  • Add StatusBadge.svelte for generic configurable status badges
  • Add FormModal.svelte for reusable modal wrapper with accessibility
  • Add LineItemsEditor.svelte for line items table editing
  • Add useListPage.svelte.ts composable for list page state management
  • Add buildQuery() helper to api.ts for URL parameter building
  • Migrate invoices, quotes, and orders pages to use new abstractions
  • Add 26 unit tests for formatting utilities

Changes

File Change
src/lib/utils/formatting.ts New - shared formatting utilities
src/lib/components/StatusBadge.svelte New - generic status badge
src/lib/components/FormModal.svelte New - reusable modal wrapper
src/lib/components/LineItemsEditor.svelte New - line items editor
src/lib/composables/useListPage.svelte.ts New - state management
src/tests/utils/formatting.test.ts New - 26 unit tests
src/lib/api.ts Add buildQuery() helper
src/routes/invoices/+page.svelte Use new abstractions
src/routes/quotes/+page.svelte Use new abstractions
src/routes/orders/+page.svelte Use new abstractions

Net reduction: 108 lines across modified files

Test plan

  • TypeScript check passes
  • All 346 unit tests pass (including 26 new formatting tests)
  • Production build succeeds
  • E2E tests for invoices, quotes, orders pages pass (19/19)

🤖 Generated with Claude Code

Tsopic and others added 19 commits January 10, 2026 13:21
- Add tenant validation utility (frontend/src/lib/utils/tenant.ts)
  - requireTenantId() for validating tenant context with error callback
  - parseApiError() for consistent error message formatting
  - getTenantId() for safely extracting tenant from URL params

- Add ErrorAlert component for consistent error/success display
  - Supports error, success, warning, info types
  - Dismissible alerts with optional action buttons
  - Proper ARIA accessibility attributes

- Add global error page (+error.svelte)
  - Handles 404, 403, 401, and server errors
  - Shows appropriate icons and messages
  - Provides retry and navigation options

- Fix silent failures in action handlers
  - invoices/+page.svelte: createInvoice, sendInvoice, downloadPDF
  - quotes/+page.svelte: createQuote, sendQuote, acceptQuote, rejectQuote
  - payments/+page.svelte: createPayment
  - settings/plugins/+page.svelte: enablePlugin, disablePlugin, saveSettings

- Add MCP server for AI assistant integration
  - Tools: list_invoices, create_invoice, get_account_balance
  - Tools: generate_report, list_contacts, record_payment
  - Tools: get_chart_of_accounts, reset_demo_data
  - Supports JWT authentication via environment variables

- Update open-accounting-development skill with error patterns and MCP docs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Login form:
- Add password visibility toggle with eye icon
- Toggle between showing/hiding password
- Accessible with aria-label

Navbar improvements:
- Add TenantSelector component always visible in navbar
- Shows current tenant name with dropdown to switch
- Group navigation items into logical categories:
  - Financial: Accounts, Journal, Assets, Inventory
  - Sales: Contacts, Invoices, Quotes, Orders
  - Payments: Banking, Cash, All Payments
  - Payroll: Employees, Payroll Runs, TSD
  - Admin: Plugins, Settings
- Update mobile navigation with same groupings

i18n:
- Add nav_selectOrganization, nav_noOrganizations
- Add nav_financial, nav_sales for grouped nav

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Combined password toggle styles with remember-me checkbox styles
from main branch.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…lation

The password toggle button's aria-label contains "password", causing
getByLabel(/password/i) to match both the input and the button.
Use locator('#password') for more specific targeting.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Increase E2E retry count from 1 to 2 in CI for stability
- Add waitForDataOrEmpty utility for graceful handling of empty tables
- Update recurring and TSD tests to handle missing demo data
- Import waitForDataOrEmpty in demo-all-views tests
- Add comprehensive auth store unit tests (17 tests)
- Add date utilities unit tests (36 tests)
- Add tenant utilities unit tests (27 tests)

Unit test count increased from 240 to 320 tests.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…all working

fix(e2e): use specific heading level selector in recurring tests
Tested all remaining views via WebFetch after E2E auth issue:
- Payroll section (5 views): employees, absences, payroll, calculator, tsd
- Banking section (2 views): banking, bank-import
- Tax & Compliance (2 views): tax, vat-returns
- Reports section (3 views): reports hub, balance-confirmations, cash-flow
- Settings section (5 views): settings hub, company, email, plugins, cost-centers
- Admin section (1 view): admin/plugins

Summary:
- 33/33 views tested and working
- 0 critical issues found
- 0 major functional problems
- Minor: responsive design needs manual verification
- Note: E2E tests blocked by demo user credential mismatch (infrastructure)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Keep { level: 1 } heading selector to avoid Playwright strict mode
violation when page has both h1 and h2 elements.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Create shared utilities and components to eliminate code duplication
across invoices, quotes, and orders pages.

New files:
- src/lib/utils/formatting.ts: Currency, date, line item calculations
- src/lib/components/StatusBadge.svelte: Generic configurable status badge
- src/lib/components/FormModal.svelte: Reusable modal wrapper
- src/lib/components/LineItemsEditor.svelte: Line items table editor
- src/lib/composables/useListPage.svelte.ts: State management composable
- src/tests/utils/formatting.test.ts: 26 unit tests for utilities

Modified:
- src/lib/api.ts: Add buildQuery() helper for URL params
- Migrate invoices, quotes, orders pages to use new abstractions

Net reduction: 108 lines across modified files
All 346 unit tests pass, TypeScript check passes, build succeeds.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…g pages

Apply shared formatting utilities and StatusBadge component to additional
pages that had duplicated patterns.

Modified:
- src/routes/payments/+page.svelte: Use StatusBadge, shared formatters
- src/routes/assets/+page.svelte: Use StatusBadge, shared formatters
- src/routes/recurring/+page.svelte: Use shared formatters

Net reduction: 51 additional lines removed

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Apply shared formatting utilities and StatusBadge component to
additional pages.

Modified:
- src/routes/inventory/+page.svelte: Use shared formatCurrency, formatDate
- src/routes/payments/cash/+page.svelte: Use StatusBadge, shared formatters

Skipped pages (have custom formatting requirements):
- dashboard: Uses maximumFractionDigits: 0 for currency
- vat-returns: Uses custom formatAmount (no currency symbol)
- banking: Uses browser default locale for dates

Net reduction: 36 additional lines removed

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Apply shared formatCurrency utility to the tax/VAT declarations page.

Modified:
- src/routes/tax/+page.svelte: Use shared formatCurrency

Net reduction: 7 lines

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Convert contact type badges to use the shared StatusBadge component
for consistent styling across the application.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Migrate payroll, absences, TSD, email settings, and VAT returns pages
to use the shared StatusBadge component. Also add badge-submitted style
to StatusBadge for consistent submission status styling.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Tsopic Tsopic merged commit 30bf50c into main Jan 23, 2026
10 checks passed
@Tsopic Tsopic deleted the refactor/reusable-abstractions branch January 23, 2026 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants