diff --git a/babel.config.js b/babel.config.js index 519dc67..f121c87 100644 --- a/babel.config.js +++ b/babel.config.js @@ -9,24 +9,11 @@ module.exports = { alias: { app: './src/app', screens: './src/screens', - pages: './src/pages', widgets: './src/widgets', features: './src/features', entities: './src/entities', shared: './src/shared', assets: './src/assets', - components: './src/components', - configs: './src/configs', - constants: './src/constants', - consts: './src/consts', - helpers: './src/helpers', - hooks: './src/hooks', - json: './src/json', - services: './src/services', - slices: './src/slices', - thunks: './src/thunks', - utils: './src/utils', - validations: './src/validations', }, }, ], diff --git a/index.js b/index.js index c8da2c5..a60c95d 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,4 @@ +import notifee from '@notifee/react-native'; import messaging from '@react-native-firebase/messaging'; import { GoogleSignin } from '@react-native-google-signin/google-signin'; import 'moment/min/locales'; @@ -5,10 +6,13 @@ import { AppRegistry, LogBox } from 'react-native'; import TrackPlayer from 'react-native-track-player'; import { googleSigninConfig } from 'shared/config/google'; import 'shared/config/i18n'; -import { onMessageReceived } from 'shared/utils/messageReceived'; import App from './src/app'; import { audioPlaybackService } from './src/entities/audio'; +const onMessageReceived = async message => { + notifee.displayNotification(JSON.parse(message.data.notifee)); +}; + messaging().onMessage(onMessageReceived); messaging().setBackgroundMessageHandler(onMessageReceived); diff --git a/src/app/navigation/ui/Navigation.tsx b/src/app/navigation/ui/Navigation.tsx index e34e2ed..09ff0f9 100644 --- a/src/app/navigation/ui/Navigation.tsx +++ b/src/app/navigation/ui/Navigation.tsx @@ -46,7 +46,7 @@ import { TrackerScreen } from 'screens/tracker'; import { WelcomeScreen } from 'screens/welcome'; import { WelcomeInfoScreen } from 'screens/welcome-info'; import { AppNavigation, NavigationStackLists } from 'shared/config/navigation'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { TabNavigation } from 'widgets/tab-navigation'; diff --git a/src/app/providers/InitializedProvider/InitializedProvider.tsx b/src/app/providers/InitializedProvider/InitializedProvider.tsx index 788e08c..0902fc4 100644 --- a/src/app/providers/InitializedProvider/InitializedProvider.tsx +++ b/src/app/providers/InitializedProvider/InitializedProvider.tsx @@ -8,9 +8,9 @@ import { } from 'entities/subscription'; import { FC, ReactNode, useEffect } from 'react'; import { getTrackingStatus } from 'react-native-tracking-transparency'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; import { delay } from 'shared/lib/delay'; import { isIos } from 'shared/lib/isIos'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; interface InitializedProviderProps { children: ReactNode; diff --git a/src/app/providers/LanguageProvider/LanguageProvider.tsx b/src/app/providers/LanguageProvider/LanguageProvider.tsx index ca2be85..064673d 100644 --- a/src/app/providers/LanguageProvider/LanguageProvider.tsx +++ b/src/app/providers/LanguageProvider/LanguageProvider.tsx @@ -3,7 +3,7 @@ import moment from 'moment'; import { FC, ReactNode, useEffect } from 'react'; import Tts from 'react-native-tts'; import i18n, { languageVoice } from 'shared/config/i18n'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; interface LanguageProviderProps { children: ReactNode; diff --git a/src/app/providers/ThemeProvider/ui/ThemeProvider.tsx b/src/app/providers/ThemeProvider/ui/ThemeProvider.tsx index 3c61d7d..bc778dd 100644 --- a/src/app/providers/ThemeProvider/ui/ThemeProvider.tsx +++ b/src/app/providers/ThemeProvider/ui/ThemeProvider.tsx @@ -1,7 +1,7 @@ import React, { FC, useEffect } from 'react'; import { Appearance } from 'react-native'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { getColorScheme } from './../model/selectors/getColorScheme/getColorScheme'; import { getTheme } from './../model/selectors/getTheme/getTheme'; import { setTheme } from './../model/slice/themeSlice'; diff --git a/src/entities/auth/ui/AuthProvider/AuthProvider.tsx b/src/entities/auth/ui/AuthProvider/AuthProvider.tsx index c70eda7..e4db81c 100644 --- a/src/entities/auth/ui/AuthProvider/AuthProvider.tsx +++ b/src/entities/auth/ui/AuthProvider/AuthProvider.tsx @@ -1,8 +1,8 @@ import AsyncStorage from '@react-native-async-storage/async-storage'; import { authLogout, getIsAuth } from 'entities/auth'; import React, { useEffect } from 'react'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; type AuthProviderProps = { children: React.ReactNode; diff --git a/src/entities/feed/model/api/FeedApi.ts b/src/entities/feed/model/api/FeedApi.ts index e5c5eff..a8c8892 100644 --- a/src/entities/feed/model/api/FeedApi.ts +++ b/src/entities/feed/model/api/FeedApi.ts @@ -1,5 +1,5 @@ import { authInstance } from 'shared/api'; -import { getLocalize } from 'shared/utils/statistics/getLocalize'; +import { getLocalize } from 'shared/lib/intl/getLocalize'; import { FeedEventTypes, FeedType } from './../types/feeds'; export const FeedApi = { diff --git a/src/entities/feed/model/lib/hooks/useFeeds.ts b/src/entities/feed/model/lib/hooks/useFeeds.ts index 92a4384..9f33b1d 100644 --- a/src/entities/feed/model/lib/hooks/useFeeds.ts +++ b/src/entities/feed/model/lib/hooks/useFeeds.ts @@ -1,6 +1,6 @@ import { useInfiniteQuery } from '@tanstack/react-query'; import { getLanguage } from 'features/language-picker'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { FeedApi } from './../../api/FeedApi'; import { QUERY_KEY_FEED_ALL, QUERY_KEY_FEED_ME } from './../../const/query-key'; diff --git a/src/entities/friend/ui/FriendMotivationItem/FriendMotivationItem.tsx b/src/entities/friend/ui/FriendMotivationItem/FriendMotivationItem.tsx index 8a4a320..e1d2c6c 100644 --- a/src/entities/friend/ui/FriendMotivationItem/FriendMotivationItem.tsx +++ b/src/entities/friend/ui/FriendMotivationItem/FriendMotivationItem.tsx @@ -1,9 +1,9 @@ import { memo } from 'react'; import { Image, ImageSourcePropType, View } from 'react-native'; import { moderateScale } from 'shared/config/dimensions'; +import { abbreviateNumber } from 'shared/lib/format/abbreviateNumber'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextWeight } from 'shared/ui/CustomText'; -import { abbrNum } from 'shared/utils/abbrNum'; import { styles } from './FriendMotivationItemStyle'; interface FriendMotivationItemProps { @@ -33,7 +33,7 @@ export const FriendMotivationItem = memo((props: FriendMotivationItemProps) => { - {abbrNum(value, 0)} + {abbreviateNumber(value, 0)} ); diff --git a/src/entities/friend/ui/ToasterAuth/ToasterAuth.tsx b/src/entities/friend/ui/ToasterAuth/ToasterAuth.tsx index f2aca12..aac9675 100644 --- a/src/entities/friend/ui/ToasterAuth/ToasterAuth.tsx +++ b/src/entities/friend/ui/ToasterAuth/ToasterAuth.tsx @@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next'; import { View } from 'react-native'; import * as Anims from 'shared/assets/anims'; import { AppNavigation } from 'shared/config/navigation'; -import { useAppNavigation } from 'shared/hooks/useAppNavigation'; +import { useAppNavigation } from 'shared/lib/navigation/useAppNavigation'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize } from 'shared/ui/CustomText'; import { styles } from './ToasterAuthStyle'; diff --git a/src/entities/message/model/services/useChatMessage/useChatMessage.ts b/src/entities/message/model/services/useChatMessage/useChatMessage.ts index 85e9050..43e9c97 100644 --- a/src/entities/message/model/services/useChatMessage/useChatMessage.ts +++ b/src/entities/message/model/services/useChatMessage/useChatMessage.ts @@ -5,7 +5,7 @@ import { useFocusEffect } from '@react-navigation/native'; import { getIsAuth } from 'entities/auth'; import { getUserEmail, getUserIsBanned } from 'entities/user'; import React, { useState } from 'react'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; type Message = { id: string; diff --git a/src/entities/message/ui/MessageItem/MessageItem.tsx b/src/entities/message/ui/MessageItem/MessageItem.tsx index 9faeeac..677c29a 100644 --- a/src/entities/message/ui/MessageItem/MessageItem.tsx +++ b/src/entities/message/ui/MessageItem/MessageItem.tsx @@ -4,10 +4,10 @@ import { View } from 'react-native'; import Tooltip from 'rn-tooltip'; import * as Icons from 'shared/assets/icons'; import { moderateScale } from 'shared/config/dimensions'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { abbreviateNumber } from 'shared/lib/format/abbreviateNumber'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize, TextWeight } from 'shared/ui/CustomText'; -import { abbrNum } from 'shared/utils/abbrNum'; import { MessageTail } from './../MessageTail/MessageTail'; import { MessageTooltip } from './../MessageTooltip/MessageTooltip'; import { styles } from './MessageItemStyle'; @@ -78,7 +78,7 @@ export const MessageItem = React.memo((props: MessageType) => { size={TextSize.S_XL} weight={TextWeight.BOLD} style={{ color: cn('indigo.300', 'indigo.400') }}> - {abbrNum(props.rating || 0, 0)} + {abbreviateNumber(props.rating || 0, 0)} diff --git a/src/features/auth/auth-by-apple/AuthByApple.tsx b/src/features/auth/auth-by-apple/AuthByApple.tsx index 71e9e5a..3391251 100644 --- a/src/features/auth/auth-by-apple/AuthByApple.tsx +++ b/src/features/auth/auth-by-apple/AuthByApple.tsx @@ -7,7 +7,7 @@ import { ColorValue, StyleSheet, View } from 'react-native'; import * as Icons from 'shared/assets/icons'; import { moderateScale } from 'shared/config/dimensions'; import { AppNavigation, RootStackParamList } from 'shared/config/navigation'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; import { PressableOpacity } from 'shared/ui/PressableOpacity'; import { AuthApi } from './../../../entities/auth/model/api/authApi'; diff --git a/src/features/auth/auth-by-email/ui/Login/ui/Login.tsx b/src/features/auth/auth-by-email/ui/Login/ui/Login.tsx index a5560b6..625bddc 100644 --- a/src/features/auth/auth-by-email/ui/Login/ui/Login.tsx +++ b/src/features/auth/auth-by-email/ui/Login/ui/Login.tsx @@ -7,7 +7,7 @@ import { useForm } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; import { ActivityIndicator, View } from 'react-native'; import { AppNavigation, RootStackParamList } from 'shared/config/navigation'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; import { CustomButton } from 'shared/ui/CustomButton'; import { InputText } from 'shared/ui/InputText'; import { RowGroup } from 'shared/ui/RowGroup'; diff --git a/src/features/auth/auth-by-email/ui/Registration/ui/Registration.tsx b/src/features/auth/auth-by-email/ui/Registration/ui/Registration.tsx index f4d409a..3763acf 100644 --- a/src/features/auth/auth-by-email/ui/Registration/ui/Registration.tsx +++ b/src/features/auth/auth-by-email/ui/Registration/ui/Registration.tsx @@ -6,7 +6,7 @@ import { useForm } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; import { ActivityIndicator, View } from 'react-native'; import { AppNavigation, RootStackParamList } from 'shared/config/navigation'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; import { CustomButton } from 'shared/ui/CustomButton'; import { InputText } from 'shared/ui/InputText'; import { RowGroup } from 'shared/ui/RowGroup'; diff --git a/src/features/auth/auth-by-google/ui/AuthByGoogle.tsx b/src/features/auth/auth-by-google/ui/AuthByGoogle.tsx index 989c36a..b2fd12b 100644 --- a/src/features/auth/auth-by-google/ui/AuthByGoogle.tsx +++ b/src/features/auth/auth-by-google/ui/AuthByGoogle.tsx @@ -8,7 +8,7 @@ import { useTranslation } from 'react-i18next'; import { ColorValue, Platform, View } from 'react-native'; import * as Icons from 'shared/assets/icons'; import { AppNavigation, RootStackParamList } from 'shared/config/navigation'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; import { CustomText } from 'shared/ui/CustomText'; import { PressableOpacity } from 'shared/ui/PressableOpacity'; import { styles } from './AuthByGoogleStyle'; diff --git a/src/features/auth/email-activation/model/lib/hooks/useIssueAccept/useIssueAccept.ts b/src/features/auth/email-activation/model/lib/hooks/useIssueAccept/useIssueAccept.ts index 3ec22b6..bb2acd3 100644 --- a/src/features/auth/email-activation/model/lib/hooks/useIssueAccept/useIssueAccept.ts +++ b/src/features/auth/email-activation/model/lib/hooks/useIssueAccept/useIssueAccept.ts @@ -1,7 +1,7 @@ import { useQuery } from '@tanstack/react-query'; import { setUserEmailIsActivate } from 'entities/user'; import { useTranslation } from 'react-i18next'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; import { DisplayMessage } from 'shared/ui/DisplayMessage'; import { activationApi } from './../../../api/activationApi'; diff --git "a/src/features/clear-statistic/ui/\320\241learStatistics.tsx" "b/src/features/clear-statistic/ui/\320\241learStatistics.tsx" index 5c162ef..c12db0d 100644 --- "a/src/features/clear-statistic/ui/\320\241learStatistics.tsx" +++ "b/src/features/clear-statistic/ui/\320\241learStatistics.tsx" @@ -3,7 +3,7 @@ import { memo } from 'react'; import { useTranslation } from 'react-i18next'; import { Alert } from 'react-native'; import * as Icons from 'shared/assets/icons'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; import { useTheme } from 'shared/lib/theme'; import { LinkRow } from 'shared/ui/LinkRow'; diff --git a/src/features/currency-picker/model/slices/currencySlice.ts b/src/features/currency-picker/model/slices/currencySlice.ts index 7d84c26..be0c938 100644 --- a/src/features/currency-picker/model/slices/currencySlice.ts +++ b/src/features/currency-picker/model/slices/currencySlice.ts @@ -1,5 +1,5 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'; -import { getAppCurrencies } from 'shared/utils/getAppCurrencies'; +import { getAppCurrencies } from 'shared/lib/intl/getAppCurrencies'; import { CurrencySchema } from './../types/currency'; export const initialState: CurrencySchema = { diff --git a/src/features/currency-picker/model/util/getCurrenciesLabels/getCurrenciesLabels.ts b/src/features/currency-picker/model/util/getCurrenciesLabels/getCurrenciesLabels.ts index 184eb98..9f9e33f 100644 --- a/src/features/currency-picker/model/util/getCurrenciesLabels/getCurrenciesLabels.ts +++ b/src/features/currency-picker/model/util/getCurrenciesLabels/getCurrenciesLabels.ts @@ -1,4 +1,4 @@ -import { currencies } from 'shared/utils/getCurrencySymbol/model/const/currency'; +import { currencies } from 'shared/lib/intl/getCurrencySymbol/model/const/currency'; export const getCurrenciesLabels = (first: string) => { const currencyValues = Object.values(currencies); diff --git a/src/features/currency-picker/model/util/getCurrenciesValues/getCurrenciesValues.ts b/src/features/currency-picker/model/util/getCurrenciesValues/getCurrenciesValues.ts index 1e47219..0739bfb 100644 --- a/src/features/currency-picker/model/util/getCurrenciesValues/getCurrenciesValues.ts +++ b/src/features/currency-picker/model/util/getCurrenciesValues/getCurrenciesValues.ts @@ -1,4 +1,4 @@ -import { currencies } from 'shared/utils/getCurrencySymbol/model/const/currency'; +import { currencies } from 'shared/lib/intl/getCurrencySymbol/model/const/currency'; export const getCurrenciesValues = () => { return ['system', ...Object.keys(currencies)]; diff --git a/src/features/currency-picker/ui/CurrencyPicker.tsx b/src/features/currency-picker/ui/CurrencyPicker.tsx index b6ac61f..fe941fb 100644 --- a/src/features/currency-picker/ui/CurrencyPicker.tsx +++ b/src/features/currency-picker/ui/CurrencyPicker.tsx @@ -1,11 +1,11 @@ import { memo, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import * as Icons from 'shared/assets/icons'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { getAppCurrencies } from 'shared/lib/intl/getAppCurrencies'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { LinkPicker } from 'shared/ui/LinkPicker'; -import { getAppCurrencies } from 'shared/utils/getAppCurrencies'; import { getCurrency } from './../model/selectors/getCurrency/getCurrency'; import { setCurrency } from './../model/slices/currencySlice'; import { getCurrenciesLabels } from './../model/util/getCurrenciesLabels/getCurrenciesLabels'; diff --git a/src/features/feed/feed-create-comment/ui/FeedCreateComment.tsx b/src/features/feed/feed-create-comment/ui/FeedCreateComment.tsx index f483ea9..5801521 100644 --- a/src/features/feed/feed-create-comment/ui/FeedCreateComment.tsx +++ b/src/features/feed/feed-create-comment/ui/FeedCreateComment.tsx @@ -7,9 +7,9 @@ import { Keyboard, TextInput, View } from 'react-native'; import { SafeAreaView } from 'react-native-safe-area-context'; import * as Icons from 'shared/assets/icons'; import { moderateScale } from 'shared/config/dimensions'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; import { isIos } from 'shared/lib/isIos'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText } from 'shared/ui/CustomText'; import { DisplayMessage } from 'shared/ui/DisplayMessage'; diff --git a/src/features/feed/feed-create-post/ui/FeedCreatePost.tsx b/src/features/feed/feed-create-post/ui/FeedCreatePost.tsx index 84494d0..b6a3cc7 100644 --- a/src/features/feed/feed-create-post/ui/FeedCreatePost.tsx +++ b/src/features/feed/feed-create-post/ui/FeedCreatePost.tsx @@ -7,9 +7,9 @@ import { SafeAreaView } from 'react-native-safe-area-context'; import * as Icons from 'shared/assets/icons'; import { moderateScale } from 'shared/config/dimensions'; import { AppNavigation, AppTabNavigation } from 'shared/config/navigation'; -import { useAppNavigation } from 'shared/hooks/useAppNavigation'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; import { isIos } from 'shared/lib/isIos'; +import { useAppNavigation } from 'shared/lib/navigation/useAppNavigation'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText } from 'shared/ui/CustomText'; import { PressableOpacity } from 'shared/ui/PressableOpacity'; diff --git a/src/features/feed/feed-liked/ui/FeedLiked/FeedLiked.tsx b/src/features/feed/feed-liked/ui/FeedLiked/FeedLiked.tsx index e5a446d..da149e0 100644 --- a/src/features/feed/feed-liked/ui/FeedLiked/FeedLiked.tsx +++ b/src/features/feed/feed-liked/ui/FeedLiked/FeedLiked.tsx @@ -12,7 +12,7 @@ import { Animated, View } from 'react-native'; import Tooltip from 'rn-tooltip'; import * as Icons from 'shared/assets/icons'; import { moderateScale } from 'shared/config/dimensions'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; import { useTheme } from 'shared/lib/theme'; import { CustomText } from 'shared/ui/CustomText'; import { DisplayMessage } from 'shared/ui/DisplayMessage'; diff --git a/src/features/feed/feed-pressing/ui/FeedPressing.tsx b/src/features/feed/feed-pressing/ui/FeedPressing.tsx index eb39a15..4e6a1eb 100644 --- a/src/features/feed/feed-pressing/ui/FeedPressing.tsx +++ b/src/features/feed/feed-pressing/ui/FeedPressing.tsx @@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next'; import { ColorValue, StyleSheet, View } from 'react-native'; import Tooltip from 'rn-tooltip'; import { AppNavigation, AppTabNavigation } from 'shared/config/navigation'; -import { useAppNavigation } from 'shared/hooks/useAppNavigation'; +import { useAppNavigation } from 'shared/lib/navigation/useAppNavigation'; import { CustomText } from 'shared/ui/CustomText'; import { DisplayMessage } from 'shared/ui/DisplayMessage'; import { PressableOpacity } from 'shared/ui/PressableOpacity'; diff --git a/src/features/language-picker/model/slices/languageSlice.ts b/src/features/language-picker/model/slices/languageSlice.ts index c238d14..ffc4520 100644 --- a/src/features/language-picker/model/slices/languageSlice.ts +++ b/src/features/language-picker/model/slices/languageSlice.ts @@ -1,6 +1,6 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'; import { LanguageType } from 'shared/config/i18n'; -import { getLocalize } from 'shared/utils/statistics/getLocalize'; +import { getLocalize } from 'shared/lib/intl/getLocalize'; export interface LanguageState { localize: LanguageType; diff --git a/src/features/language-picker/ui/LanguagePicker.tsx b/src/features/language-picker/ui/LanguagePicker.tsx index 15ca1cc..5c7f649 100644 --- a/src/features/language-picker/ui/LanguagePicker.tsx +++ b/src/features/language-picker/ui/LanguagePicker.tsx @@ -2,11 +2,11 @@ import { memo } from 'react'; import { useTranslation } from 'react-i18next'; import * as Icons from 'shared/assets/icons'; import { LanguageType } from 'shared/config/i18n'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { getLocalize } from 'shared/lib/intl/getLocalize'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { LinkPicker } from 'shared/ui/LinkPicker'; -import { getLocalize } from 'shared/utils/statistics/getLocalize'; import { languageValues } from './../model/const/value'; import { languageLabel } from './../model/lib/languageLabel'; import { getLanguage } from './../model/selectors/getLanguage'; diff --git a/src/features/open-card-progres/ui/OpenCardProgress.tsx b/src/features/open-card-progres/ui/OpenCardProgress.tsx index fc5ec36..cb0ad37 100644 --- a/src/features/open-card-progres/ui/OpenCardProgress.tsx +++ b/src/features/open-card-progres/ui/OpenCardProgress.tsx @@ -2,8 +2,8 @@ import { AppSheet, SheetCreateContext } from 'app/providers/SheetProvider'; import { ReactNode, memo, useContext } from 'react'; import { View } from 'react-native'; import { AppNavigation } from 'shared/config/navigation'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppNavigation } from 'shared/hooks/useAppNavigation'; +import { useAppNavigation } from 'shared/lib/navigation/useAppNavigation'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize, TextWeight } from 'shared/ui/CustomText'; import { PressableOpacity } from 'shared/ui/PressableOpacity'; diff --git a/src/features/player/player-control/ui/PlayerControl.tsx b/src/features/player/player-control/ui/PlayerControl.tsx index 9b518ee..bbf6a78 100644 --- a/src/features/player/player-control/ui/PlayerControl.tsx +++ b/src/features/player/player-control/ui/PlayerControl.tsx @@ -8,9 +8,9 @@ import { View } from 'react-native'; import * as Icons from 'shared/assets/icons'; import { moderateScale } from 'shared/config/dimensions'; import { AppNavigation } from 'shared/config/navigation'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppNavigation } from 'shared/hooks/useAppNavigation'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppNavigation } from 'shared/lib/navigation/useAppNavigation'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { DisplayMessage } from 'shared/ui/DisplayMessage'; import { PressableOpacity } from 'shared/ui/PressableOpacity'; diff --git a/src/features/remove-account/ui/RemoveAccount.tsx b/src/features/remove-account/ui/RemoveAccount.tsx index 4870be4..59a544c 100644 --- a/src/features/remove-account/ui/RemoveAccount.tsx +++ b/src/features/remove-account/ui/RemoveAccount.tsx @@ -3,7 +3,7 @@ import { memo } from 'react'; import { useTranslation } from 'react-i18next'; import { Alert } from 'react-native'; import * as Icons from 'shared/assets/icons'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; import { useTheme } from 'shared/lib/theme'; import { LinkRow } from 'shared/ui/LinkRow'; diff --git a/src/features/send-message-chat/model/lib/hooks/useChatOnline/useChatOnline.ts b/src/features/send-message-chat/model/lib/hooks/useChatOnline/useChatOnline.ts index e59e6d9..0991817 100644 --- a/src/features/send-message-chat/model/lib/hooks/useChatOnline/useChatOnline.ts +++ b/src/features/send-message-chat/model/lib/hooks/useChatOnline/useChatOnline.ts @@ -2,7 +2,7 @@ import database from '@react-native-firebase/database'; import { useFocusEffect } from '@react-navigation/native'; import { getLanguage } from 'features/language-picker'; import React, { useState } from 'react'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { getMessageUuid } from './../../../selectors/getMessageUuid/getMessageUuid'; export const useChatOnline = () => { diff --git a/src/features/send-message-chat/model/lib/hooks/useSendMessage/useSendMessage.ts b/src/features/send-message-chat/model/lib/hooks/useSendMessage/useSendMessage.ts index 4ced2c4..ceba199 100644 --- a/src/features/send-message-chat/model/lib/hooks/useSendMessage/useSendMessage.ts +++ b/src/features/send-message-chat/model/lib/hooks/useSendMessage/useSendMessage.ts @@ -8,8 +8,8 @@ import { } from 'entities/user'; import { getLanguage } from 'features/language-picker'; import { useState } from 'react'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { setMessageDelay } from './../../../slices/chatSlice'; type useSendMessageProps = { diff --git a/src/features/send-message-chat/ui/SendMessageChat.tsx b/src/features/send-message-chat/ui/SendMessageChat.tsx index 09cfe6b..4754898 100644 --- a/src/features/send-message-chat/ui/SendMessageChat.tsx +++ b/src/features/send-message-chat/ui/SendMessageChat.tsx @@ -6,12 +6,12 @@ import { Keyboard, TextInput, View } from 'react-native'; import { SafeAreaView } from 'react-native-safe-area-context'; import * as Icons from 'shared/assets/icons'; import { moderateScale } from 'shared/config/dimensions'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { clockify } from 'shared/lib/dates/clockify'; import { isIos } from 'shared/lib/isIos'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText } from 'shared/ui/CustomText'; import { PressableOpacity } from 'shared/ui/PressableOpacity'; -import { clockify } from 'shared/utils/clockify'; import { useSendMessage } from './../model/lib/hooks/useSendMessage/useSendMessage'; import { getMessageDelay } from './../model/selectors/getMessageDelay/getMessageDelay'; import { getSecondsToDate } from './../model/utils/getSecondsToDate/getSecondsToDate'; diff --git a/src/features/setting/set-cigarette-count/model/const/cigarette-count.ts b/src/features/setting/set-cigarette-count/model/const/cigarette-count.ts index 52e5ba2..f97eedc 100644 --- a/src/features/setting/set-cigarette-count/model/const/cigarette-count.ts +++ b/src/features/setting/set-cigarette-count/model/const/cigarette-count.ts @@ -1,3 +1,3 @@ -import { arrayMinMax } from 'shared/utils/arrayMinMax'; +import { generateRangeArray } from 'shared/lib/generate/generateRangeArray'; -export const cigaretteCount = arrayMinMax(10, 80); +export const cigaretteCount = generateRangeArray(10, 80); diff --git a/src/features/setting/set-cigarette-count/ui/SetCigaretteCount.tsx b/src/features/setting/set-cigarette-count/ui/SetCigaretteCount.tsx index 637d73b..841853a 100644 --- a/src/features/setting/set-cigarette-count/ui/SetCigaretteCount.tsx +++ b/src/features/setting/set-cigarette-count/ui/SetCigaretteCount.tsx @@ -1,8 +1,8 @@ import { getUserSmokeCountPack, setUserSmokePackCount } from 'entities/user'; import { memo } from 'react'; import { useTranslation } from 'react-i18next'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { InputPicker } from 'shared/ui/InputPicker'; import { cigaretteCount } from './../model/const/cigarette-count'; diff --git a/src/features/setting/set-cigarette-day/model/const/cigarette-day.ts b/src/features/setting/set-cigarette-day/model/const/cigarette-day.ts index 426f7ca..78f575e 100644 --- a/src/features/setting/set-cigarette-day/model/const/cigarette-day.ts +++ b/src/features/setting/set-cigarette-day/model/const/cigarette-day.ts @@ -1,3 +1,3 @@ -import { arrayMinMax } from 'shared/utils/arrayMinMax'; +import { generateRangeArray } from 'shared/lib/generate/generateRangeArray'; -export const cigaretteDay = arrayMinMax(1, 100); +export const cigaretteDay = generateRangeArray(1, 100); diff --git a/src/features/setting/set-cigarette-day/ui/SetCigaretteDay.tsx b/src/features/setting/set-cigarette-day/ui/SetCigaretteDay.tsx index b7b99dc..f061259 100644 --- a/src/features/setting/set-cigarette-day/ui/SetCigaretteDay.tsx +++ b/src/features/setting/set-cigarette-day/ui/SetCigaretteDay.tsx @@ -1,8 +1,8 @@ import { getUserSmokeEveryDay, setUserSmokeEveryDay } from 'entities/user'; import { memo } from 'react'; import { useTranslation } from 'react-i18next'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { InputPicker } from 'shared/ui/InputPicker'; import { cigaretteDay } from './../model/const/cigarette-day'; diff --git a/src/features/setting/set-cigarette-price/ui/SetCigarettePrice.tsx b/src/features/setting/set-cigarette-price/ui/SetCigarettePrice.tsx index 9e1fa57..4b18fc6 100644 --- a/src/features/setting/set-cigarette-price/ui/SetCigarettePrice.tsx +++ b/src/features/setting/set-cigarette-price/ui/SetCigarettePrice.tsx @@ -1,7 +1,7 @@ import { getUserPricePack, setUserPricePack } from 'entities/user'; import { useTranslation } from 'react-i18next'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { InputScreen } from 'shared/ui/InputScreen'; import { cigarettePrice } from './../model/validations/cigarette-price'; diff --git a/src/features/setting/set-how-much-smoke/ui/SetHowMuchSmoke.tsx b/src/features/setting/set-how-much-smoke/ui/SetHowMuchSmoke.tsx index a78c611..3ff1e70 100644 --- a/src/features/setting/set-how-much-smoke/ui/SetHowMuchSmoke.tsx +++ b/src/features/setting/set-how-much-smoke/ui/SetHowMuchSmoke.tsx @@ -1,7 +1,7 @@ import { memo, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { InputPicker } from 'shared/ui/InputPicker'; import { howMuchValues } from './../model/const/howMuch'; import { getHowMuchSmoking } from './../model/selectors/getHowMuchSmoking'; diff --git a/src/features/setting/set-user-name/ui/SetUserName.tsx b/src/features/setting/set-user-name/ui/SetUserName.tsx index 5108a3d..749e6d6 100644 --- a/src/features/setting/set-user-name/ui/SetUserName.tsx +++ b/src/features/setting/set-user-name/ui/SetUserName.tsx @@ -1,8 +1,8 @@ import { getUserName, setUserName } from 'entities/user'; import { memo } from 'react'; import { useTranslation } from 'react-i18next'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { InputScreen } from 'shared/ui/InputScreen'; import { usernameValidation } from './../model/validations/set-username'; diff --git a/src/features/setting/toggle-notification/ui/ToggleNotification.tsx b/src/features/setting/toggle-notification/ui/ToggleNotification.tsx index cbbb047..e97ebd2 100644 --- a/src/features/setting/toggle-notification/ui/ToggleNotification.tsx +++ b/src/features/setting/toggle-notification/ui/ToggleNotification.tsx @@ -5,8 +5,8 @@ import { import { memo, useCallback } from 'react'; import { useTranslation } from 'react-i18next'; import * as Icons from 'shared/assets/icons'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { LinkSwitcher } from 'shared/ui/LinkSwitcher'; import { usePermissionsNotifications } from './../model/lib/hooks/usePermissionsNotifications'; diff --git a/src/features/setting/toggle-vibration/ui/ToggleVibration.tsx b/src/features/setting/toggle-vibration/ui/ToggleVibration.tsx index d06d79a..a4ebedc 100644 --- a/src/features/setting/toggle-vibration/ui/ToggleVibration.tsx +++ b/src/features/setting/toggle-vibration/ui/ToggleVibration.tsx @@ -1,8 +1,8 @@ import { memo, useCallback } from 'react'; import { useTranslation } from 'react-i18next'; import * as Icons from 'shared/assets/icons'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { LinkSwitcher } from 'shared/ui/LinkSwitcher'; import { getVibrationIsEnabled } from './../model/selectors/getVibrationIsEnabled/getVibrationIsEnabled'; diff --git a/src/features/smoked/desire-to-smoke/ui/DesireToSmoke.tsx b/src/features/smoked/desire-to-smoke/ui/DesireToSmoke.tsx index ce3adc9..08894fa 100644 --- a/src/features/smoked/desire-to-smoke/ui/DesireToSmoke.tsx +++ b/src/features/smoked/desire-to-smoke/ui/DesireToSmoke.tsx @@ -1,7 +1,7 @@ import { useTranslation } from 'react-i18next'; import { CONTENT_IN_RADIUS } from 'shared/config/dimensions'; import { AppNavigation } from 'shared/config/navigation'; -import { useAppNavigation } from 'shared/hooks/useAppNavigation'; +import { useAppNavigation } from 'shared/lib/navigation/useAppNavigation'; import { useTheme } from 'shared/lib/theme'; import { CustomButton } from 'shared/ui/CustomButton'; diff --git a/src/features/smoked/i-smoked/ui/ISmoked.tsx b/src/features/smoked/i-smoked/ui/ISmoked.tsx index b906b85..71edf31 100644 --- a/src/features/smoked/i-smoked/ui/ISmoked.tsx +++ b/src/features/smoked/i-smoked/ui/ISmoked.tsx @@ -15,12 +15,12 @@ import { memo, useCallback, useContext } from 'react'; import { useTranslation } from 'react-i18next'; import { CONTENT_IN_RADIUS } from 'shared/config/dimensions'; import { AppNavigation } from 'shared/config/navigation'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppNavigation } from 'shared/hooks/useAppNavigation'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppNavigation } from 'shared/lib/navigation/useAppNavigation'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; +import { getWeekDay } from 'shared/lib/statistics/getWeekDay'; import { useTheme } from 'shared/lib/theme'; import { CustomButton } from 'shared/ui/CustomButton'; -import { getWeekDay } from 'shared/utils/statistics/getWeekDay'; interface ISmokedProps { disabled?: boolean; diff --git a/src/features/smoked/no-desire-to-smoke/ui/NoDesireToSmoke.tsx b/src/features/smoked/no-desire-to-smoke/ui/NoDesireToSmoke.tsx index 0cd69d7..213755a 100644 --- a/src/features/smoked/no-desire-to-smoke/ui/NoDesireToSmoke.tsx +++ b/src/features/smoked/no-desire-to-smoke/ui/NoDesireToSmoke.tsx @@ -7,12 +7,12 @@ import { useContext } from 'react'; import { useTranslation } from 'react-i18next'; import { CONTENT_IN_RADIUS } from 'shared/config/dimensions'; import { AppNavigation } from 'shared/config/navigation'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppNavigation } from 'shared/hooks/useAppNavigation'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppNavigation } from 'shared/lib/navigation/useAppNavigation'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; +import { getWeekDay } from 'shared/lib/statistics/getWeekDay'; import { useTheme } from 'shared/lib/theme'; import { CustomButton } from 'shared/ui/CustomButton'; -import { getWeekDay } from 'shared/utils/statistics/getWeekDay'; interface NoDesireToSmokeProps { disabled?: boolean; diff --git a/src/features/tracker-initial/ui/TrackerInitial.tsx b/src/features/tracker-initial/ui/TrackerInitial.tsx index 7ec339a..a24ee1e 100644 --- a/src/features/tracker-initial/ui/TrackerInitial.tsx +++ b/src/features/tracker-initial/ui/TrackerInitial.tsx @@ -1,7 +1,7 @@ import { memo } from 'react'; import { ColorValue } from 'react-native'; import { moderateScale } from 'shared/config/dimensions'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; import { CustomText } from 'shared/ui/CustomText'; import { PressableOpacity } from 'shared/ui/PressableOpacity'; import { setTrackerInitial } from './../model/slices/trackerSlice'; diff --git a/src/features/user-update-avatar/ui/UserUpdateAvatar.tsx b/src/features/user-update-avatar/ui/UserUpdateAvatar.tsx index 6c98617..167efea 100644 --- a/src/features/user-update-avatar/ui/UserUpdateAvatar.tsx +++ b/src/features/user-update-avatar/ui/UserUpdateAvatar.tsx @@ -4,7 +4,7 @@ import { View } from 'react-native'; import { launchImageLibrary } from 'react-native-image-picker'; import * as Icons from 'shared/assets/icons'; import { moderateScale } from 'shared/config/dimensions'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; import { useTheme } from 'shared/lib/theme'; import { Avatar } from 'shared/ui/Avatar'; import { PressableOpacity } from 'shared/ui/PressableOpacity'; diff --git a/src/screens/audio/audio-play/ui/AudioPlayScreen/AudioPlayScreen.tsx b/src/screens/audio/audio-play/ui/AudioPlayScreen/AudioPlayScreen.tsx index a753c63..7550da6 100644 --- a/src/screens/audio/audio-play/ui/AudioPlayScreen/AudioPlayScreen.tsx +++ b/src/screens/audio/audio-play/ui/AudioPlayScreen/AudioPlayScreen.tsx @@ -20,7 +20,7 @@ import TrackPlayer, { useTrackPlayerEvents, } from 'react-native-track-player'; import { AppNavigation, RootStackParamList } from 'shared/config/navigation'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { ScreenContent } from 'shared/ui/ScreenContent'; import { AudioDescription } from './../AudioDescription/AudioDescription'; diff --git a/src/screens/audio/audio/ui/AudioItem/AudioItem.tsx b/src/screens/audio/audio/ui/AudioItem/AudioItem.tsx index b2f39fd..1df50b8 100644 --- a/src/screens/audio/audio/ui/AudioItem/AudioItem.tsx +++ b/src/screens/audio/audio/ui/AudioItem/AudioItem.tsx @@ -4,8 +4,8 @@ import { getUserIsPremium } from 'entities/user'; import { Image, ImageSourcePropType, View } from 'react-native'; import LinearGradient from 'react-native-linear-gradient'; import { AppNavigation } from 'shared/config/navigation'; -import { useAppNavigation } from 'shared/hooks/useAppNavigation'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppNavigation } from 'shared/lib/navigation/useAppNavigation'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize } from 'shared/ui/CustomText'; import { PressableOpacity } from 'shared/ui/PressableOpacity'; diff --git a/src/screens/audio/audio/ui/AudioScreen/AudioScreen.tsx b/src/screens/audio/audio/ui/AudioScreen/AudioScreen.tsx index bb5f8e8..596add5 100644 --- a/src/screens/audio/audio/ui/AudioScreen/AudioScreen.tsx +++ b/src/screens/audio/audio/ui/AudioScreen/AudioScreen.tsx @@ -15,7 +15,7 @@ import { FlatList, View } from 'react-native'; import TrackPlayer from 'react-native-track-player'; import * as Images from 'shared/assets/images'; import { AppNavigation, RootStackParamList } from 'shared/config/navigation'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { ScreenContent } from 'shared/ui/ScreenContent'; import { AudioFooter } from './../AudioFooter/AudioFooter'; diff --git a/src/screens/auth/login/ui/AuthScreen/AuthScreen.tsx b/src/screens/auth/login/ui/AuthScreen/AuthScreen.tsx index 52765aa..5855ea8 100644 --- a/src/screens/auth/login/ui/AuthScreen/AuthScreen.tsx +++ b/src/screens/auth/login/ui/AuthScreen/AuthScreen.tsx @@ -5,13 +5,13 @@ import { AuthByGoogle } from 'features/auth/auth-by-google'; import { useTranslation } from 'react-i18next'; import { KeyboardAvoidingView, ScrollView, View } from 'react-native'; import { AppNavigation, RootStackParamList } from 'shared/config/navigation'; +import { getCountry } from 'shared/lib/intl/getCountry'; import { isIos } from 'shared/lib/isIos'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize, TextWeight } from 'shared/ui/CustomText'; import { NavigationSplash } from 'shared/ui/NavigationSplash'; import { PressableOpacity } from 'shared/ui/PressableOpacity'; import { ScreenContent } from 'shared/ui/ScreenContent'; -import { getCountry } from 'shared/utils/getCountry'; import { PrivacyPolice } from 'widgets/privacy-police'; import { styles } from './AuthScreenStyle'; diff --git a/src/screens/auth/registration/ui/RegistrationScreen/RegistrationScreen.tsx b/src/screens/auth/registration/ui/RegistrationScreen/RegistrationScreen.tsx index e1d4570..de3f424 100644 --- a/src/screens/auth/registration/ui/RegistrationScreen/RegistrationScreen.tsx +++ b/src/screens/auth/registration/ui/RegistrationScreen/RegistrationScreen.tsx @@ -5,13 +5,13 @@ import { AuthByGoogle } from 'features/auth/auth-by-google'; import { useTranslation } from 'react-i18next'; import { KeyboardAvoidingView, ScrollView, View } from 'react-native'; import { AppNavigation, RootStackParamList } from 'shared/config/navigation'; +import { getCountry } from 'shared/lib/intl/getCountry'; import { isIos } from 'shared/lib/isIos'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize, TextWeight } from 'shared/ui/CustomText'; import { NavigationSplash } from 'shared/ui/NavigationSplash'; import { PressableOpacity } from 'shared/ui/PressableOpacity'; import { ScreenContent } from 'shared/ui/ScreenContent'; -import { getCountry } from 'shared/utils/getCountry'; import { PrivacyPolice } from 'widgets/privacy-police'; import { styles } from './RegistrationScreenStyle'; diff --git a/src/screens/auth/verify/ui/VerifyScreen/VerifyScreen.tsx b/src/screens/auth/verify/ui/VerifyScreen/VerifyScreen.tsx index 65ee38e..e0b1871 100644 --- a/src/screens/auth/verify/ui/VerifyScreen/VerifyScreen.tsx +++ b/src/screens/auth/verify/ui/VerifyScreen/VerifyScreen.tsx @@ -23,14 +23,14 @@ import { } from 'react-native'; import * as Anims from 'shared/assets/anims'; import { AppNavigation, RootStackParamList } from 'shared/config/navigation'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { getCountry } from 'shared/lib/intl/getCountry'; import { isIos } from 'shared/lib/isIos'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize, TextWeight } from 'shared/ui/CustomText'; import { InputCode } from 'shared/ui/InputCode'; import { ScreenContent } from 'shared/ui/ScreenContent'; -import { getCountry } from 'shared/utils/getCountry'; import { codeDto } from 'shared/validations/code'; import { styles } from './VerifyScreenStyle'; diff --git a/src/screens/cards/ui/CardsScreen/CardsScreen.tsx b/src/screens/cards/ui/CardsScreen/CardsScreen.tsx index 2d6eead..7449a60 100644 --- a/src/screens/cards/ui/CardsScreen/CardsScreen.tsx +++ b/src/screens/cards/ui/CardsScreen/CardsScreen.tsx @@ -9,7 +9,7 @@ import { View } from 'react-native'; import { GestureHandlerRootView } from 'react-native-gesture-handler'; import { useSharedValue } from 'react-native-reanimated'; import { AppNavigation, RootStackParamList } from 'shared/config/navigation'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize, TextWeight } from 'shared/ui/CustomText'; import { ScreenContent } from 'shared/ui/ScreenContent'; diff --git a/src/screens/friend/friend-QR/ui/FriendQRScreen/FriendQRScreen.tsx b/src/screens/friend/friend-QR/ui/FriendQRScreen/FriendQRScreen.tsx index a046dda..63ae134 100644 --- a/src/screens/friend/friend-QR/ui/FriendQRScreen/FriendQRScreen.tsx +++ b/src/screens/friend/friend-QR/ui/FriendQRScreen/FriendQRScreen.tsx @@ -2,7 +2,7 @@ import { getUserId } from 'entities/user'; import { useTranslation } from 'react-i18next'; import { View } from 'react-native'; import QRCode from 'react-native-qrcode-svg'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize } from 'shared/ui/CustomText'; import { ScreenContent } from 'shared/ui/ScreenContent'; diff --git a/src/screens/friend/friend-add/ui/FriendFind/FriendFind.tsx b/src/screens/friend/friend-add/ui/FriendFind/FriendFind.tsx index e844ae8..4898ea5 100644 --- a/src/screens/friend/friend-add/ui/FriendFind/FriendFind.tsx +++ b/src/screens/friend/friend-add/ui/FriendFind/FriendFind.tsx @@ -13,11 +13,11 @@ import { View } from 'react-native'; import * as Anims from 'shared/assets/anims'; import * as Images from 'shared/assets/images'; import { AppNavigation } from 'shared/config/navigation'; -import { useAppNavigation } from 'shared/hooks/useAppNavigation'; +import { truncateWithEllipsis } from 'shared/lib/format/truncateWithEllipsis'; +import { useAppNavigation } from 'shared/lib/navigation/useAppNavigation'; import { useTheme } from 'shared/lib/theme'; import { CustomButton } from 'shared/ui/CustomButton'; import { CustomText, TextSize } from 'shared/ui/CustomText'; -import { substringStr } from 'shared/utils/substringStr'; import { styles } from './FriendFindStyle'; type FriendFindProps = { @@ -72,7 +72,7 @@ export const FriendFind = ({ - {substringStr(name, 30)} + {truncateWithEllipsis(name, 30)} { - {substringStr(name, 30)} + {truncateWithEllipsis(name, 30)} { - {substringStr(name, 30)} + {truncateWithEllipsis(name, 30)} { +export const useCameraPermissions = () => { const { t } = useTranslation(); const permission = async () => { diff --git a/src/screens/friend/friend-present/ui/FriendPresentScreen/FriendPresentScreen.tsx b/src/screens/friend/friend-present/ui/FriendPresentScreen/FriendPresentScreen.tsx index cbfbfbd..c202050 100644 --- a/src/screens/friend/friend-present/ui/FriendPresentScreen/FriendPresentScreen.tsx +++ b/src/screens/friend/friend-present/ui/FriendPresentScreen/FriendPresentScreen.tsx @@ -8,12 +8,12 @@ import { Alert, Platform, ScrollView, Share, View } from 'react-native'; import * as Anims from 'shared/assets/anims'; import * as Icons from 'shared/assets/icons'; import { AppNavigation, RootStackParamList } from 'shared/config/navigation'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; -import { usePermissionsCamera } from 'shared/hooks/usePermissionsCamera'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { LinkRow } from 'shared/ui/LinkRow'; import { RowGroup } from 'shared/ui/RowGroup'; import { ScreenContent } from 'shared/ui/ScreenContent'; +import { useCameraPermissions } from './../../model/lib/camera-permission/useCameraPermissions'; import { styles } from './FriendPresentScreenStyle'; type FriendPresentScreenProps = NativeStackScreenProps< @@ -31,7 +31,7 @@ export const FriendPresentScreen = ({ const { cn } = useTheme(); const { t } = useTranslation(); - const { permission } = usePermissionsCamera(); + const { permission } = useCameraPermissions(); const onPressQRHandler = () => { navigation.navigate(AppNavigation.FRIEND_QR); diff --git a/src/screens/leaderboard/ui/LeaderboardItem/LeaderboardItem.tsx b/src/screens/leaderboard/ui/LeaderboardItem/LeaderboardItem.tsx index bd847d3..03b3210 100644 --- a/src/screens/leaderboard/ui/LeaderboardItem/LeaderboardItem.tsx +++ b/src/screens/leaderboard/ui/LeaderboardItem/LeaderboardItem.tsx @@ -4,12 +4,12 @@ import { useTranslation } from 'react-i18next'; import { View } from 'react-native'; import * as Icons from 'shared/assets/icons'; import { moderateScale } from 'shared/config/dimensions'; +import { abbreviateNumber } from 'shared/lib/format/abbreviateNumber'; +import { truncateWithEllipsis } from 'shared/lib/format/truncateWithEllipsis'; import { useTheme } from 'shared/lib/theme'; import { Avatar } from 'shared/ui/Avatar'; import { CustomText, TextSize, TextWeight } from 'shared/ui/CustomText'; import { EmojiCountries } from 'shared/ui/EmojiCountries'; -import { abbrNum } from 'shared/utils/abbrNum'; -import { substringStr } from 'shared/utils/substringStr'; import { styles } from './LeaderboardItemStyle'; interface LeaderboardItemProps { @@ -57,7 +57,7 @@ export const LeaderboardItem = React.memo((props: LeaderboardItemProps) => { - {substringStr(name, 23)} + {truncateWithEllipsis(name, 23)} @@ -78,7 +78,7 @@ export const LeaderboardItem = React.memo((props: LeaderboardItemProps) => { /> - {abbrNum(rating || 0, 0)} + {abbreviateNumber(rating || 0, 0)} diff --git a/src/screens/market/ui/MarketProfile/MarketProfile.tsx b/src/screens/market/ui/MarketProfile/MarketProfile.tsx index 9b21d1e..2f05b4e 100644 --- a/src/screens/market/ui/MarketProfile/MarketProfile.tsx +++ b/src/screens/market/ui/MarketProfile/MarketProfile.tsx @@ -1,9 +1,9 @@ import { useTranslation } from 'react-i18next'; import { View } from 'react-native'; +import { truncateWithEllipsis } from 'shared/lib/format/truncateWithEllipsis'; import { useTheme } from 'shared/lib/theme'; import { Avatar } from 'shared/ui/Avatar'; import { CustomText, TextSize } from 'shared/ui/CustomText'; -import { substringStr } from 'shared/utils/substringStr'; import { styles } from './MarketProfileStyle'; interface MarketProfileProps { @@ -37,7 +37,7 @@ export const MarketProfile = ({ - {substringStr(name, 40)} + {truncateWithEllipsis(name, 40)} { +export const useSmokeNotifications = () => { const { t } = useTranslation(); const notification = useCallback(async () => { diff --git a/src/screens/practice/mindfulness/ui/MindfulnessScreen/MindfulnessScreen.tsx b/src/screens/practice/mindfulness/ui/MindfulnessScreen/MindfulnessScreen.tsx index 70c94f7..ad91d5e 100644 --- a/src/screens/practice/mindfulness/ui/MindfulnessScreen/MindfulnessScreen.tsx +++ b/src/screens/practice/mindfulness/ui/MindfulnessScreen/MindfulnessScreen.tsx @@ -11,14 +11,14 @@ import { View } from 'react-native'; import { ScrollView } from 'react-native-gesture-handler'; import * as Anims from 'shared/assets/anims'; import { AppNavigation, RootStackParamList } from 'shared/config/navigation'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; -import { useNotificationSmoke } from 'shared/hooks/useNotificationSmoke'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; +import { getWeekDay } from 'shared/lib/statistics/getWeekDay'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize, TextWeight } from 'shared/ui/CustomText'; import { NavigationSplash } from 'shared/ui/NavigationSplash'; import { ScreenContent } from 'shared/ui/ScreenContent'; -import { getWeekDay } from 'shared/utils/statistics/getWeekDay'; +import { useSmokeNotifications } from './../../model/lib/notification/useSmokeNotifications'; import { styles } from './MindfulnessScreenStyle'; type MindfulnessScreenProps = NativeStackScreenProps< @@ -35,7 +35,7 @@ export const MindfulnessScreen = ({ navigation }: MindfulnessScreenProps) => { const headerHeight = useHeaderHeight(); const { t } = useTranslation(); const { cn } = useTheme(); - const { notification } = useNotificationSmoke(); + const { notification } = useSmokeNotifications(); const onPressNextHandler = () => { isNotification && notification(); diff --git a/src/screens/profile/profile-setting/ui/ProfileSettingScreen/ProfileSettingScreen.tsx b/src/screens/profile/profile-setting/ui/ProfileSettingScreen/ProfileSettingScreen.tsx index 42953cc..c4c360a 100644 --- a/src/screens/profile/profile-setting/ui/ProfileSettingScreen/ProfileSettingScreen.tsx +++ b/src/screens/profile/profile-setting/ui/ProfileSettingScreen/ProfileSettingScreen.tsx @@ -9,7 +9,7 @@ import { useTranslation } from 'react-i18next'; import { ScrollView, View } from 'react-native'; import * as Icons from 'shared/assets/icons'; import { AppNavigation, RootStackParamList } from 'shared/config/navigation'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize } from 'shared/ui/CustomText'; import { LinkRow } from 'shared/ui/LinkRow'; diff --git a/src/screens/profile/profile/ui/ProfileInfo/ProfileInfo.tsx b/src/screens/profile/profile/ui/ProfileInfo/ProfileInfo.tsx index d5cf087..e47e8bd 100644 --- a/src/screens/profile/profile/ui/ProfileInfo/ProfileInfo.tsx +++ b/src/screens/profile/profile/ui/ProfileInfo/ProfileInfo.tsx @@ -2,8 +2,8 @@ import { getUserListFriends, getUserRating } from 'entities/user'; import { useTranslation } from 'react-i18next'; import { View } from 'react-native'; import { AppNavigation } from 'shared/config/navigation'; -import { useAppNavigation } from 'shared/hooks/useAppNavigation'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppNavigation } from 'shared/lib/navigation/useAppNavigation'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize, TextWeight } from 'shared/ui/CustomText'; import { PressableOpacity } from 'shared/ui/PressableOpacity'; diff --git a/src/screens/profile/profile/ui/ProfileNavigation/ProfileNavigation.tsx b/src/screens/profile/profile/ui/ProfileNavigation/ProfileNavigation.tsx index 2c97c51..ac3b0a8 100644 --- a/src/screens/profile/profile/ui/ProfileNavigation/ProfileNavigation.tsx +++ b/src/screens/profile/profile/ui/ProfileNavigation/ProfileNavigation.tsx @@ -5,8 +5,8 @@ import LinearGradient from 'react-native-linear-gradient'; import * as Icons from 'shared/assets/icons'; import { moderateScale } from 'shared/config/dimensions'; import { AppNavigation } from 'shared/config/navigation'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppNavigation } from 'shared/hooks/useAppNavigation'; +import { useAppNavigation } from 'shared/lib/navigation/useAppNavigation'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; import { useTheme } from 'shared/lib/theme'; import { CustomButton } from 'shared/ui/CustomButton'; import { DisplayMessage } from 'shared/ui/DisplayMessage'; diff --git a/src/screens/profile/profile/ui/ProfileScreen/ProfileScreen.tsx b/src/screens/profile/profile/ui/ProfileScreen/ProfileScreen.tsx index 6a70e1a..f3438ee 100644 --- a/src/screens/profile/profile/ui/ProfileScreen/ProfileScreen.tsx +++ b/src/screens/profile/profile/ui/ProfileScreen/ProfileScreen.tsx @@ -21,14 +21,14 @@ import * as Icons from 'shared/assets/icons'; import * as Images from 'shared/assets/images'; import { moderateScale } from 'shared/config/dimensions'; import { AppNavigation, RootStackParamList } from 'shared/config/navigation'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { getCurrencySymbol } from 'shared/lib/intl/getCurrencySymbol'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomButton } from 'shared/ui/CustomButton'; import { CustomText, TextSize } from 'shared/ui/CustomText'; import { PresetBackground } from 'shared/ui/PresetBackground'; import { RowGroup } from 'shared/ui/RowGroup'; import { ScreenContent } from 'shared/ui/ScreenContent'; -import { getCurrencySymbol } from 'shared/utils/getCurrencySymbol'; import { ProfileInfo } from './../ProfileInfo/ProfileInfo'; import { ProfileInfoItem } from './../ProfileInfoItem/ProfileInfoItem'; import { ProfileNavigation } from './../ProfileNavigation/ProfileNavigation'; diff --git a/src/screens/progress/ui/ProgressScreen/ProgressScreen.tsx b/src/screens/progress/ui/ProgressScreen/ProgressScreen.tsx index d95ea6b..d01e288 100644 --- a/src/screens/progress/ui/ProgressScreen/ProgressScreen.tsx +++ b/src/screens/progress/ui/ProgressScreen/ProgressScreen.tsx @@ -8,7 +8,7 @@ import { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { FlatList, View } from 'react-native'; import { AppNavigation, RootStackParamList } from 'shared/config/navigation'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize } from 'shared/ui/CustomText'; import { ScreenContent } from 'shared/ui/ScreenContent'; diff --git a/src/shared/utils/readingTime/readingTime.ts b/src/screens/read/read/model/lib/calculateReadingTime.ts similarity index 57% rename from src/shared/utils/readingTime/readingTime.ts rename to src/screens/read/read/model/lib/calculateReadingTime.ts index bd1cfa5..678164a 100644 --- a/src/shared/utils/readingTime/readingTime.ts +++ b/src/screens/read/read/model/lib/calculateReadingTime.ts @@ -1,4 +1,7 @@ -export const readingTime = (text: string, wordsPerMinute: number = 50) => { +export const calculateReadingTime = ( + text: string, + wordsPerMinute: number = 50, +) => { const numberOfWords = text.split(' ').length; const time = numberOfWords / wordsPerMinute; return Math.ceil(time); diff --git a/src/screens/read/read/ui/ReadItem/ReadItem.tsx b/src/screens/read/read/ui/ReadItem/ReadItem.tsx index 797a4f9..4582327 100644 --- a/src/screens/read/read/ui/ReadItem/ReadItem.tsx +++ b/src/screens/read/read/ui/ReadItem/ReadItem.tsx @@ -6,7 +6,7 @@ import LinearGradient from 'react-native-linear-gradient'; import * as Icons from 'shared/assets/icons'; import { moderateScale } from 'shared/config/dimensions'; import { AppNavigation } from 'shared/config/navigation'; -import { useAppNavigation } from 'shared/hooks/useAppNavigation'; +import { useAppNavigation } from 'shared/lib/navigation/useAppNavigation'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize } from 'shared/ui/CustomText'; import { PressableOpacity } from 'shared/ui/PressableOpacity'; diff --git a/src/screens/read/read/ui/ReadScreen/ReadScreen.tsx b/src/screens/read/read/ui/ReadScreen/ReadScreen.tsx index d209ff9..992cc35 100644 --- a/src/screens/read/read/ui/ReadScreen/ReadScreen.tsx +++ b/src/screens/read/read/ui/ReadScreen/ReadScreen.tsx @@ -8,11 +8,11 @@ import { useTranslation } from 'react-i18next'; import { FlatList, View } from 'react-native'; import * as Anims from 'shared/assets/anims'; import { AppNavigation, RootStackParamList } from 'shared/config/navigation'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize } from 'shared/ui/CustomText'; import { ScreenContent } from 'shared/ui/ScreenContent'; -import { readingTime } from 'shared/utils/readingTime'; +import { calculateReadingTime } from './../../model/lib/calculateReadingTime'; import { ReadItem } from './../ReadItem/ReadItem'; import { styles } from './ReadScreenStyle'; @@ -36,7 +36,7 @@ export const ReadScreen = ({ navigation }: ReadScreenProps) => { const covers = t('help.course', { returnObjects: true }) as CoverType[]; const coverTimes = useMemo(() => { - const times = covers.map(el => readingTime(el.text)); + const times = covers.map(el => calculateReadingTime(el.text)); const timing = times.reduce((total, time) => total + time, 0); return { timing: timing.toString(), times }; diff --git a/src/screens/subs/ui/HeaderRight/HeaderRight.tsx b/src/screens/subs/ui/HeaderRight/HeaderRight.tsx index f3350b9..68c6d33 100644 --- a/src/screens/subs/ui/HeaderRight/HeaderRight.tsx +++ b/src/screens/subs/ui/HeaderRight/HeaderRight.tsx @@ -4,10 +4,10 @@ import { getIsActivation, setIsActivation } from 'features/passed-activation'; import { useTranslation } from 'react-i18next'; import { Linking } from 'react-native'; import { AppNavigation } from 'shared/config/navigation'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppNavigation } from 'shared/hooks/useAppNavigation'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; import { isIos } from 'shared/lib/isIos'; +import { useAppNavigation } from 'shared/lib/navigation/useAppNavigation'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize } from 'shared/ui/CustomText'; import { PressableOpacity } from 'shared/ui/PressableOpacity'; diff --git a/src/screens/subs/ui/SubsScreen/SubsScreen.tsx b/src/screens/subs/ui/SubsScreen/SubsScreen.tsx index 685585c..a9c61c3 100644 --- a/src/screens/subs/ui/SubsScreen/SubsScreen.tsx +++ b/src/screens/subs/ui/SubsScreen/SubsScreen.tsx @@ -16,8 +16,8 @@ import { useTranslation } from 'react-i18next'; import { Alert, Linking, ScrollView, View } from 'react-native'; import * as Anims from 'shared/assets/anims'; import { AppNavigation, RootStackParamList } from 'shared/config/navigation'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomButton } from 'shared/ui/CustomButton'; import { CustomText, TextSize } from 'shared/ui/CustomText'; diff --git a/src/screens/tab-navigation/chat/ui/ChatScreen/ChatScreen.tsx b/src/screens/tab-navigation/chat/ui/ChatScreen/ChatScreen.tsx index a195635..42ebf99 100644 --- a/src/screens/tab-navigation/chat/ui/ChatScreen/ChatScreen.tsx +++ b/src/screens/tab-navigation/chat/ui/ChatScreen/ChatScreen.tsx @@ -7,7 +7,7 @@ import { useCallback, useRef } from 'react'; import { useTranslation } from 'react-i18next'; import { ActivityIndicator, FlatList, View } from 'react-native'; import { AppNavigation, RootStackParamList } from 'shared/config/navigation'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize } from 'shared/ui/CustomText'; import { ScreenContent } from 'shared/ui/ScreenContent'; diff --git a/src/screens/tab-navigation/feed/feed-details/ui/FeedAuthor/FeedAuthor.tsx b/src/screens/tab-navigation/feed/feed-details/ui/FeedAuthor/FeedAuthor.tsx index c816277..0bc5a86 100644 --- a/src/screens/tab-navigation/feed/feed-details/ui/FeedAuthor/FeedAuthor.tsx +++ b/src/screens/tab-navigation/feed/feed-details/ui/FeedAuthor/FeedAuthor.tsx @@ -13,12 +13,12 @@ import { useTranslation } from 'react-i18next'; import { View } from 'react-native'; import Tooltip from 'rn-tooltip'; import * as Icons from 'shared/assets/icons'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { truncateWithEllipsis } from 'shared/lib/format/truncateWithEllipsis'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { Avatar } from 'shared/ui/Avatar'; import { AvatarPile } from 'shared/ui/AvatarPile'; import { CustomText, TextSize, TextWeight } from 'shared/ui/CustomText'; -import { substringStr } from 'shared/utils/substringStr'; import { styles } from './FeedAuthorStyle'; type FeedAuthorProps = { @@ -98,7 +98,7 @@ export const FeedAuthor = memo((props: FeedAuthorProps) => { size={TextSize.S_LG} weight={TextWeight.MEDIUM} style={{ color: cn('white', 'black') }}> - {substringStr(author?.name, 24)} + {truncateWithEllipsis(author?.name, 24)} { size={TextSize.S_LG} weight={TextWeight.MEDIUM} style={{ color: cn('white', 'black') }}> - {substringStr(author?.name, 24)} + {truncateWithEllipsis(author?.name, 24)} { size={TextSize.S_LG} weight={TextWeight.MEDIUM} style={{ color: cn('white', 'black') }}> - {substringStr(author?.name, 24)} + {truncateWithEllipsis(author?.name, 24)} { const navigation = useAppNavigation(); const taskName = useMemo(() => { - return substringStr(task.name || name, 20); + return truncateWithEllipsis(task.name || name, 20); }, [task.name, name]); const taskValue = useMemo(() => { diff --git a/src/screens/task/task/ui/TaskScreen/TaskScreen.tsx b/src/screens/task/task/ui/TaskScreen/TaskScreen.tsx index 43e9f21..7583afd 100644 --- a/src/screens/task/task/ui/TaskScreen/TaskScreen.tsx +++ b/src/screens/task/task/ui/TaskScreen/TaskScreen.tsx @@ -11,13 +11,13 @@ import { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { FlatList, View } from 'react-native'; import { AppNavigation, RootStackParamList } from 'shared/config/navigation'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { getCurrencySymbol } from 'shared/lib/intl/getCurrencySymbol'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; +import { getCigaretteSavings } from 'shared/lib/statistics/getCigaretteSavings'; +import { getUnsmokedCigarettesCount } from 'shared/lib/statistics/getUnsmokedCigarettesCount'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize } from 'shared/ui/CustomText'; import { ScreenContent } from 'shared/ui/ScreenContent'; -import { getCigaretteSavings } from 'shared/utils/getCigaretteSavings'; -import { getCurrencySymbol } from 'shared/utils/getCurrencySymbol'; -import { getUnsmokedCigarettesCount } from 'shared/utils/statistics/getUnsmokedCigarettesCount'; import { TaskItem } from './../TaskItem/TaskItem'; import { styles } from './TaskScreenStyle'; diff --git a/src/screens/tracker/TrackerScreen.tsx b/src/screens/tracker/TrackerScreen.tsx index d25147a..820d991 100644 --- a/src/screens/tracker/TrackerScreen.tsx +++ b/src/screens/tracker/TrackerScreen.tsx @@ -6,7 +6,7 @@ import { MAIN_HORIZONTAL } from 'shared/config/dimensions'; import { AppNavigation, RootStackParamList } from 'shared/config/navigation'; import { useTheme } from 'shared/lib/theme'; import { ScreenContent } from 'shared/ui/ScreenContent'; -import { useAppSelector } from './../../shared/hooks/useAppSelector'; +import { useAppSelector } from './../../shared/lib/state/selector/useAppSelector'; import { TrackerAviable } from './ui/TrackerAviable/TrackerAviable'; import { TrackerWelcome } from './ui/TrackerWelcome/TrackerWelcome'; diff --git a/src/screens/tracker/ui/TrackerAviable/TrackerAviable.tsx b/src/screens/tracker/ui/TrackerAviable/TrackerAviable.tsx index 4c61cde..9eaee8f 100644 --- a/src/screens/tracker/ui/TrackerAviable/TrackerAviable.tsx +++ b/src/screens/tracker/ui/TrackerAviable/TrackerAviable.tsx @@ -4,7 +4,7 @@ import { getUserIsPremium } from 'entities/user'; import { useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { ScrollView, View } from 'react-native'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText } from 'shared/ui/CustomText'; import { Indicator } from 'shared/ui/Indicator'; diff --git a/src/screens/tracker/ui/TrackerNavigation/TrackerNavigation.tsx b/src/screens/tracker/ui/TrackerNavigation/TrackerNavigation.tsx index 4c3de38..6be8be2 100644 --- a/src/screens/tracker/ui/TrackerNavigation/TrackerNavigation.tsx +++ b/src/screens/tracker/ui/TrackerNavigation/TrackerNavigation.tsx @@ -1,7 +1,7 @@ import { useTranslation } from 'react-i18next'; import { ColorValue, View } from 'react-native'; import { AppNavigation } from 'shared/config/navigation'; -import { useAppNavigation } from 'shared/hooks/useAppNavigation'; +import { useAppNavigation } from 'shared/lib/navigation/useAppNavigation'; import { CustomText } from 'shared/ui/CustomText'; import { PressableOpacity } from 'shared/ui/PressableOpacity'; import { styles } from './TrackerNavigationStyle'; diff --git a/src/screens/welcome-info/ui/WelcomeInfoScreen/WelcomeInfoScreen.tsx b/src/screens/welcome-info/ui/WelcomeInfoScreen/WelcomeInfoScreen.tsx index b52d6e6..8a91d8a 100644 --- a/src/screens/welcome-info/ui/WelcomeInfoScreen/WelcomeInfoScreen.tsx +++ b/src/screens/welcome-info/ui/WelcomeInfoScreen/WelcomeInfoScreen.tsx @@ -7,8 +7,8 @@ import { useTranslation } from 'react-i18next'; import { ScrollView, View } from 'react-native'; import { RESULTS, checkNotifications } from 'react-native-permissions'; import { AppNavigation, RootStackParamList } from 'shared/config/navigation'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize, TextWeight } from 'shared/ui/CustomText'; import { NavigationSplash } from 'shared/ui/NavigationSplash'; diff --git a/src/shared/config/i18n/i18n.ts b/src/shared/config/i18n/i18n.ts index 63682ab..118f26b 100644 --- a/src/shared/config/i18n/i18n.ts +++ b/src/shared/config/i18n/i18n.ts @@ -1,6 +1,6 @@ import i18n, { LanguageDetectorAsyncModule } from 'i18next'; import { initReactI18next } from 'react-i18next'; -import { getLocalize } from 'shared/utils/statistics/getLocalize'; +import { getLocalize } from 'shared/lib/intl/getLocalize'; import { LanguageList, LanguageType } from './model/types/localize'; import en from './../../assets/locales/en.json'; diff --git a/src/shared/utils/clockify/clockify.ts b/src/shared/lib/dates/clockify/clockify.ts similarity index 100% rename from src/shared/utils/clockify/clockify.ts rename to src/shared/lib/dates/clockify/clockify.ts diff --git a/src/shared/utils/clockify/index.ts b/src/shared/lib/dates/clockify/index.ts similarity index 100% rename from src/shared/utils/clockify/index.ts rename to src/shared/lib/dates/clockify/index.ts diff --git a/src/shared/utils/dateDiffIn/dateDiffIn.ts b/src/shared/lib/dates/dateDiffIn/dateDiffIn.ts similarity index 100% rename from src/shared/utils/dateDiffIn/dateDiffIn.ts rename to src/shared/lib/dates/dateDiffIn/dateDiffIn.ts diff --git a/src/shared/utils/dateDiffIn/index.ts b/src/shared/lib/dates/dateDiffIn/index.ts similarity index 100% rename from src/shared/utils/dateDiffIn/index.ts rename to src/shared/lib/dates/dateDiffIn/index.ts diff --git a/src/shared/utils/parseValidDate/index.ts b/src/shared/lib/dates/parseValidDate/index.ts similarity index 100% rename from src/shared/utils/parseValidDate/index.ts rename to src/shared/lib/dates/parseValidDate/index.ts diff --git a/src/shared/utils/parseValidDate/parseValidDate.ts b/src/shared/lib/dates/parseValidDate/parseValidDate.ts similarity index 100% rename from src/shared/utils/parseValidDate/parseValidDate.ts rename to src/shared/lib/dates/parseValidDate/parseValidDate.ts diff --git a/src/shared/utils/abbrNum/abbrNum.ts b/src/shared/lib/format/abbreviateNumber/abbreviateNumber.ts similarity index 93% rename from src/shared/utils/abbrNum/abbrNum.ts rename to src/shared/lib/format/abbreviateNumber/abbreviateNumber.ts index 5170244..12129a0 100644 --- a/src/shared/utils/abbrNum/abbrNum.ts +++ b/src/shared/lib/format/abbreviateNumber/abbreviateNumber.ts @@ -1,4 +1,4 @@ -export const abbrNum = (number: any, decPlaces: number) => { +export const abbreviateNumber = (number: any, decPlaces: number) => { // 2 decimal places => 100, 3 => 1000, etc decPlaces = Math.pow(10, decPlaces); diff --git a/src/shared/lib/format/abbreviateNumber/index.ts b/src/shared/lib/format/abbreviateNumber/index.ts new file mode 100644 index 0000000..600f21e --- /dev/null +++ b/src/shared/lib/format/abbreviateNumber/index.ts @@ -0,0 +1 @@ +export { abbreviateNumber } from './abbreviateNumber'; diff --git a/src/shared/lib/format/truncateWithEllipsis/index.ts b/src/shared/lib/format/truncateWithEllipsis/index.ts new file mode 100644 index 0000000..e627bb0 --- /dev/null +++ b/src/shared/lib/format/truncateWithEllipsis/index.ts @@ -0,0 +1 @@ +export { truncateWithEllipsis } from './truncateWithEllipsis'; diff --git a/src/shared/utils/substringStr/substringStr.ts b/src/shared/lib/format/truncateWithEllipsis/truncateWithEllipsis.ts similarity index 65% rename from src/shared/utils/substringStr/substringStr.ts rename to src/shared/lib/format/truncateWithEllipsis/truncateWithEllipsis.ts index 3c812fd..b1eb6a1 100644 --- a/src/shared/utils/substringStr/substringStr.ts +++ b/src/shared/lib/format/truncateWithEllipsis/truncateWithEllipsis.ts @@ -1,4 +1,4 @@ -export const substringStr = (str: string, legth: number) => { +export const truncateWithEllipsis = (str: string, legth: number) => { if (!str) { return ''; } diff --git a/src/shared/lib/generate/generateRangeArray/generateRangeArray.ts b/src/shared/lib/generate/generateRangeArray/generateRangeArray.ts new file mode 100644 index 0000000..0cdf5da --- /dev/null +++ b/src/shared/lib/generate/generateRangeArray/generateRangeArray.ts @@ -0,0 +1,6 @@ +export const generateRangeArray = ( + start: number, + end: number, +): Array => { + return Array.from({ length: end - start + 1 }, (_, index) => start + index); +}; diff --git a/src/shared/lib/generate/generateRangeArray/index.ts b/src/shared/lib/generate/generateRangeArray/index.ts new file mode 100644 index 0000000..407dc22 --- /dev/null +++ b/src/shared/lib/generate/generateRangeArray/index.ts @@ -0,0 +1 @@ +export { generateRangeArray } from './generateRangeArray'; diff --git a/src/shared/utils/getAppCurrencies/getAppCurrencies.ts b/src/shared/lib/intl/getAppCurrencies/getAppCurrencies.ts similarity index 100% rename from src/shared/utils/getAppCurrencies/getAppCurrencies.ts rename to src/shared/lib/intl/getAppCurrencies/getAppCurrencies.ts diff --git a/src/shared/utils/getAppCurrencies/index.ts b/src/shared/lib/intl/getAppCurrencies/index.ts similarity index 100% rename from src/shared/utils/getAppCurrencies/index.ts rename to src/shared/lib/intl/getAppCurrencies/index.ts diff --git a/src/shared/utils/getCountry/getCountry.ts b/src/shared/lib/intl/getCountry/getCountry.ts similarity index 100% rename from src/shared/utils/getCountry/getCountry.ts rename to src/shared/lib/intl/getCountry/getCountry.ts diff --git a/src/shared/utils/getCountry/index.ts b/src/shared/lib/intl/getCountry/index.ts similarity index 100% rename from src/shared/utils/getCountry/index.ts rename to src/shared/lib/intl/getCountry/index.ts diff --git a/src/shared/utils/getCurrencySymbol/getCurrencySymbol.ts b/src/shared/lib/intl/getCurrencySymbol/getCurrencySymbol.ts similarity index 100% rename from src/shared/utils/getCurrencySymbol/getCurrencySymbol.ts rename to src/shared/lib/intl/getCurrencySymbol/getCurrencySymbol.ts diff --git a/src/shared/utils/getCurrencySymbol/index.ts b/src/shared/lib/intl/getCurrencySymbol/index.ts similarity index 100% rename from src/shared/utils/getCurrencySymbol/index.ts rename to src/shared/lib/intl/getCurrencySymbol/index.ts diff --git a/src/shared/utils/getCurrencySymbol/model/const/currency.ts b/src/shared/lib/intl/getCurrencySymbol/model/const/currency.ts similarity index 100% rename from src/shared/utils/getCurrencySymbol/model/const/currency.ts rename to src/shared/lib/intl/getCurrencySymbol/model/const/currency.ts diff --git a/src/shared/utils/getCurrencySymbol/model/types/currency.ts b/src/shared/lib/intl/getCurrencySymbol/model/types/currency.ts similarity index 100% rename from src/shared/utils/getCurrencySymbol/model/types/currency.ts rename to src/shared/lib/intl/getCurrencySymbol/model/types/currency.ts diff --git a/src/shared/utils/statistics/getLocalize/getLocalize.ts b/src/shared/lib/intl/getLocalize/getLocalize.ts similarity index 100% rename from src/shared/utils/statistics/getLocalize/getLocalize.ts rename to src/shared/lib/intl/getLocalize/getLocalize.ts diff --git a/src/shared/utils/statistics/getLocalize/index.ts b/src/shared/lib/intl/getLocalize/index.ts similarity index 100% rename from src/shared/utils/statistics/getLocalize/index.ts rename to src/shared/lib/intl/getLocalize/index.ts diff --git a/src/shared/hooks/useAppNavigation.ts b/src/shared/lib/navigation/useAppNavigation.ts similarity index 100% rename from src/shared/hooks/useAppNavigation.ts rename to src/shared/lib/navigation/useAppNavigation.ts diff --git a/src/shared/hooks/useAppDispatch.ts b/src/shared/lib/state/dispatch/useAppDispatch.ts similarity index 100% rename from src/shared/hooks/useAppDispatch.ts rename to src/shared/lib/state/dispatch/useAppDispatch.ts diff --git a/src/shared/hooks/useAppSelector.ts b/src/shared/lib/state/selector/useAppSelector.ts similarity index 100% rename from src/shared/hooks/useAppSelector.ts rename to src/shared/lib/state/selector/useAppSelector.ts diff --git a/src/shared/utils/getCigaretteSavings/getCigaretteSavings.ts b/src/shared/lib/statistics/getCigaretteSavings/getCigaretteSavings.ts similarity index 100% rename from src/shared/utils/getCigaretteSavings/getCigaretteSavings.ts rename to src/shared/lib/statistics/getCigaretteSavings/getCigaretteSavings.ts diff --git a/src/shared/utils/getCigaretteSavings/index.ts b/src/shared/lib/statistics/getCigaretteSavings/index.ts similarity index 100% rename from src/shared/utils/getCigaretteSavings/index.ts rename to src/shared/lib/statistics/getCigaretteSavings/index.ts diff --git a/src/shared/utils/statistics/getEnergy/getEnergy.ts b/src/shared/lib/statistics/getEnergy/getEnergy.ts similarity index 100% rename from src/shared/utils/statistics/getEnergy/getEnergy.ts rename to src/shared/lib/statistics/getEnergy/getEnergy.ts diff --git a/src/shared/utils/statistics/getEnergy/index.ts b/src/shared/lib/statistics/getEnergy/index.ts similarity index 100% rename from src/shared/utils/statistics/getEnergy/index.ts rename to src/shared/lib/statistics/getEnergy/index.ts diff --git a/src/shared/utils/statistics/getHelath/getHelath.ts b/src/shared/lib/statistics/getHelath/getHelath.ts similarity index 100% rename from src/shared/utils/statistics/getHelath/getHelath.ts rename to src/shared/lib/statistics/getHelath/getHelath.ts diff --git a/src/shared/utils/statistics/getHelath/index.ts b/src/shared/lib/statistics/getHelath/index.ts similarity index 100% rename from src/shared/utils/statistics/getHelath/index.ts rename to src/shared/lib/statistics/getHelath/index.ts diff --git a/src/shared/utils/statistics/getLungs/getLungs.ts b/src/shared/lib/statistics/getLungs/getLungs.ts similarity index 100% rename from src/shared/utils/statistics/getLungs/getLungs.ts rename to src/shared/lib/statistics/getLungs/getLungs.ts diff --git a/src/shared/utils/statistics/getLungs/index.ts b/src/shared/lib/statistics/getLungs/index.ts similarity index 100% rename from src/shared/utils/statistics/getLungs/index.ts rename to src/shared/lib/statistics/getLungs/index.ts diff --git a/src/shared/utils/statistics/getMoreTime/getMoreTime.ts b/src/shared/lib/statistics/getMoreTime/getMoreTime.ts similarity index 100% rename from src/shared/utils/statistics/getMoreTime/getMoreTime.ts rename to src/shared/lib/statistics/getMoreTime/getMoreTime.ts diff --git a/src/shared/utils/statistics/getMoreTime/index.ts b/src/shared/lib/statistics/getMoreTime/index.ts similarity index 100% rename from src/shared/utils/statistics/getMoreTime/index.ts rename to src/shared/lib/statistics/getMoreTime/index.ts diff --git a/src/shared/utils/statistics/getUnsmokedCigarettesCount/getUnsmokedCigarettesCount.ts b/src/shared/lib/statistics/getUnsmokedCigarettesCount/getUnsmokedCigarettesCount.ts similarity index 100% rename from src/shared/utils/statistics/getUnsmokedCigarettesCount/getUnsmokedCigarettesCount.ts rename to src/shared/lib/statistics/getUnsmokedCigarettesCount/getUnsmokedCigarettesCount.ts diff --git a/src/shared/utils/statistics/getUnsmokedCigarettesCount/index.ts b/src/shared/lib/statistics/getUnsmokedCigarettesCount/index.ts similarity index 100% rename from src/shared/utils/statistics/getUnsmokedCigarettesCount/index.ts rename to src/shared/lib/statistics/getUnsmokedCigarettesCount/index.ts diff --git a/src/shared/utils/statistics/getWeekDay/getWeekDay.ts b/src/shared/lib/statistics/getWeekDay/getWeekDay.ts similarity index 100% rename from src/shared/utils/statistics/getWeekDay/getWeekDay.ts rename to src/shared/lib/statistics/getWeekDay/getWeekDay.ts diff --git a/src/shared/utils/statistics/getWeekDay/index.ts b/src/shared/lib/statistics/getWeekDay/index.ts similarity index 100% rename from src/shared/utils/statistics/getWeekDay/index.ts rename to src/shared/lib/statistics/getWeekDay/index.ts diff --git a/src/shared/lib/theme/hooks/useTheme.ts b/src/shared/lib/theme/hooks/useTheme.ts index 932dd23..8f3fe7b 100644 --- a/src/shared/lib/theme/hooks/useTheme.ts +++ b/src/shared/lib/theme/hooks/useTheme.ts @@ -1,6 +1,6 @@ import { getColorScheme, getTheme } from 'app/providers/ThemeProvider'; import { useCallback } from 'react'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { themeMode } from './../util/themeMode/themeMode'; export const useTheme = () => { diff --git a/src/shared/ui/InputPicker/ui/InputPicker.tsx b/src/shared/ui/InputPicker/ui/InputPicker.tsx index e28415a..cc0c274 100644 --- a/src/shared/ui/InputPicker/ui/InputPicker.tsx +++ b/src/shared/ui/InputPicker/ui/InputPicker.tsx @@ -1,7 +1,7 @@ import { memo } from 'react'; import { View } from 'react-native'; import { AppNavigation } from 'shared/config/navigation'; -import { useAppNavigation } from 'shared/hooks/useAppNavigation'; +import { useAppNavigation } from 'shared/lib/navigation/useAppNavigation'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize } from 'shared/ui/CustomText'; import { PressableOpacity } from 'shared/ui/PressableOpacity'; diff --git a/src/shared/ui/InputScreen/ui/InputScreen.tsx b/src/shared/ui/InputScreen/ui/InputScreen.tsx index fd6b7b6..b65c217 100644 --- a/src/shared/ui/InputScreen/ui/InputScreen.tsx +++ b/src/shared/ui/InputScreen/ui/InputScreen.tsx @@ -1,7 +1,7 @@ import { memo } from 'react'; import { View } from 'react-native'; import { AppNavigation } from 'shared/config/navigation'; -import { useAppNavigation } from 'shared/hooks/useAppNavigation'; +import { useAppNavigation } from 'shared/lib/navigation/useAppNavigation'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize } from 'shared/ui/CustomText'; import { InputTextType } from 'shared/ui/InputText'; diff --git a/src/shared/ui/LinkPicker/ui/LinkPicker.tsx b/src/shared/ui/LinkPicker/ui/LinkPicker.tsx index a89accb..51d050f 100644 --- a/src/shared/ui/LinkPicker/ui/LinkPicker.tsx +++ b/src/shared/ui/LinkPicker/ui/LinkPicker.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { ColorValue } from 'react-native'; import { AppNavigation } from 'shared/config/navigation'; -import { useAppNavigation } from 'shared/hooks/useAppNavigation'; +import { useAppNavigation } from 'shared/lib/navigation/useAppNavigation'; import { LinkRow } from 'shared/ui/LinkRow'; export type LinkPickerProps = { diff --git a/src/shared/ui/PressableOpacity/ui/PressableOpacity.tsx b/src/shared/ui/PressableOpacity/ui/PressableOpacity.tsx index e2a73ea..c6c205e 100644 --- a/src/shared/ui/PressableOpacity/ui/PressableOpacity.tsx +++ b/src/shared/ui/PressableOpacity/ui/PressableOpacity.tsx @@ -8,7 +8,7 @@ import { } from 'react-native'; import ReactNativeHapticFeedback from 'react-native-haptic-feedback'; import { vibrationConfig } from 'shared/config/vibration'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; type PressableOpacityType = PressableProps & { children: React.ReactNode; diff --git a/src/shared/utils/abbrNum/index.ts b/src/shared/utils/abbrNum/index.ts deleted file mode 100644 index 3dff711..0000000 --- a/src/shared/utils/abbrNum/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { abbrNum } from './abbrNum'; diff --git a/src/shared/utils/arrayMinMax/arrayMinMax.ts b/src/shared/utils/arrayMinMax/arrayMinMax.ts deleted file mode 100644 index 35a9b14..0000000 --- a/src/shared/utils/arrayMinMax/arrayMinMax.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const arrayMinMax = (start: number, end: number): Array => { - return Array.from({ length: end - start + 1 }, (_, index) => start + index); -}; diff --git a/src/shared/utils/arrayMinMax/index.ts b/src/shared/utils/arrayMinMax/index.ts deleted file mode 100644 index 7cdb2b3..0000000 --- a/src/shared/utils/arrayMinMax/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { arrayMinMax } from './arrayMinMax'; diff --git a/src/shared/utils/messageReceived/index.ts b/src/shared/utils/messageReceived/index.ts deleted file mode 100644 index 86c2d80..0000000 --- a/src/shared/utils/messageReceived/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { onMessageReceived } from './messageReceived'; diff --git a/src/shared/utils/messageReceived/messageReceived.ts b/src/shared/utils/messageReceived/messageReceived.ts deleted file mode 100644 index a40dbc4..0000000 --- a/src/shared/utils/messageReceived/messageReceived.ts +++ /dev/null @@ -1,5 +0,0 @@ -import notifee from '@notifee/react-native'; - -export const onMessageReceived = async (message: any) => { - notifee.displayNotification(JSON.parse(message.data.notifee)); -}; diff --git a/src/shared/utils/readingTime/index.ts b/src/shared/utils/readingTime/index.ts deleted file mode 100644 index d020d0b..0000000 --- a/src/shared/utils/readingTime/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { readingTime } from './readingTime'; diff --git a/src/shared/utils/statistics/getSecondsDownTimer/index.ts b/src/shared/utils/statistics/getSecondsDownTimer/index.ts deleted file mode 100644 index 7d9aba5..0000000 --- a/src/shared/utils/statistics/getSecondsDownTimer/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { getSecondsDownTimer } from './getSecondsDownTimer'; diff --git a/src/shared/utils/substringStr/index.ts b/src/shared/utils/substringStr/index.ts deleted file mode 100644 index 8029f4c..0000000 --- a/src/shared/utils/substringStr/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { substringStr } from './substringStr'; diff --git a/src/widgets/breathing-exercise/ui/BreathingExercise.tsx b/src/widgets/breathing-exercise/ui/BreathingExercise.tsx index de99225..3f868dc 100644 --- a/src/widgets/breathing-exercise/ui/BreathingExercise.tsx +++ b/src/widgets/breathing-exercise/ui/BreathingExercise.tsx @@ -6,7 +6,7 @@ import { View } from 'react-native'; import ReactNativeHapticFeedback from 'react-native-haptic-feedback'; import * as Anims from 'shared/assets/anims'; import { vibrationConfig } from 'shared/config/vibration'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText } from 'shared/ui/CustomText'; import { PressableOpacity } from 'shared/ui/PressableOpacity'; diff --git a/src/widgets/daily-calendar/ui/DailyItem/DailyItem.tsx b/src/widgets/daily-calendar/ui/DailyItem/DailyItem.tsx index efbebff..d7fb07d 100644 --- a/src/widgets/daily-calendar/ui/DailyItem/DailyItem.tsx +++ b/src/widgets/daily-calendar/ui/DailyItem/DailyItem.tsx @@ -4,9 +4,9 @@ import { useTranslation } from 'react-i18next'; import { View } from 'react-native'; import * as Icons from 'shared/assets/icons'; import { moderateScale } from 'shared/config/dimensions'; +import { getWeekDay } from 'shared/lib/statistics/getWeekDay'; import { ColorPaletteType, useTheme } from 'shared/lib/theme'; import { CustomText, TextSize } from 'shared/ui/CustomText'; -import { getWeekDay } from 'shared/utils/statistics/getWeekDay'; import { styles } from './DailyItemStyle'; type DailyItemType = { diff --git a/src/widgets/daily-calendar/ui/DailyProgress/DailyProgress.tsx b/src/widgets/daily-calendar/ui/DailyProgress/DailyProgress.tsx index 94dad3f..a3d945c 100644 --- a/src/widgets/daily-calendar/ui/DailyProgress/DailyProgress.tsx +++ b/src/widgets/daily-calendar/ui/DailyProgress/DailyProgress.tsx @@ -4,7 +4,7 @@ import { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { DimensionValue, View } from 'react-native'; import LinearGradient from 'react-native-linear-gradient'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize, TextWeight } from 'shared/ui/CustomText'; import { styles } from './DailyProgressStyle'; diff --git "a/src/widgets/daily-calendar/ui/Daily\320\241alendar/Daily\320\241alendar.tsx" "b/src/widgets/daily-calendar/ui/Daily\320\241alendar/Daily\320\241alendar.tsx" index 94cc1b1..6825a77 100644 --- "a/src/widgets/daily-calendar/ui/Daily\320\241alendar/Daily\320\241alendar.tsx" +++ "b/src/widgets/daily-calendar/ui/Daily\320\241alendar/Daily\320\241alendar.tsx" @@ -3,7 +3,7 @@ import { getUserWeekly } from 'entities/user'; import React, { useCallback, useContext } from 'react'; import { useTranslation } from 'react-i18next'; import { FlatList } from 'react-native'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize } from 'shared/ui/CustomText'; import { PressableOpacity } from 'shared/ui/PressableOpacity'; diff --git a/src/widgets/leaderboard-header/ui/LeaderboardHeader/LeaderboardHeader.tsx b/src/widgets/leaderboard-header/ui/LeaderboardHeader/LeaderboardHeader.tsx index c129b74..959637a 100644 --- a/src/widgets/leaderboard-header/ui/LeaderboardHeader/LeaderboardHeader.tsx +++ b/src/widgets/leaderboard-header/ui/LeaderboardHeader/LeaderboardHeader.tsx @@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next'; import { Animated, View } from 'react-native'; import * as Icons from 'shared/assets/icons'; import { moderateScale } from 'shared/config/dimensions'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize, TextWeight } from 'shared/ui/CustomText'; import { LeaderboardItem } from './../LeaderboardItem/LeaderboardItem'; diff --git a/src/widgets/market-purchase/ui/Purchase/Purchase.tsx b/src/widgets/market-purchase/ui/Purchase/Purchase.tsx index 6faaf9a..9797200 100644 --- a/src/widgets/market-purchase/ui/Purchase/Purchase.tsx +++ b/src/widgets/market-purchase/ui/Purchase/Purchase.tsx @@ -18,8 +18,8 @@ import Carousel from 'react-native-reanimated-carousel'; import { moderateScale } from 'react-native-size-matters'; import * as Anims from 'shared/assets/anims'; import { SCREEN_WIDTH } from 'shared/config/dimensions'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { Pagination } from './../Pagination/Pagination'; import { PurchaseItem } from './../PurchaseItem/PurchaseItem'; diff --git a/src/widgets/motivation-section/ui/MotivationSection/MotivationSection.tsx b/src/widgets/motivation-section/ui/MotivationSection/MotivationSection.tsx index 356c995..8b1b76c 100644 --- a/src/widgets/motivation-section/ui/MotivationSection/MotivationSection.tsx +++ b/src/widgets/motivation-section/ui/MotivationSection/MotivationSection.tsx @@ -5,7 +5,7 @@ import * as Icons from 'shared/assets/icons'; import * as Images from 'shared/assets/images'; import { CONTENT_PADDING } from 'shared/config/dimensions'; import { AppNavigation } from 'shared/config/navigation'; -import { useAppNavigation } from 'shared/hooks/useAppNavigation'; +import { useAppNavigation } from 'shared/lib/navigation/useAppNavigation'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize } from 'shared/ui/CustomText'; import { PressableOpacity } from 'shared/ui/PressableOpacity'; diff --git a/src/widgets/profile-picker/ui/ProfilePicker.tsx b/src/widgets/profile-picker/ui/ProfilePicker.tsx index 03c345b..ae83b67 100644 --- a/src/widgets/profile-picker/ui/ProfilePicker.tsx +++ b/src/widgets/profile-picker/ui/ProfilePicker.tsx @@ -5,8 +5,8 @@ import { View } from 'react-native'; import * as Icons from 'shared/assets/icons'; import { moderateScale } from 'shared/config/dimensions'; import { AppNavigation } from 'shared/config/navigation'; -import { useAppNavigation } from 'shared/hooks/useAppNavigation'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppNavigation } from 'shared/lib/navigation/useAppNavigation'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize } from 'shared/ui/CustomText'; import { PressableOpacity } from 'shared/ui/PressableOpacity'; diff --git a/src/widgets/result-board/model/util/getDashboardDate/getDashboardDate.ts b/src/widgets/result-board/model/util/getDashboardDate/getDashboardDate.ts index 47dbdc9..12e6b3d 100644 --- a/src/widgets/result-board/model/util/getDashboardDate/getDashboardDate.ts +++ b/src/widgets/result-board/model/util/getDashboardDate/getDashboardDate.ts @@ -1,10 +1,10 @@ -import { getCigaretteSavings } from 'shared/utils/getCigaretteSavings'; -import { parseValidDate } from 'shared/utils/parseValidDate'; -import { getEnergy } from 'shared/utils/statistics/getEnergy'; -import { getHelath } from 'shared/utils/statistics/getHelath'; -import { getLungs } from 'shared/utils/statistics/getLungs'; -import { getMoreTime } from 'shared/utils/statistics/getMoreTime'; -import { getUnsmokedCigarettesCount } from 'shared/utils/statistics/getUnsmokedCigarettesCount'; +import { parseValidDate } from 'shared/lib/dates/parseValidDate'; +import { getCigaretteSavings } from 'shared/lib/statistics/getCigaretteSavings'; +import { getEnergy } from 'shared/lib/statistics/getEnergy'; +import { getHelath } from 'shared/lib/statistics/getHelath'; +import { getLungs } from 'shared/lib/statistics/getLungs'; +import { getMoreTime } from 'shared/lib/statistics/getMoreTime'; +import { getUnsmokedCigarettesCount } from 'shared/lib/statistics/getUnsmokedCigarettesCount'; export const getDashboardDate = ( toBeginDate: any, diff --git a/src/widgets/result-board/ui/ResultBoard/ResultBoard.tsx b/src/widgets/result-board/ui/ResultBoard/ResultBoard.tsx index 8cea4ff..dc2788b 100644 --- a/src/widgets/result-board/ui/ResultBoard/ResultBoard.tsx +++ b/src/widgets/result-board/ui/ResultBoard/ResultBoard.tsx @@ -11,9 +11,9 @@ import { useTranslation } from 'react-i18next'; import { View } from 'react-native'; import * as Images from 'shared/assets/images'; import { CONTENT_PADDING } from 'shared/config/dimensions'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { getCurrencySymbol } from 'shared/lib/intl/getCurrencySymbol'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { Row } from 'shared/ui/Row'; -import { getCurrencySymbol } from 'shared/utils/getCurrencySymbol'; import { ProfilePicker } from 'widgets/profile-picker'; import { getDashboardDate } from './../../model/util/getDashboardDate/getDashboardDate'; import { ResultBoardItem } from './../ResultBoardItem/ResultBoardItem'; diff --git a/src/widgets/sheet/Dashboards/SheetBank/SheetDashboardBank.tsx b/src/widgets/sheet/Dashboards/SheetBank/SheetDashboardBank.tsx index 15775d9..e0ea1b5 100644 --- a/src/widgets/sheet/Dashboards/SheetBank/SheetDashboardBank.tsx +++ b/src/widgets/sheet/Dashboards/SheetBank/SheetDashboardBank.tsx @@ -14,14 +14,14 @@ import React, { useContext, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { View } from 'react-native'; import * as Anims from 'shared/assets/anims'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { getCurrencySymbol } from 'shared/lib/intl/getCurrencySymbol'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; +import { getCigaretteSavings } from 'shared/lib/statistics/getCigaretteSavings'; +import { getUnsmokedCigarettesCount } from 'shared/lib/statistics/getUnsmokedCigarettesCount'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize, TextWeight } from 'shared/ui/CustomText'; import { RowGroup } from 'shared/ui/RowGroup'; import { Sheet } from 'shared/ui/Sheet'; -import { getCigaretteSavings } from 'shared/utils/getCigaretteSavings'; -import { getCurrencySymbol } from 'shared/utils/getCurrencySymbol'; -import { getUnsmokedCigarettesCount } from 'shared/utils/statistics/getUnsmokedCigarettesCount'; import { styles } from './SheetDashboardBankStyle'; export const SheetDashboardBank = React.memo(() => { diff --git a/src/widgets/sheet/Dashboards/SheetCiggy/SheetDashboardCiggy.tsx b/src/widgets/sheet/Dashboards/SheetCiggy/SheetDashboardCiggy.tsx index dcbc52b..258c947 100644 --- a/src/widgets/sheet/Dashboards/SheetCiggy/SheetDashboardCiggy.tsx +++ b/src/widgets/sheet/Dashboards/SheetCiggy/SheetDashboardCiggy.tsx @@ -5,12 +5,12 @@ import React, { useContext, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { View } from 'react-native'; import * as Anims from 'shared/assets/anims'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; +import { getCigaretteSavings } from 'shared/lib/statistics/getCigaretteSavings'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize, TextWeight } from 'shared/ui/CustomText'; import { RowGroup } from 'shared/ui/RowGroup'; import { Sheet } from 'shared/ui/Sheet'; -import { getCigaretteSavings } from 'shared/utils/getCigaretteSavings'; import { styles } from './SheetDashboardCiggyStyle'; export const SheetDashboardCiggy = React.memo(() => { diff --git a/src/widgets/sheet/Dashboards/SheetEnergy/SheetDashboardEnergy.tsx b/src/widgets/sheet/Dashboards/SheetEnergy/SheetDashboardEnergy.tsx index 9a701c8..42321ee 100644 --- a/src/widgets/sheet/Dashboards/SheetEnergy/SheetDashboardEnergy.tsx +++ b/src/widgets/sheet/Dashboards/SheetEnergy/SheetDashboardEnergy.tsx @@ -5,12 +5,12 @@ import React, { useContext, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { View } from 'react-native'; import * as Anims from 'shared/assets/anims'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; +import { getCigaretteSavings } from 'shared/lib/statistics/getCigaretteSavings'; +import { getEnergy } from 'shared/lib/statistics/getEnergy'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize, TextWeight } from 'shared/ui/CustomText'; import { Sheet } from 'shared/ui/Sheet'; -import { getCigaretteSavings } from 'shared/utils/getCigaretteSavings'; -import { getEnergy } from 'shared/utils/statistics/getEnergy'; import { styles } from './SheetDashboardEnergyStyle'; export const SheetDashboardEnergy = React.memo(() => { diff --git a/src/widgets/sheet/Dashboards/SheetHealth/SheetDashboardHealth.tsx b/src/widgets/sheet/Dashboards/SheetHealth/SheetDashboardHealth.tsx index f421b11..f46f44c 100644 --- a/src/widgets/sheet/Dashboards/SheetHealth/SheetDashboardHealth.tsx +++ b/src/widgets/sheet/Dashboards/SheetHealth/SheetDashboardHealth.tsx @@ -5,12 +5,12 @@ import React, { useContext, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { View } from 'react-native'; import * as Anims from 'shared/assets/anims'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; +import { getCigaretteSavings } from 'shared/lib/statistics/getCigaretteSavings'; +import { getHelath } from 'shared/lib/statistics/getHelath'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize, TextWeight } from 'shared/ui/CustomText'; import { Sheet } from 'shared/ui/Sheet'; -import { getCigaretteSavings } from 'shared/utils/getCigaretteSavings'; -import { getHelath } from 'shared/utils/statistics/getHelath'; import { styles } from './SheetDashboardHealthStyle'; export const SheetDashboardHealth = React.memo(() => { diff --git a/src/widgets/sheet/Dashboards/SheetLungs/SheetDashboardLungs.tsx b/src/widgets/sheet/Dashboards/SheetLungs/SheetDashboardLungs.tsx index 6005647..b6dd10d 100644 --- a/src/widgets/sheet/Dashboards/SheetLungs/SheetDashboardLungs.tsx +++ b/src/widgets/sheet/Dashboards/SheetLungs/SheetDashboardLungs.tsx @@ -5,12 +5,12 @@ import React, { useContext, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { View } from 'react-native'; import * as Anims from 'shared/assets/anims'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; +import { getCigaretteSavings } from 'shared/lib/statistics/getCigaretteSavings'; +import { getLungs } from 'shared/lib/statistics/getLungs'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize, TextWeight } from 'shared/ui/CustomText'; import { Sheet } from 'shared/ui/Sheet'; -import { getCigaretteSavings } from 'shared/utils/getCigaretteSavings'; -import { getLungs } from 'shared/utils/statistics/getLungs'; import { styles } from './SheetDashboardLungsStyle'; export const SheetDashboardLungs = React.memo(() => { diff --git a/src/widgets/sheet/Dashboards/SheetMoreTime/SheetDashboardMoreTime.tsx b/src/widgets/sheet/Dashboards/SheetMoreTime/SheetDashboardMoreTime.tsx index e9d7239..3d9ad2f 100644 --- a/src/widgets/sheet/Dashboards/SheetMoreTime/SheetDashboardMoreTime.tsx +++ b/src/widgets/sheet/Dashboards/SheetMoreTime/SheetDashboardMoreTime.tsx @@ -5,12 +5,12 @@ import React, { useContext, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { View } from 'react-native'; import * as Anims from 'shared/assets/anims'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; +import { getCigaretteSavings } from 'shared/lib/statistics/getCigaretteSavings'; +import { getMoreTime } from 'shared/lib/statistics/getMoreTime'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize, TextWeight } from 'shared/ui/CustomText'; import { Sheet } from 'shared/ui/Sheet'; -import { getCigaretteSavings } from 'shared/utils/getCigaretteSavings'; -import { getMoreTime } from 'shared/utils/statistics/getMoreTime'; import { styles } from './SheetDashboardMoreTimeStyle'; export const SheetDashboardMoreTime = React.memo(() => { diff --git a/src/widgets/sheet/SheetChart/SheetCharts.tsx b/src/widgets/sheet/SheetChart/SheetCharts.tsx index 2f01b6f..7d94c4d 100644 --- a/src/widgets/sheet/SheetChart/SheetCharts.tsx +++ b/src/widgets/sheet/SheetChart/SheetCharts.tsx @@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next'; import { View } from 'react-native'; import { PieChart } from 'react-native-chart-kit'; import * as Anims from 'shared/assets/anims'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize, TextWeight } from 'shared/ui/CustomText'; import { Sheet } from 'shared/ui/Sheet'; diff --git a/src/widgets/sheet/SheetNotification/SheetNotification.tsx b/src/widgets/sheet/SheetNotification/SheetNotification.tsx index 84c03b2..5c91866 100644 --- a/src/widgets/sheet/SheetNotification/SheetNotification.tsx +++ b/src/widgets/sheet/SheetNotification/SheetNotification.tsx @@ -6,7 +6,7 @@ import React, { useContext } from 'react'; import { useTranslation } from 'react-i18next'; import { View } from 'react-native'; import * as Anims from 'shared/assets/anims'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; import { useTheme } from 'shared/lib/theme'; import { CustomButton } from 'shared/ui/CustomButton'; import { CustomText, TextSize, TextWeight } from 'shared/ui/CustomText'; diff --git a/src/widgets/sheet/SheetProgress/SheetProgress.tsx b/src/widgets/sheet/SheetProgress/SheetProgress.tsx index 89003e8..8f8203f 100644 --- a/src/widgets/sheet/SheetProgress/SheetProgress.tsx +++ b/src/widgets/sheet/SheetProgress/SheetProgress.tsx @@ -6,7 +6,7 @@ import React, { useContext } from 'react'; import { useTranslation } from 'react-i18next'; import { View } from 'react-native'; import * as Anims from 'shared/assets/anims'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize, TextWeight } from 'shared/ui/CustomText'; import { RowGroup } from 'shared/ui/RowGroup'; diff --git a/src/shared/utils/statistics/getSecondsDownTimer/getSecondsDownTimer.ts b/src/widgets/simulator/model/lib/calculate/calculateRemainingSeconds.ts similarity index 55% rename from src/shared/utils/statistics/getSecondsDownTimer/getSecondsDownTimer.ts rename to src/widgets/simulator/model/lib/calculate/calculateRemainingSeconds.ts index a282d67..80c281d 100644 --- a/src/shared/utils/statistics/getSecondsDownTimer/getSecondsDownTimer.ts +++ b/src/widgets/simulator/model/lib/calculate/calculateRemainingSeconds.ts @@ -1,7 +1,7 @@ -import { parseValidDate } from 'shared/utils/parseValidDate'; -import { dateDiffIn } from './../../dateDiffIn/dateDiffIn'; +import { dateDiffIn } from 'shared/lib/dates/dateDiffIn'; +import { parseValidDate } from 'shared/lib/dates/parseValidDate'; -export const getSecondsDownTimer = (date: any, range = 5) => { +export const calculateRemainingSeconds = (date: any, range = 5) => { let parseDate = parseValidDate(date); parseDate.setMinutes(parseDate.getMinutes() + range); diff --git a/src/widgets/simulator/model/util/hooks/useCountDownTimer.ts b/src/widgets/simulator/model/lib/hooks/useCountDownTimer.ts similarity index 90% rename from src/widgets/simulator/model/util/hooks/useCountDownTimer.ts rename to src/widgets/simulator/model/lib/hooks/useCountDownTimer.ts index 614a087..aeb5632 100644 --- a/src/widgets/simulator/model/util/hooks/useCountDownTimer.ts +++ b/src/widgets/simulator/model/lib/hooks/useCountDownTimer.ts @@ -1,15 +1,15 @@ import { useCallback, useEffect, useState } from 'react'; import BackgroundTimer from 'react-native-background-timer'; -import { clockify } from 'shared/utils/clockify'; +import { clockify } from 'shared/lib/dates/clockify'; -type useCountDownTimerProps = { +type СountDownTimerProps = { isStart: boolean; setIsStart: (value: boolean) => void; seconds?: number; onTimerFinished?: () => void; }; -export const useCountDownTimer = (props: useCountDownTimerProps) => { +export const useCountDownTimer = (props: СountDownTimerProps) => { const { isStart, setIsStart, seconds = 3601, onTimerFinished } = props; const [secondsLeft, setSecondsLeft] = useState(seconds); diff --git a/src/shared/hooks/useAppForegroundState.ts b/src/widgets/simulator/model/lib/hooks/useForegroundState.ts similarity index 92% rename from src/shared/hooks/useAppForegroundState.ts rename to src/widgets/simulator/model/lib/hooks/useForegroundState.ts index 96dd55e..36db62f 100644 --- a/src/shared/hooks/useAppForegroundState.ts +++ b/src/widgets/simulator/model/lib/hooks/useForegroundState.ts @@ -1,7 +1,7 @@ import { useEffect, useState } from 'react'; import { AppState, AppStateStatus } from 'react-native'; -export function useAppForegroundState() { +export const useForegroundState = () => { const [foreground, setForeground] = useState(false); useEffect(() => { @@ -24,4 +24,4 @@ export function useAppForegroundState() { }, []); return foreground; -} +}; diff --git a/src/widgets/simulator/ui/CountDownTimer/CountDownTimer.tsx b/src/widgets/simulator/ui/CountDownTimer/CountDownTimer.tsx index 81fc735..b798bba 100644 --- a/src/widgets/simulator/ui/CountDownTimer/CountDownTimer.tsx +++ b/src/widgets/simulator/ui/CountDownTimer/CountDownTimer.tsx @@ -5,12 +5,12 @@ import Lottie from 'lottie-react-native'; import { memo, useEffect, useMemo } from 'react'; import { View } from 'react-native'; import * as Anims from 'shared/assets/anims'; -import { useAppForegroundState } from 'shared/hooks/useAppForegroundState'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize, TextWeight } from 'shared/ui/CustomText'; -import { getSecondsDownTimer } from 'shared/utils/statistics/getSecondsDownTimer'; -import { useCountDownTimer } from './../../model/util/hooks/useCountDownTimer'; +import { calculateRemainingSeconds } from './../../model/lib/calculate/calculateRemainingSeconds'; +import { useCountDownTimer } from './../../model/lib/hooks/useCountDownTimer'; +import { useForegroundState } from './../../model/lib/hooks/useForegroundState'; import { styles } from './CountDownTimerStyle'; interface CountDownTimerProps { @@ -32,11 +32,11 @@ export const CountDownTimer = memo( setIsStart, }); - const foreground = useAppForegroundState(); + const foreground = useForegroundState(); useEffect(() => { if (foreground) { const newTime = motivationUpdated - ? getSecondsDownTimer(motivationUpdated, howOffen) + ? calculateRemainingSeconds(motivationUpdated, howOffen) : null; newTime ? setSecondsLeft(newTime) : setSecondsLeft(0); @@ -47,7 +47,7 @@ export const CountDownTimer = memo( if (!motivationUpdated) { return null; } - return getSecondsDownTimer(motivationUpdated, howOffen); + return calculateRemainingSeconds(motivationUpdated, howOffen); }, [motivationUpdated, isAuth]); useEffect(() => { diff --git a/src/widgets/simulator/ui/Simulator/Simulator.tsx b/src/widgets/simulator/ui/Simulator/Simulator.tsx index 89d6eb3..0a03c02 100644 --- a/src/widgets/simulator/ui/Simulator/Simulator.tsx +++ b/src/widgets/simulator/ui/Simulator/Simulator.tsx @@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next'; import { View } from 'react-native'; import { CONTENT_PADDING } from 'shared/config/dimensions'; import { AppNavigation } from 'shared/config/navigation'; -import { useAppNavigation } from 'shared/hooks/useAppNavigation'; +import { useAppNavigation } from 'shared/lib/navigation/useAppNavigation'; import { useTheme } from 'shared/lib/theme'; import { CustomText, TextSize } from 'shared/ui/CustomText'; import { PressableOpacity } from 'shared/ui/PressableOpacity'; diff --git a/src/widgets/tab-navigation/ui/TabNavigation/TabNavigation.tsx b/src/widgets/tab-navigation/ui/TabNavigation/TabNavigation.tsx index 4758773..adfb5fa 100644 --- a/src/widgets/tab-navigation/ui/TabNavigation/TabNavigation.tsx +++ b/src/widgets/tab-navigation/ui/TabNavigation/TabNavigation.tsx @@ -23,9 +23,9 @@ import { AppTabNavigation, NavigationTabLists, } from 'shared/config/navigation'; -import { useAppDispatch } from 'shared/hooks/useAppDispatch'; -import { useAppNavigation } from 'shared/hooks/useAppNavigation'; -import { useAppSelector } from 'shared/hooks/useAppSelector'; +import { useAppNavigation } from 'shared/lib/navigation/useAppNavigation'; +import { useAppDispatch } from 'shared/lib/state/dispatch/useAppDispatch'; +import { useAppSelector } from 'shared/lib/state/selector/useAppSelector'; import { useTheme } from 'shared/lib/theme'; import { getReview } from './../../model/selectors/getReview/getReview'; import { setReview } from './../../model/slices/tabNavigationSlice';