Commit graph

319 commits

Author SHA1 Message Date
senke
f7d8726808 [FE-TYPE-009] fe-type: Add type definitions for query params
- Created comprehensive query parameter types (queryParams.ts):
  * Pagination: PaginationQueryParams
  * Sorting: SortQueryParams
  * Search: SearchQueryParams, TrackSearchQueryParams, PlaylistSearchQueryParams, UserSearchQueryParams
  * Lists: TrackListQueryParams, PlaylistListQueryParams, ConversationListQueryParams, MessageListQueryParams
  * Filters: LibraryQueryParams, MarketplaceQueryParams, NotificationQueryParams, AuditLogQueryParams
  * Analytics: AnalyticsQueryParams
  * Auth: ResetPasswordQueryParams, VerifyEmailQueryParams, OAuthCallbackQueryParams
  * Utility: ShareQueryParams, EmbedQueryParams, AdminQueryParams, SettingsQueryParams
- Added helper functions: parseQueryParams, buildQueryString, convertQueryParams
- Added parsing helpers: parsePaginationParams, parseBooleanParam, parseNumberParam
- Ensures type safety for all URL query string handling
2025-12-25 14:46:56 +01:00
senke
9627153921 [FE-TYPE-008] fe-type: Add type definitions for route params
- Created comprehensive route parameter types (routes.ts):
  * Detail pages: TrackDetailParams, PlaylistDetailParams, UserProfileParams
  * Chat: ConversationDetailParams, MessageDetailParams
  * Settings: SessionDetailParams, SettingsParams
  * Admin: RoleDetailParams, AuditLogDetailParams, AdminParams
  * Auth: ResetPasswordParams, VerifyEmailParams, OAuthCallbackParams
  * Search/Filter: SearchParams, LibraryParams, MarketplaceParams
  * Generic: IdRouteParams, SlugRouteParams, PaginationParams, FilterParams
- Added type guards: hasIdParam, hasUsernameParam
- Added helper functions: extractRouteParams, extractQueryParams
- Ensures type safety for all route navigation and params
2025-12-25 14:45:10 +01:00
senke
729a4435be [FE-TYPE-007] fix: Correct profileSchema import in forms.ts 2025-12-25 14:43:54 +01:00
senke
58e52e2b04 [FE-TYPE-007] fe-type: Add type definitions for form data
- Created comprehensive form data types (forms.ts):
  * Authentication: LoginFormData, RegisterFormData, ForgotPasswordFormData, ResetPasswordFormData
  * Profile: ProfileFormData
  * Content: PlaylistFormData, TrackUploadFormData, TrackEditFormData, CommentFormData
  * Utility: SearchFormData, SettingsFormData, ContactFormData, FeedbackFormData
  * Actions: ReportFormData, ShareFormData, InviteFormData, BulkActionFormData
  * Import/Export: ImportFormData, ExportFormData
  * Generic: FormField, FormState, FormValidationResult
- All types use Zod schema inference where applicable
- Ensures type safety for all form inputs and validation
2025-12-25 14:43:13 +01:00
senke
6ce0906729 [FE-TYPE-006] fe-type: Add type definitions for WebSocket messages
- Created comprehensive WebSocket message types (websocket.ts):
  * Chat messages: ChatMessageEvent, TypingIndicatorEvent, ReadReceiptEvent
  * User events: UserJoinedEvent, UserLeftEvent, ConversationUpdatedEvent
  * Outgoing requests: SendMessageRequest, JoinConversationRequest, etc.
  * Playback/streaming: PlaybackStateEvent, SubscribePlaybackRequest
  * Notifications: NotificationEvent
  * Errors: WebSocketErrorEvent
  * Ping/Pong: PingMessage, PongMessage
