@umituz/react-native-ai-generation-content 1.17.239 → 1.17.241
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/domain/entities/Creation.ts +13 -0
- package/src/domains/creations/presentation/components/CreationDetail/DetailActions.tsx +22 -3
- package/src/domains/creations/presentation/screens/CreationDetailScreen.tsx +4 -0
- package/src/domains/result-preview/presentation/components/ResultActionBar.tsx +4 -4
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.241",
|
|
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",
|
|
@@ -30,6 +30,8 @@ export interface Creation {
|
|
|
30
30
|
readonly createdAt: Date;
|
|
31
31
|
readonly isShared: boolean;
|
|
32
32
|
readonly isFavorite: boolean;
|
|
33
|
+
readonly rating?: number;
|
|
34
|
+
readonly ratedAt?: Date;
|
|
33
35
|
// Extended fields for job-based creations
|
|
34
36
|
readonly status?: CreationStatus;
|
|
35
37
|
readonly output?: CreationOutput;
|
|
@@ -49,6 +51,8 @@ export interface CreationDocument {
|
|
|
49
51
|
readonly output?: CreationOutput | null;
|
|
50
52
|
readonly isShared: boolean;
|
|
51
53
|
readonly isFavorite?: boolean;
|
|
54
|
+
readonly rating?: number;
|
|
55
|
+
readonly ratedAt?: FirebaseTimestamp | Date;
|
|
52
56
|
readonly createdAt: FirebaseTimestamp | Date;
|
|
53
57
|
readonly completedAt?: FirebaseTimestamp | Date;
|
|
54
58
|
}
|
|
@@ -78,6 +82,13 @@ export function mapDocumentToCreation(
|
|
|
78
82
|
data.uri ||
|
|
79
83
|
"";
|
|
80
84
|
|
|
85
|
+
let ratedAtDate: Date | undefined;
|
|
86
|
+
if (data.ratedAt instanceof Date) {
|
|
87
|
+
ratedAtDate = data.ratedAt;
|
|
88
|
+
} else if (data.ratedAt && typeof data.ratedAt === "object" && "toDate" in data.ratedAt && typeof data.ratedAt.toDate === "function") {
|
|
89
|
+
ratedAtDate = data.ratedAt.toDate();
|
|
90
|
+
}
|
|
91
|
+
|
|
81
92
|
return {
|
|
82
93
|
id,
|
|
83
94
|
uri,
|
|
@@ -88,6 +99,8 @@ export function mapDocumentToCreation(
|
|
|
88
99
|
createdAt: creationDate,
|
|
89
100
|
isShared: data.isShared ?? false,
|
|
90
101
|
isFavorite: data.isFavorite ?? false,
|
|
102
|
+
rating: data.rating,
|
|
103
|
+
ratedAt: ratedAtDate,
|
|
91
104
|
status: data.status as CreationStatus | undefined,
|
|
92
105
|
output: data.output ?? undefined,
|
|
93
106
|
};
|
|
@@ -6,21 +6,36 @@ import { AtomicText, AtomicIcon, useAppDesignTokens, type DesignTokens } from "@
|
|
|
6
6
|
interface DetailActionsProps {
|
|
7
7
|
readonly onShare: () => void;
|
|
8
8
|
readonly onDelete: () => void;
|
|
9
|
+
readonly onViewResult?: () => void;
|
|
9
10
|
readonly shareLabel: string;
|
|
10
11
|
readonly deleteLabel: string;
|
|
12
|
+
readonly viewResultLabel?: string;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
export const DetailActions: React.FC<DetailActionsProps> = ({
|
|
14
16
|
onShare,
|
|
15
17
|
onDelete,
|
|
18
|
+
onViewResult,
|
|
16
19
|
shareLabel,
|
|
17
|
-
deleteLabel
|
|
20
|
+
deleteLabel,
|
|
21
|
+
viewResultLabel
|
|
18
22
|
}) => {
|
|
19
23
|
const tokens = useAppDesignTokens();
|
|
20
24
|
const styles = useStyles(tokens);
|
|
21
25
|
|
|
22
26
|
return (
|
|
23
27
|
<View style={styles.container}>
|
|
28
|
+
{onViewResult && viewResultLabel && (
|
|
29
|
+
<TouchableOpacity
|
|
30
|
+
style={[styles.button, styles.viewResultButton]}
|
|
31
|
+
onPress={onViewResult}
|
|
32
|
+
activeOpacity={0.7}
|
|
33
|
+
>
|
|
34
|
+
<AtomicIcon name="eye-outline" size="sm" color="onPrimary" />
|
|
35
|
+
<AtomicText style={styles.buttonText}>{viewResultLabel}</AtomicText>
|
|
36
|
+
</TouchableOpacity>
|
|
37
|
+
)}
|
|
38
|
+
|
|
24
39
|
<TouchableOpacity
|
|
25
40
|
style={[styles.button, styles.shareButton]}
|
|
26
41
|
onPress={onShare}
|
|
@@ -48,6 +63,7 @@ const useStyles = (tokens: DesignTokens) => StyleSheet.create({
|
|
|
48
63
|
container: {
|
|
49
64
|
flexDirection: 'row',
|
|
50
65
|
justifyContent: 'center',
|
|
66
|
+
flexWrap: 'wrap',
|
|
51
67
|
gap: tokens.spacing.md,
|
|
52
68
|
paddingHorizontal: tokens.spacing.lg,
|
|
53
69
|
marginBottom: tokens.spacing.xxl,
|
|
@@ -57,10 +73,13 @@ const useStyles = (tokens: DesignTokens) => StyleSheet.create({
|
|
|
57
73
|
alignItems: 'center',
|
|
58
74
|
justifyContent: 'center',
|
|
59
75
|
paddingVertical: 12,
|
|
60
|
-
paddingHorizontal:
|
|
76
|
+
paddingHorizontal: 20,
|
|
61
77
|
borderRadius: 16,
|
|
62
78
|
gap: 8,
|
|
63
|
-
minWidth:
|
|
79
|
+
minWidth: 110,
|
|
80
|
+
},
|
|
81
|
+
viewResultButton: {
|
|
82
|
+
backgroundColor: tokens.colors.primary,
|
|
64
83
|
},
|
|
65
84
|
shareButton: {
|
|
66
85
|
backgroundColor: tokens.colors.primary,
|
|
@@ -21,6 +21,7 @@ interface CreationDetailScreenProps {
|
|
|
21
21
|
readonly onClose: () => void;
|
|
22
22
|
readonly onShare: (creation: Creation) => void;
|
|
23
23
|
readonly onDelete: (creation: Creation) => void;
|
|
24
|
+
readonly onViewResult?: (creation: Creation) => void;
|
|
24
25
|
readonly t: (key: string) => string;
|
|
25
26
|
}
|
|
26
27
|
|
|
@@ -37,6 +38,7 @@ export const CreationDetailScreen: React.FC<CreationDetailScreenProps> = ({
|
|
|
37
38
|
onClose,
|
|
38
39
|
onShare,
|
|
39
40
|
onDelete,
|
|
41
|
+
onViewResult,
|
|
40
42
|
t
|
|
41
43
|
}) => {
|
|
42
44
|
const tokens = useAppDesignTokens();
|
|
@@ -100,8 +102,10 @@ export const CreationDetailScreen: React.FC<CreationDetailScreenProps> = ({
|
|
|
100
102
|
<DetailActions
|
|
101
103
|
onShare={() => onShare(creation)}
|
|
102
104
|
onDelete={() => onDelete(creation)}
|
|
105
|
+
onViewResult={onViewResult ? () => onViewResult(creation) : undefined}
|
|
103
106
|
shareLabel={t("result.shareButton")}
|
|
104
107
|
deleteLabel={t("common.delete")}
|
|
108
|
+
viewResultLabel={onViewResult ? t("result.viewResult") : undefined}
|
|
105
109
|
/>
|
|
106
110
|
</ScrollView>
|
|
107
111
|
|
|
@@ -55,7 +55,7 @@ export const ResultActionBar: React.FC<ResultActionBarProps> = ({
|
|
|
55
55
|
title={isSaving ? saveButtonLoadingText : saveButtonText}
|
|
56
56
|
onPress={onDownload}
|
|
57
57
|
disabled={isSaving}
|
|
58
|
-
variant="
|
|
58
|
+
variant="outline"
|
|
59
59
|
icon="download"
|
|
60
60
|
style={styles.button}
|
|
61
61
|
/>
|
|
@@ -63,7 +63,7 @@ export const ResultActionBar: React.FC<ResultActionBarProps> = ({
|
|
|
63
63
|
title={isSharing ? shareButtonLoadingText : shareButtonText}
|
|
64
64
|
onPress={onShare}
|
|
65
65
|
disabled={isSharing}
|
|
66
|
-
variant="
|
|
66
|
+
variant="primary"
|
|
67
67
|
icon="share-social"
|
|
68
68
|
style={styles.button}
|
|
69
69
|
/>
|
|
@@ -72,7 +72,7 @@ export const ResultActionBar: React.FC<ResultActionBarProps> = ({
|
|
|
72
72
|
<AtomicButton
|
|
73
73
|
title={tryAgainButtonText}
|
|
74
74
|
onPress={onTryAgain}
|
|
75
|
-
variant="
|
|
75
|
+
variant="outline"
|
|
76
76
|
icon="refresh"
|
|
77
77
|
style={styles.button}
|
|
78
78
|
/>
|
|
@@ -80,7 +80,7 @@ export const ResultActionBar: React.FC<ResultActionBarProps> = ({
|
|
|
80
80
|
<AtomicButton
|
|
81
81
|
title={rateButtonText}
|
|
82
82
|
onPress={onRate}
|
|
83
|
-
variant="
|
|
83
|
+
variant="primary"
|
|
84
84
|
icon="star"
|
|
85
85
|
style={styles.button}
|
|
86
86
|
/>
|