@umituz/react-native-ai-generation-content 1.17.280 → 1.17.282
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/domains/creations/presentation/screens/CreationsGalleryScreen.tsx +15 -0
- package/src/domains/result-preview/presentation/components/ResultActionBar.tsx +13 -2
- package/src/domains/result-preview/presentation/components/ResultPreviewScreen.tsx +4 -0
- package/src/domains/result-preview/presentation/types/result-preview.types.ts +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.282",
|
|
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",
|
|
@@ -101,6 +101,18 @@ export function CreationsGalleryScreen({
|
|
|
101
101
|
setSelectedCreation(null);
|
|
102
102
|
}, []);
|
|
103
103
|
|
|
104
|
+
const handleRate = useCallback(() => {
|
|
105
|
+
if (!userId || !selectedCreation) return;
|
|
106
|
+
void (async () => {
|
|
107
|
+
const success = await repository.rate(userId, selectedCreation.id, 5);
|
|
108
|
+
if (success) {
|
|
109
|
+
setSelectedCreation({ ...selectedCreation, rating: 5, ratedAt: new Date() });
|
|
110
|
+
alert.show(AlertType.SUCCESS, AlertMode.TOAST, t("rating.thankYouTitle"), t("rating.thankYouMessage"));
|
|
111
|
+
void refetch();
|
|
112
|
+
}
|
|
113
|
+
})();
|
|
114
|
+
}, [userId, selectedCreation, repository, alert, t, refetch]);
|
|
115
|
+
|
|
104
116
|
const filterButtons = useMemo(() => {
|
|
105
117
|
const buttons = [];
|
|
106
118
|
if (showStatusFilter) {
|
|
@@ -168,6 +180,7 @@ export function CreationsGalleryScreen({
|
|
|
168
180
|
|
|
169
181
|
// Show result preview when a creation is selected
|
|
170
182
|
if (selectedCreation && selectedImageUrl) {
|
|
183
|
+
const hasRating = selectedCreation.rating !== undefined && selectedCreation.rating !== null;
|
|
171
184
|
return (
|
|
172
185
|
<ResultPreviewScreen
|
|
173
186
|
imageUrl={selectedImageUrl}
|
|
@@ -177,9 +190,11 @@ export function CreationsGalleryScreen({
|
|
|
177
190
|
onShare={handleShare}
|
|
178
191
|
onTryAgain={handleTryAgain}
|
|
179
192
|
onNavigateBack={handleBack}
|
|
193
|
+
onRate={handleRate}
|
|
180
194
|
hideLabel
|
|
181
195
|
iconOnly
|
|
182
196
|
showTryAgain={false}
|
|
197
|
+
showRating={!hasRating}
|
|
183
198
|
translations={{
|
|
184
199
|
title: t(config.translations.title),
|
|
185
200
|
yourResult: "",
|
|
@@ -18,11 +18,13 @@ export const ResultActionBar: React.FC<ResultActionBarProps> = ({
|
|
|
18
18
|
onDownload,
|
|
19
19
|
onShare,
|
|
20
20
|
onTryAgain,
|
|
21
|
+
onRate,
|
|
21
22
|
saveButtonText,
|
|
22
23
|
shareButtonText,
|
|
23
24
|
tryAgainButtonText,
|
|
24
25
|
iconOnly = false,
|
|
25
26
|
showTryAgain = true,
|
|
27
|
+
showRating = false,
|
|
26
28
|
}) => {
|
|
27
29
|
const tokens = useAppDesignTokens();
|
|
28
30
|
|
|
@@ -80,7 +82,7 @@ export const ResultActionBar: React.FC<ResultActionBarProps> = ({
|
|
|
80
82
|
{isSaving ? (
|
|
81
83
|
<ActivityIndicator color={tokens.colors.textInverse} size="small" />
|
|
82
84
|
) : (
|
|
83
|
-
<AtomicIcon name="
|
|
85
|
+
<AtomicIcon name="Download" customSize={24} color="onPrimary" />
|
|
84
86
|
)}
|
|
85
87
|
</TouchableOpacity>
|
|
86
88
|
<TouchableOpacity
|
|
@@ -92,9 +94,18 @@ export const ResultActionBar: React.FC<ResultActionBarProps> = ({
|
|
|
92
94
|
{isSharing ? (
|
|
93
95
|
<ActivityIndicator color={tokens.colors.textInverse} size="small" />
|
|
94
96
|
) : (
|
|
95
|
-
<AtomicIcon name="
|
|
97
|
+
<AtomicIcon name="Share2" customSize={24} color="onPrimary" />
|
|
96
98
|
)}
|
|
97
99
|
</TouchableOpacity>
|
|
100
|
+
{showRating && onRate && (
|
|
101
|
+
<TouchableOpacity
|
|
102
|
+
style={styles.iconButton}
|
|
103
|
+
onPress={onRate}
|
|
104
|
+
activeOpacity={0.7}
|
|
105
|
+
>
|
|
106
|
+
<AtomicIcon name="Star" customSize={24} color="onPrimary" />
|
|
107
|
+
</TouchableOpacity>
|
|
108
|
+
)}
|
|
98
109
|
</View>
|
|
99
110
|
);
|
|
100
111
|
}
|
|
@@ -24,6 +24,7 @@ export const ResultPreviewScreen: React.FC<ResultPreviewScreenProps> = ({
|
|
|
24
24
|
onShare,
|
|
25
25
|
onTryAgain,
|
|
26
26
|
onNavigateBack,
|
|
27
|
+
onRate,
|
|
27
28
|
recentCreations,
|
|
28
29
|
onViewAll,
|
|
29
30
|
onCreationPress,
|
|
@@ -32,6 +33,7 @@ export const ResultPreviewScreen: React.FC<ResultPreviewScreenProps> = ({
|
|
|
32
33
|
hideLabel = false,
|
|
33
34
|
iconOnly = false,
|
|
34
35
|
showTryAgain = true,
|
|
36
|
+
showRating = false,
|
|
35
37
|
}) => {
|
|
36
38
|
const tokens = useAppDesignTokens();
|
|
37
39
|
|
|
@@ -80,11 +82,13 @@ export const ResultPreviewScreen: React.FC<ResultPreviewScreenProps> = ({
|
|
|
80
82
|
onDownload={onDownload}
|
|
81
83
|
onShare={onShare}
|
|
82
84
|
onTryAgain={onTryAgain}
|
|
85
|
+
onRate={onRate}
|
|
83
86
|
saveButtonText={translations.saveButton}
|
|
84
87
|
shareButtonText={translations.shareButton}
|
|
85
88
|
tryAgainButtonText={translations.tryAnother}
|
|
86
89
|
iconOnly={iconOnly}
|
|
87
90
|
showTryAgain={showTryAgain}
|
|
91
|
+
showRating={showRating}
|
|
88
92
|
/>
|
|
89
93
|
</View>
|
|
90
94
|
{recentCreations && recentCreations.length > 0 && translations.recentCreations && translations.viewAll && (
|
|
@@ -63,6 +63,8 @@ export interface ResultActionBarProps {
|
|
|
63
63
|
onShare: () => void;
|
|
64
64
|
/** Try again callback */
|
|
65
65
|
onTryAgain: () => void;
|
|
66
|
+
/** Rate callback */
|
|
67
|
+
onRate?: () => void;
|
|
66
68
|
/** Save button text */
|
|
67
69
|
saveButtonText: string;
|
|
68
70
|
/** Share button text */
|
|
@@ -73,6 +75,8 @@ export interface ResultActionBarProps {
|
|
|
73
75
|
iconOnly?: boolean;
|
|
74
76
|
/** Show try again button */
|
|
75
77
|
showTryAgain?: boolean;
|
|
78
|
+
/** Show rating button */
|
|
79
|
+
showRating?: boolean;
|
|
76
80
|
}
|
|
77
81
|
|
|
78
82
|
/**
|
|
@@ -100,7 +104,7 @@ export interface ResultPreviewScreenProps {
|
|
|
100
104
|
onShare: () => void;
|
|
101
105
|
onTryAgain: () => void;
|
|
102
106
|
onNavigateBack: () => void;
|
|
103
|
-
|
|
107
|
+
onRate?: () => void;
|
|
104
108
|
/** Recent creations to display */
|
|
105
109
|
recentCreations?: readonly RecentCreation[];
|
|
106
110
|
/** Navigate to all creations */
|
|
@@ -117,6 +121,8 @@ export interface ResultPreviewScreenProps {
|
|
|
117
121
|
iconOnly?: boolean;
|
|
118
122
|
/** Show try again button */
|
|
119
123
|
showTryAgain?: boolean;
|
|
124
|
+
/** Show rating button */
|
|
125
|
+
showRating?: boolean;
|
|
120
126
|
}
|
|
121
127
|
|
|
122
128
|
/**
|