- Created union types: IncomingWebSocketMessage, OutgoingWebSocketMessage
- Added type guards for runtime validation
- Ensures type safety for all WebSocket communications
2025-12-25 14:42:04 +01:00
senke
862d48fcf5 [FE-TYPE-005] fe-type: Add type definitions for all backend DTOs
- Created dto.ts with all backend DTO types:
  * RegisterRequest, RegisterResponse
  * LoginRequest, LoginResponse
  * UserResponse, TokenResponse
  * RefreshRequest, ResendVerificationRequest
  * ValidationError, ValidationErrors
- Updated api.ts to match backend DTOs:
  * Added password_confirm to RegisterRequest
  * Added remember_me to LoginRequest
  * Added requires_2fa to AuthResult/LoginResponse
  * Added value field to ValidationError details
- All types now match backend Go structs exactly
- Ensures type safety between frontend and backend
2025-12-25 14:40:35 +01:00
senke
09462ed524 [FE-TYPE-004] fe-type: Add type guards for runtime type checking
- Created comprehensive type guard functions (typeGuards.ts) for:
  * User, Track, Playlist, Conversation, Message
  * Session, AuditLog, Notification
  * ApiError, ApiResponse, PaginationData
  * Arrays of all entity types
- Added utility type guards:
  * isUUID, isEmail, isISO8601Date, isURL
  * isNonEmptyString, isPositiveNumber, isNonNegativeNumber
  * isPlainObject, isArrayOf, isNotNull, isDefined
  * isNumber, isBoolean, isString
- Enables safe type narrowing in TypeScript
- Improves runtime type safety throughout the application
- Comprehensive test suite (44 tests, all passing)
- Allows TypeScript to narrow types safely at runtime
2025-12-25 14:38:55 +01:00
senke
1311c095e3 [FE-TYPE-003] fe-type: Add Zod schemas for all API requests
- Created comprehensive Zod schemas (apiRequestSchemas.ts) for:
  * LoginRequest, RegisterRequest, CreateUserRequest
  * UpdateUserRequest, UpdateProfileRequest
  * SendMessageRequest, UpdateMessageRequest
  * CreateConversationRequest, UpdateConversationRequest
  * UploadTrackRequest, UpdateTrackRequest
  * PaginationParams and list/search request types
- Added validation utilities:
  * validateApiRequest: Validate requests before sending
  * safeValidateApiRequest: Safe validation with error handling
  * validateApiRequestWithError: Validation with custom error handler
- Integrated validation into API client request interceptor
- Enhanced validatedApiClient with request validation support
- Automatic validation prevents invalid requests from being sent
- Comprehensive test suite (19 tests, all passing)
- Ensures runtime type safety for all API requests
2025-12-25 14:36:32 +01:00
senke
d3ff88d667 [FE-TYPE-002] fix: Remove final strict reference 2025-12-25 14:33:47 +01:00
senke
5ab46f3fe4 [FE-TYPE-002] fix: Remove unused strict parameter from validation functions 2025-12-25 14:33:19 +01:00
senke
e7348b8b61 [FE-TYPE-002] fix: Resolve TypeScript errors in Zod schemas
- Removed strict() and passthrough() calls (not available on all Zod types)
- Simplified validation to use parse() directly
- Fixed type issues in clientWithValidation.ts
2025-12-25 14:32:30 +01:00
senke
3b4b36bd72 [FE-TYPE-002] fe-type: Add Zod schemas for all API responses
- Created comprehensive Zod schemas (apiSchemas.ts) for:
  * User, Track, Playlist, Conversation, Message
  * Session, AuditLog, Notification
  * PaginationData, ApiError, ApiResponse
- Added validation utilities:
  * validateApiResponse: Validate and normalize responses
  * safeValidateApiResponse: Safe validation with error handling
  * validateApiResponseArray: Validate arrays of items
  * validatePaginatedResponse: Validate paginated responses
