@umituz/react-native-settings 4.21.19 → 4.21.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/package.json +1 -1
  2. package/src/domains/about/presentation/components/AboutContent.tsx +3 -4
  3. package/src/domains/about/presentation/components/AboutHeader.tsx +7 -14
  4. package/src/domains/about/presentation/components/AboutSection.tsx +2 -2
  5. package/src/domains/about/presentation/components/AboutSettingItem.tsx +16 -16
  6. package/src/domains/appearance/presentation/components/AppearanceSection.tsx +2 -2
  7. package/src/domains/appearance/presentation/screens/AppearanceScreen.tsx +3 -4
  8. package/src/domains/faqs/presentation/components/FAQEmptyState.tsx +2 -2
  9. package/src/domains/gamification/components/AchievementCard.tsx +26 -19
  10. package/src/domains/gamification/components/AchievementItem.tsx +27 -25
  11. package/src/domains/gamification/components/AchievementToast.tsx +16 -12
  12. package/src/domains/gamification/components/GamificationScreen/AchievementsList.tsx +6 -5
  13. package/src/domains/gamification/components/GamificationScreen/Header.tsx +4 -3
  14. package/src/domains/gamification/components/GamificationScreen/StatsGrid.tsx +4 -3
  15. package/src/domains/gamification/components/GamificationScreen/index.tsx +38 -28
  16. package/src/domains/gamification/components/LevelProgress.tsx +25 -18
  17. package/src/domains/gamification/components/PointsBadge.tsx +13 -9
  18. package/src/domains/gamification/components/StatsCard.tsx +20 -14
  19. package/src/domains/gamification/components/StreakDisplay.tsx +28 -22
  20. package/src/domains/legal/presentation/components/LegalSection.tsx +2 -2
  21. package/src/domains/notifications/presentation/components/NotificationsSection.tsx +2 -4
  22. package/src/domains/notifications/presentation/screens/NotificationSettingsScreen.tsx +3 -4
  23. package/src/domains/rating/presentation/components/StarRating.tsx +2 -2
  24. package/src/domains/video-tutorials/presentation/components/VideoTutorialCard.tsx +35 -127
  25. package/src/domains/video-tutorials/presentation/screens/VideoTutorialsScreen.tsx +88 -153
  26. package/src/presentation/components/SettingsItemCard.tsx +3 -22
  27. package/src/presentation/navigation/SettingsStackNavigator.tsx +112 -100
  28. package/src/presentation/screens/SettingsScreen.tsx +2 -2
  29. package/src/presentation/screens/components/GamificationSettingsItem.tsx +3 -3
  30. package/src/presentation/screens/components/SettingsHeader.tsx +2 -3
  31. package/src/presentation/screens/components/SubscriptionSettingsItem.tsx +2 -2
  32. package/src/presentation/screens/components/WalletSettingsItem.tsx +2 -2
  33. package/src/presentation/screens/components/sections/FeatureSettingsSection.tsx +2 -2
  34. package/src/presentation/screens/components/sections/ProfileSectionLoader.tsx +2 -2
  35. package/src/presentation/screens/components/sections/SupportSettingsSection.tsx +2 -2
  36. package/src/presentation/screens/types/SettingsConfig.ts +2 -2
  37. package/src/presentation/screens/types/UserFeatureConfig.ts +2 -2
  38. package/src/presentation/screens/types/index.ts +2 -0
  39. package/src/presentation/screens/utils/normalizeConfig.ts +2 -2
@@ -6,15 +6,10 @@
6
6
  */
7
7
 
8
8
  import React from "react";
