@umituz/react-native-ai-creations 1.2.9 → 1.2.11
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-creations",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.11",
|
|
4
4
|
"description": "AI-generated creations gallery with filtering, sharing, and management for React Native apps",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@umituz/react-native-filter": "latest",
|
|
32
32
|
"@umituz/react-native-image": "latest",
|
|
33
|
-
"@umituz/react-native-bottom-sheet": "latest"
|
|
33
|
+
"@umituz/react-native-bottom-sheet": "latest",
|
|
34
|
+
"@umituz/react-native-alert": "latest"
|
|
34
35
|
},
|
|
35
36
|
"peerDependencies": {
|
|
36
37
|
"@tanstack/react-query": ">=5.0.0",
|
|
@@ -5,18 +5,22 @@
|
|
|
5
5
|
|
|
6
6
|
import React, { useMemo } from "react";
|
|
7
7
|
import { View, StyleSheet } from "react-native";
|
|
8
|
-
import { AtomicText, useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
8
|
+
import { AtomicText, AtomicButton, useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
9
9
|
|
|
10
10
|
interface EmptyStateProps {
|
|
11
11
|
readonly title: string;
|
|
12
12
|
readonly description: string;
|
|
13
13
|
readonly icon?: string;
|
|
14
|
+
readonly actionLabel?: string;
|
|
15
|
+
readonly onAction?: () => void;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export function EmptyState({
|
|
17
19
|
title,
|
|
18
20
|
description,
|
|
19
21
|
icon = "🎨",
|
|
22
|
+
actionLabel,
|
|
23
|
+
onAction,
|
|
20
24
|
}: EmptyStateProps) {
|
|
21
25
|
const tokens = useAppDesignTokens();
|
|
22
26
|
|
|
@@ -43,9 +47,13 @@ export function EmptyState({
|
|
|
43
47
|
...tokens.typography.bodyMedium,
|
|
44
48
|
color: tokens.colors.textSecondary,
|
|
45
49
|
textAlign: "center",
|
|
50
|
+
marginBottom: onAction ? tokens.spacing.xl : 0,
|
|
51
|
+
},
|
|
52
|
+
button: {
|
|
53
|
+
minWidth: 160,
|
|
46
54
|
},
|
|
47
55
|
}),
|
|
48
|
-
[tokens],
|
|
56
|
+
[tokens, onAction],
|
|
49
57
|
);
|
|
50
58
|
|
|
51
59
|
return (
|
|
@@ -53,6 +61,14 @@ export function EmptyState({
|
|
|
53
61
|
<AtomicText style={styles.icon}>{icon}</AtomicText>
|
|
54
62
|
<AtomicText style={styles.title}>{title}</AtomicText>
|
|
55
63
|
<AtomicText style={styles.description}>{description}</AtomicText>
|
|
64
|
+
{onAction && actionLabel && (
|
|
65
|
+
<AtomicButton
|
|
66
|
+
title={actionLabel}
|
|
67
|
+
onPress={onAction}
|
|
68
|
+
variant="primary"
|
|
69
|
+
style={styles.button}
|
|
70
|
+
/>
|
|
71
|
+
)}
|
|
56
72
|
</View>
|
|
57
73
|
);
|
|
58
74
|
}
|
|
@@ -22,6 +22,8 @@ import { BottomSheetModalRef } from "@umituz/react-native-bottom-sheet";
|
|
|
22
22
|
import { AtomicIcon, AtomicText } from "@umituz/react-native-design-system";
|
|
23
23
|
import { GalleryHeader } from "../components/GalleryHeader";
|
|
24
24
|
|
|
25
|
+
import { useAlert } from "@umituz/react-native-alert";
|
|
26
|
+
|
|
25
27
|
interface CreationsGalleryScreenProps {
|
|
26
28
|
readonly userId: string | null;
|
|
27
29
|
readonly repository: ICreationsRepository;
|
|
@@ -29,6 +31,8 @@ interface CreationsGalleryScreenProps {
|
|
|
29
31
|
readonly t: (key: string) => string;
|
|
30
32
|
readonly enableEditing?: boolean;
|
|
31
33
|
readonly onImageEdit?: (uri: string, creationId: string) => void | Promise<void>;
|
|
34
|
+
readonly onEmptyAction?: () => void;
|
|
35
|
+
readonly emptyActionLabel?: string;
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
export function CreationsGalleryScreen({
|
|
@@ -38,10 +42,13 @@ export function CreationsGalleryScreen({
|
|
|
38
42
|
t,
|
|
39
43
|
enableEditing = false,
|
|
40
44
|
onImageEdit,
|
|
45
|
+
onEmptyAction,
|
|
46
|
+
emptyActionLabel,
|
|
41
47
|
}: CreationsGalleryScreenProps) {
|
|
42
48
|
const tokens = useAppDesignTokens();
|
|
43
49
|
const insets = useSafeAreaInsets();
|
|
44
50
|
const { share } = useSharing();
|
|
51
|
+
const alert = useAlert();
|
|
45
52
|
const [viewerVisible, setViewerVisible] = useState(false);
|
|
46
53
|
const [viewerIndex, setViewerIndex] = useState(0);
|
|
47
54
|
const filterSheetRef = React.useRef<BottomSheetModalRef>(null);
|
|
@@ -106,20 +113,28 @@ export function CreationsGalleryScreen({
|
|
|
106
113
|
|
|
107
114
|
const handleDelete = useCallback(
|
|
108
115
|
(creation: Creation) => {
|
|
109
|
-
|
|
110
|
-
t(config.translations.deleteTitle),
|
|
111
|
-
t(config.translations.deleteMessage),
|
|
112
|
-
|
|
113
|
-
|
|
116
|
+
alert.show({
|
|
117
|
+
title: t(config.translations.deleteTitle),
|
|
118
|
+
message: t(config.translations.deleteMessage),
|
|
119
|
+
type: 'warning' as any,
|
|
120
|
+
actions: [
|
|
121
|
+
{
|
|
122
|
+
id: 'cancel',
|
|
123
|
+
label: t("common.cancel"),
|
|
124
|
+
style: 'secondary',
|
|
125
|
+
onPress: () => { }
|
|
126
|
+
},
|
|
114
127
|
{
|
|
115
|
-
|
|
116
|
-
|
|
128
|
+
id: 'delete',
|
|
129
|
+
label: t("common.delete"),
|
|
130
|
+
style: 'destructive',
|
|
131
|
+
variant: 'danger',
|
|
117
132
|
onPress: () => deleteMutation.mutate(creation.id),
|
|
118
133
|
},
|
|
119
|
-
]
|
|
120
|
-
);
|
|
134
|
+
]
|
|
135
|
+
});
|
|
121
136
|
},
|
|
122
|
-
[t, config.translations, deleteMutation],
|
|
137
|
+
[t, config.translations, deleteMutation, alert],
|
|
123
138
|
);
|
|
124
139
|
|
|
125
140
|
const handleImageChange = useCallback(
|
|
@@ -172,6 +187,8 @@ export function CreationsGalleryScreen({
|
|
|
172
187
|
<EmptyState
|
|
173
188
|
title={t(config.translations.empty)}
|
|
174
189
|
description={t(config.translations.emptyDescription)}
|
|
190
|
+
actionLabel={emptyActionLabel}
|
|
191
|
+
onAction={onEmptyAction}
|
|
175
192
|
/>
|
|
176
193
|
</View>
|
|
177
194
|
);
|