- Integrated validation into API client interceptor
- Created validatedApiClient for type-safe API calls
- Automatic ID normalization during validation
- Comprehensive test suite (13 tests, all passing)
- Ensures runtime type safety for all API responses
2025-12-25 14:30:55 +01:00
senke
b406d8a1a1 [FE-TYPE-001] fe-type: Fix all ID type mismatches
- Created ID normalization utility (idNormalization.ts) with:
  * normalizeId: Convert IDs to strings (handles number/string/null)
  * normalizeObjectIds: Recursively normalize IDs in objects
  * normalizeArrayIds: Normalize IDs in arrays of objects
  * Type guards for ID validation
- Updated stores/chat.ts to use normalization instead of manual String() conversions
- Fixed type definitions:
  * PlaylistAnalytics: playlistId number -> string
  * ImportPlaylistButton: playlistId number -> string
  * ExportPlaylistButton: playlistId number -> string
  * usePlaylistNotifications: lastNotificationId number -> string
- Removed unnecessary String() conversions in comparisons
- Comprehensive test suite (20 tests, all passing)
- Ensures all IDs are consistently strings (UUIDs) throughout the app
2025-12-25 14:27:28 +01:00
senke
5da916f3b3 [FE-STATE-012] fe-state: Add state cleanup
- Created state cleanup system (stateCleanup.ts) with:
  * Size limit cleanup: Limit number of items in arrays/normalized state
  * Age limit cleanup: Remove items older than specified time
  * Custom cleanup: User-defined cleanup functions
  * Support for arrays, normalized state, and nested objects
- Added cleanupMiddleware for automatic periodic cleanup
- Added performCleanup function for manual cleanup
- Comprehensive test suite (9 tests, all passing)
- Prevents memory leaks by cleaning unused state data
2025-12-25 14:23:06 +01:00
senke
ee3504b552 [FE-STATE-011] fe-state: Add state versioning
- Created state versioning system (stateVersioning.ts) with:
  * Version management: Wrap/unwrap state with version info
  * Migration support: Sequential migrations between versions
  * Versioned storage: Adapter for Zustand persist middleware
  * Error handling: Fallback to initial state on migration failure
  * Automatic migration: Migrate state on load if needed
- Added comprehensive test suite (17 tests, 14 passing)
- Created example integration showing usage with stores
- Supports legacy state (unversioned) and version mismatches
2025-12-25 14:19:40 +01:00
senke
6ba074f7ae [FE-STATE-010] fe-state: Add state middleware
- Created comprehensive state middleware (stateMiddleware.ts) with:
  * Logging: State change logging with configurable filters
  * Analytics: Event tracking for state changes, actions, errors, performance
  * Error handling: Automatic error capture and reporting
  * Sanitization: Remove sensitive data from logs
  * Performance tracking: Monitor async action durations
- Applied middleware to LibraryStore as example
- Added comprehensive test suite (7 tests, all passing)
- Configurable options for all features
- Global handlers for analytics and errors
2025-12-25 14:14:54 +01:00
senke
b93a5ca149 [FE-STATE-009] fe-state: Add state normalization
- Created state normalization utility (stateNormalization.ts) with functions:
  * normalize/denormalize for converting arrays to normalized state
  * addToNormalized, updateInNormalized, removeFromNormalized
  * Helper functions for working with normalized state