9
- import { createStackNavigator } from "@react-navigation/stack";
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
- return (
81
- <Stack.Navigator screenOptions={screenOptions}>
82
- <Stack.Screen
83
- name="SettingsMain"
84
- options={showHeader ? { headerTitle: t("settings.title") } : { headerShown: false }}
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
- </Stack.Screen>
98
-
99
- <Stack.Screen
100
- name="Appearance"
101
- component={AppearanceScreen}
102
- options={{ headerShown: false }}
103
- />
104
-
105
- <Stack.Screen name="About" options={{ headerTitle: t("settings.about.title") }}>
106
- {() => <AboutScreenWrapper config={aboutConfig} />}
107
- </Stack.Screen>
108
-
109
- <Stack.Screen name="Legal" options={{ headerTitle: t("settings.legal.title") }}>
110
- {() => <LegalScreenWrapper {...legalScreenProps} />}
111
- </Stack.Screen>
112
-
113
- <Stack.Screen
114
- name="Notifications"
115
- options={{ headerShown: false }}
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
- </Stack.Screen>
124
-
125
- {faqData && faqData.categories.length > 0 && (
126
- <Stack.Screen name="FAQ" options={{ headerTitle: t("settings.faqs.title") }}>
127
- {() => (
128
- <FAQScreen
129
- categories={faqData.categories}
130
- searchPlaceholder={t("settings.faqs.searchPlaceholder")}
131
- emptySearchTitle={t("settings.faqs.emptySearchTitle")}
132
- emptySearchMessage={t("settings.faqs.emptySearchMessage")}
133
- headerTitle={t("settings.faqs.headerTitle")}
134
- />
135
- )}
136
- </Stack.Screen>
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
- </Stack.Screen>
178
-
179
- {accountConfig && (
180
- <Stack.Screen name="Account" options={{ headerTitle: t("settings.account.title") }}>
181
- {() => <AccountScreen config={accountConfig} />}
182
- </Stack.Screen>
183
- )}
184
- </Stack.Navigator>
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";
@@ -72,7 +72,7 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
72
72
  devSettings,
73
73
  gamificationConfig,
74
74
  }) => {
75
- const navigation = useNavigation();
75
+ const navigation = useAppNavigation();
76
76
  const tokens = useAppDesignTokens();
77
77
 
78
78
  const normalizedConfig = normalizeSettingsConfig(config);
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
2
  // @ts-ignore - Optional peer dependency
3
- import { useNavigation } from "@react-navigation/native";
4
- import { SettingsItemCard } from "../../components/SettingsItemCard";
3
+ import { useAppNavigation } from "@umituz/react-native-design-system";
5
4
  import type { IconName } from "@umituz/react-native-design-system";
5
+ import { SettingsItemCard } from "../../components/SettingsItemCard";
6
6
  import { useGamification } from "../../../domains/gamification";
7
7
 
8
8
  export interface GamificationSettingsItemProps {
@@ -16,7 +16,7 @@ export const GamificationSettingsItem: React.FC<GamificationSettingsItemProps> =
16
16
  gamificationConfig,
17
17
  t
18
18
  }) => {
19
- const navigation = useNavigation();
19
+ const navigation = useAppNavigation();
20
20
  const { level } = useGamification(gamificationConfig);
21
21
 
22
22
  const handlePress = () => {
@@ -5,8 +5,7 @@
5
5
 
6
6
  import React from "react";
7
7
  import { View, Pressable, StyleSheet } from "react-native";
8
- import { useNavigation } from "@react-navigation/native";
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 = useNavigation();
20
+ const navigation = useAppNavigation();
22
21
  const tokens = useAppDesignTokens();
23
22
  const { t } = useLocalization();
24
23
 
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  // @ts-ignore - Optional peer dependency
3
- import { useNavigation } from "@react-navigation/native";
3
+ import { useAppNavigation } from "@umituz/react-native-design-system";
4
4
  import { SettingsItemCard } from "../../components/SettingsItemCard";
5
5
  import type { IconName } from "@umituz/react-native-design-system";
6
6
 
@@ -10,7 +10,7 @@ export interface SubscriptionSettingsItemProps {
10
10
  }
11
11
 
12
12
  export const SubscriptionSettingsItem: React.FC<SubscriptionSettingsItemProps> = ({ config, t }) => {
13
- const navigation = useNavigation();
13
+ const navigation = useAppNavigation();
14
14
  const handlePress = () => {
15
15
  if (config.route) {
16
16
  navigation.navigate(config.route as never);
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  // @ts-ignore - Optional peer dependency
3
- import { useNavigation } from "@react-navigation/native";
3
+ import { useAppNavigation } from "@umituz/react-native-design-system";
4
4
  import { SettingsItemCard } from "../../components/SettingsItemCard";
5
5
  import type { IconName } from "@umituz/react-native-design-system";
6
6
 
@@ -10,7 +10,7 @@ export interface WalletSettingsItemProps {
10
10
  }
11
11
 
12
12
  export const WalletSettingsItem: React.FC<WalletSettingsItemProps> = ({ config, t }) => {
13
- const navigation = useNavigation();
13
+ const navigation = useAppNavigation();
14
14
  const handlePress = () => {
15
15
  if (config.route) {
16
16
  navigation.navigate(config.route as never);
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { useNavigation } from "@react-navigation/native";
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 = useNavigation();
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 = useNavigation<any>();
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 = useNavigation();
18
+ const navigation = useAppNavigation();
19
19
 
20
20
  const handleFAQPress = useCallback(() => {
21
21
  navigation.navigate("FAQ" as never);
@@ -20,7 +20,7 @@ import type {
20
20
  CloudSyncConfig,
21
21
  SubscriptionConfig,
22
22
  WalletConfig,
23
- GamificationConfig,
23
+ GamificationItemConfig,
24
24
  } from "./UserFeatureConfig";
25
25
 
26
26
  /**
@@ -135,7 +135,7 @@ export interface SettingsConfig {
135
135
  * Gamification settings configuration
136
136
  * @default false
137
137
  */
138
- gamification?: FeatureVisibility | GamificationConfig;
138
+ gamification?: FeatureVisibility | GamificationItemConfig;
139
139
 
140
140
  /**
141
141
  * Custom empty state text when no settings are available
@@ -141,9 +141,9 @@ export interface WalletConfig {
141
141
  }
142
142
 
143
143
  /**
144
- * Gamification Settings Configuration
144
+ * Gamification Settings Item Configuration
145
145
  */
146
- export interface GamificationConfig {
146
+ export interface GamificationItemConfig {
147
147
  /** Show gamification section */
148
148
  enabled?: FeatureVisibility;
149
149
  /** Custom title for the gamification section */
@@ -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";
@@ -17,7 +17,7 @@ import type {
17
17
  FAQConfig,
18
18
  SubscriptionConfig,
19
19
  WalletConfig,
20
- GamificationConfig,
20
+ GamificationItemConfig,
21
21
  SettingsConfig,
22
22
  } from "../types";
23
23
 
@@ -72,7 +72,7 @@ export interface NormalizedConfig {
72
72
  };
73
73
  gamification: {
74
74
  enabled: boolean;
75
- config?: GamificationConfig;
75
+ config?: GamificationItemConfig;
76
76
  };
77
77
  }
78
78