From ea18fdef950f9110f5e1c8b56d46a10da48a0645 Mon Sep 17 00:00:00 2001 From: "Georgi Ganchev @7DIGIT" Date: Tue, 21 Nov 2023 12:00:23 +0200 Subject: [PATCH 1/8] Remove: ChangeLanguage screen --- src/navigation/AppNavigation.jsx | 2 - src/screens/ChangeLanguage/ChangeLanguage.jsx | 81 ------------------- src/screens/ChangeLanguage/index.js | 1 - src/screens/ChangeLanguage/locales.js | 3 - src/screens/ChangeLanguage/locales/en.json | 4 - src/screens/ChangeLanguage/locales/kk.json | 4 - src/screens/ChangeLanguage/locales/ru.json | 4 - src/screens/index.js | 1 - src/screens/locales.js | 1 - 9 files changed, 101 deletions(-) delete mode 100644 src/screens/ChangeLanguage/ChangeLanguage.jsx delete mode 100644 src/screens/ChangeLanguage/index.js delete mode 100644 src/screens/ChangeLanguage/locales.js delete mode 100644 src/screens/ChangeLanguage/locales/en.json delete mode 100644 src/screens/ChangeLanguage/locales/kk.json delete mode 100644 src/screens/ChangeLanguage/locales/ru.json diff --git a/src/navigation/AppNavigation.jsx b/src/navigation/AppNavigation.jsx index b3c87be2..880be818 100644 --- a/src/navigation/AppNavigation.jsx +++ b/src/navigation/AppNavigation.jsx @@ -27,7 +27,6 @@ import { PaymentHistory, ChangePasscode, TermsOfUse, - ChangeLanguage, } from "#screens"; import { Context } from "#services"; @@ -73,7 +72,6 @@ export const AppNavigation = () => { - ); }; diff --git a/src/screens/ChangeLanguage/ChangeLanguage.jsx b/src/screens/ChangeLanguage/ChangeLanguage.jsx deleted file mode 100644 index a6e160bb..00000000 --- a/src/screens/ChangeLanguage/ChangeLanguage.jsx +++ /dev/null @@ -1,81 +0,0 @@ -import React, { useState } from "react"; -import { useQuery } from "@tanstack/react-query"; -import { useTranslation } from "react-i18next"; -import { Screen, Block, Dropdown, Heading, Loading } from "#components"; -import { localStorage, languageSvc, userSvc } from "#services"; -import { StyleSheet } from "react-native"; - -export default function ChangeLanguage({ navigation }) { - const { t, i18n } = useTranslation("change-language"); - const [data, setData] = useState({ - language: "", - }); - const fetchLanguages = async () => { - const localStorageLanguage = await localStorage.getItem("language"); - if (localStorageLanguage) { - setData({ - language: localStorageLanguage, - }); - } - const res = await languageSvc.getActiveLanguages(); - const languages = res.data.map((x) => { - const languageObject = { - value: x.alpha2, - label: x.name === "English" ? x.name : `${x.name} (${x.local_name})`, - id: x["language_id"], - }; - if (localStorageLanguage === x.alpha2) { - setData({ language: x.alpha2 }); - i18n.changeLanguage(localStorageLanguage); - } - return languageObject; - }); - return languages; - }; - const languagesQuery = useQuery(["languages"], fetchLanguages); - - const handleChangeLanguage = async (lang) => { - setData({ language: lang }); - i18n.changeLanguage(lang); - await localStorage.setItem("language", lang); - - try { - await userSvc.changeLanguage(lang); - } catch (err) { - console.log(err, "err"); - } - }; - - return ( - - navigation.goBack()} - /> - - {languagesQuery.isLoading ? ( - - ) : ( - - )} - - - ); -} - -const styles = StyleSheet.create({ - dropdown: { zIndex: 3 }, - marginBottom32: { marginBottom: 32 }, - mt84: { marginTop: 84 }, - center: { alignSelf: "center" }, -}); - -export { ChangeLanguage }; diff --git a/src/screens/ChangeLanguage/index.js b/src/screens/ChangeLanguage/index.js deleted file mode 100644 index 7c85fe1e..00000000 --- a/src/screens/ChangeLanguage/index.js +++ /dev/null @@ -1 +0,0 @@ -export * from "./ChangeLanguage"; diff --git a/src/screens/ChangeLanguage/locales.js b/src/screens/ChangeLanguage/locales.js deleted file mode 100644 index 9cfad788..00000000 --- a/src/screens/ChangeLanguage/locales.js +++ /dev/null @@ -1,3 +0,0 @@ -export * as en from "./locales/en.json"; -export * as ru from "./locales/ru.json"; -export * as kk from "./locales/kk.json"; diff --git a/src/screens/ChangeLanguage/locales/en.json b/src/screens/ChangeLanguage/locales/en.json deleted file mode 100644 index 3eff27a8..00000000 --- a/src/screens/ChangeLanguage/locales/en.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "heading": "Change language", - "language": "Language" -} diff --git a/src/screens/ChangeLanguage/locales/kk.json b/src/screens/ChangeLanguage/locales/kk.json deleted file mode 100644 index d5fdfa69..00000000 --- a/src/screens/ChangeLanguage/locales/kk.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "heading": "Тілді өзгерту", - "language": "Тілдер" -} diff --git a/src/screens/ChangeLanguage/locales/ru.json b/src/screens/ChangeLanguage/locales/ru.json deleted file mode 100644 index 03449121..00000000 --- a/src/screens/ChangeLanguage/locales/ru.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "heading": "Изменить язык", - "language": "Языки" -} diff --git a/src/screens/index.js b/src/screens/index.js index 4ad1807f..c8c5cbe2 100644 --- a/src/screens/index.js +++ b/src/screens/index.js @@ -35,4 +35,3 @@ export * from "./ChangePasscode"; export * from "./LocalAuthenticationScreen"; export * from "./TermsOfUse"; export * from "./MyQA"; -export * from "./ChangeLanguage"; diff --git a/src/screens/locales.js b/src/screens/locales.js index 8a8037f7..68b4a8d5 100644 --- a/src/screens/locales.js +++ b/src/screens/locales.js @@ -21,4 +21,3 @@ export * as PaymentHistory from "./PaymentHistory/locales"; export * as ChangePasscode from "./ChangePasscode/locales"; export * as LocalAuthenticationScreen from "./LocalAuthenticationScreen/locales"; export * as MyQA from "./MyQA/locales"; -export * as ChangeLanguage from "./ChangeLanguage/locales"; From d8e0bfc0654f92e6e25bc24b6f44a403455f70f9 Mon Sep 17 00:00:00 2001 From: "Georgi Ganchev @7DIGIT" Date: Tue, 21 Nov 2023 12:00:39 +0200 Subject: [PATCH 2/8] Create: dark mode --- App.js | 34 +++--- i18n.js | 4 - .../FilterProviders/FilterProviders.jsx | 4 +- .../SelectConsultation/SelectConsultation.jsx | 8 +- .../ActivityHistory/ActivityHistory.jsx | 21 ++-- src/blocks/ArticleView/ArticleView.jsx | 72 +++++++----- src/blocks/Consultations/Consultations.jsx | 2 - .../ConsultationsDashboard.jsx | 7 +- src/blocks/MoodTracker/MoodTracker.jsx | 9 +- src/blocks/PlatformRating/PlatformRating.jsx | 2 +- src/blocks/PrivacyPolicy/PrivacyPolicy.jsx | 10 +- .../ProviderDetails/ProviderDetails.jsx | 33 ++++-- .../RegisterAnonymous/RegisterAnonymous.jsx | 14 ++- .../RegisterPreview/RegisterPreview.jsx | 9 +- src/blocks/SelectProvider/SelectProvider.jsx | 1 + src/blocks/UserDetails/UserDetails.jsx | 21 +++- src/blocks/UserProfile/UserProfile.jsx | 107 ++++++++++++++---- .../ProfilePicturePreview.jsx | 8 +- src/components/boxes/Box/Box.jsx | 6 +- .../buttons/ButtonSelector/ButtonSelector.jsx | 14 ++- src/components/calendar/Header/Header.jsx | 18 ++- src/components/cards/Answer/Answer.jsx | 5 +- src/components/cards/CardMedia/CardMedia.jsx | 12 +- .../cards/Consultation/Consultation.jsx | 10 +- .../cards/ConsultationBig/ConsultationBig.jsx | 11 +- .../ConsultationDashboard.jsx | 23 +++- .../ConsultationInformation.jsx | 27 +++-- .../cards/EmergencyCenter/EmergencyCenter.jsx | 19 +++- .../MoodTrackDetails/MoodTrackDetails.jsx | 24 +++- .../cards/Notification/Notification.jsx | 12 +- .../ProviderOverview/ProviderOverview.jsx | 26 +++-- .../MoodTrackLineChart/MoodTrackLineChart.jsx | 7 +- .../dropdowns/Dropdown/Dropdown.jsx | 30 ++++- .../HeaderNavigation/HeaderNavigation.jsx | 17 ++- src/components/headings/Heading/Heading.jsx | 12 +- src/components/icons/Like.jsx | 17 ++- src/components/inputs/CheckBox/CheckBox.jsx | 12 +- .../inputs/CheckBoxGroup/CheckBoxGroup.jsx | 10 +- src/components/inputs/Input/Input.jsx | 16 ++- .../inputs/RadioButton/RadioButton.jsx | 11 +- .../RadioButtonSelector.jsx | 12 +- .../RadioButtonSelectorGroup.jsx | 8 +- src/components/inputs/Toggle/Toggle.jsx | 11 +- src/components/modals/Backdrop/Backdrop.jsx | 8 +- src/components/modals/TransparentModal.jsx | 17 ++- .../TermsAgreement/TermsAgreement.jsx | 16 ++- src/components/ratings/Rating/Rating.jsx | 10 +- .../PaymentsHistoryTable.jsx | 11 +- src/components/tabs/Tabs/Tabs.jsx | 14 ++- src/components/texts/AppText/AppText.jsx | 17 ++- src/components/wrappers/Screen/Screen.jsx | 11 +- src/hooks/index.js | 1 + src/hooks/useGetTheme.js | 8 ++ .../assets/HowItWorks2Mobile.png | Bin 177179 -> 156058 bytes .../assets/HowItWorks3Mobile.png | Bin 218186 -> 434172 bytes .../RequireDataAgreemant.jsx | 9 +- src/navigation/Navigation.jsx | 38 ++++++- src/navigation/TabNavigation.jsx | 17 ++- src/screens/Checkout/Checkout.jsx | 66 ++++++----- src/screens/Dashboard/Dashboard.jsx | 22 +++- .../InformationalPortal.jsx | 12 +- .../LocalAuthenticationScreen.jsx | 9 +- src/screens/MyQA/MyQA.jsx | 8 +- .../ProviderOverview/ProviderOverview.jsx | 1 + src/screens/SelectProvider/SelectProvider.jsx | 84 ++++++++------ src/styles/appStyles.js | 4 + src/styles/colors.js | 23 ++++ src/styles/index.js | 1 + 68 files changed, 807 insertions(+), 336 deletions(-) create mode 100644 src/hooks/useGetTheme.js create mode 100644 src/styles/colors.js diff --git a/App.js b/App.js index 8059b3c0..90f2cf36 100644 --- a/App.js +++ b/App.js @@ -62,6 +62,7 @@ function App() { const [hasCheckedTmpUser, setHasCheckedTmpUser] = useState(false); const [activeCoupon, setActiveCoupon] = useState(); const [isAnonymousRegister, setIsAnonymousRegister] = useState(false); + const [theme, setTheme] = useState(null); const [dropdownOptions, setDropdownOptions] = useState({ isOpen: false, @@ -184,6 +185,8 @@ function App() { setActiveCoupon, isAnonymousRegister, setIsAnonymousRegister, + theme, + setTheme, }; return ( @@ -192,21 +195,22 @@ function App() { - - - - setDropdownOptions((options) => ({ - ...options, - isOpen: false, - })) - } - {...dropdownOptions} - /> + + + setDropdownOptions((options) => ({ + ...options, + isOpen: false, + })) + } + {...dropdownOptions} + /> + + diff --git a/i18n.js b/i18n.js index 30f9b4af..2696d129 100644 --- a/i18n.js +++ b/i18n.js @@ -62,7 +62,6 @@ import { SOSCenter as SOSCenterScreen, LocalAuthenticationScreen, MyQA as MyQAScreen, - ChangeLanguage, } from "./src/screens/locales.js"; import { @@ -155,7 +154,6 @@ const resources = { "share-platform-screen": SharePlatformScreen.en, "sos-center-screen": SOSCenterScreen.en, "my-qa-screen": MyQAScreen.en, - "change-language": ChangeLanguage.en, // Backdrops "cancel-consultation": CancelConsultation.en, @@ -246,7 +244,6 @@ const resources = { "share-platform-screen": SharePlatformScreen.ru, "sos-center-screen": SOSCenterScreen.ru, "my-qa-screen": MyQAScreen.ru, - "change-language": ChangeLanguage.ru, // Backdrops "cancel-consultation": CancelConsultation.ru, @@ -337,7 +334,6 @@ const resources = { "share-platform-screen": SharePlatformScreen.kk, "sos-center-screen": SOSCenterScreen.kk, "my-qa-screen": MyQAScreen.kk, - "change-language": ChangeLanguage.kk, // Backdrops "cancel-consultation": CancelConsultation.kk, diff --git a/src/backdrops/FilterProviders/FilterProviders.jsx b/src/backdrops/FilterProviders/FilterProviders.jsx index 22af60a9..d8271203 100644 --- a/src/backdrops/FilterProviders/FilterProviders.jsx +++ b/src/backdrops/FilterProviders/FilterProviders.jsx @@ -246,10 +246,8 @@ export const FilterProviders = ({ dropdownId="filterLanguage" /> - - {t("providers_free_consultation_label")} - handleSelect("onlyFreeConsultation", checked) diff --git a/src/backdrops/SelectConsultation/SelectConsultation.jsx b/src/backdrops/SelectConsultation/SelectConsultation.jsx index d04f8869..d261e673 100644 --- a/src/backdrops/SelectConsultation/SelectConsultation.jsx +++ b/src/backdrops/SelectConsultation/SelectConsultation.jsx @@ -132,7 +132,6 @@ export const SelectConsultation = ({ name="free-slots" selected={selectedSlot} setSelected={handleChooseSlot} - classes="select-consultation__radio-button-selector-group" /> ); }; @@ -201,19 +200,19 @@ export const SelectConsultation = ({ loading={isCouponLoading} style={{ width: appStyles.screenWidth * 0.4, - minWidth: 'auto', + minWidth: "auto", borderRadius: 40, paddingVertical: 10, }} /> - {couponError && } + {couponError && } {providerDataQuery.isLoading ? ( ) : ( - +
{ const { t } = useTranslation("activity-history"); + const { colors } = useGetTheme(); const [shownMessages, setShownMessages] = useState(); const messagesContainerRef = useRef(); @@ -144,16 +146,7 @@ export const ActivityHistory = ({ }; return ( <> - + navigation.goBack()}> { + const { colors } = useGetTheme(); + return ( <> @@ -47,7 +48,10 @@ export const ArticleView = ({ articleData }) => { - + {articleData.categoryName} @@ -59,7 +63,40 @@ export const ArticleView = ({ articleData }) => { })} - {articleData.body} + + {articleData.body} + ); @@ -86,35 +123,8 @@ const styles = StyleSheet.create({ borderRadius: 25, justifyContent: "center", }, - heading3: { - fontSize: 20, - lineHeight: 24, - fontFamily: "Nunito_600SemiBold", - color: appStyles.colorBlue_3d527b, - marginTop: 20, - marginBottom: 8, - }, - heading4: { - fontSize: 16, - lineHeight: 24, - fontFamily: "Nunito_600SemiBold", - color: appStyles.colorBlue_3d527b, - marginTop: 12, - }, - paragraph: { - color: appStyles.colorGray_66768d, - fontSize: 16, - fontFamily: "Nunito_400Regular", - lineHeight: 24, - }, categoryText: { fontFamily: appStyles.fontBold, color: appStyles.colorBlue_3d527b, }, - list_item: { - color: appStyles.colorGray_66768d, - fontSize: 16, - fontFamily: "Nunito_400Regular", - lineHeight: 24, - }, }); diff --git a/src/blocks/Consultations/Consultations.jsx b/src/blocks/Consultations/Consultations.jsx index 5be2db7e..5d13ae7f 100644 --- a/src/blocks/Consultations/Consultations.jsx +++ b/src/blocks/Consultations/Consultations.jsx @@ -3,9 +3,7 @@ import { useTranslation } from "react-i18next"; import { StyleSheet, View } from "react-native"; import { AppText, Block, Consultation, TabsUnderlined } from "#components"; - import { ONE_HOUR, showToast } from "#utils"; - import { useGetAllConsultations, useAcceptConsultation, diff --git a/src/blocks/ConsultationsDashboard/ConsultationsDashboard.jsx b/src/blocks/ConsultationsDashboard/ConsultationsDashboard.jsx index 10a69c00..61a2598a 100644 --- a/src/blocks/ConsultationsDashboard/ConsultationsDashboard.jsx +++ b/src/blocks/ConsultationsDashboard/ConsultationsDashboard.jsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from "react"; +import React from "react"; import { useTranslation } from "react-i18next"; import { View, StyleSheet, TouchableOpacity } from "react-native"; @@ -12,7 +12,7 @@ import { } from "#components"; import { appStyles } from "#styles"; -import { userSvc } from "#services"; +import { useGetTheme } from "#hooks"; /** * ConsultationsDashboard @@ -32,6 +32,7 @@ export const ConsultationsDashboard = ({ handleRegistrationModalOpen, isTmpUser, }) => { + const { isDarkMode } = useGetTheme(); const { t } = useTranslation("consultations-dashboard"); const width = appStyles.screenWidth * 0.96; @@ -81,7 +82,7 @@ export const ConsultationsDashboard = ({ diff --git a/src/blocks/MoodTracker/MoodTracker.jsx b/src/blocks/MoodTracker/MoodTracker.jsx index 88e04405..b18a9d8c 100644 --- a/src/blocks/MoodTracker/MoodTracker.jsx +++ b/src/blocks/MoodTracker/MoodTracker.jsx @@ -4,13 +4,9 @@ import { StyleSheet, View, TouchableOpacity } from "react-native"; import { useTranslation } from "react-i18next"; import { Block, Emoticon, AppText, Textarea, AppButton } from "#components"; - -import { useAddMoodTrack } from "#hooks"; - +import { useAddMoodTrack, useGetTheme } from "#hooks"; import { showToast } from "#utils"; - import { appStyles } from "#styles"; - import { Context } from "#services"; /** @@ -21,6 +17,7 @@ import { Context } from "#services"; * @return {jsx} */ export const MoodTracker = ({ navigation }) => { + const { colors } = useGetTheme(); const { t, i18n } = useTranslation("mood-tracker"); const { isTmpUser, handleRegistrationModalOpen } = useContext(Context); const queryClient = useQueryClient(); @@ -77,7 +74,7 @@ export const MoodTracker = ({ navigation }) => { {emoticon.label} diff --git a/src/blocks/PlatformRating/PlatformRating.jsx b/src/blocks/PlatformRating/PlatformRating.jsx index c3e9463e..73fa3126 100644 --- a/src/blocks/PlatformRating/PlatformRating.jsx +++ b/src/blocks/PlatformRating/PlatformRating.jsx @@ -77,7 +77,7 @@ export const PlatformRating = ({ navigation }) => { handleChange("rating", value)} - style={[styles.marginTop32, styles.rating]} + style={[{ marginTop: 50 }, styles.rating]} />