3beb23a765
refactor(frontend): improve code quality and maintainability
...
- Extract API error handling utility (utils/error-handling.ts)
- Centralize error message extraction logic
- Add type guards for API errors
- Replace duplicated error handling across components
- Create reusable Toast component (components/Toast.tsx)
- Extract toast notification logic from profile page
- Support auto-dismiss functionality
- Consistent styling with shared styles
- Extract form validation debouncing hook (hooks/useDebouncedValidation.ts)
- Reusable debounced validation logic
- Clean timeout management
- Used in profile page for form validation
- Consolidate duplicate styles (styles/auth-form.ts)
- Use shared style tokens instead of duplicating values
- Reduce code duplication between auth-form and shared styles
- Extract loading state component (components/LoadingState.tsx)
- Standardize loading UI across pages
- Replace duplicated loading JSX patterns
- Used in profile, exchange, and trades pages
- Fix useRequireAuth dependency array
- Remove unnecessary hasPermission from dependencies
- Add eslint-disable comment with explanation
- Improve hook stability and performance
All frontend tests pass. Linting passes.
2025-12-25 19:04:45 +01:00
bbd9fae763
Phase 7: Final cleanup - Remove deprecated booking/appointment code
...
Deleted deprecated files:
- backend/routes/booking.py
- frontend/app/admin/appointments/, booking/, appointments/, sum/, audit/
- frontend/app/utils/appointment.ts
- frontend/e2e/booking.spec.ts, appointments.spec.ts
Updated references:
- exchange/page.tsx: Use /api/exchange/slots instead of /api/booking/slots
- useRequireAuth.ts: Redirect to /admin/trades and /exchange
- profile.tsx, invites.tsx: Update fallback redirect
- E2E tests: Update all /audit references to /admin/trades
- profile.test.tsx: Update admin redirect test
2025-12-22 20:18:33 +01:00
fdab4a5dac
refactor(frontend): extract validation utilities to shared module
...
Issue #7 : Profile validation logic was embedded in page component.
Changes:
- Create utils/validation.ts with shared validation functions:
- validateEmail: email format validation
- validateTelegram: handle format with @ prefix
- validateSignal: username length validation
- validateNostrNpub: bech32 format validation
- validateProfileFields: combined validation
- Update profile/page.tsx to use shared validation
- Both frontend and backend now read validation rules from
shared/constants.json for consistency
2025-12-22 09:13:03 +01:00
21698203fe
refactor(auth): unify authorization patterns with MANAGE_OWN_PROFILE permission
...
Issue #2 : The profile route used a custom role-based check instead
of the permission-based pattern used everywhere else.
Changes:
- Add MANAGE_OWN_PROFILE permission to backend Permission enum
- Add permission to ROLE_REGULAR role definition
- Update profile routes to use require_permission(MANAGE_OWN_PROFILE)
- Remove custom require_regular_user dependency
- Update frontend Permission constant and profile page
- Update invites page to use permission instead of role check
- Update profile tests with proper permission mocking
This ensures consistent authorization patterns across all routes.
2025-12-21 23:50:06 +01:00
81cd34b0e7
refactor(frontend): consolidate shared styles into centralized style system
...
- Create comprehensive shared.ts with design tokens and categorized styles:
- layoutStyles: main, loader, content variants
- cardStyles: card, tableCard, cardHeader
- tableStyles: complete table styling
- paginationStyles: pagination controls
- formStyles: inputs, labels, errors
- buttonStyles: primary, secondary, accent, danger variants
- badgeStyles: status badges with color variants
- bannerStyles: error/success banners
- modalStyles: modal overlay and content
- toastStyles: toast notifications
- utilityStyles: divider, emptyState, etc.
- Refactor all page components to use shared styles:
- page.tsx (counter)
- audit/page.tsx
- booking/page.tsx
- appointments/page.tsx
- profile/page.tsx
- invites/page.tsx
- admin/invites/page.tsx
- admin/availability/page.tsx
- Reduce code duplication significantly (each page now has only
truly page-specific styles)
- Maintain backwards compatibility with sharedStyles export
2025-12-21 23:45:47 +01:00
37de6f70e0
Add Prettier for TypeScript formatting
...
- Install prettier
- Configure .prettierrc.json and .prettierignore
- Add npm scripts: format, format:check
- Add Makefile target: format-frontend
- Format all frontend files
2025-12-21 21:59:26 +01:00
d3638e2e69
implemented
2025-12-20 23:06:05 +01:00
870804e7b9
first implementation
2025-12-20 11:12:11 +01:00
75cfc6c928
some fixes and refactors
2025-12-19 11:08:19 +01:00
ead8a566d0
small validation fixes
2025-12-19 10:52:47 +01:00
bbc5625b2d
second round of review
2025-12-19 10:38:15 +01:00
7140cf6f27
first round of review
2025-12-19 10:30:23 +01:00
409e0df9a6
implemented
2025-12-19 10:12:55 +01:00