diff --git a/App.js b/App.js index 9b96c3b..ffbc064 100644 --- a/App.js +++ b/App.js @@ -12,6 +12,7 @@ const App = () => { light : require("./assets/fonts/Farsi/Light.ttf"), regular: require("./assets/fonts/Farsi/Regular.ttf"), bold: require("./assets/fonts/Farsi/Medium.ttf"), + demi: require("./assets/fonts/Farsi/DemiBold.ttf"), }); if (!fontsLoaded) { diff --git a/eas.json b/eas.json new file mode 100644 index 0000000..fec19c7 --- /dev/null +++ b/eas.json @@ -0,0 +1,18 @@ +{ + "cli": { + "version": ">= 0.47.0" + }, + "build": { + "development": { + "developmentClient": true, + "distribution": "internal" + }, + "preview": { + "distribution": "internal" + }, + "production": {} + }, + "submit": { + "production": {} + } +} diff --git a/src/components/CustomTextInput.js b/src/components/CustomTextInput.js index 2bb1230..fb0c788 100644 --- a/src/components/CustomTextInput.js +++ b/src/components/CustomTextInput.js @@ -36,7 +36,7 @@ const FloatingLabelInput = ({ fontFamily: "regular", top: !isFocused ? "50%" : 1, fontSize: !isFocused ? fontSize.tiny : fontSize.sm, - transform: [{ translateY: -width / 35 }], + transform: [{ translateY: -fontSize.lg }], color: !isFocused ? Colors.theme1[colorScheme].gray2077 : Colors.theme1[colorScheme].green79, diff --git a/src/components/Drawer.js b/src/components/Drawer.js index 105ef03..91ccc34 100644 --- a/src/components/Drawer.js +++ b/src/components/Drawer.js @@ -48,13 +48,6 @@ const Drawer = ({ position, setBoxPosition, user = JSON.parse(user) }) => { toast: "", message: "", }, - { - name: "پروفایل", - route: "Profile", - icon: , - toast: "", - message: "", - }, { name: "واقعیت افزوده", route: "AR", @@ -69,13 +62,6 @@ const Drawer = ({ position, setBoxPosition, user = JSON.parse(user) }) => { toast: "", message: "", }, - { - name: "سبد خرید", - route: "ShoppingCart", - icon: , - toast: "", - message: "", - }, { name: "سوالات متداول", route: "Faq", diff --git a/src/components/Header.js b/src/components/Header.js index 5114599..fb6d1b4 100644 --- a/src/components/Header.js +++ b/src/components/Header.js @@ -26,7 +26,7 @@ export default function Header({ title, description, background }) { {description} diff --git a/src/components/Progress.js b/src/components/Progress.js index db99f19..47879b2 100644 --- a/src/components/Progress.js +++ b/src/components/Progress.js @@ -1,35 +1,41 @@ -import React, {useState, useEffect} from 'react'; -import {View, Appearance } from 'react-native'; -import tw from 'tailwind-rn'; +import React, { useState, useEffect } from "react"; +import { View, Appearance } from "react-native"; +import tw from "tailwind-rn"; import Colors from "../constants/Colors"; //Color -import Color from '../constants/Colors'; +import Color from "../constants/Colors"; -function Progress({percent, alignItems}) { +function Progress({ percent, alignItems }) { const colorScheme = Appearance.getColorScheme(); const [delayPercent, setDelayPercent] = useState(0); useEffect(() => { - setTimeout(() => { - setDelayPercent(() => percent); - }, 1000); + if (percent) { + setTimeout(() => { + setDelayPercent(() => percent); + }, 1000); + } }, [percent]); return ( + tw( + `w-full h-1.5 rounded-full overflow-hidden my-3 flex ${alignItems}` + ), + { backgroundColor: Colors.theme1[colorScheme].green79 + "22" }, + ]} + > + ]} + > ); } diff --git a/src/redux/reducers/public.js b/src/redux/reducers/public.js index 28aa9e8..6d103f9 100644 --- a/src/redux/reducers/public.js +++ b/src/redux/reducers/public.js @@ -5,6 +5,7 @@ const width = Dimensions.get("window").width; const initialState = { // isDark: (await AsyncStorage.getItem("isDark")) || false, + mobile : width < 720, homeData: [], newProducts: [], levels: [], diff --git a/src/screens/Activation/index.js b/src/screens/Activation/index.js index 28bb3e0..1b07d56 100644 --- a/src/screens/Activation/index.js +++ b/src/screens/Activation/index.js @@ -7,11 +7,12 @@ import { Platform, KeyboardAvoidingView, TouchableWithoutFeedback, - Appearance + Appearance, + SafeAreaView, } from "react-native"; import { connect } from "react-redux"; import Svg, { Image as Imagee } from "react-native-svg"; -import {activation} from "../../redux/actions"; +import { activation } from "../../redux/actions"; import TopHeader from "../../components/Header"; import Navbar from "../../components/Navbar"; @@ -26,94 +27,100 @@ import Colors from "../../constants/Colors"; //assets import bgQr from "./assets/bgQr.png"; -function Activation({add}) { +const ios = Platform.OS === "ios"; + +function Activation({ add, mobile }) { const colorScheme = Appearance.getColorScheme(); const [value, setValue] = useState(null); return ( - - - - - - - + + + + - - - + + + - + > + + + + + setValue(value)} + /> + add({ code: value })} + /> + + {}} + /> + - - setValue(value)} - /> - add({code : value})} - /> - - {}} - /> - - - - + + + ); } @@ -122,10 +129,11 @@ Activation.defaultProps = { }; const mapStateToProps = (state) => ({ + mobile : state.publicApi.mobile }); const mapDispatchToProps = { - add : activation.add, + add: activation.add, }; export default connect(mapStateToProps, mapDispatchToProps)(Activation); diff --git a/src/screens/Address/index.js b/src/screens/Address/index.js index a9e755d..a8cca2f 100644 --- a/src/screens/Address/index.js +++ b/src/screens/Address/index.js @@ -47,7 +47,7 @@ const Address = ({ setPhase, cityLoading, }) => { - const profilePage = route.params.type === "profile"; + const profilePage = route.params?.type === "profile"; const colorScheme = Appearance.getColorScheme(); const navigation = useNavigation(); const [addressFields, setAddressFields] = useState({}); diff --git a/src/screens/Blogs/layouts/Target.js b/src/screens/Blogs/layouts/Target.js index 5cb4de0..51bb8e8 100644 --- a/src/screens/Blogs/layouts/Target.js +++ b/src/screens/Blogs/layouts/Target.js @@ -152,7 +152,7 @@ const Target = ({ blogs }) => { return ( - + {blogs?.slice(1, 3).map((blog, index) => ( ))} diff --git a/src/screens/Contact/Box.js b/src/screens/Contact/Box.js index d83dcb1..e00e16f 100644 --- a/src/screens/Contact/Box.js +++ b/src/screens/Contact/Box.js @@ -1,8 +1,10 @@ -import { View, Text, Image, TouchableOpacity } from "react-native"; +import { View, Text, Image, TouchableOpacity, Platform } from "react-native"; import React from "react"; import tw from "tailwind-rn"; import fontSize from "../../constants/fontSize"; +const ios = Platform.OS === "ios"; + const Box = ({ info }) => { return ( { fontFamily: "bold", fontSize: fontSize.lg, color: info.title.color, + textAlign : ios ? "right" : "auto", }} > {info.title.text} @@ -33,6 +36,7 @@ const Box = ({ info }) => { fontFamily: "light", fontSize: fontSize.sm, color: info.description.color, + textAlign : ios ? "right" : "auto", }, ]} > @@ -40,9 +44,9 @@ const Box = ({ info }) => { { return ( navigation.navigate('Product')} > @@ -42,7 +42,10 @@ function Blogs({ blogs }) { source={{ uri: `https://dnvn.ir/api/v1/file/${blog.fileIds}` }} style={[ tw("rounded-md"), - { width: "100%", height: ((width / 1.5) * 9) / 16 }, + { + width: "100%", + height: ((mobile ? width / 1.5 : width / 2.2) * 9) / 16, + }, ]} /> @@ -65,7 +68,7 @@ function Blogs({ blogs }) { { color: Colors.theme1[colorScheme].gray20, fontFamily: "bold", - fontSize: fontSize.tiny, + fontSize: mobile ? fontSize.tiny : fontSize.lg, textAlign: ios ? "right" : "auto", }, ]} @@ -83,7 +86,7 @@ function Blogs({ blogs }) { { color: Colors.theme1[colorScheme].gray20, fontFamily: "regular", - fontSize: fontSize.sm, + fontSize: mobile ? fontSize.sm : fontSize.base, }, ]} > @@ -97,7 +100,7 @@ function Blogs({ blogs }) { { color: Colors.theme1[colorScheme].gray20, fontFamily: "regular", - fontSize: fontSize.sm, + fontSize: mobile ? fontSize.sm : fontSize.base, }, ]} > @@ -150,5 +153,6 @@ function Blogs({ blogs }) { const mapStateToProps = (state) => ({ // features: state.publicApi.home?.features, + mobile: state.publicApi.mobile, }); export default connect(mapStateToProps, {})(Blogs); diff --git a/src/screens/Home/components/Header.js b/src/screens/Home/components/Header.js index 750a443..843837d 100644 --- a/src/screens/Home/components/Header.js +++ b/src/screens/Home/components/Header.js @@ -2,23 +2,25 @@ import React from "react"; import { View, Text, Pressable, Appearance } from "react-native"; import { Entypo } from "@expo/vector-icons"; import { useNavigation } from "@react-navigation/native"; +import {connect} from 'react-redux'; + import fontSize from "../../../constants/fontSize"; import tw from "tailwind-rn"; //Color import Color from "../../../constants/Colors"; -const Header = ({ title, route }) => { +const Header = ({ title, route, mobile }) => { const colorScheme = Appearance.getColorScheme(); const navigation = useNavigation(); return ( - + @@ -33,4 +35,8 @@ const Header = ({ title, route }) => { ); }; -export default Header; +const mapStateToProps = (state) => ({ + mobile : state.publicApi.mobile +}) + +export default connect(mapStateToProps)(Header); diff --git a/src/screens/Home/components/Scroll.js b/src/screens/Home/components/Scroll.js index fa6ad95..45bc8ee 100644 --- a/src/screens/Home/components/Scroll.js +++ b/src/screens/Home/components/Scroll.js @@ -5,15 +5,17 @@ import { TouchableOpacity, FlatList, Platform, + Dimensions } from "react-native"; import { useNavigation } from "@react-navigation/native"; import tw from "tailwind-rn"; const ios = Platform.OS === "ios"; +const {height} = Dimensions.get("window"); import { connect } from "react-redux"; -function Scroll({ books }) { +function Scroll({ books, mobile }) { const Box = ({ books }) => { const Product = ({ book, position }) => { const navigation = useNavigation(); @@ -25,8 +27,8 @@ function Scroll({ books }) { style={[ tw("rounded-md mx-1 overflow-hidden rounded-md"), { - width: position === 0 ? 163 : 79, - height: position === 0 ? 245 : 118, + width: position === 0 ? mobile ? 163 : 240 : mobile ? 79 : 125, + height: position === 0 ? mobile ? 245 : 350 : mobile ? 118 : 170, }, ]} onPress={() => @@ -48,7 +50,7 @@ function Scroll({ books }) { ios ? "flex-wrap" : "flex-wrap-reverse" }` ), - { height: 245, direction: "rtl" }, + { height: mobile ? 245 : 350, direction: "rtl" }, ]} > {books.map((book, index) => ( @@ -72,6 +74,8 @@ function Scroll({ books }) { ); } -const mapStateToProps = (state) => ({}); +const mapStateToProps = (state) => ({ + mobile : state.publicApi.mobile +}); export default connect(mapStateToProps, {})(Scroll); diff --git a/src/screens/Home/components/Videos.js b/src/screens/Home/components/Videos.js index 3d1e916..63ade89 100644 --- a/src/screens/Home/components/Videos.js +++ b/src/screens/Home/components/Videos.js @@ -21,13 +21,13 @@ import fontSize from "../../../constants/fontSize"; const ios = Platform.OS === "ios"; -function Videos({ videos, grades }) { +function Videos({ videos, grades, mobile }) { const colorScheme = Appearance.getColorScheme(); const Video = ({ video }) => { const navigation = useNavigation(); return ( navigation.navigate("Video", { id: video.id })} > @@ -46,12 +46,12 @@ function Videos({ videos, grades }) { { color: Colors.theme1[colorScheme].gray20, fontFamily: "bold", - fontSize: fontSize.base, + fontSize: mobile ? fontSize.base : fontSize.xl, textAlign: ios ? "right" : "auto", }, ]} > - {video.name} + {'دوره ویدئویی' + ' ' + video.name} ({ grades: state.publicApi.grades, + mobile : state.publicApi.mobile }); export default connect(mapStateToProps, {})(Videos); diff --git a/src/screens/Home/index.js b/src/screens/Home/index.js index bafbd51..a7d2785 100644 --- a/src/screens/Home/index.js +++ b/src/screens/Home/index.js @@ -32,7 +32,9 @@ const Home = ({ getBooks, userProducts, getUserProducts, + mobile, }) => { + const [width, setWidth] = useState(Dimensions.get("window").width); const [position, setPosition] = useState("100%"); useEffect(() => { @@ -69,15 +71,17 @@ const Home = ({ setWidth(Dimensions.get("window").width)} > - {userProduct?.length > 0 && } + {!mobile && } + {userProduct?.length > 0 && }
- {books?.length > 0 && } - {books?.length > 0 && } - {/* {blogs?.length > 0 && } */} + {books?.length > 0 && } + {books?.length > 0 && } + {blogs?.length > 0 && } ); @@ -90,7 +94,6 @@ const styles = StyleSheet.create({ // alignItems: "", }, container: { - width: Dimensions.get("window").width, backgroundColor: "white", flexDirection: "column", paddingVertical: 0, @@ -102,6 +105,7 @@ const mapStateToProps = (state) => ({ blogs: state.blog.list, books: state.book.list, userProducts: state.userProduct.list, + mobile: state.publicApi.isMobile, }); const mapDispatchToProps = { diff --git a/src/screens/Login/index.js b/src/screens/Login/index.js index c4af650..ce4e7da 100644 --- a/src/screens/Login/index.js +++ b/src/screens/Login/index.js @@ -56,88 +56,112 @@ function Login(props) { {/* */} - + + {"سلام"} + + + {"خوش برگشتی!"} + + + - - {"سلام"} - - - {"خوش برگشتی!"} - - - - - submit()} - > - {loading ? ( - - ) : ( - - {"ادامه"} - - )} - + + { + !props.mobile && + } + submit()} + > + {loading ? ( + + ) : ( + + {"ادامه"} + + )} + {/* */} ); } -const mapStateToProps = (state) => ({}); +const mapStateToProps = (state) => ({ + mobile: state.publicApi.mobile, +}); const mapDispatchToProps = { sendPhoneNumber: user.otp, diff --git a/src/screens/Otp/index.js b/src/screens/Otp/index.js index df2d6e3..2c1d54d 100644 --- a/src/screens/Otp/index.js +++ b/src/screens/Otp/index.js @@ -132,11 +132,11 @@ function Otp(props) { /> {`یک کد تائیدیه به شماره ${props.route.params?.phone} ارسال شد. آن را در قسمت زیر وارد کنید`} @@ -152,7 +152,7 @@ function Otp(props) { fontSize: fontSize.xl3, fontFamily: "bold", color: Colors.theme1[colorScheme].green79, - // width : ios ? fontSize.xl3 + 40 : "" + width : ios ? fontSize.xl3 + 40 : "" }, ]} underlineColorAndroid={"transparent"} @@ -170,7 +170,7 @@ function Otp(props) { fontSize: fontSize.xl3, fontFamily: "bold", color: Colors.theme1[colorScheme].green79, - // width : ios ? fontSize.xl3 + 40 : "" + width : ios ? fontSize.xl3 + 40 : "" }, ]} underlineColorAndroid={"transparent"} @@ -188,7 +188,7 @@ function Otp(props) { fontSize: fontSize.xl3, fontFamily: "bold", color: Colors.theme1[colorScheme].green79, - // width : ios ? fontSize.xl3 + 40 : "" + width : ios ? fontSize.xl3 + 40 : "" }, ]} underlineColorAndroid={"transparent"} @@ -206,7 +206,7 @@ function Otp(props) { fontSize: fontSize.xl3, fontFamily: "bold", color: Colors.theme1[colorScheme].green79, - // width : ios ? fontSize.xl3 + 40 : "" + width : ios ? fontSize.xl3 + 40 : "" }, ]} underlineColorAndroid={"transparent"} @@ -221,7 +221,7 @@ function Otp(props) { {"زمان باقی مانده تا انقضای کد: " + time} @@ -275,6 +275,7 @@ function Otp(props) { const mapStateToProps = (state) => ({ isLogin: state.user.status, + mobile : state.publicApi.mobile }); const mapDispatchToProps = { diff --git a/src/screens/Profile/components/User.js b/src/screens/Profile/components/User.js index 5185d4f..7cec771 100644 --- a/src/screens/Profile/components/User.js +++ b/src/screens/Profile/components/User.js @@ -1,4 +1,11 @@ -import { View, Text, Image, Appearance, Platform, Pressable } from "react-native"; +import { + View, + Text, + Image, + Appearance, + Platform, + Pressable, +} from "react-native"; import React from "react"; import { connect } from "react-redux"; import Svg, { Path } from "react-native-svg"; @@ -21,30 +28,26 @@ const User = ({ user }) => { )} onPress={() => setDropdown(!dropdown)} > - - {user?.picFileId ? ( + + {user?.picFileIds ? ( ) : ( )} - + {user?.firstName + " " + user?.lastName} @@ -54,6 +57,7 @@ const User = ({ user }) => { fontSize: fontSize.tiny, color: Colors.theme1[colorScheme].gray20, fontFamily: "light", + marginTop: 3, }} > {user?.cellphone} @@ -79,25 +83,28 @@ const User = ({ user }) => { > - {user?.picFileId ? ( + {user?.picFileIds ? ( ) : ( )} @@ -105,7 +112,8 @@ const User = ({ user }) => { style={{ fontSize: fontSize.base, color: Colors.theme1[colorScheme].gray20, - fontFamily: "regular", + fontFamily: "bold", + marginRight: 5, }} > {user?.firstName + " " + user?.lastName} @@ -113,9 +121,7 @@ const User = ({ user }) => {