@umituz/react-native-settings 4.20.61 → 4.21.1
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 +8 -60
- package/src/domains/gamification/README.md +343 -0
- package/src/domains/gamification/components/AchievementCard.tsx +142 -0
- package/src/domains/gamification/components/AchievementItem.tsx +182 -0
- package/src/domains/gamification/components/AchievementToast.tsx +122 -0
- package/src/domains/gamification/components/GamificationScreen/AchievementsList.tsx +84 -0
- package/src/domains/gamification/components/GamificationScreen/Header.tsx +29 -0
- package/src/domains/gamification/components/GamificationScreen/StatsGrid.tsx +51 -0
- package/src/domains/gamification/components/GamificationScreen/index.tsx +111 -0
- package/src/domains/gamification/components/GamificationScreen/styles.ts +43 -0
- package/src/domains/gamification/components/GamificationScreen/types.ts +77 -0
- package/src/domains/gamification/components/GamificationScreenWrapper.tsx +91 -0
- package/src/domains/gamification/components/GamificationSettingsItem.tsx +33 -0
- package/src/domains/gamification/components/LevelProgress.tsx +129 -0
- package/src/domains/gamification/components/PointsBadge.tsx +60 -0
- package/src/domains/gamification/components/StatsCard.tsx +89 -0
- package/src/domains/gamification/components/StreakDisplay.tsx +119 -0
- package/src/domains/gamification/components/index.ts +13 -0
- package/src/domains/gamification/examples/gamification.config.example.ts +70 -0
- package/src/domains/gamification/examples/localization.example.json +71 -0
- package/src/domains/gamification/hooks/useGamification.ts +91 -0
- package/src/domains/gamification/index.ts +65 -0
- package/src/domains/gamification/store/gamificationStore.ts +162 -0
- package/src/domains/gamification/types/index.ts +103 -0
- package/src/domains/gamification/types/settings.ts +28 -0
- package/src/domains/gamification/utils/calculations.ts +85 -0
- package/src/index.ts +18 -8
- package/src/presentation/navigation/SettingsStackNavigator.tsx +12 -0
- package/src/presentation/navigation/types.ts +2 -0
- package/src/presentation/navigation/utils/navigationScreenOptions.ts +7 -0
- package/src/presentation/screens/types/UserFeatureConfig.ts +2 -0
- package/src/presentation/utils/configCreators.ts +147 -0
- package/src/presentation/utils/index.ts +5 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -51
- package/.github/ISSUE_TEMPLATE/documentation.md +0 -52
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -63
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -84
- package/AI_AGENT_GUIDELINES.md +0 -367
- package/ARCHITECTURE.md +0 -246
- package/CHANGELOG.md +0 -67
- package/CODE_OF_CONDUCT.md +0 -75
- package/CONTRIBUTING.md +0 -107
- package/DOCUMENTATION_MIGRATION.md +0 -319
- package/DOCUMENTATION_TEMPLATE.md +0 -155
- package/SECURITY.md +0 -98
- package/SETTINGS_SCREEN_GUIDE.md +0 -185
- package/TESTING.md +0 -358
- package/src/__tests__/integration.test.tsx +0 -371
- package/src/__tests__/performance.test.tsx +0 -369
- package/src/__tests__/setup.test.tsx +0 -20
- package/src/__tests__/setup.ts +0 -154
- package/src/domains/about/__tests__/integration.test.tsx +0 -328
- package/src/domains/about/__tests__/types.d.ts +0 -5
- package/src/domains/about/domain/entities/__tests__/AppInfo.test.ts +0 -93
- package/src/domains/about/infrastructure/repositories/__tests__/AboutRepository.test.ts +0 -153
- package/src/domains/about/presentation/components/__tests__/AboutContent.simple.test.tsx +0 -178
- package/src/domains/about/presentation/components/__tests__/AboutContent.test.tsx +0 -293
- package/src/domains/about/presentation/components/__tests__/AboutHeader.test.tsx +0 -201
- package/src/domains/about/presentation/components/__tests__/AboutSettingItem.test.tsx +0 -71
- package/src/domains/about/presentation/hooks/__tests__/useAboutInfo.simple.test.tsx +0 -229
- package/src/domains/about/presentation/hooks/__tests__/useAboutInfo.test.tsx +0 -240
- package/src/domains/about/presentation/screens/__tests__/AboutScreen.simple.test.tsx +0 -199
- package/src/domains/about/presentation/screens/__tests__/AboutScreen.test.tsx +0 -366
- package/src/domains/about/utils/__tests__/index.test.ts +0 -408
- package/src/domains/appearance/__tests__/components/AppearanceScreen.test.tsx +0 -195
- package/src/domains/appearance/__tests__/hooks/index.test.tsx +0 -232
- package/src/domains/appearance/__tests__/integration/index.test.tsx +0 -207
- package/src/domains/appearance/__tests__/services/appearanceService.test.ts +0 -299
- package/src/domains/appearance/__tests__/setup.ts +0 -88
- package/src/domains/appearance/__tests__/stores/appearanceStore.test.tsx +0 -175
- package/src/domains/cloud-sync/presentation/components/__tests__/CloudSyncSetting.test.tsx +0 -78
- package/src/domains/legal/__tests__/ContentValidationService.test.ts +0 -195
- package/src/domains/legal/__tests__/StyleCacheService.test.ts +0 -110
- package/src/domains/legal/__tests__/UrlHandlerService.test.ts +0 -71
- package/src/domains/legal/__tests__/setup.ts +0 -82
- package/src/presentation/components/__tests__/SettingsErrorBoundary.test.tsx +0 -186
- package/src/presentation/screens/__tests__/SettingsScreen.test.tsx +0 -322
- package/src/presentation/screens/hooks/__tests__/useFeatureDetection.test.tsx +0 -261
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AchievementItem Component
|
|
3
|
+
* List item for achievements - all text via props
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from "react";
|
|
7
|
+
import {
|
|
8
|
+
View,
|
|
9
|
+
Text,
|
|
10
|
+
StyleSheet,
|
|
11
|
+
type ViewStyle,
|
|
12
|
+
type TextStyle,
|
|
13
|
+
} from "react-native";
|
|
14
|
+
|
|
15
|
+
export interface AchievementItemProps {
|
|
16
|
+
title: string;
|
|
17
|
+
description: string;
|
|
18
|
+
icon: React.ReactNode;
|
|
19
|
+
isUnlocked: boolean;
|
|
20
|
+
progress: number;
|
|
21
|
+
threshold: number;
|
|
22
|
+
progressLabel?: string;
|
|
23
|
+
// Customization
|
|
24
|
+
containerStyle?: ViewStyle;
|
|
25
|
+
titleStyle?: TextStyle;
|
|
26
|
+
descriptionStyle?: TextStyle;
|
|
27
|
+
// Colors
|
|
28
|
+
accentColor?: string;
|
|
29
|
+
backgroundColor?: string;
|
|
30
|
+
textColor?: string;
|
|
31
|
+
subtextColor?: string;
|
|
32
|
+
lockedOpacity?: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const AchievementItem: React.FC<AchievementItemProps> = ({
|
|
36
|
+
title,
|
|
37
|
+
description,
|
|
38
|
+
icon,
|
|
39
|
+
isUnlocked,
|
|
40
|
+
progress,
|
|
41
|
+
threshold,
|
|
42
|
+
progressLabel,
|
|
43
|
+
containerStyle,
|
|
44
|
+
titleStyle,
|
|
45
|
+
descriptionStyle,
|
|
46
|
+
accentColor = "#FFD700",
|
|
47
|
+
backgroundColor = "#1A1A1A",
|
|
48
|
+
textColor = "#FFFFFF",
|
|
49
|
+
subtextColor = "#888888",
|
|
50
|
+
lockedOpacity = 0.5,
|
|
51
|
+
}) => {
|
|
52
|
+
const progressPercent = Math.min((progress / threshold) * 100, 100);
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<View
|
|
56
|
+
style={[
|
|
57
|
+
styles.container,
|
|
58
|
+
{ backgroundColor, opacity: isUnlocked ? 1 : lockedOpacity },
|
|
59
|
+
containerStyle,
|
|
60
|
+
]}
|
|
61
|
+
>
|
|
62
|
+
<View
|
|
63
|
+
style={[styles.iconContainer, { backgroundColor: `${accentColor}20` }]}
|
|
64
|
+
>
|
|
65
|
+
{icon}
|
|
66
|
+
</View>
|
|
67
|
+
|
|
68
|
+
<View style={styles.content}>
|
|
69
|
+
<View style={styles.header}>
|
|
70
|
+
<Text style={[styles.title, { color: textColor }, titleStyle]}>
|
|
71
|
+
{title}
|
|
72
|
+
</Text>
|
|
73
|
+
{isUnlocked && (
|
|
74
|
+
<View style={[styles.checkmark, { backgroundColor: accentColor }]}>
|
|
75
|
+
<Text style={styles.checkmarkText}>✓</Text>
|
|
76
|
+
</View>
|
|
77
|
+
)}
|
|
78
|
+
</View>
|
|
79
|
+
|
|
80
|
+
<Text
|
|
81
|
+
style={[styles.description, { color: subtextColor }, descriptionStyle]}
|
|
82
|
+
numberOfLines={2}
|
|
83
|
+
>
|
|
84
|
+
{description}
|
|
85
|
+
</Text>
|
|
86
|
+
|
|
87
|
+
{!isUnlocked && (
|
|
88
|
+
<View style={styles.progressContainer}>
|
|
89
|
+
<View
|
|
90
|
+
style={[styles.progressBar, { backgroundColor: `${accentColor}30` }]}
|
|
91
|
+
>
|
|
92
|
+
<View
|
|
93
|
+
style={[
|
|
94
|
+
styles.progressFill,
|
|
95
|
+
{
|
|
96
|
+
backgroundColor: accentColor,
|
|
97
|
+
width: `${progressPercent}%`,
|
|
98
|
+
},
|
|
99
|
+
]}
|
|
100
|
+
/>
|
|
101
|
+
</View>
|
|
102
|
+
{progressLabel && (
|
|
103
|
+
<Text style={[styles.progressText, { color: subtextColor }]}>
|
|
104
|
+
{progressLabel}
|
|
105
|
+
</Text>
|
|
106
|
+
)}
|
|
107
|
+
</View>
|
|
108
|
+
)}
|
|
109
|
+
</View>
|
|
110
|
+
</View>
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const styles = StyleSheet.create({
|
|
115
|
+
container: {
|
|
116
|
+
flexDirection: "row",
|
|
117
|
+
alignItems: "center",
|
|
118
|
+
padding: 12,
|
|
119
|
+
borderRadius: 12,
|
|
120
|
+
marginBottom: 8,
|
|
121
|
+
},
|
|
122
|
+
iconContainer: {
|
|
123
|
+
width: 48,
|
|
124
|
+
height: 48,
|
|
125
|
+
borderRadius: 24,
|
|
126
|
+
alignItems: "center",
|
|
127
|
+
justifyContent: "center",
|
|
128
|
+
marginRight: 12,
|
|
129
|
+
},
|
|
130
|
+
content: {
|
|
131
|
+
flex: 1,
|
|
132
|
+
},
|
|
133
|
+
header: {
|
|
134
|
+
flexDirection: "row",
|
|
135
|
+
alignItems: "center",
|
|
136
|
+
justifyContent: "space-between",
|
|
137
|
+
marginBottom: 4,
|
|
138
|
+
},
|
|
139
|
+
title: {
|
|
140
|
+
fontSize: 16,
|
|
141
|
+
fontWeight: "600",
|
|
142
|
+
flex: 1,
|
|
143
|
+
},
|
|
144
|
+
checkmark: {
|
|
145
|
+
width: 20,
|
|
146
|
+
height: 20,
|
|
147
|
+
borderRadius: 10,
|
|
148
|
+
alignItems: "center",
|
|
149
|
+
justifyContent: "center",
|
|
150
|
+
marginLeft: 8,
|
|
151
|
+
},
|
|
152
|
+
checkmarkText: {
|
|
153
|
+
color: "#000",
|
|
154
|
+
fontSize: 12,
|
|
155
|
+
fontWeight: "bold",
|
|
156
|
+
},
|
|
157
|
+
description: {
|
|
158
|
+
fontSize: 13,
|
|
159
|
+
lineHeight: 18,
|
|
160
|
+
},
|
|
161
|
+
progressContainer: {
|
|
162
|
+
marginTop: 8,
|
|
163
|
+
flexDirection: "row",
|
|
164
|
+
alignItems: "center",
|
|
165
|
+
gap: 8,
|
|
166
|
+
},
|
|
167
|
+
progressBar: {
|
|
168
|
+
flex: 1,
|
|
169
|
+
height: 4,
|
|
170
|
+
borderRadius: 2,
|
|
171
|
+
overflow: "hidden",
|
|
172
|
+
},
|
|
173
|
+
progressFill: {
|
|
174
|
+
height: "100%",
|
|
175
|
+
borderRadius: 2,
|
|
176
|
+
},
|
|
177
|
+
progressText: {
|
|
178
|
+
fontSize: 11,
|
|
179
|
+
minWidth: 40,
|
|
180
|
+
textAlign: "right",
|
|
181
|
+
},
|
|
182
|
+
});
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AchievementToast Component
|
|
3
|
+
* Shows achievement unlock notification - all text via props
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React, { useEffect, useRef } from "react";
|
|
7
|
+
import { View, Text, StyleSheet, Animated, type ViewStyle, type TextStyle } from "react-native";
|
|
8
|
+
|
|
9
|
+
export interface AchievementToastProps {
|
|
10
|
+
visible: boolean;
|
|
11
|
+
title: string;
|
|
12
|
+
label: string; // e.g., "Achievement Unlocked!" - from app translations
|
|
13
|
+
icon: React.ReactNode;
|
|
14
|
+
onDismiss: () => void;
|
|
15
|
+
duration?: number;
|
|
16
|
+
// Customization
|
|
17
|
+
containerStyle?: ViewStyle;
|
|
18
|
+
labelStyle?: TextStyle;
|
|
19
|
+
titleStyle?: TextStyle;
|
|
20
|
+
// Colors
|
|
21
|
+
backgroundColor?: string;
|
|
22
|
+
textColor?: string;
|
|
23
|
+
labelColor?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const AchievementToast: React.FC<AchievementToastProps> = ({
|
|
27
|
+
visible,
|
|
28
|
+
title,
|
|
29
|
+
label,
|
|
30
|
+
icon,
|
|
31
|
+
onDismiss,
|
|
32
|
+
duration = 3000,
|
|
33
|
+
containerStyle,
|
|
34
|
+
labelStyle,
|
|
35
|
+
titleStyle,
|
|
36
|
+
backgroundColor = "#FFD700",
|
|
37
|
+
textColor = "#000000",
|
|
38
|
+
labelColor = "#00000080",
|
|
39
|
+
}) => {
|
|
40
|
+
const translateY = useRef(new Animated.Value(-100)).current;
|
|
41
|
+
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (visible) {
|
|
44
|
+
Animated.sequence([
|
|
45
|
+
Animated.timing(translateY, {
|
|
46
|
+
toValue: 0,
|
|
47
|
+
duration: 400,
|
|
48
|
+
useNativeDriver: true,
|
|
49
|
+
}),
|
|
50
|
+
Animated.delay(duration),
|
|
51
|
+
Animated.timing(translateY, {
|
|
52
|
+
toValue: -100,
|
|
53
|
+
duration: 300,
|
|
54
|
+
useNativeDriver: true,
|
|
55
|
+
}),
|
|
56
|
+
]).start(() => {
|
|
57
|
+
onDismiss();
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}, [visible, duration, onDismiss, translateY]);
|
|
61
|
+
|
|
62
|
+
if (!visible) return null;
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<Animated.View
|
|
66
|
+
style={[
|
|
67
|
+
styles.container,
|
|
68
|
+
{ transform: [{ translateY }] },
|
|
69
|
+
containerStyle,
|
|
70
|
+
]}
|
|
71
|
+
>
|
|
72
|
+
<View style={[styles.toast, { backgroundColor }]}>
|
|
73
|
+
<View style={styles.iconContainer}>{icon}</View>
|
|
74
|
+
<View style={styles.content}>
|
|
75
|
+
<Text style={[styles.label, { color: labelColor }, labelStyle]}>
|
|
76
|
+
{label}
|
|
77
|
+
</Text>
|
|
78
|
+
<Text style={[styles.title, { color: textColor }, titleStyle]}>
|
|
79
|
+
{title}
|
|
80
|
+
</Text>
|
|
81
|
+
</View>
|
|
82
|
+
</View>
|
|
83
|
+
</Animated.View>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const styles = StyleSheet.create({
|
|
88
|
+
container: {
|
|
89
|
+
position: "absolute",
|
|
90
|
+
top: 60,
|
|
91
|
+
left: 16,
|
|
92
|
+
right: 16,
|
|
93
|
+
zIndex: 1000,
|
|
94
|
+
},
|
|
95
|
+
toast: {
|
|
96
|
+
flexDirection: "row",
|
|
97
|
+
alignItems: "center",
|
|
98
|
+
padding: 16,
|
|
99
|
+
borderRadius: 16,
|
|
100
|
+
gap: 12,
|
|
101
|
+
},
|
|
102
|
+
iconContainer: {
|
|
103
|
+
width: 40,
|
|
104
|
+
height: 40,
|
|
105
|
+
justifyContent: "center",
|
|
106
|
+
alignItems: "center",
|
|
107
|
+
},
|
|
108
|
+
content: {
|
|
109
|
+
flex: 1,
|
|
110
|
+
},
|
|
111
|
+
label: {
|
|
112
|
+
fontSize: 12,
|
|
113
|
+
fontWeight: "bold",
|
|
114
|
+
textTransform: "uppercase",
|
|
115
|
+
letterSpacing: 1,
|
|
116
|
+
},
|
|
117
|
+
title: {
|
|
118
|
+
fontSize: 16,
|
|
119
|
+
fontWeight: "600",
|
|
120
|
+
marginTop: 2,
|
|
121
|
+
},
|
|
122
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GamificationScreen AchievementsList Component
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { View, Text, type TextStyle } from "react-native";
|
|
7
|
+
import { AchievementItem } from "../AchievementItem";
|
|
8
|
+
import { styles } from "./styles";
|
|
9
|
+
import type { AchievementItemProps } from "../AchievementItem";
|
|
10
|
+
|
|
11
|
+
export interface AchievementsListProps {
|
|
12
|
+
achievementsTitle: string;
|
|
13
|
+
achievements: Array<
|
|
14
|
+
Omit<
|
|
15
|
+
AchievementItemProps,
|
|
16
|
+
| "accentColor"
|
|
17
|
+
| "backgroundColor"
|
|
18
|
+
| "textColor"
|
|
19
|
+
| "subtextColor"
|
|
20
|
+
| "lockedOpacity"
|
|
21
|
+
>
|
|
22
|
+
>;
|
|
23
|
+
emptyAchievementsText?: string;
|
|
24
|
+
accentColor: string;
|
|
25
|
+
cardBackgroundColor: string;
|
|
26
|
+
textColor: string;
|
|
27
|
+
subtextColor: string;
|
|
28
|
+
sectionTitleStyle?: TextStyle;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const AchievementsList: React.FC<AchievementsListProps> = ({
|
|
32
|
+
achievementsTitle,
|
|
33
|
+
achievements,
|
|
34
|
+
emptyAchievementsText,
|
|
35
|
+
accentColor,
|
|
36
|
+
cardBackgroundColor,
|
|
37
|
+
textColor,
|
|
38
|
+
subtextColor,
|
|
39
|
+
sectionTitleStyle,
|
|
40
|
+
}) => {
|
|
41
|
+
const unlockedAchievements = achievements.filter((a) => a.isUnlocked);
|
|
42
|
+
const lockedAchievements = achievements.filter((a) => !a.isUnlocked);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<View style={styles.section}>
|
|
46
|
+
<Text style={[styles.sectionTitle, { color: textColor }, sectionTitleStyle]}>
|
|
47
|
+
{achievementsTitle}
|
|
48
|
+
</Text>
|
|
49
|
+
|
|
50
|
+
{achievements.length === 0 && emptyAchievementsText ? (
|
|
51
|
+
<Text style={[styles.emptyText, { color: subtextColor }]}>
|
|
52
|
+
{emptyAchievementsText}
|
|
53
|
+
</Text>
|
|
54
|
+
) : (
|
|
55
|
+
<>
|
|
56
|
+
{/* Unlocked achievements first */}
|
|
57
|
+
{unlockedAchievements.map((achievement, index) => (
|
|
58
|
+
<AchievementItem
|
|
59
|
+
key={`unlocked-${index}`}
|
|
60
|
+
{...achievement}
|
|
61
|
+
accentColor={accentColor}
|
|
62
|
+
backgroundColor={cardBackgroundColor}
|
|
63
|
+
textColor={textColor}
|
|
64
|
+
subtextColor={subtextColor}
|
|
65
|
+
/>
|
|
66
|
+
))}
|
|
67
|
+
|
|
68
|
+
{/* Locked achievements */}
|
|
69
|
+
{lockedAchievements.map((achievement, index) => (
|
|
70
|
+
<AchievementItem
|
|
71
|
+
key={`locked-${index}`}
|
|
72
|
+
{...achievement}
|
|
73
|
+
accentColor={accentColor}
|
|
74
|
+
backgroundColor={cardBackgroundColor}
|
|
75
|
+
textColor={textColor}
|
|
76
|
+
subtextColor={subtextColor}
|
|
77
|
+
lockedOpacity={0.6}
|
|
78
|
+
/>
|
|
79
|
+
))}
|
|
80
|
+
</>
|
|
81
|
+
)}
|
|
82
|
+
</View>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GamificationScreen Header Component
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { View, Text, type ViewStyle, type TextStyle } from "react-native";
|
|
7
|
+
import { styles } from "./styles";
|
|
8
|
+
|
|
9
|
+
export interface HeaderProps {
|
|
10
|
+
title: string;
|
|
11
|
+
headerStyle?: ViewStyle;
|
|
12
|
+
titleStyle?: TextStyle;
|
|
13
|
+
textColor: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const Header: React.FC<HeaderProps> = ({
|
|
17
|
+
title,
|
|
18
|
+
headerStyle,
|
|
19
|
+
titleStyle,
|
|
20
|
+
textColor,
|
|
21
|
+
}) => {
|
|
22
|
+
return (
|
|
23
|
+
<View style={[styles.header, headerStyle]}>
|
|
24
|
+
<Text style={[styles.title, { color: textColor }, titleStyle]}>
|
|
25
|
+
{title}
|
|
26
|
+
</Text>
|
|
27
|
+
</View>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GamificationScreen StatsGrid Component
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { View, Text, type TextStyle } from "react-native";
|
|
7
|
+
import { StatsCard } from "../StatsCard";
|
|
8
|
+
import { styles } from "./styles";
|
|
9
|
+
import type { StatsCardProps } from "../StatsCard";
|
|
10
|
+
|
|
11
|
+
export interface StatsGridProps {
|
|
12
|
+
statsTitle: string;
|
|
13
|
+
stats: Array<Omit<StatsCardProps, "accentColor" | "backgroundColor" | "textColor" | "subtextColor">>;
|
|
14
|
+
accentColor: string;
|
|
15
|
+
cardBackgroundColor: string;
|
|
16
|
+
textColor: string;
|
|
17
|
+
subtextColor: string;
|
|
18
|
+
sectionTitleStyle?: TextStyle;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const StatsGrid: React.FC<StatsGridProps> = ({
|
|
22
|
+
statsTitle,
|
|
23
|
+
stats,
|
|
24
|
+
accentColor,
|
|
25
|
+
cardBackgroundColor,
|
|
26
|
+
textColor,
|
|
27
|
+
subtextColor,
|
|
28
|
+
sectionTitleStyle,
|
|
29
|
+
}) => {
|
|
30
|
+
if (stats.length === 0) return null;
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<View style={styles.section}>
|
|
34
|
+
<Text style={[styles.sectionTitle, { color: textColor }, sectionTitleStyle]}>
|
|
35
|
+
{statsTitle}
|
|
36
|
+
</Text>
|
|
37
|
+
<View style={styles.statsGrid}>
|
|
38
|
+
{stats.map((stat, index) => (
|
|
39
|
+
<StatsCard
|
|
40
|
+
key={index}
|
|
41
|
+
{...stat}
|
|
42
|
+
accentColor={accentColor}
|
|
43
|
+
backgroundColor={cardBackgroundColor}
|
|
44
|
+
textColor={textColor}
|
|
45
|
+
subtextColor={subtextColor}
|
|
46
|
+
/>
|
|
47
|
+
))}
|
|
48
|
+
</View>
|
|
49
|
+
</View>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GamificationScreen Component
|
|
3
|
+
* Full gamification screen - all text via props
|
|
4
|
+
* Generic for 100+ apps - NO hardcoded strings
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { View, ScrollView, Text, StyleSheet } from "react-native";
|
|
9
|
+
import { LevelProgress } from "../LevelProgress";
|
|
10
|
+
import { StreakDisplay } from "../StreakDisplay";
|
|
11
|
+
import { Header } from "./Header";
|
|
12
|
+
import { StatsGrid } from "./StatsGrid";
|
|
13
|
+
import { AchievementsList } from "./AchievementsList";
|
|
14
|
+
import { styles } from "./styles";
|
|
15
|
+
import type { GamificationScreenProps } from "./types";
|
|
16
|
+
|
|
17
|
+
export type { GamificationScreenProps };
|
|
18
|
+
|
|
19
|
+
export const GamificationScreen: React.FC<GamificationScreenProps> = ({
|
|
20
|
+
title,
|
|
21
|
+
statsTitle,
|
|
22
|
+
achievementsTitle,
|
|
23
|
+
streakTitle,
|
|
24
|
+
levelProps,
|
|
25
|
+
stats,
|
|
26
|
+
achievements,
|
|
27
|
+
streakProps,
|
|
28
|
+
emptyAchievementsText,
|
|
29
|
+
containerStyle,
|
|
30
|
+
headerStyle,
|
|
31
|
+
titleStyle,
|
|
32
|
+
sectionTitleStyle,
|
|
33
|
+
accentColor = "#FFD700",
|
|
34
|
+
backgroundColor = "#0A0A0A",
|
|
35
|
+
cardBackgroundColor = "#1A1A1A",
|
|
36
|
+
textColor = "#FFFFFF",
|
|
37
|
+
subtextColor = "#888888",
|
|
38
|
+
headerComponent,
|
|
39
|
+
}) => {
|
|
40
|
+
return (
|
|
41
|
+
<View style={[styles.container, { backgroundColor }, containerStyle]}>
|
|
42
|
+
{headerComponent}
|
|
43
|
+
|
|
44
|
+
<ScrollView
|
|
45
|
+
style={styles.scrollView}
|
|
46
|
+
contentContainerStyle={styles.scrollContent}
|
|
47
|
+
showsVerticalScrollIndicator={false}
|
|
48
|
+
>
|
|
49
|
+
{/* Header */}
|
|
50
|
+
<Header
|
|
51
|
+
title={title}
|
|
52
|
+
headerStyle={headerStyle}
|
|
53
|
+
titleStyle={titleStyle}
|
|
54
|
+
textColor={textColor}
|
|
55
|
+
/>
|
|
56
|
+
|
|
57
|
+
{/* Level Progress */}
|
|
58
|
+
<View style={styles.section}>
|
|
59
|
+
<LevelProgress
|
|
60
|
+
{...levelProps}
|
|
61
|
+
primaryColor={accentColor}
|
|
62
|
+
backgroundColor={cardBackgroundColor}
|
|
63
|
+
textColor={textColor}
|
|
64
|
+
subtextColor={subtextColor}
|
|
65
|
+
/>
|
|
66
|
+
</View>
|
|
67
|
+
|
|
68
|
+
{/* Streak (if provided) */}
|
|
69
|
+
{streakProps && (
|
|
70
|
+
<View style={styles.section}>
|
|
71
|
+
<Text
|
|
72
|
+
style={[styles.sectionTitle, { color: textColor }, sectionTitleStyle]}
|
|
73
|
+
>
|
|
74
|
+
{streakTitle}
|
|
75
|
+
</Text>
|
|
76
|
+
<StreakDisplay
|
|
77
|
+
{...streakProps}
|
|
78
|
+
primaryColor={accentColor}
|
|
79
|
+
backgroundColor={cardBackgroundColor}
|
|
80
|
+
textColor={textColor}
|
|
81
|
+
subtextColor={subtextColor}
|
|
82
|
+
/>
|
|
83
|
+
</View>
|
|
84
|
+
)}
|
|
85
|
+
|
|
86
|
+
{/* Stats Grid */}
|
|
87
|
+
<StatsGrid
|
|
88
|
+
statsTitle={statsTitle}
|
|
89
|
+
stats={stats}
|
|
90
|
+
accentColor={accentColor}
|
|
91
|
+
cardBackgroundColor={cardBackgroundColor}
|
|
92
|
+
textColor={textColor}
|
|
93
|
+
subtextColor={subtextColor}
|
|
94
|
+
sectionTitleStyle={sectionTitleStyle}
|
|
95
|
+
/>
|
|
96
|
+
|
|
97
|
+
{/* Achievements */}
|
|
98
|
+
<AchievementsList
|
|
99
|
+
achievementsTitle={achievementsTitle}
|
|
100
|
+
achievements={achievements}
|
|
101
|
+
emptyAchievementsText={emptyAchievementsText}
|
|
102
|
+
accentColor={accentColor}
|
|
103
|
+
cardBackgroundColor={cardBackgroundColor}
|
|
104
|
+
textColor={textColor}
|
|
105
|
+
subtextColor={subtextColor}
|
|
106
|
+
sectionTitleStyle={sectionTitleStyle}
|
|
107
|
+
/>
|
|
108
|
+
</ScrollView>
|
|
109
|
+
</View>
|
|
110
|
+
);
|
|
111
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GamificationScreen Styles
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { StyleSheet } from "react-native";
|
|
6
|
+
|
|
7
|
+
export const styles = StyleSheet.create({
|
|
8
|
+
container: {
|
|
9
|
+
flex: 1,
|
|
10
|
+
},
|
|
11
|
+
scrollView: {
|
|
12
|
+
flex: 1,
|
|
13
|
+
},
|
|
14
|
+
scrollContent: {
|
|
15
|
+
padding: 16,
|
|
16
|
+
paddingBottom: 32,
|
|
17
|
+
},
|
|
18
|
+
header: {
|
|
19
|
+
marginBottom: 20,
|
|
20
|
+
},
|
|
21
|
+
title: {
|
|
22
|
+
fontSize: 28,
|
|
23
|
+
fontWeight: "bold",
|
|
24
|
+
},
|
|
25
|
+
section: {
|
|
26
|
+
marginBottom: 24,
|
|
27
|
+
},
|
|
28
|
+
sectionTitle: {
|
|
29
|
+
fontSize: 18,
|
|
30
|
+
fontWeight: "600",
|
|
31
|
+
marginBottom: 12,
|
|
32
|
+
},
|
|
33
|
+
statsGrid: {
|
|
34
|
+
flexDirection: "row",
|
|
35
|
+
flexWrap: "wrap",
|
|
36
|
+
gap: 12,
|
|
37
|
+
},
|
|
38
|
+
emptyText: {
|
|
39
|
+
fontSize: 14,
|
|
40
|
+
textAlign: "center",
|
|
41
|
+
paddingVertical: 20,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GamificationScreen Types
|
|
3
|
+
* Generic types for 100+ apps - NO app-specific code
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { LevelProgressProps } from "../LevelProgress";
|
|
7
|
+
import type { StatsCardProps } from "../StatsCard";
|
|
8
|
+
import type { AchievementItemProps } from "../AchievementItem";
|
|
9
|
+
import type { StreakDisplayProps } from "../StreakDisplay";
|
|
10
|
+
import type { ViewStyle, TextStyle } from "react-native";
|
|
11
|
+
|
|
12
|
+
export interface GamificationScreenProps {
|
|
13
|
+
// Section titles (all via props)
|
|
14
|
+
title: string;
|
|
15
|
+
statsTitle: string;
|
|
16
|
+
achievementsTitle: string;
|
|
17
|
+
streakTitle: string;
|
|
18
|
+
|
|
19
|
+
// Level data
|
|
20
|
+
levelProps: Omit<
|
|
21
|
+
LevelProgressProps,
|
|
22
|
+
"primaryColor" | "backgroundColor" | "textColor" | "subtextColor"
|
|
23
|
+
>;
|
|
24
|
+
|
|
25
|
+
// Stats data
|
|
26
|
+
stats: Array<
|
|
27
|
+
Omit<
|
|
28
|
+
StatsCardProps,
|
|
29
|
+
"accentColor" | "backgroundColor" | "textColor" | "subtextColor"
|
|
30
|
+
>
|
|
31
|
+
>;
|
|
32
|
+
|
|
33
|
+
// Achievements data
|
|
34
|
+
achievements: Array<
|
|
35
|
+
Omit<
|
|
36
|
+
AchievementItemProps,
|
|
37
|
+
| "accentColor"
|
|
38
|
+
| "backgroundColor"
|
|
39
|
+
| "textColor"
|
|
40
|
+
| "subtextColor"
|
|
41
|
+
| "lockedOpacity"
|
|
42
|
+
>
|
|
43
|
+
>;
|
|
44
|
+
|
|
45
|
+
// Streak data (optional)
|
|
46
|
+
streakProps?: Omit<
|
|
47
|
+
StreakDisplayProps,
|
|
48
|
+
"primaryColor" | "backgroundColor" | "textColor" | "subtextColor"
|
|
49
|
+
>;
|
|
50
|
+
|
|
51
|
+
// Empty state
|
|
52
|
+
emptyAchievementsText?: string;
|
|
53
|
+
|
|
54
|
+
// Customization
|
|
55
|
+
containerStyle?: ViewStyle;
|
|
56
|
+
headerStyle?: ViewStyle;
|
|
57
|
+
titleStyle?: TextStyle;
|
|
58
|
+
sectionTitleStyle?: TextStyle;
|
|
59
|
+
|
|
60
|
+
// Colors (applied to all child components)
|
|
61
|
+
accentColor?: string;
|
|
62
|
+
backgroundColor?: string;
|
|
63
|
+
cardBackgroundColor?: string;
|
|
64
|
+
textColor?: string;
|
|
65
|
+
subtextColor?: string;
|
|
66
|
+
|
|
67
|
+
// Header component (optional - for back button etc)
|
|
68
|
+
headerComponent?: React.ReactNode;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface GamificationScreenStyleProps {
|
|
72
|
+
accentColor: string;
|
|
73
|
+
backgroundColor: string;
|
|
74
|
+
cardBackgroundColor: string;
|
|
75
|
+
textColor: string;
|
|
76
|
+
subtextColor: string;
|
|
77
|
+
}
|