@umituz/react-native-design-system 4.23.101 → 4.23.102

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.
@@ -1,101 +0,0 @@
1
- /**
2
- * Multimedia Flashcard Hooks
3
- * Main hook and exports for multimedia functionality
4
- */
5
-
6
- import { useState, useCallback } from "react";
7
- import { calculateTotalSize, extractMediaTypes } from "../../infrastructure/utils/media-collection-utils";
8
- import type { UseMultimediaFlashcardResult } from "./multimedia.types";
9
- import type {
10
- MediaAttachment,
11
- MultimediaFlashcard,
12
- CreateMultimediaCardData,
13
- } from "../../domain/entities/MediaAttachments";
14
-
15
- // Export individual hooks
16
- export { useMediaUpload } from "./useMediaUpload";
17
- export { useMediaGeneration } from "./useMediaGeneration";
18
- export { useMediaValidation } from "./useMediaValidation";
19
-
20
- // Export types
21
- export type {
22
- UseMediaUploadResult,
23
- UseMediaGenerationResult,
24
- UseMediaValidationResult,
25
- UseMultimediaFlashcardResult,
26
- } from "./multimedia.types";
27
-
28
- /**
29
- * Main hook for multimedia flashcard operations
30
- */
31
- export const useMultimediaFlashcard = (): UseMultimediaFlashcardResult => {
32
- const [isProcessing, setIsProcessing] = useState(false);
33
- const [error, setError] = useState<string | null>(null);
34
-
35
- const createMultimediaCard = useCallback(
36
- async (cardData: CreateMultimediaCardData): Promise<MultimediaFlashcard> => {
37
- try {
38
- setIsProcessing(true);
39
- setError(null);
40
-
41
- // Simulate card creation
42
- await new Promise((resolve) => setTimeout(resolve, 1000));
43
-
44
- const card: MultimediaFlashcard = {
45
- id: `card_${Date.now()}`,
46
- front: cardData.front || "",
47
- back: cardData.back || "",
48
- difficulty: cardData.difficulty || "medium",
49
- tags: cardData.tags || [],
50
- media: cardData.media || [],
51
- hasMedia: (cardData.media || []).length > 0,
52
- mediaType: extractMediaTypes(cardData.media || []),
53
- isDownloaded: (cardData.media || []).every(
54
- (m: MediaAttachment) => m.isDownloaded,
55
- ),
56
- estimatedSize: calculateTotalSize(cardData.media || []),
57
- createdAt: new Date().toISOString(),
58
- };
59
-
60
- return card;
61
- } catch (err) {
62
- const errorMessage =
63
- err instanceof Error ? err.message : "Card creation failed";
64
- setError(errorMessage);
65
- setIsProcessing(false);
66
- throw err;
67
- } finally {
68
- setIsProcessing(false);
69
- }
70
- },
71
- [],
72
- );
73
-
74
- const updateMedia = useCallback(
75
- async (
76
- _cardId: string,
77
- _media: MediaAttachment[],
78
- ): Promise<MultimediaFlashcard> => {
79
- // Mock implementation
80
- await new Promise((resolve) => setTimeout(resolve, 500));
81
- return {} as MultimediaFlashcard;
82
- },
83
- [],
84
- );
85
-
86
- const deleteMedia = useCallback(
87
- async (_attachmentId: string): Promise<void> => {
88
- // Mock implementation
89
- await new Promise((resolve) => setTimeout(resolve, 500));
90
- },
91
- [],
92
- );
93
-
94
- return {
95
- createMultimediaCard,
96
- updateMedia,
97
- deleteMedia,
98
- isProcessing,
99
- error,
100
- };
101
- };