@umituz/react-native-ai-generation-content 1.83.92 → 1.83.94

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-ai-generation-content",
3
- "version": "1.83.92",
3
+ "version": "1.83.94",
4
4
  "description": "Provider-agnostic AI generation orchestration for React Native with result preview components",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -3,10 +3,6 @@
3
3
  * AI-generated creations gallery with filtering, sharing, and management
4
4
  */
5
5
 
6
- if (typeof __DEV__ !== "undefined" && __DEV__) {
7
- console.log("📍 [LIFECYCLE] creations/index.ts - Module loading");
8
- }
9
-
10
6
  // Domain Layer
11
7
  export * from "./domain-exports";
12
8
 
@@ -56,12 +56,7 @@ export const GalleryHeader: React.FC<GalleryHeaderProps> = ({
56
56
  {filterButtons.map((btn: FilterButtonConfig) => (
57
57
  <TouchableOpacity
58
58
  key={btn.id}
59
- onPress={() => {
60
- if (__DEV__) {
61
- console.log(`[GalleryHeader] ${btn.id} filter pressed`);
62
- }
63
- btn.onPress();
64
- }}
59
+ onPress={btn.onPress}
65
60
  style={[styles.filterButton, btn.isActive && styles.filterButtonActive]}
66
61
  activeOpacity={0.7}
67
62
  >
@@ -23,6 +23,8 @@ interface GalleryResultPreviewProps {
23
23
  readonly onRate: () => void;
24
24
  readonly onSubmitRating: (rating: number, description: string) => void;
25
25
  readonly onCloseRating: () => void;
26
+ /** Called when the user taps Edit. Only provided for image (non-video) creations. */
27
+ readonly onEdit?: (imageUrl: string) => void;
26
28
  }
27
29
 
28
30
  export function GalleryResultPreview({
@@ -37,6 +39,7 @@ export function GalleryResultPreview({
37
39
  onRate,
38
40
  onSubmitRating,
39
41
  onCloseRating,
42
+ onEdit,
40
43
  }: GalleryResultPreviewProps) {
41
44
  const alert = useAlert();
42
45
 
@@ -61,6 +64,7 @@ export function GalleryResultPreview({
61
64
  onTryAgain={onTryAgain}
62
65
  onNavigateBack={onBack}
63
66
  onRate={onRate}
67
+ onEdit={!videoUrl && imageUrl && onEdit ? () => onEdit(imageUrl) : undefined}
64
68
  hideLabel
65
69
  iconOnly
66
70
  showTryAgain
@@ -0,0 +1,32 @@
1
+ import { useMemo } from "react";
2
+ import type { Creation } from "../../domain/entities/Creation";
3
+
4
+ export interface CreationsStats {
5
+ readonly total: number;
6
+ readonly thisWeek: number;
7
+ readonly processing: number;
8
+ }
9
+
10
+ const WEEK_MS = 7 * 24 * 60 * 60 * 1000;
11
+
12
+ /**
13
+ * useCreationsStats
14
+ * Computes summary statistics from a list of creations.
15
+ * Accepts the raw data array from useCreations.
16
+ */
17
+ export function useCreationsStats(creations: Creation[] | undefined): CreationsStats {
18
+ return useMemo(() => {
19
+ if (!creations?.length) return { total: 0, thisWeek: 0, processing: 0 };
20
+
21
+ const weekAgo = new Date(Date.now() - WEEK_MS);
22
+ let thisWeek = 0;
23
+ let processing = 0;
24
+
25
+ for (const c of creations) {
26
+ if (new Date(c.createdAt) > weekAgo) thisWeek++;
27
+ if (c.status === "processing" || c.status === "queued" || c.status === "pending") processing++;
28
+ }
29
+
30
+ return { total: creations.length, thisWeek, processing };
31
+ }, [creations]);
32
+ }
@@ -32,6 +32,7 @@ export function CreationsGalleryScreen({
32
32
  onTryAgain,
33
33
  getCreationTitle,
34
34
  onCreationPress,
35
+ onEdit,
35
36
  }: CreationsGalleryScreenProps) {
36
37
  const tokens = useAppDesignTokens();
37
38
  const [viewMode, setViewMode] = useState<"list" | "grid">("list");
@@ -182,6 +183,7 @@ export function CreationsGalleryScreen({
182
183
  onRate={callbacks.handleOpenRatingPicker}
183
184
  onSubmitRating={callbacks.handleSubmitRating}
184
185
  onCloseRating={() => galleryState.setShowRatingPicker(false)}
186
+ onEdit={onEdit}
185
187
  />
186
188
  );
187
189
  }
@@ -22,4 +22,6 @@ export interface CreationsGalleryScreenProps {
22
22
  readonly getCreationTitle?: (creation: { type: string; metadata?: Record<string, unknown> }) => string;
23
23
  /** Custom handler when a creation card is pressed. When provided, overrides the built-in preview. */
24
24
  readonly onCreationPress?: (creation: { id: string; uri: string; type: string; originalUri?: string; output?: { imageUrl?: string; videoUrl?: string }; metadata?: Record<string, unknown> }) => void;
25
+ /** Called when the user taps the Edit button in the creation detail view. Receives the image URL. Only shown for image creations. */
26
+ readonly onEdit?: (imageUrl: string) => void;
25
27
  }
@@ -57,5 +57,9 @@ export {
57
57
  getTranslatedTypes,
58
58
  } from "./presentation/utils/gallery-filters";
59
59
 
60
+ // Stats
61
+ export { useCreationsStats } from "./presentation/hooks/useCreationsStats";
62
+ export type { CreationsStats } from "./presentation/hooks/useCreationsStats";
63
+
60
64
  // Screens
61
65
  export { CreationsGalleryScreen } from "./presentation/screens/CreationsGalleryScreen";
@@ -23,6 +23,7 @@ export const ResultActionBar: React.FC<ResultActionBarProps> = ({
23
23
  iconOnly = false,
24
24
  showTryAgain = true,
25
25
  showRating = false,
26
+ onEdit,
26
27
  }) => {
27
28
  const tokens = useAppDesignTokens();
28
29
  const { minTouchTarget } = useResponsive();
@@ -114,6 +115,15 @@ export const ResultActionBar: React.FC<ResultActionBarProps> = ({
114
115
  <AtomicIcon name="star-outline" customSize={20} color="onPrimary" />
115
116
  </TouchableOpacity>
116
117
  )}
118
+ {onEdit && (
119
+ <TouchableOpacity
120
+ style={styles.iconButton}
121
+ onPress={onEdit}
122
+ activeOpacity={0.7}
123
+ >
124
+ <AtomicIcon name="edit" customSize={20} color="onPrimary" />
125
+ </TouchableOpacity>
126
+ )}
117
127
  </View>
118
128
  );
119
129
  }
@@ -21,6 +21,7 @@ export const ResultPreviewScreen: React.FC<ResultPreviewScreenProps> = ({
21
21
  onTryAgain,
22
22
  onNavigateBack,
23
23
  onRate,
24
+ onEdit,
24
25
  recentCreations,
25
26
  onViewAll,
26
27
  onCreationPress,
@@ -71,6 +72,7 @@ export const ResultPreviewScreen: React.FC<ResultPreviewScreenProps> = ({
71
72
  onShare={onShare}
72
73
  onTryAgain={onTryAgain}
73
74
  onRate={onRate}
75
+ onEdit={onEdit}
74
76
  saveButtonText={translations.saveButton}
75
77
  shareButtonText={translations.shareButton}
76
78
  tryAgainButtonText={translations.tryAnother}
@@ -44,4 +44,6 @@ export interface ResultActionBarProps {
44
44
  showTryAgain?: boolean;
45
45
  /** Show rating button */
46
46
  showRating?: boolean;
47
+ /** Edit button callback — only shown in iconOnly mode when provided */
48
+ onEdit?: () => void;
47
49
  }
@@ -22,6 +22,8 @@ export interface ResultPreviewScreenProps {
22
22
  onTryAgain: () => void;
23
23
  onNavigateBack: () => void;
24
24
  onRate?: () => void;
25
+ /** Edit callback — opens photo editor for the result image */
26
+ onEdit?: () => void;
25
27
  /** Recent creations to display */
26
28
  recentCreations?: readonly RecentCreation[];
27
29
  /** Navigate to all creations */