@umituz/react-native-design-system 4.23.100 → 4.23.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/atoms/AtomicInput.tsx +0 -2
- package/src/media/domain/entities/{MultimediaFlashcardTypes.ts → MediaAttachments.ts} +13 -32
- package/src/media/index.ts +24 -23
- package/src/media/infrastructure/services/MediaGenerationService.ts +1 -1
- package/src/media/infrastructure/services/MediaOptimizerService.ts +1 -1
- package/src/media/infrastructure/services/MediaUploadService.ts +1 -1
- package/src/media/infrastructure/services/MediaValidationService.ts +1 -1
- package/src/media/infrastructure/services/MultimediaFlashcardService.ts +1 -1
- package/src/media/infrastructure/utils/PermissionManager.ts +1 -1
- package/src/media/infrastructure/utils/media-collection-utils.ts +4 -2
- package/src/media/infrastructure/utils/mediaPickerMappers.ts +1 -1
- package/src/media/presentation/hooks/multimedia.types.ts +1 -1
- package/src/media/presentation/hooks/useCardMultimediaFlashcard.ts +4 -4
- package/src/media/presentation/hooks/useMedia.ts +2 -2
- package/src/media/presentation/hooks/useMediaGeneration.ts +1 -1
- package/src/media/presentation/hooks/useMediaUpload.ts +1 -1
- package/src/media/presentation/hooks/useMediaValidation.ts +1 -1
- package/src/media/presentation/hooks/useMultimediaFlashcard.ts +1 -1
- package/src/molecules/navigation/utils/AppNavigation.ts +3 -3
- package/src/storage/infrastructure/adapters/StorageService.ts +3 -3
- package/src/storage/infrastructure/repositories/BaseStorageOperations.ts +5 -5
- package/src/storage/presentation/hooks/CacheStorageOperations.ts +3 -3
- package/src/storage/presentation/hooks/useStore.ts +0 -1
- package/src/media/domain/entities/CardMultimedia.types.README.md +0 -129
- package/src/media/domain/entities/Media.README.md +0 -80
- package/src/media/domain/entities/MultimediaFlashcardTypes.README.md +0 -144
- package/src/media/domain/utils/MediaUtils.README.md +0 -178
- package/src/media/index.ts.README.md +0 -191
- package/src/media/infrastructure/services/CardMultimediaService.README.md +0 -176
- package/src/media/infrastructure/services/CardMultimediaService.ts +0 -98
- package/src/media/infrastructure/services/MediaGenerationService.README.md +0 -142
- package/src/media/infrastructure/services/MediaOptimizerService.README.md +0 -145
- package/src/media/infrastructure/services/MediaPickerService.README.md +0 -106
- package/src/media/infrastructure/services/MediaSaveService.README.md +0 -120
- package/src/media/infrastructure/services/MediaUploadService.README.md +0 -135
- package/src/media/infrastructure/services/MediaValidationService.README.md +0 -135
- package/src/media/infrastructure/services/MultimediaFlashcardService.README.md +0 -142
- package/src/media/infrastructure/utils/mediaHelpers.README.md +0 -96
- package/src/media/infrastructure/utils/mediaPickerMappers.README.md +0 -129
- package/src/media/presentation/hooks/card-multimedia.types.README.md +0 -177
- package/src/media/presentation/hooks/card-multimedia.types.ts +0 -53
- package/src/media/presentation/hooks/multimedia.types.README.md +0 -201
- package/src/media/presentation/hooks/useCardMediaGeneration.ts +0 -20
- package/src/media/presentation/hooks/useCardMediaUpload.ts +0 -84
- package/src/media/presentation/hooks/useCardMediaValidation.ts +0 -104
- package/src/media/presentation/hooks/useCardMultimediaFlashcard.README.md +0 -158
- package/src/media/presentation/hooks/useMedia.README.md +0 -94
- package/src/media/presentation/hooks/useMediaGeneration.README.md +0 -118
- package/src/media/presentation/hooks/useMediaUpload.README.md +0 -108
- package/src/media/presentation/hooks/useMediaValidation.README.md +0 -134
- package/src/media/presentation/hooks/useMultimediaFlashcard.README.md +0 -141
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
# useMediaValidation
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
React hook for validating media files before upload, checking file size, type, and providing improvement recommendations.
|
|
5
|
-
|
|
6
|
-
## File Location
|
|
7
|
-
`src/presentation/hooks/useMediaValidation.ts`
|
|
8
|
-
|
|
9
|
-
## Strategy
|
|
10
|
-
- Provide comprehensive media file validation before upload
|
|
11
|
-
- Check file size limits with appropriate warnings
|
|
12
|
-
- Validate MIME types against supported formats
|
|
13
|
-
- Provide three-tier feedback: errors (blocking), warnings (performance), recommendations (improvements)
|
|
14
|
-
- Support validation state management
|
|
15
|
-
- Enable pre-upload validation workflow
|
|
16
|
-
- Return actionable feedback for each validation issue
|
|
17
|
-
|
|
18
|
-
## Forbidden
|
|
19
|
-
- **DO NOT** upload files that fail validation (errors present)
|
|
20
|
-
- **DO NOT** ignore warnings - they indicate performance issues
|
|
21
|
-
- **DO NOT** bypass file type validation
|
|
22
|
-
- **DO NOT** use mock validation in production
|
|
23
|
-
- **DO NOT** allow files exceeding maximum size limits
|
|
24
|
-
- **DO NOT** modify file during validation process
|
|
25
|
-
- **DO NOT** store validation results permanently in hook state
|
|
26
|
-
- **DO NOT** validate empty or missing files
|
|
27
|
-
- **DO NOT** suppress validation errors for user convenience
|
|
28
|
-
|
|
29
|
-
## Rules
|
|
30
|
-
1. Always validate before upload operations
|
|
31
|
-
2. Files over 50 MB must be rejected with error
|
|
32
|
-
3. Files over 10 MB must trigger warning and recommendation
|
|
33
|
-
4. Unsupported MIME types must be rejected
|
|
34
|
-
5. Validation must check file size, type, and format
|
|
35
|
-
6. Return errors array for blocking issues
|
|
36
|
-
7. Return warnings array for performance concerns
|
|
37
|
-
8. Return recommendations array for improvements
|
|
38
|
-
9. Clear validation state on new validation requests
|
|
39
|
-
10. Support synchronous and asynchronous validation
|
|
40
|
-
|
|
41
|
-
## AI Agent Guidelines
|
|
42
|
-
|
|
43
|
-
When working with useMediaValidation hook:
|
|
44
|
-
|
|
45
|
-
1. **Pre-upload Check**: Always validate before useMediaUpload calls
|
|
46
|
-
2. **Three-Tier Feedback**: Distinguish between errors, warnings, recommendations
|
|
47
|
-
3. **User Decision**: Show warnings but allow user to proceed
|
|
48
|
-
4. **File Size**: Be strict with maximum limits, flexible with warnings
|
|
49
|
-
5. **Type Safety**: Validate MIME types against supported formats
|
|
50
|
-
|
|
51
|
-
### Validation Levels
|
|
52
|
-
|
|
53
|
-
**Errors** (Blocking - Must fix before upload):
|
|
54
|
-
- File size exceeds 50 MB
|
|
55
|
-
- Unsupported file type
|
|
56
|
-
- Invalid file format
|
|
57
|
-
- Missing required properties
|
|
58
|
-
|
|
59
|
-
**Warnings** (Performance - Should fix but can proceed):
|
|
60
|
-
- File size over 10 MB (performance impact)
|
|
61
|
-
- Large dimensions (may need optimization)
|
|
62
|
-
- Non-standard format (compatibility issues)
|
|
63
|
-
|
|
64
|
-
**Recommendations** (Improvements - Optional suggestions):
|
|
65
|
-
- Reduce file size for better performance
|
|
66
|
-
- Use recommended format (JPEG for images, MP4 for video)
|
|
67
|
-
- Optimize dimensions for target use case
|
|
68
|
-
- Compress to balance quality and size
|
|
69
|
-
|
|
70
|
-
### Supported File Types
|
|
71
|
-
|
|
72
|
-
**Images:**
|
|
73
|
-
- image/jpeg (JPEG photos)
|
|
74
|
-
- image/png (PNG graphics with transparency)
|
|
75
|
-
- image/webp (WebP format)
|
|
76
|
-
|
|
77
|
-
**Audio:**
|
|
78
|
-
- audio/mp3 (MP3 compressed audio)
|
|
79
|
-
- audio/wav (WAV uncompressed audio)
|
|
80
|
-
- audio/m4a (M4A audio format)
|
|
81
|
-
|
|
82
|
-
**Video:**
|
|
83
|
-
- video/mp4 (MP4 video)
|
|
84
|
-
- video/mov (QuickTime video)
|
|
85
|
-
|
|
86
|
-
### Validation Workflow
|
|
87
|
-
|
|
88
|
-
1. Receive file object with name, type, size, uri
|
|
89
|
-
2. Check file size against limits (50 MB max, 10 MB warning)
|
|
90
|
-
3. Validate MIME type against supported formats
|
|
91
|
-
4. Generate appropriate errors, warnings, recommendations
|
|
92
|
-
5. Return MediaValidation object with results
|
|
93
|
-
6. Display feedback to user for action
|
|
94
|
-
|
|
95
|
-
### Validation State Management
|
|
96
|
-
|
|
97
|
-
- isValid: Boolean (true if no errors)
|
|
98
|
-
- errors: String array (blocking issues)
|
|
99
|
-
- warnings: String array (performance concerns)
|
|
100
|
-
- recommendations: String array (improvement suggestions)
|
|
101
|
-
|
|
102
|
-
### Integration with Upload Flow
|
|
103
|
-
|
|
104
|
-
Typical validation-upload workflow:
|
|
105
|
-
1. Select file from picker or file system
|
|
106
|
-
2. Call validateMedia(file)
|
|
107
|
-
3. Check validation.isValid
|
|
108
|
-
4. If errors: Show to user, block upload
|
|
109
|
-
5. If warnings: Show to user, ask confirmation
|
|
110
|
-
6. If recommendations: Show to user for reference
|
|
111
|
-
7. Proceed to upload if no errors or user confirms warnings
|
|
112
|
-
|
|
113
|
-
### File Size Guidelines
|
|
114
|
-
|
|
115
|
-
**Images:**
|
|
116
|
-
- Optimal: Under 2 MB
|
|
117
|
-
- Warning: 2-10 MB
|
|
118
|
-
- Error: Over 50 MB
|
|
119
|
-
|
|
120
|
-
**Audio:**
|
|
121
|
-
- Optimal: Under 5 MB
|
|
122
|
-
- Warning: 5-10 MB
|
|
123
|
-
- Error: Over 50 MB
|
|
124
|
-
|
|
125
|
-
**Video:**
|
|
126
|
-
- Optimal: Under 10 MB
|
|
127
|
-
- Warning: 10-50 MB
|
|
128
|
-
- Error: Over 50 MB
|
|
129
|
-
|
|
130
|
-
## Dependencies
|
|
131
|
-
|
|
132
|
-
- MediaValidationService (infrastructure layer)
|
|
133
|
-
- Domain types: MediaValidation, file input interfaces
|
|
134
|
-
- Media constants (size limits, supported types)
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
# useMultimediaFlashcard
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
Main hook for creating and managing flashcards with media attachments, providing all multimedia operations in one place.
|
|
5
|
-
|
|
6
|
-
## File Location
|
|
7
|
-
`src/presentation/hooks/useMultimediaFlashcard.ts`
|
|
8
|
-
|
|
9
|
-
## Strategy
|
|
10
|
-
- Provide unified interface for flashcard creation with media support
|
|
11
|
-
- Support adding, updating, and deleting media on flashcards
|
|
12
|
-
- Automatically analyze media composition (types, sizes, positions)
|
|
13
|
-
- Calculate estimated storage requirements
|
|
14
|
-
- Track download status for offline support
|
|
15
|
-
- Enable rich multimedia flashcard experiences
|
|
16
|
-
- Maintain separation between card data and media management
|
|
17
|
-
|
|
18
|
-
## Forbidden
|
|
19
|
-
- **DO NOT** create flashcards without required fields (front, back)
|
|
20
|
-
- **DO NOT** add media without proper validation first
|
|
21
|
-
- **DO NOT** allow duplicate media attachments with same ID
|
|
22
|
-
- **DO NOT** mock card operations in production without backend integration
|
|
23
|
-
- **DO NOT** assume all media is downloaded (check isDownloaded flag)
|
|
24
|
-
- **DO NOT** modify card structure after creation (use update functions)
|
|
25
|
-
- **DO NOT** exceed practical media limits per card (performance)
|
|
26
|
-
- **DO NOT** store large media directly in card object (use references)
|
|
27
|
-
- **DO NOT** bypass media analysis for size estimation
|
|
28
|
-
|
|
29
|
-
## Rules
|
|
30
|
-
1. Always validate media before adding to flashcard
|
|
31
|
-
2. Calculate estimatedSize from all media attachments
|
|
32
|
-
3. Generate unique ID for each flashcard
|
|
33
|
-
4. Analyze media types and populate mediaType array
|
|
34
|
-
5. Set hasMedia flag based on media array length
|
|
35
|
-
6. Set isDownloaded based on all media download status
|
|
36
|
-
7. Support front, back, and both positions for media
|
|
37
|
-
8. Return complete MultimediaFlashcard object
|
|
38
|
-
9. Clear processing state on completion or error
|
|
39
|
-
10. Support empty media array for text-only cards
|
|
40
|
-
|
|
41
|
-
## AI Agent Guidelines
|
|
42
|
-
|
|
43
|
-
When working with useMultimediaFlashcard hook:
|
|
44
|
-
|
|
45
|
-
1. **Media First**: Upload and validate media before creating card
|
|
46
|
-
2. **Size Awareness**: Monitor estimatedSize for performance implications
|
|
47
|
-
3. **Type Analysis**: Use mediaType array to determine card capabilities
|
|
48
|
-
4. **Download Status**: Check isDownloaded before displaying media
|
|
49
|
-
5. **Position Strategy**: Assign appropriate position (front, back, both)
|
|
50
|
-
|
|
51
|
-
### Card Creation Workflow
|
|
52
|
-
|
|
53
|
-
1. Prepare card content (front text, back text)
|
|
54
|
-
2. Upload and validate media files separately
|
|
55
|
-
3. Collect MediaAttachment objects
|
|
56
|
-
4. Call createMultimediaCard with data
|
|
57
|
-
5. Receive complete MultimediaFlashcard object
|
|
58
|
-
6. Use returned card for display and storage
|
|
59
|
-
|
|
60
|
-
### Flashcard Structure
|
|
61
|
-
|
|
62
|
-
MultimediaFlashcard includes:
|
|
63
|
-
- id: Unique card identifier
|
|
64
|
-
- front: Front side content (question/prompt)
|
|
65
|
-
- back: Back side content (answer/explanation)
|
|
66
|
-
- difficulty: easy/medium/hard
|
|
67
|
-
- tags: Array of topic tags
|
|
68
|
-
- media: Array of MediaAttachment objects
|
|
69
|
-
- hasMedia: Boolean flag for media presence
|
|
70
|
-
- mediaType: Array of unique media types present
|
|
71
|
-
- isDownloaded: Boolean (all media downloaded)
|
|
72
|
-
- estimatedSize: Total size in bytes
|
|
73
|
-
- createdAt: ISO timestamp
|
|
74
|
-
|
|
75
|
-
### Media Analysis
|
|
76
|
-
|
|
77
|
-
**hasMedia**: True if media array has items
|
|
78
|
-
**mediaType**: Unique array of media types (image, audio, video)
|
|
79
|
-
**isDownloaded**: True if all media.isDownloaded are true
|
|
80
|
-
**estimatedSize**: Sum of all media.fileSize values
|
|
81
|
-
|
|
82
|
-
### Media Positioning
|
|
83
|
-
|
|
84
|
-
Media can be assigned to:
|
|
85
|
-
- **front**: Displayed on front side of card
|
|
86
|
-
- **back**: Displayed on back side of card
|
|
87
|
-
- **both**: Displayed on both sides
|
|
88
|
-
|
|
89
|
-
### Card Management Operations
|
|
90
|
-
|
|
91
|
-
**createMultimediaCard**: Create new card with media
|
|
92
|
-
- Validates required fields (front, back)
|
|
93
|
-
- Processes media array
|
|
94
|
-
- Generates unique ID
|
|
95
|
-
- Analyzes media composition
|
|
96
|
-
- Calculates estimated size
|
|
97
|
-
|
|
98
|
-
**updateMedia**: Replace media on existing card
|
|
99
|
-
- Updates media array
|
|
100
|
-
- Re-analyzes composition
|
|
101
|
-
- Recalculates size
|
|
102
|
-
- Preserves card ID and metadata
|
|
103
|
-
|
|
104
|
-
**deleteMedia**: Remove specific media attachment
|
|
105
|
-
- Removes from media array by ID
|
|
106
|
-
- Updates analysis
|
|
107
|
-
- Recalculates size
|
|
108
|
-
|
|
109
|
-
### Integration with Other Hooks
|
|
110
|
-
|
|
111
|
-
Typical workflow combining multiple hooks:
|
|
112
|
-
1. useMedia: Select images/videos
|
|
113
|
-
2. useMediaUpload: Upload selected media
|
|
114
|
-
3. useMediaValidation: Validate before upload
|
|
115
|
-
4. useMediaGeneration: Generate AI media (optional)
|
|
116
|
-
5. useMultimediaFlashcard: Create card with media
|
|
117
|
-
|
|
118
|
-
### Performance Considerations
|
|
119
|
-
|
|
120
|
-
- Limit media count per card (recommend 5-10 items)
|
|
121
|
-
- Monitor estimatedSize (warn over 25 MB)
|
|
122
|
-
- Use thumbnails for previews
|
|
123
|
-
- Lazy load media when displaying cards
|
|
124
|
-
- Cache cards with downloaded media
|
|
125
|
-
|
|
126
|
-
### Best Practices
|
|
127
|
-
|
|
128
|
-
1. Always validate media before adding to cards
|
|
129
|
-
2. Use descriptive tags for card organization
|
|
130
|
-
3. Set appropriate difficulty levels
|
|
131
|
-
4. Balance media types (don't overload with videos)
|
|
132
|
-
5. Consider offline usage (isDownloaded flag)
|
|
133
|
-
6. Provide captions for accessibility
|
|
134
|
-
|
|
135
|
-
## Dependencies
|
|
136
|
-
|
|
137
|
-
- MultimediaFlashcardService (infrastructure layer)
|
|
138
|
-
- Domain types: MultimediaFlashcard, MediaAttachment
|
|
139
|
-
- useMediaUpload (for media upload)
|
|
140
|
-
- useMediaValidation (for media validation)
|
|
141
|
-
- useMediaGeneration (for AI media generation)
|