- Applied normalization to LibraryStore (items and favorites)
- Updated storeSelectors to convert normalized state to arrays
- Updated DashboardPage components to use new selectors
- Updated tests to work with normalized state structure
- Improved performance with O(1) lookups instead of O(n) array searches
2025-12-25 14:10:14 +01:00
senke
aab04776ba [FE-STATE-008] fe-state: Add state selectors optimization 2025-12-25 13:58:53 +01:00
senke
e9a3d9084b [FE-STATE-007] fe-state: Add state debugging tools 2025-12-25 13:56:53 +01:00
senke
3af5589970 [FE-STATE-006] fe-state: Add state undo/redo 2025-12-25 13:51:14 +01:00
senke
2b6565c0a6 [FE-STATE-005] fe-state: Add optimistic state updates 2025-12-25 13:48:32 +01:00
senke
e43a20b122 [FE-STATE-004] fe-state: Add state invalidation 2025-12-25 13:45:49 +01:00
senke
dab16e0cf4 [FE-STATE-003] fe-state: Add state hydration 2025-12-25 13:43:01 +01:00
senke
abdaca76aa [FE-STATE-002] fe-state: Add state synchronization 2025-12-25 13:40:56 +01:00
senke
bc9773e19f [FE-STATE-001] fe-state: Add state persistence 2025-12-25 13:38:49 +01:00
senke
467887acb3 [FE-API-019] fe-api: Add API mocking for development 2025-12-25 13:37:10 +01:00
senke
b81547dd44 [FE-API-018] fe-api: Add optimistic updates 2025-12-25 13:33:42 +01:00
senke
c3d1d53787 [FE-API-017] fe-api: Add request caching 2025-12-25 13:29:43 +01:00
senke
276b04bca6 [FE-API-016] fe-api: Add request deduplication 2025-12-25 13:26:27 +01:00
senke
e3ebc039f9 [FE-API-015] fe-api: Add offline support 2025-12-25 13:24:19 +01:00
senke
c9f6955da7 [FE-API-014] fe-api: Add request timeout handling 2025-12-25 13:22:15 +01:00
senke
6737bd397a [FE-API-013] fe-api: Add error handling improvements 2025-12-25 13:20:07 +01:00
senke
936d31f16e [FE-API-012] fe-api: Add conversation service improvements 2025-12-25 13:15:39 +01:00
senke
882f1fe8e1 [FE-API-011] fe-api: Add roles service integration 2025-12-25 13:13:25 +01:00
senke
0a676acecd [FE-API-010] fe-api: Add analytics service integration 2025-12-25 12:31:54 +01:00
senke
4172974be3 [FE-API-009] fe-api: Add notifications service integration 2025-12-25 12:29:29 +01:00
senke
d617ece4a6 [FE-API-008] fe-api: Add search service integration 2025-12-25 12:27:42 +01:00
senke
b6a2db1776 [FE-COMP-024] fe-comp: Add tooltips and help text 2025-12-25 12:25:39 +01:00
senke
c28a30b2d3 [FE-COMP-023] fe-comp: Add drag-and-drop for playlists 2025-12-25 12:22:33 +01:00
senke
662284b92c [FE-COMP-022] fe-comp: Add keyboard shortcuts 2025-12-25 12:21:17 +01:00
senke
3cebb7561b [FE-COMP-021] fe-comp: Add internationalization (i18n) 2025-12-25 12:15:58 +01:00
senke
bab1977849 [FE-COMP-020] fe-comp: Add dark mode support 2025-12-25 12:13:29 +01:00
senke
349475c550 [FE-COMP-019] fix: Correct TypeScript errors in TrackCard keyboard handlers 2025-12-25 12:11:38 +01:00
senke
5d240a18d0 [FE-COMP-019] fe-comp: Add accessibility (a11y) improvements 2025-12-25 12:11:08 +01:00
senke
611624940a [FE-COMP-018] fe-comp: Add responsive design for mobile 2025-12-25 12:09:20 +01:00
senke
c10fca8f44 [FE-COMP-017] fe-comp: Add playlist follow/unfollow button 2025-12-25 12:07:29 +01:00
senke
e9ecf97e7e [FE-COMP-016] fe-comp: Add track like/unlike button 2025-12-25 12:04:49 +01:00
senke
a618e995d8 [FE-COMP-015] fix: Remove unused initialFollowerCount prop 2025-12-25 12:02:22 +01:00
senke
d410fce9a5 [FE-COMP-015] fix: Correct TypeScript errors in FollowButton 2025-12-25 12:01:57 +01:00
senke
246d353d12 [FE-COMP-015] fe-comp: Add user follow/unfollow button 2025-12-25 12:00:19 +01:00