@umituz/react-native-ai-generation-content 1.37.10 → 1.37.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.
- package/package.json +1 -1
- package/src/domains/creations/presentation/hooks/useGalleryFilters.ts +11 -12
- package/src/domains/creations/presentation/screens/CreationsGalleryScreen.tsx +3 -11
- package/src/domains/creations/presentation/screens/creations-gallery.types.ts +0 -1
- package/src/domains/generation/wizard/infrastructure/builders/dynamic-step-builder.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.37.
|
|
3
|
+
"version": "1.37.12",
|
|
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",
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
import { useState, useCallback, useMemo } from "react";
|
|
8
8
|
import type { Creation } from "../../domain/entities/Creation";
|
|
9
9
|
import type { FilterOption } from "../../domain/types/creation-filter";
|
|
10
|
-
import type { BackgroundJob } from "../../../../domain/entities/job.types";
|
|
11
10
|
import { useFilter } from "./useFilter";
|
|
12
11
|
import { useCreationsFilter } from "./useCreationsFilter";
|
|
13
12
|
|
|
@@ -16,14 +15,13 @@ interface UseGalleryFiltersProps {
|
|
|
16
15
|
readonly statusOptions: FilterOption[];
|
|
17
16
|
readonly mediaOptions: FilterOption[];
|
|
18
17
|
readonly t: (key: string) => string;
|
|
19
|
-
/** Pending background jobs to include in status counts */
|
|
20
|
-
readonly pendingJobs?: BackgroundJob[];
|
|
21
18
|
}
|
|
22
19
|
|
|
23
20
|
interface UseGalleryFiltersReturn {
|
|
24
21
|
readonly filtered: Creation[];
|
|
25
22
|
readonly isFiltered: boolean;
|
|
26
23
|
readonly activeFiltersCount: number;
|
|
24
|
+
readonly processingCount: number;
|
|
27
25
|
readonly statusFilterVisible: boolean;
|
|
28
26
|
readonly mediaFilterVisible: boolean;
|
|
29
27
|
readonly statusFilter: ReturnType<typeof useFilter>;
|
|
@@ -40,27 +38,27 @@ export function useGalleryFilters({
|
|
|
40
38
|
statusOptions,
|
|
41
39
|
mediaOptions,
|
|
42
40
|
t,
|
|
43
|
-
pendingJobs = [],
|
|
44
41
|
}: UseGalleryFiltersProps): UseGalleryFiltersReturn {
|
|
45
42
|
const [statusFilterVisible, setStatusFilterVisible] = useState(false);
|
|
46
43
|
const [mediaFilterVisible, setMediaFilterVisible] = useState(false);
|
|
47
44
|
|
|
48
|
-
// Calculate
|
|
49
|
-
const
|
|
50
|
-
return
|
|
51
|
-
|
|
45
|
+
// Calculate processing count from creations status (single source of truth)
|
|
46
|
+
const processingCount = useMemo(() => {
|
|
47
|
+
if (!creations) return 0;
|
|
48
|
+
return creations.filter(
|
|
49
|
+
(c) => c.status === "processing" || c.status === "queued",
|
|
52
50
|
).length;
|
|
53
|
-
}, [
|
|
51
|
+
}, [creations]);
|
|
54
52
|
|
|
55
53
|
// Enrich status options with dynamic counts
|
|
56
54
|
const enrichedStatusOptions = useMemo(() => {
|
|
57
55
|
return statusOptions.map((option) => {
|
|
58
|
-
if (option.id === "processing" &&
|
|
59
|
-
return { ...option, count:
|
|
56
|
+
if (option.id === "processing" && processingCount > 0) {
|
|
57
|
+
return { ...option, count: processingCount };
|
|
60
58
|
}
|
|
61
59
|
return option;
|
|
62
60
|
});
|
|
63
|
-
}, [statusOptions,
|
|
61
|
+
}, [statusOptions, processingCount]);
|
|
64
62
|
|
|
65
63
|
const statusFilter = useFilter({ options: enrichedStatusOptions, t });
|
|
66
64
|
const mediaFilter = useFilter({ options: mediaOptions, t });
|
|
@@ -85,6 +83,7 @@ export function useGalleryFilters({
|
|
|
85
83
|
filtered,
|
|
86
84
|
isFiltered,
|
|
87
85
|
activeFiltersCount,
|
|
86
|
+
processingCount,
|
|
88
87
|
statusFilterVisible,
|
|
89
88
|
mediaFilterVisible,
|
|
90
89
|
statusFilter,
|
|
@@ -12,7 +12,6 @@ import { useGalleryFilters } from "../hooks/useGalleryFilters";
|
|
|
12
12
|
import { useGalleryCallbacks } from "../hooks/useGalleryCallbacks";
|
|
13
13
|
import { GalleryHeader, CreationCard, GalleryEmptyStates } from "../components";
|
|
14
14
|
import { GalleryResultPreview } from "../components/GalleryResultPreview";
|
|
15
|
-
import { usePendingJobs } from "../../../../presentation/hooks/use-pending-jobs";
|
|
16
15
|
import { MEDIA_FILTER_OPTIONS, STATUS_FILTER_OPTIONS } from "../../domain/types/creation-filter";
|
|
17
16
|
import { getPreviewUrl } from "../../domain/utils";
|
|
18
17
|
import type { Creation } from "../../domain/entities/Creation";
|
|
@@ -30,7 +29,6 @@ export function CreationsGalleryScreen({
|
|
|
30
29
|
onEmptyAction,
|
|
31
30
|
emptyActionLabel,
|
|
32
31
|
showFilter = config.showFilter ?? true,
|
|
33
|
-
showPendingJobs = true,
|
|
34
32
|
}: CreationsGalleryScreenProps) {
|
|
35
33
|
const tokens = useAppDesignTokens();
|
|
36
34
|
const [selectedCreation, setSelectedCreation] = useState<Creation | null>(null);
|
|
@@ -38,7 +36,6 @@ export function CreationsGalleryScreen({
|
|
|
38
36
|
const hasAutoSelectedRef = useRef(false);
|
|
39
37
|
|
|
40
38
|
const { data: creations, isLoading, refetch } = useCreations({ userId, repository });
|
|
41
|
-
const { jobs: pendingJobs } = usePendingJobs();
|
|
42
39
|
const deleteMutation = useDeleteCreation({ userId, repository });
|
|
43
40
|
|
|
44
41
|
useEffect(() => {
|
|
@@ -68,7 +65,7 @@ export function CreationsGalleryScreen({
|
|
|
68
65
|
const showStatusFilter = config.filterConfig?.showStatusFilter ?? true;
|
|
69
66
|
const showMediaFilter = config.filterConfig?.showMediaFilter ?? true;
|
|
70
67
|
|
|
71
|
-
const filters = useGalleryFilters({ creations, statusOptions, mediaOptions, t
|
|
68
|
+
const filters = useGalleryFilters({ creations, statusOptions, mediaOptions, t });
|
|
72
69
|
|
|
73
70
|
useAppFocusEffect(useCallback(() => { void refetch(); }, [refetch]));
|
|
74
71
|
|
|
@@ -113,11 +110,6 @@ export function CreationsGalleryScreen({
|
|
|
113
110
|
/>
|
|
114
111
|
), [callbacks, getScenarioTitle]);
|
|
115
112
|
|
|
116
|
-
const activePendingCount = useMemo(() => {
|
|
117
|
-
if (!showPendingJobs) return 0;
|
|
118
|
-
return pendingJobs.filter((j) => j.status === "processing" || j.status === "queued").length;
|
|
119
|
-
}, [showPendingJobs, pendingJobs]);
|
|
120
|
-
|
|
121
113
|
const renderHeader = useMemo(() => {
|
|
122
114
|
if (!creations?.length && !isLoading) return null;
|
|
123
115
|
return (
|
|
@@ -128,12 +120,12 @@ export function CreationsGalleryScreen({
|
|
|
128
120
|
countLabel={t(config.translations.photoCount)}
|
|
129
121
|
showFilter={showFilter}
|
|
130
122
|
filterButtons={filterButtons}
|
|
131
|
-
pendingCount={
|
|
123
|
+
pendingCount={filters.processingCount}
|
|
132
124
|
pendingLabel={t("creations.processing")}
|
|
133
125
|
/>
|
|
134
126
|
</View>
|
|
135
127
|
);
|
|
136
|
-
}, [creations, isLoading, filters.filtered.length, showFilter, filterButtons, t, config, tokens
|
|
128
|
+
}, [creations, isLoading, filters.filtered.length, filters.processingCount, showFilter, filterButtons, t, config, tokens]);
|
|
137
129
|
|
|
138
130
|
const renderEmpty = useMemo(() => (
|
|
139
131
|
<GalleryEmptyStates
|
|
@@ -104,7 +104,7 @@ export const quickBuildWizard = (
|
|
|
104
104
|
featureId: string,
|
|
105
105
|
scenarioConfig: ScenarioBasedConfig,
|
|
106
106
|
): StepDefinition[] => {
|
|
107
|
-
const { buildWizardConfigFromScenario } = require("../../domain/entities/wizard-
|
|
107
|
+
const { buildWizardConfigFromScenario } = require("../../domain/entities/wizard-feature.types");
|
|
108
108
|
const wizardConfig = buildWizardConfigFromScenario(featureId, scenarioConfig);
|
|
109
109
|
return buildFlowStepsFromWizard(wizardConfig, {
|
|
110
110
|
includePreview: true,
|