@umituz/react-native-ai-generation-content 1.12.21 → 1.12.23
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 +33 -15
- package/src/domains/content-moderation/infrastructure/services/content-moderation.service.ts +4 -32
- package/src/domains/content-moderation/infrastructure/services/moderators/base.moderator.ts +1 -1
- package/src/domains/face-detection/infrastructure/validators/faceValidator.ts +1 -1
- package/src/domains/face-detection/presentation/components/FaceValidationStatus.tsx +3 -3
- package/src/domains/feature-background/presentation/components/BackgroundFeature.tsx +5 -4
- package/src/domains/feature-background/presentation/components/ComparisonSlider.tsx +45 -51
- package/src/domains/feature-background/presentation/components/ErrorDisplay.tsx +5 -3
- package/src/domains/feature-background/presentation/components/ModeSelector.tsx +2 -2
- package/src/domains/feature-background/presentation/hooks/useBackgroundFeature.ts +3 -2
- package/src/domains/prompts/domain/entities/FuturePredictionConfig.ts +2 -1
- package/src/domains/prompts/domain/entities/GeneratedPrompt.ts +0 -1
- package/src/domains/prompts/domain/repositories/IAIPromptServices.ts +6 -12
- package/src/domains/prompts/infrastructure/repositories/PromptHistoryRepository.ts +42 -42
- package/src/domains/prompts/infrastructure/repositories/TemplateRepository.ts +42 -42
- package/src/domains/prompts/infrastructure/services/BackgroundRemovalService.ts +7 -7
- package/src/domains/prompts/infrastructure/services/ColorizationService.ts +7 -7
- package/src/domains/prompts/infrastructure/services/FaceSwapService.ts +19 -20
- package/src/domains/prompts/infrastructure/services/FuturePredictionService.ts +11 -31
- package/src/domains/prompts/infrastructure/services/ImageEnhancementService.ts +7 -7
- package/src/domains/prompts/infrastructure/services/PhotoRestorationService.ts +7 -7
- package/src/domains/prompts/infrastructure/services/PromptGenerationService.ts +13 -13
- package/src/domains/prompts/infrastructure/services/StyleTransferService.ts +8 -8
- package/src/domains/prompts/infrastructure/services/TextGenerationService.ts +7 -7
- package/src/domains/prompts/presentation/hooks/useAIServices.ts +30 -28
- package/src/domains/prompts/presentation/hooks/useFaceSwap.ts +1 -2
- package/src/domains/prompts/presentation/hooks/usePromptGeneration.ts +4 -5
- package/src/domains/prompts/presentation/hooks/useStyleTransfer.ts +1 -1
- package/src/domains/prompts/presentation/hooks/useTemplateRepository.ts +3 -3
- package/src/domains/prompts/presentation/theme/utils.ts +1 -1
- package/src/index.ts +0 -5
- package/src/infrastructure/utils/status-checker.util.ts +4 -4
- package/src/infrastructure/wrappers/synchronous-generation.wrapper.ts +3 -3
- package/src/presentation/components/result/GenerationResultContent.tsx +21 -22
- package/src/presentation/components/result/ResultActions.tsx +51 -52
- package/src/presentation/components/result/ResultHeader.tsx +24 -25
- package/src/presentation/components/result/ResultImageCard.tsx +19 -20
- package/src/presentation/components/result/ResultStoryCard.tsx +23 -24
- package/src/presentation/hooks/photo-generation.types.ts +4 -4
- package/src/presentation/hooks/usePhotoGeneration.ts +18 -13
- package/src/domains/creations/application/services/CreationsService.ts +0 -72
- package/src/domains/creations/domain/entities/Creation.ts +0 -54
- package/src/domains/creations/domain/entities/index.ts +0 -6
- package/src/domains/creations/domain/repositories/ICreationsRepository.ts +0 -25
- package/src/domains/creations/domain/repositories/index.ts +0 -5
- package/src/domains/creations/domain/services/ICreationsStorageService.ts +0 -13
- package/src/domains/creations/domain/value-objects/CreationsConfig.ts +0 -77
- package/src/domains/creations/domain/value-objects/index.ts +0 -12
- package/src/domains/creations/index.ts +0 -84
- package/src/domains/creations/infrastructure/adapters/createRepository.ts +0 -54
- package/src/domains/creations/infrastructure/adapters/index.ts +0 -5
- package/src/domains/creations/infrastructure/repositories/CreationsRepository.ts +0 -263
- package/src/domains/creations/infrastructure/repositories/index.ts +0 -8
- package/src/domains/creations/infrastructure/services/CreationsStorageService.ts +0 -48
- package/src/domains/creations/presentation/components/CreationCard.tsx +0 -196
- package/src/domains/creations/presentation/components/CreationDetail/DetailActions.tsx +0 -76
- package/src/domains/creations/presentation/components/CreationDetail/DetailHeader.tsx +0 -81
- package/src/domains/creations/presentation/components/CreationDetail/DetailImage.tsx +0 -41
- package/src/domains/creations/presentation/components/CreationDetail/DetailStory.tsx +0 -67
- package/src/domains/creations/presentation/components/CreationDetail/index.ts +0 -4
- package/src/domains/creations/presentation/components/CreationImageViewer.tsx +0 -101
- package/src/domains/creations/presentation/components/CreationThumbnail.tsx +0 -63
- package/src/domains/creations/presentation/components/CreationsGalleryEmptyState.tsx +0 -77
- package/src/domains/creations/presentation/components/CreationsGrid.tsx +0 -87
- package/src/domains/creations/presentation/components/CreationsHomeCard.tsx +0 -176
- package/src/domains/creations/presentation/components/EmptyState.tsx +0 -75
- package/src/domains/creations/presentation/components/FilterBottomSheet.tsx +0 -157
- package/src/domains/creations/presentation/components/FilterChips.tsx +0 -105
- package/src/domains/creations/presentation/components/GalleryHeader.tsx +0 -157
- package/src/domains/creations/presentation/components/index.ts +0 -20
- package/src/domains/creations/presentation/hooks/index.ts +0 -9
- package/src/domains/creations/presentation/hooks/useCreations.ts +0 -33
- package/src/domains/creations/presentation/hooks/useCreationsFilter.ts +0 -90
- package/src/domains/creations/presentation/hooks/useDeleteCreation.ts +0 -51
- package/src/domains/creations/presentation/hooks/useDeleteMultipleCreations.ts +0 -57
- package/src/domains/creations/presentation/hooks/useToggleFavorite.ts +0 -59
- package/src/domains/creations/presentation/screens/CreationDetailScreen.tsx +0 -71
- package/src/domains/creations/presentation/screens/CreationsGalleryScreen.tsx +0 -264
- package/src/domains/creations/presentation/screens/index.ts +0 -5
- package/src/domains/creations/presentation/utils/filterUtils.ts +0 -52
- package/src/domains/creations/types.d.ts +0 -107
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useCallback, useMemo } from 'react';
|
|
2
|
-
import { View, StyleSheet, TouchableOpacity, ScrollView } from 'react-native';
|
|
3
|
-
import { BottomSheetModal, type BottomSheetModalRef, useAppDesignTokens, AtomicText, AtomicIcon } from '@umituz/react-native-design-system';
|
|
4
|
-
|
|
5
|
-
export interface FilterOption {
|
|
6
|
-
id: string;
|
|
7
|
-
label: string;
|
|
8
|
-
icon?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface FilterCategory {
|
|
12
|
-
id: string;
|
|
13
|
-
title: string;
|
|
14
|
-
multiSelect?: boolean;
|
|
15
|
-
options: FilterOption[];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface FilterBottomSheetProps {
|
|
19
|
-
categories: FilterCategory[];
|
|
20
|
-
selectedIds: string[];
|
|
21
|
-
onFilterPress: (id: string, categoryId: string) => void;
|
|
22
|
-
onClearFilters: () => void;
|
|
23
|
-
title: string;
|
|
24
|
-
snapPoints?: string[];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const FilterBottomSheet = forwardRef<BottomSheetModalRef, FilterBottomSheetProps>((props, ref) => {
|
|
28
|
-
const { categories, selectedIds, onFilterPress, onClearFilters, title, snapPoints: propSnapPoints } = props;
|
|
29
|
-
const tokens = useAppDesignTokens();
|
|
30
|
-
const styles = useStyles(tokens);
|
|
31
|
-
|
|
32
|
-
const snapPoints = useMemo(() => propSnapPoints || ['50%', '75%'], [propSnapPoints]);
|
|
33
|
-
|
|
34
|
-
const renderOption = useCallback((option: FilterOption, category: FilterCategory) => {
|
|
35
|
-
const isSelected = selectedIds.includes(option.id);
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<TouchableOpacity
|
|
39
|
-
key={option.id}
|
|
40
|
-
style={[styles.option, isSelected && styles.optionSelected]}
|
|
41
|
-
onPress={() => onFilterPress(option.id, category.id)}
|
|
42
|
-
>
|
|
43
|
-
<View style={styles.optionContent}>
|
|
44
|
-
{option.icon && (
|
|
45
|
-
<View style={styles.optionIcon}>
|
|
46
|
-
<AtomicIcon
|
|
47
|
-
name={option.icon as any}
|
|
48
|
-
size="sm"
|
|
49
|
-
color={isSelected ? "primary" : "onSurface"}
|
|
50
|
-
/>
|
|
51
|
-
</View>
|
|
52
|
-
)}
|
|
53
|
-
<AtomicText
|
|
54
|
-
style={[styles.optionLabel, isSelected && styles.optionLabelSelected]}
|
|
55
|
-
>
|
|
56
|
-
{option.label}
|
|
57
|
-
</AtomicText>
|
|
58
|
-
</View>
|
|
59
|
-
{isSelected && (
|
|
60
|
-
<AtomicIcon name="check" size="sm" color="primary" />
|
|
61
|
-
)}
|
|
62
|
-
</TouchableOpacity>
|
|
63
|
-
);
|
|
64
|
-
}, [onFilterPress, selectedIds, styles]);
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<BottomSheetModal
|
|
68
|
-
ref={ref}
|
|
69
|
-
snapPoints={snapPoints}
|
|
70
|
-
>
|
|
71
|
-
<View style={styles.header}>
|
|
72
|
-
<AtomicText style={styles.headerTitle}>{title}</AtomicText>
|
|
73
|
-
<TouchableOpacity onPress={onClearFilters}>
|
|
74
|
-
<AtomicText style={styles.clearButton}>Clear</AtomicText>
|
|
75
|
-
</TouchableOpacity>
|
|
76
|
-
</View>
|
|
77
|
-
|
|
78
|
-
<ScrollView contentContainerStyle={styles.content}>
|
|
79
|
-
{categories.map(category => (
|
|
80
|
-
<View key={category.id} style={styles.categoryContainer}>
|
|
81
|
-
<AtomicText style={styles.categoryTitle}>{category.title}</AtomicText>
|
|
82
|
-
<View style={styles.optionsContainer}>
|
|
83
|
-
{category.options.map(option => renderOption(option, category))}
|
|
84
|
-
</View>
|
|
85
|
-
</View>
|
|
86
|
-
))}
|
|
87
|
-
</ScrollView>
|
|
88
|
-
</BottomSheetModal>
|
|
89
|
-
);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
const useStyles = (tokens: any) => StyleSheet.create({
|
|
93
|
-
content: {
|
|
94
|
-
padding: tokens.spacing.md,
|
|
95
|
-
paddingBottom: tokens.spacing.xl,
|
|
96
|
-
},
|
|
97
|
-
header: {
|
|
98
|
-
flexDirection: 'row',
|
|
99
|
-
justifyContent: 'space-between',
|
|
100
|
-
alignItems: 'center',
|
|
101
|
-
paddingHorizontal: tokens.spacing.md,
|
|
102
|
-
paddingBottom: tokens.spacing.sm,
|
|
103
|
-
borderBottomWidth: 1,
|
|
104
|
-
borderBottomColor: tokens.colors.outline,
|
|
105
|
-
},
|
|
106
|
-
headerTitle: {
|
|
107
|
-
fontSize: 20,
|
|
108
|
-
fontWeight: '700',
|
|
109
|
-
color: tokens.colors.textPrimary,
|
|
110
|
-
},
|
|
111
|
-
clearButton: {
|
|
112
|
-
color: tokens.colors.primary,
|
|
113
|
-
fontSize: 14,
|
|
114
|
-
fontWeight: '600',
|
|
115
|
-
},
|
|
116
|
-
categoryContainer: {
|
|
117
|
-
marginTop: tokens.spacing.md,
|
|
118
|
-
},
|
|
119
|
-
categoryTitle: {
|
|
120
|
-
marginBottom: tokens.spacing.xs,
|
|
121
|
-
color: tokens.colors.textSecondary,
|
|
122
|
-
fontSize: 16,
|
|
123
|
-
fontWeight: '600',
|
|
124
|
-
},
|
|
125
|
-
optionsContainer: {
|
|
126
|
-
backgroundColor: tokens.colors.background,
|
|
127
|
-
borderRadius: tokens.borderRadius.md,
|
|
128
|
-
overflow: 'hidden',
|
|
129
|
-
},
|
|
130
|
-
option: {
|
|
131
|
-
flexDirection: 'row',
|
|
132
|
-
alignItems: 'center',
|
|
133
|
-
justifyContent: 'space-between',
|
|
134
|
-
padding: tokens.spacing.md,
|
|
135
|
-
backgroundColor: tokens.colors.background,
|
|
136
|
-
borderBottomWidth: 1,
|
|
137
|
-
borderBottomColor: tokens.colors.surface,
|
|
138
|
-
},
|
|
139
|
-
optionSelected: {
|
|
140
|
-
backgroundColor: tokens.colors.surface,
|
|
141
|
-
},
|
|
142
|
-
optionContent: {
|
|
143
|
-
flexDirection: 'row',
|
|
144
|
-
alignItems: 'center',
|
|
145
|
-
},
|
|
146
|
-
optionIcon: {
|
|
147
|
-
marginRight: tokens.spacing.sm,
|
|
148
|
-
},
|
|
149
|
-
optionLabel: {
|
|
150
|
-
color: tokens.colors.text,
|
|
151
|
-
fontSize: 14,
|
|
152
|
-
},
|
|
153
|
-
optionLabelSelected: {
|
|
154
|
-
color: tokens.colors.primary,
|
|
155
|
-
fontWeight: 'bold',
|
|
156
|
-
},
|
|
157
|
-
});
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FilterChips Component
|
|
3
|
-
* Displays filter chips for creation types
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React, { useMemo } from "react";
|
|
7
|
-
import { View, TouchableOpacity, StyleSheet, ScrollView } from "react-native";
|
|
8
|
-
import { AtomicText, useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
9
|
-
import type { CreationType } from "../../domain/value-objects/CreationsConfig";
|
|
10
|
-
|
|
11
|
-
interface FilterChipsProps {
|
|
12
|
-
readonly types: readonly CreationType[];
|
|
13
|
-
readonly availableTypes: string[];
|
|
14
|
-
readonly selectedType: string;
|
|
15
|
-
readonly allLabel: string;
|
|
16
|
-
readonly onSelect: (type: string) => void;
|
|
17
|
-
readonly style?: any;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function FilterChips({
|
|
21
|
-
types,
|
|
22
|
-
availableTypes,
|
|
23
|
-
selectedType,
|
|
24
|
-
allLabel,
|
|
25
|
-
onSelect,
|
|
26
|
-
style,
|
|
27
|
-
}: FilterChipsProps) {
|
|
28
|
-
const tokens = useAppDesignTokens();
|
|
29
|
-
|
|
30
|
-
const styles = useMemo(
|
|
31
|
-
() =>
|
|
32
|
-
StyleSheet.create({
|
|
33
|
-
container: {
|
|
34
|
-
marginBottom: tokens.spacing.md,
|
|
35
|
-
},
|
|
36
|
-
scrollContent: {
|
|
37
|
-
paddingHorizontal: tokens.spacing.md,
|
|
38
|
-
gap: tokens.spacing.sm,
|
|
39
|
-
flexDirection: "row",
|
|
40
|
-
},
|
|
41
|
-
chip: {
|
|
42
|
-
paddingHorizontal: tokens.spacing.md,
|
|
43
|
-
paddingVertical: tokens.spacing.sm,
|
|
44
|
-
borderRadius: tokens.spacing.lg,
|
|
45
|
-
backgroundColor: tokens.colors.backgroundSecondary,
|
|
46
|
-
},
|
|
47
|
-
chipSelected: {
|
|
48
|
-
backgroundColor: tokens.colors.primary,
|
|
49
|
-
},
|
|
50
|
-
chipText: {
|
|
51
|
-
...tokens.typography.bodySmall,
|
|
52
|
-
color: tokens.colors.textSecondary,
|
|
53
|
-
},
|
|
54
|
-
chipTextSelected: {
|
|
55
|
-
color: tokens.colors.textInverse,
|
|
56
|
-
},
|
|
57
|
-
}),
|
|
58
|
-
[tokens],
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
const visibleTypes = types.filter((t) => availableTypes.includes(t.id));
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<View style={[styles.container, style]}>
|
|
65
|
-
<ScrollView
|
|
66
|
-
horizontal
|
|
67
|
-
showsHorizontalScrollIndicator={false}
|
|
68
|
-
contentContainerStyle={styles.scrollContent}
|
|
69
|
-
>
|
|
70
|
-
<TouchableOpacity
|
|
71
|
-
style={[styles.chip, selectedType === "all" && styles.chipSelected]}
|
|
72
|
-
onPress={() => onSelect("all")}
|
|
73
|
-
>
|
|
74
|
-
<AtomicText
|
|
75
|
-
style={[
|
|
76
|
-
styles.chipText,
|
|
77
|
-
selectedType === "all" && styles.chipTextSelected,
|
|
78
|
-
]}
|
|
79
|
-
>
|
|
80
|
-
{allLabel}
|
|
81
|
-
</AtomicText>
|
|
82
|
-
</TouchableOpacity>
|
|
83
|
-
{visibleTypes.map((type) => (
|
|
84
|
-
<TouchableOpacity
|
|
85
|
-
key={type.id}
|
|
86
|
-
style={[
|
|
87
|
-
styles.chip,
|
|
88
|
-
selectedType === type.id && styles.chipSelected,
|
|
89
|
-
]}
|
|
90
|
-
onPress={() => onSelect(type.id)}
|
|
91
|
-
>
|
|
92
|
-
<AtomicText
|
|
93
|
-
style={[
|
|
94
|
-
styles.chipText,
|
|
95
|
-
selectedType === type.id && styles.chipTextSelected,
|
|
96
|
-
]}
|
|
97
|
-
>
|
|
98
|
-
{type.icon} {type.labelKey}
|
|
99
|
-
</AtomicText>
|
|
100
|
-
</TouchableOpacity>
|
|
101
|
-
))}
|
|
102
|
-
</ScrollView>
|
|
103
|
-
</View>
|
|
104
|
-
);
|
|
105
|
-
}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View, TouchableOpacity, StyleSheet } from 'react-native';
|
|
3
|
-
import { AtomicText, AtomicIcon, useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
4
|
-
|
|
5
|
-
interface GalleryHeaderProps {
|
|
6
|
-
readonly title: string;
|
|
7
|
-
readonly count: number;
|
|
8
|
-
readonly countLabel: string;
|
|
9
|
-
readonly isFiltered: boolean;
|
|
10
|
-
readonly onFilterPress: () => void;
|
|
11
|
-
readonly filterLabel?: string;
|
|
12
|
-
readonly filterIcon?: any;
|
|
13
|
-
readonly onFavoritesPress?: () => void;
|
|
14
|
-
readonly showOnlyFavorites?: boolean;
|
|
15
|
-
readonly style?: any;
|
|
16
|
-
readonly subtitle?: string;
|
|
17
|
-
readonly isFilterEnabled?: boolean;
|
|
18
|
-
readonly showCount?: boolean;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const GalleryHeader: React.FC<GalleryHeaderProps> = ({
|
|
22
|
-
title,
|
|
23
|
-
count,
|
|
24
|
-
countLabel,
|
|
25
|
-
isFiltered,
|
|
26
|
-
onFilterPress,
|
|
27
|
-
filterLabel = 'Filter',
|
|
28
|
-
filterIcon = 'filter-outline',
|
|
29
|
-
onFavoritesPress,
|
|
30
|
-
showOnlyFavorites = false,
|
|
31
|
-
subtitle,
|
|
32
|
-
isFilterEnabled = true,
|
|
33
|
-
showCount = true,
|
|
34
|
-
style,
|
|
35
|
-
}) => {
|
|
36
|
-
const tokens = useAppDesignTokens();
|
|
37
|
-
const styles = useStyles(tokens);
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<View style={[styles.headerArea, style]}>
|
|
41
|
-
<View style={styles.titleArea}>
|
|
42
|
-
{!!title && <AtomicText style={styles.title}>{title}</AtomicText>}
|
|
43
|
-
<AtomicText style={styles.subtitle}>
|
|
44
|
-
{subtitle || (showCount ? `${count} ${countLabel}` : '')}
|
|
45
|
-
</AtomicText>
|
|
46
|
-
</View>
|
|
47
|
-
<View style={styles.actions}>
|
|
48
|
-
{onFavoritesPress && (
|
|
49
|
-
<TouchableOpacity
|
|
50
|
-
onPress={onFavoritesPress}
|
|
51
|
-
style={[styles.actionButton, showOnlyFavorites && styles.actionButtonActive]}
|
|
52
|
-
activeOpacity={0.7}
|
|
53
|
-
>
|
|
54
|
-
<AtomicIcon
|
|
55
|
-
name={showOnlyFavorites ? "heart" : "heart-outline"}
|
|
56
|
-
size="sm"
|
|
57
|
-
color={showOnlyFavorites ? "error" : "secondary"}
|
|
58
|
-
/>
|
|
59
|
-
</TouchableOpacity>
|
|
60
|
-
)}
|
|
61
|
-
{isFilterEnabled && (
|
|
62
|
-
<TouchableOpacity
|
|
63
|
-
onPress={onFilterPress}
|
|
64
|
-
style={[styles.filterButton, isFiltered && styles.filterButtonActive]}
|
|
65
|
-
activeOpacity={0.7}
|
|
66
|
-
>
|
|
67
|
-
<AtomicIcon
|
|
68
|
-
name={filterIcon}
|
|
69
|
-
size="sm"
|
|
70
|
-
color={isFiltered ? "primary" : "secondary"}
|
|
71
|
-
/>
|
|
72
|
-
<AtomicText style={[styles.filterText, { color: isFiltered ? tokens.colors.primary : tokens.colors.textSecondary }]}>
|
|
73
|
-
{filterLabel}
|
|
74
|
-
</AtomicText>
|
|
75
|
-
{isFiltered && (
|
|
76
|
-
<View style={styles.badge} />
|
|
77
|
-
)}
|
|
78
|
-
</TouchableOpacity>
|
|
79
|
-
)}
|
|
80
|
-
</View>
|
|
81
|
-
</View>
|
|
82
|
-
);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
const useStyles = (tokens: any) => StyleSheet.create({
|
|
86
|
-
headerArea: {
|
|
87
|
-
flexDirection: "row",
|
|
88
|
-
alignItems: "center",
|
|
89
|
-
justifyContent: 'space-between',
|
|
90
|
-
paddingHorizontal: tokens.spacing.md,
|
|
91
|
-
paddingVertical: tokens.spacing.sm,
|
|
92
|
-
marginBottom: tokens.spacing.sm,
|
|
93
|
-
},
|
|
94
|
-
titleArea: {
|
|
95
|
-
flex: 1,
|
|
96
|
-
marginRight: tokens.spacing.md,
|
|
97
|
-
},
|
|
98
|
-
title: {
|
|
99
|
-
fontSize: 20,
|
|
100
|
-
fontWeight: "700",
|
|
101
|
-
color: tokens.colors.textPrimary,
|
|
102
|
-
marginBottom: 4,
|
|
103
|
-
},
|
|
104
|
-
subtitle: {
|
|
105
|
-
fontSize: 14,
|
|
106
|
-
color: tokens.colors.textSecondary,
|
|
107
|
-
opacity: 0.6
|
|
108
|
-
},
|
|
109
|
-
actions: {
|
|
110
|
-
flexDirection: 'row',
|
|
111
|
-
alignItems: 'center',
|
|
112
|
-
gap: tokens.spacing.sm,
|
|
113
|
-
},
|
|
114
|
-
actionButton: {
|
|
115
|
-
width: 40,
|
|
116
|
-
height: 40,
|
|
117
|
-
borderRadius: 20,
|
|
118
|
-
backgroundColor: tokens.colors.surfaceVariant,
|
|
119
|
-
justifyContent: 'center',
|
|
120
|
-
alignItems: 'center',
|
|
121
|
-
borderWidth: 1,
|
|
122
|
-
borderColor: 'transparent',
|
|
123
|
-
},
|
|
124
|
-
actionButtonActive: {
|
|
125
|
-
backgroundColor: tokens.colors.primary + "15",
|
|
126
|
-
borderColor: tokens.colors.primary + "30",
|
|
127
|
-
},
|
|
128
|
-
filterButton: {
|
|
129
|
-
flexDirection: 'row',
|
|
130
|
-
alignItems: 'center',
|
|
131
|
-
gap: tokens.spacing.xs,
|
|
132
|
-
paddingVertical: tokens.spacing.xs,
|
|
133
|
-
paddingHorizontal: tokens.spacing.md,
|
|
134
|
-
borderRadius: 999,
|
|
135
|
-
backgroundColor: tokens.colors.surfaceVariant,
|
|
136
|
-
borderWidth: 1,
|
|
137
|
-
borderColor: 'transparent',
|
|
138
|
-
height: 40,
|
|
139
|
-
},
|
|
140
|
-
filterButtonActive: {
|
|
141
|
-
backgroundColor: tokens.colors.primary + "15",
|
|
142
|
-
borderColor: tokens.colors.primary + "30",
|
|
143
|
-
},
|
|
144
|
-
filterText: {
|
|
145
|
-
fontSize: 14,
|
|
146
|
-
fontWeight: "500",
|
|
147
|
-
},
|
|
148
|
-
badge: {
|
|
149
|
-
width: 8,
|
|
150
|
-
height: 8,
|
|
151
|
-
borderRadius: 4,
|
|
152
|
-
backgroundColor: tokens.colors.primary,
|
|
153
|
-
position: 'absolute',
|
|
154
|
-
top: 6,
|
|
155
|
-
right: 6,
|
|
156
|
-
},
|
|
157
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Presentation Components
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export { GalleryHeader } from "./GalleryHeader";
|
|
6
|
-
export { EmptyState } from "./EmptyState";
|
|
7
|
-
export { FilterChips } from "./FilterChips";
|
|
8
|
-
export { CreationsHomeCard } from "./CreationsHomeCard";
|
|
9
|
-
export { CreationCard } from "./CreationCard";
|
|
10
|
-
export { CreationThumbnail } from "./CreationThumbnail";
|
|
11
|
-
export { CreationImageViewer } from "./CreationImageViewer";
|
|
12
|
-
export { CreationsGrid } from "./CreationsGrid";
|
|
13
|
-
export { CreationsGalleryEmptyState } from "./CreationsGalleryEmptyState";
|
|
14
|
-
export { FilterBottomSheet, type FilterCategory, type FilterOption } from "./FilterBottomSheet";
|
|
15
|
-
|
|
16
|
-
// Detail Components
|
|
17
|
-
export { DetailHeader } from "./CreationDetail/DetailHeader";
|
|
18
|
-
export { DetailImage } from "./CreationDetail/DetailImage";
|
|
19
|
-
export { DetailStory } from "./CreationDetail/DetailStory";
|
|
20
|
-
export { DetailActions } from "./CreationDetail/DetailActions";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Presentation Hooks
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export { useCreations } from "./useCreations";
|
|
6
|
-
export { useDeleteCreation } from "./useDeleteCreation";
|
|
7
|
-
export { useCreationsFilter } from "./useCreationsFilter";
|
|
8
|
-
export { useToggleFavorite } from "./useToggleFavorite";
|
|
9
|
-
export { useDeleteMultipleCreations } from "./useDeleteMultipleCreations";
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useCreations Hook
|
|
3
|
-
* Fetches user's creations from repository
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { useQuery } from "@tanstack/react-query";
|
|
7
|
-
import type { ICreationsRepository } from "../../domain/repositories/ICreationsRepository";
|
|
8
|
-
import type { Creation } from "../../domain/entities/Creation";
|
|
9
|
-
|
|
10
|
-
const CACHE_CONFIG = {
|
|
11
|
-
staleTime: 5 * 60 * 1000, // 5 minutes - use cache invalidation on mutations
|
|
12
|
-
gcTime: 30 * 60 * 1000,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
interface UseCreationsProps {
|
|
16
|
-
readonly userId: string | null;
|
|
17
|
-
readonly repository: ICreationsRepository;
|
|
18
|
-
readonly enabled?: boolean;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function useCreations({
|
|
22
|
-
userId,
|
|
23
|
-
repository,
|
|
24
|
-
enabled = true,
|
|
25
|
-
}: UseCreationsProps) {
|
|
26
|
-
return useQuery<Creation[]>({
|
|
27
|
-
queryKey: ["creations", userId ?? ""],
|
|
28
|
-
queryFn: () => repository.getAll(userId!),
|
|
29
|
-
enabled: !!userId && enabled,
|
|
30
|
-
staleTime: CACHE_CONFIG.staleTime,
|
|
31
|
-
gcTime: CACHE_CONFIG.gcTime,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useCreationsFilter Hook
|
|
3
|
-
* Handles filtering of creations by type, search, and favorites
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { useState, useMemo, useCallback } from "react";
|
|
7
|
-
import type { Creation } from "../../domain/entities/Creation";
|
|
8
|
-
|
|
9
|
-
interface UseCreationsFilterProps {
|
|
10
|
-
readonly creations: Creation[] | undefined;
|
|
11
|
-
readonly defaultFilterId?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function useCreationsFilter({
|
|
15
|
-
creations,
|
|
16
|
-
defaultFilterId = "all"
|
|
17
|
-
}: UseCreationsFilterProps) {
|
|
18
|
-
const [selectedIds, setSelectedIds] = useState<string[]>([defaultFilterId]);
|
|
19
|
-
const [searchQuery, setSearchQuery] = useState("");
|
|
20
|
-
const [showOnlyFavorites, setShowOnlyFavorites] = useState(false);
|
|
21
|
-
|
|
22
|
-
const filtered = useMemo(() => {
|
|
23
|
-
if (!creations) return [];
|
|
24
|
-
|
|
25
|
-
let result = creations;
|
|
26
|
-
|
|
27
|
-
// 1. Filter by Favorites
|
|
28
|
-
if (showOnlyFavorites) {
|
|
29
|
-
result = result.filter(c => c.isFavorite);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// 2. Filter by Category/Type
|
|
33
|
-
if (!selectedIds.includes(defaultFilterId)) {
|
|
34
|
-
result = result.filter((c) =>
|
|
35
|
-
selectedIds.includes(c.type) ||
|
|
36
|
-
selectedIds.some(id => (c as any).metadata?.tags?.includes(id))
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// 3. Filter by Search Query
|
|
41
|
-
if (searchQuery.trim()) {
|
|
42
|
-
const query = searchQuery.toLowerCase();
|
|
43
|
-
result = result.filter(c =>
|
|
44
|
-
c.prompt?.toLowerCase().includes(query) ||
|
|
45
|
-
c.type.toLowerCase().includes(query)
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return result;
|
|
50
|
-
}, [creations, selectedIds, defaultFilterId, searchQuery, showOnlyFavorites]);
|
|
51
|
-
|
|
52
|
-
const toggleFilter = useCallback((filterId: string, multiSelect: boolean = false) => {
|
|
53
|
-
setSelectedIds(prev => {
|
|
54
|
-
if (filterId === defaultFilterId) return [defaultFilterId];
|
|
55
|
-
|
|
56
|
-
let newIds: string[];
|
|
57
|
-
if (!multiSelect) {
|
|
58
|
-
if (prev.includes(filterId) && prev.length === 1) return prev;
|
|
59
|
-
newIds = [filterId];
|
|
60
|
-
} else {
|
|
61
|
-
if (prev.includes(filterId)) {
|
|
62
|
-
newIds = prev.filter(id => id !== filterId);
|
|
63
|
-
} else {
|
|
64
|
-
newIds = [...prev.filter(id => id !== defaultFilterId), filterId];
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (newIds.length === 0) return [defaultFilterId];
|
|
69
|
-
return newIds;
|
|
70
|
-
});
|
|
71
|
-
}, [defaultFilterId]);
|
|
72
|
-
|
|
73
|
-
const clearFilters = useCallback(() => {
|
|
74
|
-
setSelectedIds([defaultFilterId]);
|
|
75
|
-
setSearchQuery("");
|
|
76
|
-
setShowOnlyFavorites(false);
|
|
77
|
-
}, [defaultFilterId]);
|
|
78
|
-
|
|
79
|
-
return {
|
|
80
|
-
filtered,
|
|
81
|
-
selectedIds,
|
|
82
|
-
searchQuery,
|
|
83
|
-
setSearchQuery,
|
|
84
|
-
showOnlyFavorites,
|
|
85
|
-
setShowOnlyFavorites,
|
|
86
|
-
toggleFilter,
|
|
87
|
-
clearFilters,
|
|
88
|
-
isFiltered: !selectedIds.includes(defaultFilterId) || !!searchQuery || showOnlyFavorites,
|
|
89
|
-
};
|
|
90
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useDeleteCreation Hook
|
|
3
|
-
* Handles deletion of user creations with optimistic update
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
7
|
-
import type { ICreationsRepository } from "../../domain/repositories/ICreationsRepository";
|
|
8
|
-
import type { Creation } from "../../domain/entities/Creation";
|
|
9
|
-
|
|
10
|
-
interface UseDeleteCreationProps {
|
|
11
|
-
readonly userId: string | null;
|
|
12
|
-
readonly repository: ICreationsRepository;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function useDeleteCreation({
|
|
16
|
-
userId,
|
|
17
|
-
repository,
|
|
18
|
-
}: UseDeleteCreationProps) {
|
|
19
|
-
const queryClient = useQueryClient();
|
|
20
|
-
|
|
21
|
-
return useMutation({
|
|
22
|
-
mutationFn: async (creationId: string) => {
|
|
23
|
-
if (!userId) return false;
|
|
24
|
-
return repository.delete(userId, creationId);
|
|
25
|
-
},
|
|
26
|
-
onMutate: async (creationId) => {
|
|
27
|
-
if (!userId) return;
|
|
28
|
-
|
|
29
|
-
await queryClient.cancelQueries({
|
|
30
|
-
queryKey: ["creations", userId],
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const previous = queryClient.getQueryData<Creation[]>([
|
|
34
|
-
"creations",
|
|
35
|
-
userId,
|
|
36
|
-
]);
|
|
37
|
-
|
|
38
|
-
queryClient.setQueryData<Creation[]>(
|
|
39
|
-
["creations", userId],
|
|
40
|
-
(old) => old?.filter((c) => c.id !== creationId) ?? [],
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
return { previous };
|
|
44
|
-
},
|
|
45
|
-
onError: (_err, _id, rollback) => {
|
|
46
|
-
if (userId && rollback?.previous) {
|
|
47
|
-
queryClient.setQueryData(["creations", userId], rollback.previous);
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useDeleteMultipleCreations Hook
|
|
3
|
-
* Handles batch deletion of user creations with optimistic update
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
7
|
-
import type { ICreationsRepository } from "../../domain/repositories/ICreationsRepository";
|
|
8
|
-
import type { Creation } from "../../domain/entities/Creation";
|
|
9
|
-
|
|
10
|
-
interface UseDeleteMultipleCreationsProps {
|
|
11
|
-
readonly userId: string | null;
|
|
12
|
-
readonly repository: ICreationsRepository;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function useDeleteMultipleCreations({
|
|
16
|
-
userId,
|
|
17
|
-
repository,
|
|
18
|
-
}: UseDeleteMultipleCreationsProps) {
|
|
19
|
-
const queryClient = useQueryClient();
|
|
20
|
-
|
|
21
|
-
return useMutation({
|
|
22
|
-
mutationFn: async (creationIds: string[]) => {
|
|
23
|
-
if (!userId) return false;
|
|
24
|
-
return repository.deleteMultiple(userId, creationIds);
|
|
25
|
-
},
|
|
26
|
-
onMutate: async (creationIds) => {
|
|
27
|
-
if (!userId) return;
|
|
28
|
-
|
|
29
|
-
await queryClient.cancelQueries({
|
|
30
|
-
queryKey: ["creations", userId],
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const previous = queryClient.getQueryData<Creation[]>([
|
|
34
|
-
"creations",
|
|
35
|
-
userId,
|
|
36
|
-
]);
|
|
37
|
-
|
|
38
|
-
queryClient.setQueryData<Creation[]>(
|
|
39
|
-
["creations", userId],
|
|
40
|
-
(old) =>
|
|
41
|
-
old?.filter((c) => !creationIds.includes(c.id)) ?? [],
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
return { previous };
|
|
45
|
-
},
|
|
46
|
-
onError: (_err, _ids, rollback) => {
|
|
47
|
-
if (userId && rollback?.previous) {
|
|
48
|
-
queryClient.setQueryData(["creations", userId], rollback.previous);
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
onSettled: () => {
|
|
52
|
-
if (userId) {
|
|
53
|
-
queryClient.invalidateQueries({ queryKey: ["creations", userId] });
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
}
|