@umituz/react-native-settings 4.21.18 → 4.21.20
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/about/presentation/components/AboutContent.tsx +3 -4
- package/src/domains/about/presentation/components/AboutHeader.tsx +7 -14
- package/src/domains/about/presentation/components/AboutSection.tsx +2 -2
- package/src/domains/about/presentation/components/AboutSettingItem.tsx +16 -16
- package/src/domains/appearance/presentation/components/AppearanceSection.tsx +2 -2
- package/src/domains/appearance/presentation/screens/AppearanceScreen.tsx +3 -4
- package/src/domains/faqs/presentation/components/FAQEmptyState.tsx +2 -2
- package/src/domains/gamification/components/AchievementCard.tsx +26 -19
- package/src/domains/gamification/components/AchievementItem.tsx +27 -25
- package/src/domains/gamification/components/AchievementToast.tsx +16 -12
- package/src/domains/gamification/components/GamificationScreen/AchievementsList.tsx +6 -5
- package/src/domains/gamification/components/GamificationScreen/Header.tsx +4 -3
- package/src/domains/gamification/components/GamificationScreen/StatsGrid.tsx +4 -3
- package/src/domains/gamification/components/GamificationScreen/index.tsx +38 -28
- package/src/domains/gamification/components/LevelProgress.tsx +25 -18
- package/src/domains/gamification/components/PointsBadge.tsx +13 -9
- package/src/domains/gamification/components/StatsCard.tsx +20 -14
- package/src/domains/gamification/components/StreakDisplay.tsx +28 -22
- package/src/domains/legal/presentation/components/LegalSection.tsx +2 -2
- package/src/domains/notifications/presentation/components/NotificationsSection.tsx +2 -4
- package/src/domains/notifications/presentation/screens/NotificationSettingsScreen.tsx +3 -4
- package/src/domains/rating/presentation/components/StarRating.tsx +2 -2
- package/src/domains/video-tutorials/presentation/components/VideoTutorialCard.tsx +35 -127
- package/src/domains/video-tutorials/presentation/screens/VideoTutorialsScreen.tsx +88 -153
- package/src/presentation/components/SettingsItemCard.tsx +3 -22
- package/src/presentation/navigation/SettingsStackNavigator.tsx +112 -100
- package/src/presentation/screens/SettingsScreen.tsx +6 -2
- package/src/presentation/screens/components/GamificationSettingsItem.tsx +48 -0
- package/src/presentation/screens/components/SettingsContent.tsx +17 -41
- package/src/presentation/screens/components/SettingsHeader.tsx +2 -3
- package/src/presentation/screens/components/SubscriptionSettingsItem.tsx +30 -0
- package/src/presentation/screens/components/WalletSettingsItem.tsx +28 -0
- package/src/presentation/screens/components/sections/FeatureSettingsSection.tsx +2 -2
- package/src/presentation/screens/components/sections/ProfileSectionLoader.tsx +2 -2
- package/src/presentation/screens/components/sections/SupportSettingsSection.tsx +2 -2
- package/src/presentation/screens/hooks/useFeatureDetection.ts +2 -0
- package/src/presentation/screens/types/SettingsConfig.ts +7 -0
- package/src/presentation/screens/types/UserFeatureConfig.ts +21 -0
- package/src/presentation/screens/types/index.ts +2 -0
- package/src/presentation/screens/utils/normalizeConfig.ts +6 -0
|
@@ -6,15 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React from "react";
|
|
9
|
-
import {
|
|
9
|
+
import { useAppDesignTokens, StackNavigator, type StackScreen, type StackNavigatorConfig } from "@umituz/react-native-design-system";
|
|
10
10
|
import { useLocalization, LanguageSelectionScreen } from "@umituz/react-native-localization";
|
|
11
11
|
import { NotificationSettingsScreen } from "../../domains/notifications";
|
|
12
12
|
import { AccountScreen } from "@umituz/react-native-auth";
|
|
13
|
-
import { useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
14
|
-
|
|
15
|
-
// ...
|
|
16
|
-
|
|
17
|
-
|
|
18
13
|
import { AppearanceScreen } from "../screens/AppearanceScreen";
|
|
19
14
|
import { FAQScreen } from "../../domains/faqs";
|
|
20
15
|
import { useNavigationHandlers } from "./hooks";
|
|
@@ -31,8 +26,6 @@ import {
|
|
|
31
26
|
import type { SettingsStackParamList, SettingsStackNavigatorProps } from "./types";
|
|
32
27
|
import { GamificationScreenWrapper } from "../../domains/gamification";
|
|
33
28
|
|
|
34
|
-
const Stack = createStackNavigator<SettingsStackParamList>();
|
|
35
|
-
|
|
36
29
|
export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = ({
|
|
37
30
|
appInfo,
|
|
38
31
|
legalUrls,
|
|
@@ -70,6 +63,7 @@ export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = ({
|
|
|
70
63
|
}),
|
|
71
64
|
[tokens, t]
|
|
72
65
|
);
|
|
66
|
+
|
|
73
67
|
const notificationTranslations = React.useMemo(() => createNotificationTranslations(t), [t]);
|
|
74
68
|
const quietHoursTranslations = React.useMemo(() => createQuietHoursTranslations(t), [t]);
|
|
75
69
|
const legalScreenProps = React.useMemo(
|
|
@@ -77,13 +71,12 @@ export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = ({
|
|
|
77
71
|
[t, handlePrivacyPress, handleTermsPress, handleEulaPress]
|
|
78
72
|
);
|
|
79
73
|
|
|
80
|
-
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
name
|
|
84
|
-
options
|
|
85
|
-
|
|
86
|
-
{() => (
|
|
74
|
+
const screens = React.useMemo(() => {
|
|
75
|
+
const list: StackScreen<any>[] = [
|
|
76
|
+
{
|
|
77
|
+
name: "SettingsMain",
|
|
78
|
+
options: showHeader ? { headerTitle: t("settings.title") } : { headerShown: false },
|
|
79
|
+
children: () => (
|
|
87
80
|
<SettingsScreenWrapper
|
|
88
81
|
config={config}
|
|
89
82
|
appVersion={appInfo.version}
|
|
@@ -93,94 +86,113 @@ export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = ({
|
|
|
93
86
|
customSections={customSections}
|
|
94
87
|
showHeader={showHeader}
|
|
95
88
|
/>
|
|
96
|
-
)
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
{()
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
name
|
|
115
|
-
options
|
|
116
|
-
|
|
117
|
-
{() => (
|
|
89
|
+
),
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: "Appearance",
|
|
93
|
+
component: AppearanceScreen,
|
|
94
|
+
options: { headerShown: false },
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: "About",
|
|
98
|
+
options: { headerTitle: t("settings.about.title") },
|
|
99
|
+
children: () => <AboutScreenWrapper config={aboutConfig} />,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: "Legal",
|
|
103
|
+
options: { headerTitle: t("settings.legal.title") },
|
|
104
|
+
children: () => <LegalScreenWrapper {...legalScreenProps} />,
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "Notifications",
|
|
108
|
+
options: { headerShown: false },
|
|
109
|
+
children: () => (
|
|
118
110
|
<NotificationSettingsScreen
|
|
119
111
|
translations={notificationTranslations}
|
|
120
112
|
quietHoursTranslations={quietHoursTranslations}
|
|
121
113
|
/>
|
|
122
|
-
)
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
)}
|
|
138
|
-
|
|
139
|
-
{additionalScreens.map((screen) =>
|
|
140
|
-
screen.children ? (
|
|
141
|
-
<Stack.Screen
|
|
142
|
-
key={screen.name}
|
|
143
|
-
name={screen.name as keyof SettingsStackParamList}
|
|
144
|
-
options={screen.options}
|
|
145
|
-
>
|
|
146
|
-
{screen.children}
|
|
147
|
-
</Stack.Screen>
|
|
148
|
-
) : screen.component ? (
|
|
149
|
-
<Stack.Screen
|
|
150
|
-
key={screen.name}
|
|
151
|
-
name={screen.name as keyof SettingsStackParamList}
|
|
152
|
-
component={screen.component}
|
|
153
|
-
options={screen.options}
|
|
154
|
-
/>
|
|
155
|
-
) : null
|
|
156
|
-
)}
|
|
157
|
-
|
|
158
|
-
{gamificationConfig?.enabled && (
|
|
159
|
-
<Stack.Screen
|
|
160
|
-
name="Gamification"
|
|
161
|
-
options={{ headerTitle: t("settings.gamification.title") }}
|
|
162
|
-
>
|
|
163
|
-
{() => <GamificationScreenWrapper config={gamificationConfig} />}
|
|
164
|
-
</Stack.Screen>
|
|
165
|
-
)}
|
|
166
|
-
|
|
167
|
-
<Stack.Screen
|
|
168
|
-
name="LanguageSelection"
|
|
169
|
-
options={{ headerShown: false }}
|
|
170
|
-
>
|
|
171
|
-
{() => (
|
|
172
|
-
<LanguageSelectionScreen
|
|
173
|
-
headerTitle={t("settings.language.title")}
|
|
174
|
-
searchPlaceholder={t("settings.languageSelection.searchPlaceholder")}
|
|
114
|
+
),
|
|
115
|
+
},
|
|
116
|
+
];
|
|
117
|
+
|
|
118
|
+
if (faqData && faqData.categories.length > 0) {
|
|
119
|
+
list.push({
|
|
120
|
+
name: "FAQ",
|
|
121
|
+
options: { headerTitle: t("settings.faqs.title") },
|
|
122
|
+
children: () => (
|
|
123
|
+
<FAQScreen
|
|
124
|
+
categories={faqData.categories}
|
|
125
|
+
searchPlaceholder={t("settings.faqs.searchPlaceholder")}
|
|
126
|
+
emptySearchTitle={t("settings.faqs.emptySearchTitle")}
|
|
127
|
+
emptySearchMessage={t("settings.faqs.emptySearchMessage")}
|
|
128
|
+
headerTitle={t("settings.faqs.headerTitle")}
|
|
175
129
|
/>
|
|
176
|
-
)
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
130
|
+
),
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Add additional screens
|
|
135
|
+
additionalScreens.forEach((screen) => {
|
|
136
|
+
list.push({
|
|
137
|
+
name: screen.name as keyof SettingsStackParamList,
|
|
138
|
+
component: screen.component as any,
|
|
139
|
+
children: screen.children as any,
|
|
140
|
+
options: screen.options as any,
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
if (gamificationConfig?.enabled) {
|
|
145
|
+
list.push({
|
|
146
|
+
name: "Gamification",
|
|
147
|
+
options: { headerTitle: t("settings.gamification.title") },
|
|
148
|
+
children: () => <GamificationScreenWrapper config={gamificationConfig} />,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
list.push({
|
|
153
|
+
name: "LanguageSelection",
|
|
154
|
+
options: { headerShown: false },
|
|
155
|
+
children: () => (
|
|
156
|
+
<LanguageSelectionScreen
|
|
157
|
+
headerTitle={t("settings.language.title")}
|
|
158
|
+
searchPlaceholder={t("settings.languageSelection.searchPlaceholder")}
|
|
159
|
+
/>
|
|
160
|
+
),
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
if (accountConfig) {
|
|
164
|
+
list.push({
|
|
165
|
+
name: "Account",
|
|
166
|
+
options: { headerTitle: t("settings.account.title") },
|
|
167
|
+
children: () => <AccountScreen config={accountConfig} />,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return list;
|
|
172
|
+
}, [
|
|
173
|
+
t,
|
|
174
|
+
showHeader,
|
|
175
|
+
config,
|
|
176
|
+
appInfo.version,
|
|
177
|
+
showUserProfile,
|
|
178
|
+
userProfile,
|
|
179
|
+
devSettings,
|
|
180
|
+
customSections,
|
|
181
|
+
aboutConfig,
|
|
182
|
+
legalScreenProps,
|
|
183
|
+
notificationTranslations,
|
|
184
|
+
quietHoursTranslations,
|
|
185
|
+
faqData,
|
|
186
|
+
additionalScreens,
|
|
187
|
+
gamificationConfig,
|
|
188
|
+
accountConfig,
|
|
189
|
+
]);
|
|
190
|
+
|
|
191
|
+
const navigatorConfig: StackNavigatorConfig<SettingsStackParamList> = {
|
|
192
|
+
initialRouteName: "SettingsMain",
|
|
193
|
+
screenOptions: screenOptions as any,
|
|
194
|
+
screens,
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
return <StackNavigator<any> config={navigatorConfig as any} />;
|
|
186
198
|
};
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
import React from "react";
|
|
7
7
|
import { View, StatusBar, StyleSheet } from "react-native";
|
|
8
|
-
import { useNavigation } from "@react-navigation/native";
|
|
9
8
|
import {
|
|
10
9
|
useAppDesignTokens,
|
|
11
10
|
ScreenLayout,
|
|
11
|
+
useAppNavigation,
|
|
12
12
|
} from "@umituz/react-native-design-system";
|
|
13
13
|
import { SettingsHeader } from "./components/SettingsHeader";
|
|
14
14
|
import { SettingsContent } from "./components/SettingsContent";
|
|
@@ -51,6 +51,8 @@ export interface SettingsScreenProps {
|
|
|
51
51
|
};
|
|
52
52
|
/** Dev settings (only shown in __DEV__ mode) */
|
|
53
53
|
devSettings?: DevSettingsProps;
|
|
54
|
+
/** Gamification configuration */
|
|
55
|
+
gamificationConfig?: import("../../domains/gamification").GamificationSettingsConfig;
|
|
54
56
|
/** Show header (default: true) */
|
|
55
57
|
showHeader?: boolean;
|
|
56
58
|
}
|
|
@@ -68,8 +70,9 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
|
|
|
68
70
|
onClose,
|
|
69
71
|
featureOptions,
|
|
70
72
|
devSettings,
|
|
73
|
+
gamificationConfig,
|
|
71
74
|
}) => {
|
|
72
|
-
const navigation =
|
|
75
|
+
const navigation = useAppNavigation();
|
|
73
76
|
const tokens = useAppDesignTokens();
|
|
74
77
|
|
|
75
78
|
const normalizedConfig = normalizeSettingsConfig(config);
|
|
@@ -94,6 +97,7 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
|
|
|
94
97
|
customSections={customSections}
|
|
95
98
|
showCloseButton={showCloseButton}
|
|
96
99
|
devSettings={devSettings}
|
|
100
|
+
gamificationConfig={gamificationConfig}
|
|
97
101
|
/>
|
|
98
102
|
</SettingsErrorBoundary>
|
|
99
103
|
</ScreenLayout>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
// @ts-ignore - Optional peer dependency
|
|
3
|
+
import { useAppNavigation } from "@umituz/react-native-design-system";
|
|
4
|
+
import type { IconName } from "@umituz/react-native-design-system";
|
|
5
|
+
import { SettingsItemCard } from "../../components/SettingsItemCard";
|
|
6
|
+
import { useGamification } from "../../../domains/gamification";
|
|
7
|
+
|
|
8
|
+
export interface GamificationSettingsItemProps {
|
|
9
|
+
config: any;
|
|
10
|
+
gamificationConfig?: any;
|
|
11
|
+
t: (key: string) => string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const GamificationSettingsItem: React.FC<GamificationSettingsItemProps> = ({
|
|
15
|
+
config,
|
|
16
|
+
gamificationConfig,
|
|
17
|
+
t
|
|
18
|
+
}) => {
|
|
19
|
+
const navigation = useAppNavigation();
|
|
20
|
+
const { level } = useGamification(gamificationConfig);
|
|
21
|
+
|
|
22
|
+
const handlePress = () => {
|
|
23
|
+
if (config.route) {
|
|
24
|
+
navigation.navigate(config.route as never);
|
|
25
|
+
} else {
|
|
26
|
+
navigation.navigate("Gamification" as never);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const icon = (config.icon || "trophy-outline") as IconName;
|
|
31
|
+
const title = config.title || t("settings.gamification.title");
|
|
32
|
+
|
|
33
|
+
// Dynamic description showing current level and points
|
|
34
|
+
const description = config.description ||
|
|
35
|
+
t("settings.gamification.description")
|
|
36
|
+
.replace("{level}", level.currentLevel.toString())
|
|
37
|
+
.replace("{points}", level.currentPoints.toString());
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<SettingsItemCard
|
|
41
|
+
title={title}
|
|
42
|
+
description={description}
|
|
43
|
+
icon={icon}
|
|
44
|
+
onPress={handlePress}
|
|
45
|
+
sectionTitle={config.sectionTitle}
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useMemo } from "react";
|
|
2
2
|
import { View, StyleSheet } from "react-native";
|
|
3
|
-
import { useNavigation } from "@react-navigation/native";
|
|
4
3
|
import { useLocalization } from "@umituz/react-native-localization";
|
|
5
4
|
import { SettingsFooter } from "../../components/SettingsFooter";
|
|
6
5
|
import { SettingsSection } from "../../components/SettingsSection";
|
|
@@ -10,49 +9,14 @@ import { ProfileSectionLoader } from "./sections/ProfileSectionLoader";
|
|
|
10
9
|
import { FeatureSettingsSection } from "./sections/FeatureSettingsSection";
|
|
11
10
|
import { IdentitySettingsSection } from "./sections/IdentitySettingsSection";
|
|
12
11
|
import { SupportSettingsSection } from "./sections/SupportSettingsSection";
|
|
13
|
-
import { SettingsItemCard } from "../../components/SettingsItemCard";
|
|
14
|
-
import type { IconName } from "@umituz/react-native-design-system";
|
|
15
12
|
import { CustomSettingsList } from "./sections/CustomSettingsList";
|
|
16
13
|
import type { NormalizedConfig } from "../utils/normalizeConfig";
|
|
17
|
-
import type { CustomSettingsSection
|
|
18
|
-
|
|
19
|
-
const WalletSettingsItem: React.FC<{ config: WalletConfig; t: (key: string) => string }> = ({ config, t }) => {
|
|
20
|
-
const navigation = useNavigation();
|
|
21
|
-
const handlePress = () => {
|
|
22
|
-
if (config.route) {
|
|
23
|
-
navigation.navigate(config.route as never);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
return (
|
|
27
|
-
<SettingsItemCard
|
|
28
|
-
title={config.title || t("wallet.title")}
|
|
29
|
-
description={config.description || t("wallet.description")}
|
|
30
|
-
icon={(config.icon || "wallet") as IconName}
|
|
31
|
-
onPress={handlePress}
|
|
32
|
-
sectionTitle={config.sectionTitle}
|
|
33
|
-
/>
|
|
34
|
-
);
|
|
35
|
-
};
|
|
14
|
+
import type { CustomSettingsSection } from "../types";
|
|
36
15
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
navigation.navigate(config.route as never);
|
|
42
|
-
} else if (config.onPress) {
|
|
43
|
-
config.onPress();
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
return (
|
|
47
|
-
<SettingsItemCard
|
|
48
|
-
title={config.title || t("settings.subscription.title")}
|
|
49
|
-
description={config.description || t("settings.subscription.description")}
|
|
50
|
-
icon={(config.icon || "star") as IconName}
|
|
51
|
-
onPress={handlePress}
|
|
52
|
-
sectionTitle={config.sectionTitle}
|
|
53
|
-
/>
|
|
54
|
-
);
|
|
55
|
-
};
|
|
16
|
+
// Extracted Item Components
|
|
17
|
+
import { SubscriptionSettingsItem } from "./SubscriptionSettingsItem";
|
|
18
|
+
import { WalletSettingsItem } from "./WalletSettingsItem";
|
|
19
|
+
import { GamificationSettingsItem } from "./GamificationSettingsItem";
|
|
56
20
|
|
|
57
21
|
interface SettingsContentProps {
|
|
58
22
|
normalizedConfig: NormalizedConfig;
|
|
@@ -70,6 +34,7 @@ interface SettingsContentProps {
|
|
|
70
34
|
faqs: boolean;
|
|
71
35
|
subscription: boolean;
|
|
72
36
|
wallet: boolean;
|
|
37
|
+
gamification: boolean;
|
|
73
38
|
};
|
|
74
39
|
showUserProfile?: boolean;
|
|
75
40
|
userProfile?: any;
|
|
@@ -79,6 +44,7 @@ interface SettingsContentProps {
|
|
|
79
44
|
customSections?: CustomSettingsSection[];
|
|
80
45
|
showCloseButton?: boolean;
|
|
81
46
|
devSettings?: DevSettingsProps;
|
|
47
|
+
gamificationConfig?: import("../../../domains/gamification").GamificationSettingsConfig;
|
|
82
48
|
}
|
|
83
49
|
|
|
84
50
|
export const SettingsContent: React.FC<SettingsContentProps> = ({
|
|
@@ -93,6 +59,7 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
|
|
|
93
59
|
customSections = [],
|
|
94
60
|
showCloseButton = false,
|
|
95
61
|
devSettings,
|
|
62
|
+
gamificationConfig,
|
|
96
63
|
}) => {
|
|
97
64
|
const { t } = useLocalization();
|
|
98
65
|
|
|
@@ -108,6 +75,7 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
|
|
|
108
75
|
features.faqs ||
|
|
109
76
|
features.subscription ||
|
|
110
77
|
features.wallet ||
|
|
78
|
+
features.gamification ||
|
|
111
79
|
customSections.length > 0,
|
|
112
80
|
[features, customSections.length]
|
|
113
81
|
);
|
|
@@ -129,6 +97,14 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
|
|
|
129
97
|
/>
|
|
130
98
|
)}
|
|
131
99
|
|
|
100
|
+
{features.gamification && (
|
|
101
|
+
<GamificationSettingsItem
|
|
102
|
+
config={normalizedConfig.gamification.config || {}}
|
|
103
|
+
gamificationConfig={gamificationConfig}
|
|
104
|
+
t={t}
|
|
105
|
+
/>
|
|
106
|
+
)}
|
|
107
|
+
|
|
132
108
|
<FeatureSettingsSection normalizedConfig={normalizedConfig} features={features} />
|
|
133
109
|
|
|
134
110
|
<IdentitySettingsSection normalizedConfig={normalizedConfig} features={features} />
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import React from "react";
|
|
7
7
|
import { View, Pressable, StyleSheet } from "react-native";
|
|
8
|
-
import {
|
|
9
|
-
import { useAppDesignTokens, AtomicIcon, AtomicText } from "@umituz/react-native-design-system";
|
|
8
|
+
import { useAppDesignTokens, AtomicIcon, AtomicText, useAppNavigation } from "@umituz/react-native-design-system";
|
|
10
9
|
import { useLocalization } from "@umituz/react-native-localization";
|
|
11
10
|
|
|
12
11
|
interface SettingsHeaderProps {
|
|
@@ -18,7 +17,7 @@ export const SettingsHeader: React.FC<SettingsHeaderProps> = ({
|
|
|
18
17
|
showCloseButton = false,
|
|
19
18
|
onClose,
|
|
20
19
|
}) => {
|
|
21
|
-
const navigation =
|
|
20
|
+
const navigation = useAppNavigation();
|
|
22
21
|
const tokens = useAppDesignTokens();
|
|
23
22
|
const { t } = useLocalization();
|
|
24
23
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
// @ts-ignore - Optional peer dependency
|
|
3
|
+
import { useAppNavigation } from "@umituz/react-native-design-system";
|
|
4
|
+
import { SettingsItemCard } from "../../components/SettingsItemCard";
|
|
5
|
+
import type { IconName } from "@umituz/react-native-design-system";
|
|
6
|
+
|
|
7
|
+
export interface SubscriptionSettingsItemProps {
|
|
8
|
+
config: any;
|
|
9
|
+
t: (key: string) => string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const SubscriptionSettingsItem: React.FC<SubscriptionSettingsItemProps> = ({ config, t }) => {
|
|
13
|
+
const navigation = useAppNavigation();
|
|
14
|
+
const handlePress = () => {
|
|
15
|
+
if (config.route) {
|
|
16
|
+
navigation.navigate(config.route as never);
|
|
17
|
+
} else if (config.onPress) {
|
|
18
|
+
config.onPress();
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
return (
|
|
22
|
+
<SettingsItemCard
|
|
23
|
+
title={config.title || t("settings.subscription.title")}
|
|
24
|
+
description={config.description || t("settings.subscription.description")}
|
|
25
|
+
icon={(config.icon || "star") as IconName}
|
|
26
|
+
onPress={handlePress}
|
|
27
|
+
sectionTitle={config.sectionTitle}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
// @ts-ignore - Optional peer dependency
|
|
3
|
+
import { useAppNavigation } from "@umituz/react-native-design-system";
|
|
4
|
+
import { SettingsItemCard } from "../../components/SettingsItemCard";
|
|
5
|
+
import type { IconName } from "@umituz/react-native-design-system";
|
|
6
|
+
|
|
7
|
+
export interface WalletSettingsItemProps {
|
|
8
|
+
config: any;
|
|
9
|
+
t: (key: string) => string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const WalletSettingsItem: React.FC<WalletSettingsItemProps> = ({ config, t }) => {
|
|
13
|
+
const navigation = useAppNavigation();
|
|
14
|
+
const handlePress = () => {
|
|
15
|
+
if (config.route) {
|
|
16
|
+
navigation.navigate(config.route as never);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
return (
|
|
20
|
+
<SettingsItemCard
|
|
21
|
+
title={config.title || t("wallet.title")}
|
|
22
|
+
description={config.description || t("wallet.description")}
|
|
23
|
+
icon={(config.icon || "wallet") as IconName}
|
|
24
|
+
onPress={handlePress}
|
|
25
|
+
sectionTitle={config.sectionTitle}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { useAppNavigation } from "@umituz/react-native-design-system";
|
|
3
3
|
import { AppearanceSection } from "../../../../domains/appearance/presentation/components/AppearanceSection";
|
|
4
4
|
import { NotificationsSection } from "../../../../domains/notifications";
|
|
5
5
|
import { useLocalization, getLanguageByCode } from "@umituz/react-native-localization";
|
|
@@ -20,7 +20,7 @@ export const FeatureSettingsSection: React.FC<FeatureSettingsSectionProps> = ({
|
|
|
20
20
|
features,
|
|
21
21
|
}) => {
|
|
22
22
|
const { t, currentLanguage } = useLocalization();
|
|
23
|
-
const navigation =
|
|
23
|
+
const navigation = useAppNavigation();
|
|
24
24
|
|
|
25
25
|
const handleLanguagePress = () => {
|
|
26
26
|
const route = normalizedConfig.language.config?.route || "LanguageSelection";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View, StyleSheet } from "react-native";
|
|
3
|
-
import { useNavigation } from "@react-navigation/native";
|
|
4
3
|
import { ProfileSection } from "@umituz/react-native-auth";
|
|
5
4
|
import { useLocalization } from "@umituz/react-native-localization";
|
|
5
|
+
import { useAppNavigation } from "@umituz/react-native-design-system";
|
|
6
6
|
|
|
7
7
|
export interface ProfileSectionLoaderProps {
|
|
8
8
|
userProfile?: {
|
|
@@ -19,7 +19,7 @@ export interface ProfileSectionLoaderProps {
|
|
|
19
19
|
|
|
20
20
|
export const ProfileSectionLoader: React.FC<ProfileSectionLoaderProps> = ({ userProfile }) => {
|
|
21
21
|
const { t } = useLocalization();
|
|
22
|
-
const navigation =
|
|
22
|
+
const navigation = useAppNavigation();
|
|
23
23
|
|
|
24
24
|
if (!userProfile) return null;
|
|
25
25
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback } from "react";
|
|
2
|
-
import { useNavigation } from "@react-navigation/native";
|
|
3
2
|
import { useLocalization } from "@umituz/react-native-localization";
|
|
3
|
+
import { useAppNavigation } from "@umituz/react-native-design-system";
|
|
4
4
|
import { SupportSection } from "../../../../domains/feedback/presentation/components/SupportSection";
|
|
5
5
|
import { SettingsSection } from "../../../components/SettingsSection";
|
|
6
6
|
import { SettingsItemCard } from "../../../components/SettingsItemCard";
|
|
@@ -15,7 +15,7 @@ export const SupportSettingsSection: React.FC<SupportSettingsSectionProps> = ({
|
|
|
15
15
|
normalizedConfig,
|
|
16
16
|
}) => {
|
|
17
17
|
const { t } = useLocalization();
|
|
18
|
-
const navigation =
|
|
18
|
+
const navigation = useAppNavigation();
|
|
19
19
|
|
|
20
20
|
const handleFAQPress = useCallback(() => {
|
|
21
21
|
navigation.navigate("FAQ" as never);
|
|
@@ -60,6 +60,7 @@ export function useFeatureDetection(
|
|
|
60
60
|
faqs,
|
|
61
61
|
subscription,
|
|
62
62
|
wallet,
|
|
63
|
+
gamification,
|
|
63
64
|
} = normalizedConfig;
|
|
64
65
|
|
|
65
66
|
const notificationServiceAvailable = !!options?.notificationServiceAvailable;
|
|
@@ -114,6 +115,7 @@ export function useFeatureDetection(
|
|
|
114
115
|
faqs: faqs.enabled,
|
|
115
116
|
subscription: subscription.enabled,
|
|
116
117
|
wallet: wallet.enabled,
|
|
118
|
+
gamification: gamification.enabled,
|
|
117
119
|
};
|
|
118
120
|
}, [normalizedConfig, navigation, options]);
|
|
119
121
|
}
|
|
@@ -20,6 +20,7 @@ import type {
|
|
|
20
20
|
CloudSyncConfig,
|
|
21
21
|
SubscriptionConfig,
|
|
22
22
|
WalletConfig,
|
|
23
|
+
GamificationItemConfig,
|
|
23
24
|
} from "./UserFeatureConfig";
|
|
24
25
|
|
|
25
26
|
/**
|
|
@@ -130,6 +131,12 @@ export interface SettingsConfig {
|
|
|
130
131
|
*/
|
|
131
132
|
wallet?: FeatureVisibility | WalletConfig;
|
|
132
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Gamification settings configuration
|
|
136
|
+
* @default false
|
|
137
|
+
*/
|
|
138
|
+
gamification?: FeatureVisibility | GamificationItemConfig;
|
|
139
|
+
|
|
133
140
|
/**
|
|
134
141
|
* Custom empty state text when no settings are available
|
|
135
142
|
*/
|
|
@@ -139,3 +139,24 @@ export interface WalletConfig {
|
|
|
139
139
|
/** Current balance to display */
|
|
140
140
|
balance?: number;
|
|
141
141
|
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Gamification Settings Item Configuration
|
|
145
|
+
*/
|
|
146
|
+
export interface GamificationItemConfig {
|
|
147
|
+
/** Show gamification section */
|
|
148
|
+
enabled?: FeatureVisibility;
|
|
149
|
+
/** Custom title for the gamification section */
|
|
150
|
+
title?: string;
|
|
151
|
+
/** Custom label for the gamification item */
|
|
152
|
+
description?: string;
|
|
153
|
+
/** Custom icon name (Ionicons) */
|
|
154
|
+
icon?: string;
|
|
155
|
+
/** Custom section title for grouping */
|
|
156
|
+
sectionTitle?: string;
|
|
157
|
+
/** Navigation route for gamification screen */
|
|
158
|
+
route?: string;
|
|
159
|
+
/** Achievements to display */
|
|
160
|
+
achievementsCount?: number;
|
|
161
|
+
}
|
|
162
|
+
|
|
@@ -20,6 +20,8 @@ export type {
|
|
|
20
20
|
CloudSyncConfig,
|
|
21
21
|
SubscriptionConfig,
|
|
22
22
|
WalletConfig,
|
|
23
|
+
GamificationItemConfig,
|
|
23
24
|
} from "./UserFeatureConfig";
|
|
25
|
+
export type { GamificationSettingsConfig as GamificationConfig } from "../../../domains/gamification";
|
|
24
26
|
export type { SettingsConfig } from "./SettingsConfig";
|
|
25
27
|
export type { CustomSettingsSection } from "./CustomSection";
|