@umituz/react-native-ai-generation-content 1.72.11 → 1.72.12

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.
Files changed (29) hide show
  1. package/package.json +1 -1
  2. package/src/domains/creations/presentation/components/CreationCard.utils.ts +2 -3
  3. package/src/domains/creations/presentation/components/CreationsFilterBar.tsx +41 -5
  4. package/src/domains/creations/presentation/hooks/filterHelpers.ts +5 -17
  5. package/src/domains/image-to-video/presentation/hooks/useFormState.ts +30 -58
  6. package/src/domains/image-to-video/presentation/hooks/useGeneration.ts +41 -71
  7. package/src/domains/text-to-image/presentation/hooks/useFormState.ts +34 -81
  8. package/src/exports/presentation.ts +5 -5
  9. package/src/index.ts +3 -0
  10. package/src/presentation/components/GenerationProgressContent.tsx +5 -2
  11. package/src/presentation/components/PendingJobCard.tsx +9 -2
  12. package/src/presentation/components/README.md +6 -5
  13. package/src/presentation/components/index.ts +0 -4
  14. package/src/shared/components/common/ProgressBar.tsx +99 -0
  15. package/src/shared/components/common/index.ts +5 -0
  16. package/src/shared/components/index.ts +5 -0
  17. package/src/shared/hooks/factories/createFormStateHook.ts +119 -0
  18. package/src/shared/hooks/factories/createGenerationHook.ts +253 -0
  19. package/src/shared/hooks/factories/index.ts +21 -0
  20. package/src/shared/hooks/index.ts +5 -0
  21. package/src/shared/index.ts +14 -0
  22. package/src/shared/utils/date/index.ts +11 -0
  23. package/src/shared/utils/date/normalization.ts +60 -0
  24. package/src/shared/utils/filters/createFilterButtons.ts +60 -0
  25. package/src/shared/utils/filters/index.ts +11 -0
  26. package/src/shared/utils/index.ts +6 -0
  27. package/src/domains/creations/presentation/components/filter-bar-utils.ts +0 -96
  28. package/src/presentation/components/GenerationProgressBar.tsx +0 -78
  29. package/src/presentation/components/PendingJobProgressBar.tsx +0 -56
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Shared Utilities
3
+ */
4
+
5
+ export * from "./date";
6
+ export * from "./filters";
@@ -1,96 +0,0 @@
1
- /**
2
- * CreationsFilterBar Helper Functions
3
- */
4
-
5
- import type {
6
- FilterButton,
7
- MediaFilterLabels,
8
- StatusFilterLabels,
9
- } from "./CreationsFilterBar.types";
10
-
11
- /**
12
- * Helper to create filter buttons from filter state
13
- */
14
- export function createMediaFilterButtons(
15
- activeFilter: string,
16
- onSelect: (filter: string) => void,
17
- labels: MediaFilterLabels
18
- ): FilterButton[] {
19
- return [
20
- {
21
- id: "all",
22
- label: labels.all,
23
- icon: "grid",
24
- active: activeFilter === "all",
25
- onPress: () => onSelect("all"),
26
- },
27
- {
28
- id: "image",
29
- label: labels.images,
30
- icon: "image",
31
- active: activeFilter === "image",
32
- onPress: () => onSelect("image"),
33
- },
34
- {
35
- id: "video",
36
- label: labels.videos,
37
- icon: "film",
38
- active: activeFilter === "video",
39
- onPress: () => onSelect("video"),
40
- },
41
- {
42
- id: "voice",
43
- label: labels.voice,
44
- icon: "mic",
45
- active: activeFilter === "voice",
46
- onPress: () => onSelect("voice"),
47
- },
48
- ];
49
- }
50
-
51
- /**
52
- * Helper to create status filter buttons
53
- */
54
- export function createStatusFilterButtons(
55
- activeFilter: string,
56
- onSelect: (filter: string) => void,
57
- labels: StatusFilterLabels
58
- ): FilterButton[] {
59
- return [
60
- {
61
- id: "all",
62
- label: labels.all,
63
- icon: "options",
64
- active: activeFilter === "all",
65
- onPress: () => onSelect("all"),
66
- },
67
- {
68
- id: "completed",
69
- label: labels.completed,
70
- icon: "checkmark-circle",
71
- active: activeFilter === "completed",
72
- onPress: () => onSelect("completed"),
73
- },
74
- {
75
- id: "processing",
76
- label: labels.processing,
77
- icon: "refresh",
78
- active: activeFilter === "processing",
79
- onPress: () => onSelect("processing"),
80
- },
81
- {
82
- id: "pending",
83
- label: labels.pending,
84
- icon: "time",
85
- active: activeFilter === "pending",
86
- onPress: () => onSelect("pending"),
87
- },
88
- {
89
- id: "failed",
90
- label: labels.failed,
91
- icon: "close-circle",
92
- active: activeFilter === "failed",
93
- onPress: () => onSelect("failed"),
94
- },
95
- ];
96
- }
@@ -1,78 +0,0 @@
1
- /**
2
- * GenerationProgressBar
3
- * Individual progress bar component for AI generation
4
- */
5
-
6
- import React from "react";
7
- import { View, StyleSheet } from "react-native";
8
- import { AtomicText, useAppDesignTokens } from "@umituz/react-native-design-system";
9
- import { clampProgress, roundProgress } from "../../infrastructure/utils/progress.utils";
10
-
11
- export interface GenerationProgressBarProps {
12
- progress: number;
13
- textColor?: string;
14
- progressColor?: string;
15
- backgroundColor?: string;
16
- }
17
-
18
- export const GenerationProgressBar: React.FC<GenerationProgressBarProps> = ({
19
- progress,
20
- textColor,
21
- progressColor,
22
- backgroundColor,
23
- }) => {
24
- const tokens = useAppDesignTokens();
25
- const clampedProgress = clampProgress(progress);
26
-
27
- return (
28
- <View style={styles.container}>
29
- <View
30
- style={[
31
- styles.background,
32
- { backgroundColor: backgroundColor || tokens.colors.borderLight },
33
- ]}
34
- >
35
- <View
36
- style={[
37
- styles.fill,
38
- {
39
- backgroundColor: progressColor || tokens.colors.primary,
40
- width: `${clampedProgress}%`,
41
- },
42
- ]}
43
- />
44
- </View>
45
- <AtomicText
46
- style={[
47
- styles.text,
48
- { color: textColor || tokens.colors.textPrimary },
49
- ]}
50
- >
51
- {roundProgress(clampedProgress)}%
52
- </AtomicText>
53
- </View>
54
- );
55
- };
56
-
57
- const styles = StyleSheet.create({
58
- container: {
59
- width: "100%",
60
- marginBottom: 16,
61
- alignItems: "center",
62
- },
63
- background: {
64
- width: "100%",
65
- height: 8,
66
- borderRadius: 4,
67
- overflow: "hidden",
68
- },
69
- fill: {
70
- height: "100%",
71
- borderRadius: 4,
72
- },
73
- text: {
74
- fontSize: 14,
75
- fontWeight: "600",
76
- marginTop: 8,
77
- },
78
- });
@@ -1,56 +0,0 @@
1
- /**
2
- * PendingJobProgressBar
3
- * Individual progress bar for the PendingJobCard
4
- */
5
-
6
- import React from "react";
7
- import { View, StyleSheet } from "react-native";
8
- import { useAppDesignTokens } from "@umituz/react-native-design-system";
9
- import { clampProgress } from "../../infrastructure/utils/progress.utils";
10
-
11
- export interface PendingJobProgressBarProps {
12
- progress: number;
13
- backgroundColor?: string;
14
- fillColor?: string;
15
- }
16
-
17
- export const PendingJobProgressBar: React.FC<PendingJobProgressBarProps> = ({
18
- progress,
19
- backgroundColor,
20
- fillColor,
21
- }) => {
22
- const tokens = useAppDesignTokens();
23
- const clampedProgress = clampProgress(progress);
24
-
25
- return (
26
- <View
27
- style={[
28
- styles.progressContainer,
29
- { backgroundColor: backgroundColor || tokens.colors.borderLight },
30
- ]}
31
- >
32
- <View
33
- style={[
34
- styles.progressFill,
35
- {
36
- backgroundColor: fillColor || tokens.colors.primary,
37
- width: `${clampedProgress}%`,
38
- },
39
- ]}
40
- />
41
- </View>
42
- );
43
- };
44
-
45
- const styles = StyleSheet.create({
46
- progressContainer: {
47
- height: 4,
48
- borderRadius: 2,
49
- marginTop: 8,
50
- overflow: "hidden",
51
- },
52
- progressFill: {
53
- height: "100%",
54
- borderRadius: 2,
55
- },
56
- });