delete 3 files and update 18 files

master
Reza_ashrafi 2 years ago
parent e4c74efad6
commit 0145002b2a
  1. 24
      bottomNavigation.json
  2. 10
      filters.json
  3. 24
      navigation/bottomNavigation.js
  4. 38
      navigation/index.js
  5. 6
      src/redux/actions/config.js
  6. 2
      src/redux/reducers/blog.js
  7. 15
      src/redux/reducers/book.js
  8. 7
      src/redux/reducers/config.js
  9. 13
      src/redux/reducers/userProduct.js
  10. 2
      src/redux/store.js
  11. 4
      src/screens/Blogs/index.js
  12. 8
      src/screens/Home/components/Scroll.js
  13. 10
      src/screens/Home/components/Videos.js
  14. 18
      src/screens/Home/index.js
  15. 2
      src/screens/OrderDetails/index.js
  16. 2
      src/screens/Product/components/Book.js
  17. 380
      src/screens/Products/components/Main.js
  18. 13
      src/screens/Products/index.js
  19. 69
      src/screens/Splash/index.js
  20. 2
      src/screens/Videos/components/MostViewedVideo.js

@ -1,24 +0,0 @@
{
"bottomNavigationList": {
"home": {
"label": "خانه",
"isActive": true
},
"products": {
"label": "کتابها",
"isActive": true
},
"vod": {
"label": "ویدئوها",
"isActive": true
},
"cart": {
"label": "سبد خرید",
"isActive": true
},
"profile": {
"label": "پروفایل",
"isActive": true
}
}
}

@ -1,10 +0,0 @@
{
"sort": ["مرتب سازی", "مرتب سازی", "محبوب ترین", "جدیدترین"],
"productTypes" : [
"نوع محصول",
"کتاب فیزیکی",
"کتاب دیجیتال",
"دوره ویدئویی",
"بسته های آموزشی"
]
}

@ -1,24 +0,0 @@
const bottomNavigationList = {
home: {
label: "خانه",
isActive: true,
},
products: {
label: "کتابها",
isActive: true,
},
vod: {
label: "ویدئوها",
isActive: true,
},
cart: {
label: "سبد خرید",
isActive: true,
},
profile: {
label: "پروفایل",
isActive: true,
},
};
export default bottomNavigationList;

@ -3,14 +3,13 @@ import { Restart } from "fiction-expo-restart";
import { I18nManager, StatusBar, Dimensions } from "react-native";
import * as Linking from "expo-linking";
import Svg, { G, Path } from "react-native-svg";
import {asyncAwesomeAlert} from "../src/utils/AsyncWrappers";
import { asyncAwesomeAlert } from "../src/utils/AsyncWrappers";
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { connect } from "react-redux";
import { user, publicApi } from "../src/redux/actions";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import bottomNavigationList from "./bottomNavigation";
//components
import OrderDetails from "../src/screens/OrderDetails";
@ -53,7 +52,7 @@ import Colors from "../src/constants/Colors";
import fontSize from "../src/constants/fontSize";
const Tab = createBottomTabNavigator();
const BottomTabNavigator = ({ theme, userProducts }) => {
const BottomTabNavigator = ({ theme, userProducts, bottomNavigation }) => {
const insets = useSafeAreaInsets();
const [headerShown, setHeaderShown] = React.useState(true);
React.useEffect(() => {
@ -95,12 +94,12 @@ const BottomTabNavigator = ({ theme, userProducts }) => {
tabBarShowLabel: true,
}}
>
{bottomNavigationList.home.isActive ? (
{bottomNavigation.home.isActive ? (
<Tab.Screen
name="HomeTab"
children={() => <HomeStackScreen theme={theme} />}
options={{
title: bottomNavigationList.home.label,
title: bottomNavigation.home.label,
tabBarIcon: ({ focused, color }) =>
focused ? (
<Svg
@ -166,12 +165,12 @@ const BottomTabNavigator = ({ theme, userProducts }) => {
/>
) : null}
{bottomNavigationList.products.isActive ? (
{bottomNavigation.products.isActive ? (
<Tab.Screen
name="ProductsTab"
children={() => <ProductsStackScreen theme={theme} />}
options={{
title: bottomNavigationList.products.label,
title: bottomNavigation.products.label,
tabBarIcon: ({ focused, color }) =>
focused ? (
<Svg
@ -229,14 +228,14 @@ const BottomTabNavigator = ({ theme, userProducts }) => {
/>
) : null}
{bottomNavigationList.vod.isActive ? (
{bottomNavigation.vod.isActive ? (
<Tab.Screen
name="VODTab"
children={() => <VODStackScreen theme={theme} />}
options={{
unmountOnExit: true,
unmountOnBlur: true,
title: bottomNavigationList.vod.label,
title: bottomNavigation.vod.label,
tabBarIcon: ({ focused, color }) =>
focused ? (
<Svg
@ -316,14 +315,14 @@ const BottomTabNavigator = ({ theme, userProducts }) => {
/>
) : null}
{bottomNavigationList.cart.isActive ? (
{bottomNavigation.cart.isActive ? (
<Tab.Screen
name="ShoppingCartTab"
children={() => <CARTStackScreen theme={theme} />}
options={{
tabBarBadge: userProducts.filter((product) => product.condition < 2)
tabBarBadge: userProducts?.filter((product) => product?.condition < 2)
.length
? userProducts.filter((product) => product.condition < 2).length
? userProducts?.filter((product) => product?.condition < 2)?.length
: null,
tabBarBadgeStyle: {
color: "white",
@ -340,7 +339,7 @@ const BottomTabNavigator = ({ theme, userProducts }) => {
theme === "light" ? Colors.theme1.greenCF : Colors.theme1.dark,
fontFamily: "bold",
},
title: bottomNavigationList.cart.label,
title: bottomNavigation.cart.label,
tabBarIcon: ({ focused, color }) =>
focused ? (
<Svg
@ -401,12 +400,12 @@ const BottomTabNavigator = ({ theme, userProducts }) => {
/>
) : null}
{bottomNavigationList.profile.isActive ? (
{bottomNavigation.profile.isActive ? (
<Tab.Screen
name="ProfileTab"
children={() => <PROFILEStackScreen theme={theme} />}
options={{
title: bottomNavigationList.profile.label,
title: bottomNavigation.profile.label,
tabBarIcon: ({ focused, color }) =>
focused ? (
<Svg
@ -589,6 +588,7 @@ const Navigation = ({
setLTR,
theme,
setOrientation,
bottomNavigation,
}) => {
const linking = {
prefixes: [prefix],
@ -611,7 +611,6 @@ const Navigation = ({
);
}, []);
Dimensions.addEventListener("change", () => {
const dim = Dimensions.get("window");
setOrientation(dim.height > dim.width ? "portrait" : "landscape");
@ -636,7 +635,11 @@ const Navigation = ({
<Stack.Screen
name="Root"
children={() => (
<BottomTabNavigator theme={theme} userProducts={userProducts} />
<BottomTabNavigator
theme={theme}
userProducts={userProducts}
bottomNavigation={bottomNavigation}
/>
)}
/>
<Stack.Screen name="QR" component={QR} />
@ -662,6 +665,7 @@ const mapStateToProps = (state) => ({
userProducts: state.userProduct.list,
theme: state.publicApi.theme,
ltr: state.publicApi.ltr,
bottomNavigation: state.config.bottomNavigation,
});
const mapDispatchToProps = {
getStatus: user.getStatus,

@ -4,7 +4,11 @@ const config = {
getBottomNavigation:
(data = {}) =>
async (dispatch) =>
await proxy.get("config/bottomNavigations", data, { dispatch }),
await proxy.get("config/bottomNavigationList", data, { dispatch }),
getFilters:
(data = {}) =>
async (dispatch) =>
await proxy.get("config/filters", data, { dispatch }),
};
export default config;

@ -1,7 +1,7 @@
const initialState = {
loading: false,
error: null,
list: [],
list: null,
info: null,
hashtags : [],
hashtag : null,

@ -1,9 +1,9 @@
import {asyncAwesomeAlert} from '../../utils/AsyncWrappers';
import { asyncAwesomeAlert } from "../../utils/AsyncWrappers";
const initialState = {
loading: false,
error: null,
list: [],
list: null,
info: null,
searchResult: [],
filterResult: [],
@ -18,7 +18,7 @@ const initialState = {
filterOptions: {
grade: "",
subject: "",
productType: '',
productType: "",
available: false,
sort: null,
search: "",
@ -51,6 +51,13 @@ const grades = [
export default function book(state = initialState, action) {
let { type, data } = action;
switch (type) {
case "config/filters":
return {
...state,
error: false,
loading: false,
productTypes: ["نوع محصول", ...data.productTypes],
};
case "book/list":
let itemsSubject = (Array.isArray(data) ? data : []).map(
(item, index) => item.name
@ -87,7 +94,7 @@ export default function book(state = initialState, action) {
case "book/error":
asyncAwesomeAlert("خطا", data.message, {
showCancelButton: false,
confirmText: "باشه"
confirmText: "باشه",
});
return { ...state, loading: false, error: data.message };
default:

@ -1,18 +1,17 @@
const initialState = {
loading: false,
error: null,
bottomNavigations: null,
bottomNavigation: null,
};
export default function config(state = initialState, action) {
let { type, data } = action;
switch (type) {
case "config/bottomNavigations":
console.log(data);
case "config/bottomNavigationList":
return {
...state,
loading: false,
bottomNavigations: data,
bottomNavigation: data.bottomNavigationList,
error: null,
};
case "config/loading":

@ -3,7 +3,7 @@ import { asyncAwesomeAlert } from "../../utils/AsyncWrappers";
const initialState = {
loading: false,
error: null,
list: [],
list: null,
myList: [],
info: null,
sum: null,
@ -19,20 +19,13 @@ export default function userFactor(state = initialState, action) {
case "userProduct/myList":
return { ...state, loading: false, myList: data, error: null };
case "userProduct/list":
const checkEmpty = data.filter(
(item) => item.condition === 2 && item.product.productType === (1 || 3)
);
const hasPhysical =
data.filter((item) => item.product.productType === 2).length > 0
? true
: false;
return {
...state,
loading: false,
list: data,
checkEmpty: checkEmpty.length > 0 ? false : true,
// checkEmpty: checkEmpty.length > 0 ? false : true,
error: null,
hasPhysical: hasPhysical,
// hasPhysical: hasPhysical,
};
case "userProduct/info":
return { ...state, loading: false, info: data, error: null };

@ -19,6 +19,7 @@ import comment from "./reducers/comment";
import form from "./reducers/form";
import userFavorite from "./reducers/userFavorite";
import vote from "./reducers/vote";
import config from "./reducers/config";
const persistConfig = {
key: "root",
@ -50,6 +51,7 @@ const persistedReducer = persistReducer(
form,
userFavorite,
vote,
config
})
);

@ -97,7 +97,7 @@ function Blogs({ getList, blogs, hashtag, setHashtag, theme }) {
horizontal={true}
inverted={true}
style={[tw("flex flex-row mt-3 pb-3")]}
data={blogs.slice(0, 7)}
data={blogs?.slice(0, 7)}
renderItem={({ item }) => <New blog={item} />}
keyExtractor={(item) => item?.id}
/>
@ -107,7 +107,7 @@ function Blogs({ getList, blogs, hashtag, setHashtag, theme }) {
horizontal={true}
inverted={true}
style={[tw("flex flex-row mt-3 pb-3")]}
data={blogs.slice(0, 7)}
data={blogs?.slice(0, 7)}
renderItem={({ item }) => <New blog={item} />}
keyExtractor={(item) => item?.id}
/>

@ -6,6 +6,7 @@ import tw from "tailwind-rn";
const ios = Platform.OS === "ios";
import { connect } from "react-redux";
import Tab from "../../QRContent/Tab";
function Scroll({ books, mobile }) {
const Box = ({ books }) => {
@ -14,7 +15,10 @@ function Scroll({ books, mobile }) {
return (
<Pressable
onPress={() =>
navigation.navigate("Product", { id: book?.id, type: "book" })
navigation.push("Product", {
id: book?.id,
type: "book",
})
}
style={[
tw("mr-1 overflow-hidden"),
@ -43,7 +47,7 @@ function Scroll({ books, mobile }) {
{ height: mobile ? 242 : 350, direction: "rtl" },
]}
>
{books.slice(0, 14)?.map((book, index) => (
{books?.slice(0, 14)?.map((book, index) => (
<Product book={book} position={Number(index)} key={index} />
))}
</View>

@ -24,7 +24,7 @@ function Videos({ videos, grades, mobile, theme }) {
</View>
<FlatList
showsHorizontalScrollIndicator={false}
style={[tw("py-3")]}
style={[tw("py-3 px-4")]}
horizontal={true}
inverted={true}
data={videos?.slice(0, 7)}
@ -51,7 +51,7 @@ const Video = ({ video, mobile, grades, theme }) => {
<Pressable
style={[
tw(`flex relative ${mobile ? "mr-4" : "ml-5"}`),
{ width: mobile ? 200 : 200, height: mobile ? 210 : 210 },
{ width: mobile ? 200 : 260, height: mobile ? 210 : 250 },
]}
onPress={() => navigation.navigate("Video", { id: video?.id })}
>
@ -61,7 +61,7 @@ const Video = ({ video, mobile, grades, theme }) => {
style={[
tw("bg-gray-100"),
{
height: mobile ? 130 : 130,
height: mobile ? 130 : 170,
},
]}
/>
@ -72,7 +72,7 @@ const Video = ({ video, mobile, grades, theme }) => {
color:
theme === "light" ? Colors.theme1.gray20 : Colors.theme1.white,
fontFamily: "bold",
fontSize: mobile ? fontSize.sm : fontSize.xl,
fontSize: mobile ? fontSize.sm : fontSize.tiny,
textAlign: ios ? "right" : "auto",
},
]}
@ -86,7 +86,7 @@ const Video = ({ video, mobile, grades, theme }) => {
color:
theme === "light" ? Colors.theme1.gray20 : Colors.theme1.white,
fontFamily: "regular",
fontSize: mobile ? fontSize.xs : fontSize.base,
fontSize: mobile ? fontSize.xs : fontSize.sm,
textAlign: ios ? "right" : "auto",
},
]}

@ -1,7 +1,7 @@
import React, { useState } from "react";
import { connect } from "react-redux";
import { blog, book, userProduct } from "../../redux/actions";
import {useNavigation} from "@react-navigation/native";
import { blog, book, user, userProduct } from "../../redux/actions";
import { useNavigation } from "@react-navigation/native";
import {
View,
@ -37,6 +37,7 @@ const Home = ({
getBlogs,
getBooks,
getUserProducts,
bottomNavigation,
}) => {
const navigation = useNavigation();
const [position, setPosition] = useState("100%");
@ -47,15 +48,15 @@ const Home = ({
};
React.useEffect(() => {
if (blogs?.length === 0) {
if (!blogs) {
getBlogs();
} else if (books?.length === 0) {
} else if (!books) {
getBooks({ vod: true });
} else if (userProducts?.length === 0) {
} else if (!userProducts) {
getUserProducts();
}
}, [books, userProducts, blogs]);
}, []);
return (
<SafeAreaView style={styles.safeStyle}>
<Navbar
@ -84,7 +85,7 @@ const Home = ({
) : null}
<Scroll books={books} />
{/* <Videos videos={books} /> */}
{bottomNavigation.vod.isActive ? <Videos videos={books} /> : null}
<Blogs blogs={blogs} />
</ScrollView>
</SafeAreaView>
@ -114,6 +115,7 @@ const mapStateToProps = (state) => ({
books: state.book.list,
userProducts: state.userProduct.list,
mobile: state.publicApi.isMobile,
bottomNavigation: state.config.bottomNavigation,
});
const mapDispatchToProps = {

@ -284,7 +284,7 @@ function OrderDetails({ mobile, route, theme }) {
</Text>
</View>
<View style={tw("w-full flex items-end")}>
{order?.userProducts.map((item, index) => (
{order?.userProducts?.map((item, index) => (
<Book book={item} key={index} />
))}
</View>

@ -278,7 +278,7 @@ function Book({
? Colors.theme1.green79
: Colors.theme1.white,
fontSize: mobile ? fontSize.tiny : fontSize.lg,
fontSize: mobile ? fontSize.tiny : fontSize.base,
fontFamily: "demi",
},
]}

@ -68,198 +68,200 @@ const Main = ({ books, filterOptions, grades, mobile, theme, orientation }) => {
bySearchFilter = byAvailableFilter;
}
return filterOptions?.productType === "دوره ویدئویی"
return filterOptions?.productType === "محصولات ویدیویی"
? bySearchFilter?.map((product, index) => (
// <Pressable
// style={[
// {
// width: mobile ? "auto" : width / 2.2,
// borderWidth: 1,
// borderColor:
// Colors.theme1.grayE3 + (theme === "light" ? "" : "55"),
// },
// tw(`flex mb-5 p-2 rounded-md ${mobile ? "w-full" : ""}`),
// ]}
// key={index}
// onPress={() => navigation.navigate("Video", { id: product.id })}
// >
// <View style={[tw("relative w-full mb-1")]}>
// <Image
// source={{
// uri: `https://dnvn.ir/api/v1/file/${product?.fileIds}`,
// }}
// style={[
// tw("w-full rounded-sm"),
// { height: ((mobile ? width - 25 : width / 2.2) * 9) / 16 },
// ]}
// />
// </View>
<Pressable
style={[
{
width: mobile ? "auto" : width / 2.2,
borderWidth: 1,
borderColor:
Colors.theme1.grayE3 + (theme === "light" ? "" : "55"),
},
tw(`flex mb-5 p-2 rounded-md ${mobile ? "w-full" : ""}`),
]}
key={index}
onPress={() => navigation.navigate("Video", { id: product.id })}
>
<View style={[tw("relative w-full mb-1")]}>
<Image
source={{
uri: `https://dnvn.ir/api/v1/file/${product?.fileIds}`,
}}
style={[
tw("w-full rounded-sm"),
{ height: ((mobile ? width - 25 : width / 2.2) * 9) / 16 },
]}
/>
</View>
// <Text
// style={[
// tw("mb-1"),
// {
// fontFamily: "bold",
// fontSize: fontSize.lg,
// color:
// theme === "light"
// ? Colors.theme1.gray20
// : Colors.theme1.white,
// textAlign: ios ? "right" : "auto",
// },
// ]}
// >
// {"دوره ویدئویی" + " " + product?.name}
// </Text>
// <Text
// style={[
// tw("mb-4"),
// {
// fontSize: fontSize.tiny,
// fontFamily: "regular",
// color: Colors.theme1.greenBA,
// textAlign: ios ? "right" : "auto",
// },
// ]}
// >
// {"پایه" + " " + grades[product?.gradeId]}
// </Text>
// <Text
// style={[
// tw("w-full flex flex-row text-left"),
// {
// fontSize: fontSize.xl,
// fontFamily: "bold",
// color:
// theme === "light"
// ? Colors.theme1.gray20
// : Colors.theme1.white,
// },
// ]}
// >
// {separate(
// product?.product?.filter(
// (product) => product?.productType === 4
// )[0].price
// )}{" "}
// <Text style={{ fontSize: fontSize.sm }}>تومان</Text>
// </Text>
// </Pressable>
<></>
<Text
style={[
tw("mb-1"),
{
fontFamily: "bold",
fontSize: mobile ? fontSize.lg : fontSize.base,
color:
theme === "light"
? Colors.theme1.gray20
: Colors.theme1.white,
textAlign: ios ? "right" : "auto",
},
]}
>
{"دوره ویدئویی" + " " + product?.name}
</Text>
<Text
style={[
tw("mb-4"),
{
fontSize: mobile ? fontSize.tiny : fontSize.sm,
fontFamily: "regular",
color: Colors.theme1.greenBA,
textAlign: ios ? "right" : "auto",
},
]}
>
{"پایه" + " " + grades[product?.gradeId]}
</Text>
<Text
style={[
tw("w-full flex flex-row text-left"),
{
fontSize: mobile ? fontSize.xl : fontSize.lg,
fontFamily: "bold",
color:
theme === "light"
? Colors.theme1.gray20
: Colors.theme1.white,
},
]}
>
{separate(
product?.product?.filter(
(product) => product?.productType === 4
)[0].price
)}{" "}
<Text style={{ fontSize: fontSize.sm }}>تومان</Text>
</Text>
</Pressable>
))
: bySearchFilter?.map((product, index) => (
<React.Fragment key={index}>
{(
productType
? productType === ("کتاب دیجیتال" || "همه محصولات")
? productType === ("محصولات دیجیتال" || "همه محصولات")
: true
) ? (
// <Pressable
// key={product?.product[0]?.id}
// style={[
// {
// width: mobile ? width / 2 - 25 : width / 3.2,
// marginBottom: 15,
// borderWidth: 1,
// borderColor:
// Colors.theme1.grayE3 + (theme === "light" ? "" : "55"),
// },
// tw("flex justify-between px-2 pt-2 rounded-md"),
// ]}
// onPress={() =>
// navigation.navigate("Product", {
// id: product?.id,
// type: "book",
// })
// }
// >
// <View style={tw("w-full flex")}>
// <Image
// resizeMode="contain"
// source={{
// uri: `https://dnvn.ir/api/v1/file/${product?.fileIds}`,
// }}
// style={[
// tw("rounded-sm"),
// {
// flex: 1,
// height: mobile
// ? ((width / 2 - 25) * 4) / 2.9
// : ((width / 3.2) * 16) / 14,
// },
// ]}
// />
// <Text
// style={{
// fontSize: fontSize.base,
// marginTop: 5,
// fontFamily: "bold",
// width: "100%",
// textAlign: ios ? "right" : "auto",
// color:
// theme === "light"
// ? Colors.theme1.gray20
// : Colors.theme1.white,
// }}
// >
// {"کتاب دیجیتال" + " " + product?.name}
// </Text>
// <Text
// style={{
// color: Colors.theme1.greenBA,
// fontSize: fontSize.tiny,
// marginTop: 5,
// fontFamily: "regular",
// width: "100%",
// textAlign: ios ? "right" : "auto",
// }}
// >
// {"پایه" + " " + grades[product?.gradeId]}
// </Text>
// </View>
// <View
// style={tw(
// "flex flex-row-reverse items-center justify-center pb-1 pt-2"
// )}
// >
// <Text
// style={[
// tw("text-center ml-1"),
// {
// color:
// theme === "light"
// ? Colors.theme1.gray20
// : Colors.theme1.white,
// fontFamily: "bold",
// fontSize: fontSize.xl2,
// },
// ]}
// >
// {separate(
// product?.product?.filter(
// (product) => product?.productType === 1
// )[0]?.price
// )}
// </Text>
// <Text
// style={{
// fontSize: fontSize.sm,
// color:
// theme === "light"
// ? Colors.theme1.gray20
// : Colors.theme1.white,
// fontFamily: "regular",
// }}
// >
// تومان
// </Text>
// </View>
// </Pressable>
<></>
<Pressable
key={product?.product[0]?.id}
style={[
{
width: mobile
? width / 2 - 25
: orientation === "portrait"
? width / 4.2
: width / 5.2,
marginBottom: 15,
borderWidth: 1,
borderColor:
Colors.theme1.grayE3 + (theme === "light" ? "" : "55"),
},
tw("flex justify-between px-2 pt-2 rounded-md"),
]}
onPress={() =>
navigation.navigate("Product", {
id: product?.id,
type: "book",
})
}
>
<View style={tw("w-full flex")}>
<Image
resizeMode="contain"
source={{
uri: `https://dnvn.ir/api/v1/file/${product?.fileIds}`,
}}
style={[
tw("rounded-sm"),
{
flex: 1,
height: mobile
? ((width / 2 - 25) * 4) / 2.9
: ((width / 3.2) * 16) / 16,
},
]}
/>
<Text
style={{
fontSize: mobile ? fontSize.base : fontSize.tiny,
marginTop: 5,
fontFamily: "bold",
width: "100%",
textAlign: ios ? "right" : "auto",
color:
theme === "light"
? Colors.theme1.gray20
: Colors.theme1.white,
}}
>
{"کتاب دیجیتال" + " " + product?.name}
</Text>
<Text
style={{
color: Colors.theme1.greenBA,
fontSize: mobile ? fontSize.tiny : fontSize.sm,
marginTop: 5,
fontFamily: "regular",
width: "100%",
textAlign: ios ? "right" : "auto",
}}
>
{"پایه" + " " + grades[product?.gradeId]}
</Text>
</View>
<View
style={tw(
"flex flex-row-reverse items-center justify-center pb-1 mt-3"
)}
>
<Text
style={[
tw("text-center ml-1"),
{
color:
theme === "light"
? Colors.theme1.gray20
: Colors.theme1.white,
fontFamily: "bold",
fontSize: mobile ? fontSize.xl2 : fontSize.lg,
},
]}
>
{separate(
product?.product?.filter(
(product) => product?.productType === 1
)[0]?.price
)}
</Text>
<Text
style={{
fontSize: fontSize.sm,
color:
theme === "light"
? Colors.theme1.gray20
: Colors.theme1.white,
fontFamily: "regular",
}}
>
تومان
</Text>
</View>
</Pressable>
) : null}
{(
productType
? productType === ("کتاب فیزیکی" || "همه محصولات")
? productType === ("محصولات فیزیکی" || "همه محصولات")
: true
) ? (
<Pressable
@ -297,15 +299,13 @@ const Main = ({ books, filterOptions, grades, mobile, theme, orientation }) => {
flex: 1,
height: mobile
? ((width / 2 - 25) * 4) / 2.9
: orientation === "portrait"
? ((width / 4.2) * 16) / 11
: ((width / 5.2) * 16) / 11,
: ((width / 3.2) * 16) / 16,
},
]}
/>
<Text
style={{
fontSize: fontSize.base,
fontSize: mobile ? fontSize.base : fontSize.tiny,
marginTop: 5,
color:
theme === "light"
@ -321,7 +321,7 @@ const Main = ({ books, filterOptions, grades, mobile, theme, orientation }) => {
<Text
style={{
color: Colors.theme1.greenBA,
fontSize: fontSize.tiny,
fontSize: mobile ? fontSize.tiny : fontSize.sm,
marginTop: 5,
fontFamily: "regular",
width: "100%",
@ -333,7 +333,7 @@ const Main = ({ books, filterOptions, grades, mobile, theme, orientation }) => {
</View>
<View
style={tw(
"flex flex-row-reverse items-center justify-center pb-1"
"flex flex-row-reverse items-center justify-center pb-1 mt-2"
)}
>
<Text
@ -345,7 +345,7 @@ const Main = ({ books, filterOptions, grades, mobile, theme, orientation }) => {
? Colors.theme1.gray20
: Colors.theme1.white,
fontFamily: "bold",
fontSize: fontSize.xl2,
fontSize: mobile ? fontSize.xl2 : fontSize.lg,
},
]}
>
@ -381,9 +381,9 @@ const Main = ({ books, filterOptions, grades, mobile, theme, orientation }) => {
),
]}
>
{/* {filterOptions?.productType === "دوره ویدئویی" ? Items(2) : null} */}
{/* {filterOptions?.productType === "کتاب دیجیتال" ? Items(0) : null} */}
{filterOptions?.productType === "کتاب فیزیکی" ? Items(1) : null}
{filterOptions?.productType === "محصولات ویدیویی" ? Items(2) : null}
{filterOptions?.productType === "محصولات دیجیتال" ? Items(0) : null}
{filterOptions?.productType === "محصولات فیزیکی" ? Items(1) : null}
{!filterOptions?.productType ? Items(0) : null}
{/* {filterLoading && (
<View style="w-full h-screen flex justify-center items-center bg-white bg-opacity-20 backdrop-filter backdrop-blur-xl fixed left-0 top-0">

@ -9,7 +9,7 @@ import {
LayoutAnimation,
} from "react-native";
import { connect } from "react-redux";
import { book } from "../../redux/actions";
import { book, config } from "../../redux/actions";
//components
import Drawer from "../../components/Drawer";
@ -29,10 +29,12 @@ function Products({
route,
setFilterOptions,
filterOptions,
getFilters
}) {
const [position, setPosition] = useState("100%");
useEffect(() => {
getFilters();
getBooks({ vod: true });
}, []);
@ -43,7 +45,7 @@ function Products({
useEffect(() => {
if (route?.params?.productType === "دوره ویدئویی") {
setFilterOptions({ ...filterOptions, productType: "دوره ویدئویی" });
setFilterOptions({ ...filterOptions, productType: "محصولات ویدیویی" });
}
}, [route]);
@ -84,10 +86,7 @@ const mapStateToProps = (state) => ({
const mapDispatchToProps = {
getBooks: book.list,
setFilterOptions: book.setFilterOptions,
getFilters: config.getFilters
};
export default connect(mapStateToProps, mapDispatchToProps)(Products);
Products.defaultProps = {
productTypes: ["کتاب فیزیکی", "کتاب دیجیتال", "ویدئوها", "اشتراک"],
};
export default connect(mapStateToProps, mapDispatchToProps)(Products);

@ -29,9 +29,7 @@ function Splash({
navigation,
theme,
isLogin,
blogs,
getBlogs,
books,
getBooks,
userProducts,
getUserProducts,
@ -39,9 +37,7 @@ function Splash({
getBottomNavigation,
bottomNavigation,
}) {
const isFocused = useIsFocused();
const [out, setOut] = React.useState(false);
const [sendRequest, setSendRequest] = React.useState(false);
React.useEffect(() => {
StatusBar.setBarStyle(
`${theme === "light" ? "dark" : "light"}-content`,
@ -54,33 +50,27 @@ function Splash({
setIsDark(!theme ? "light" : theme);
};
const setOutHandler = React.useCallback(
(value) => {
setOut(value);
},
[out]
);
useEffect(() => {
getTheme();
if (isLogin !== null) {
if (isLogin === false) {
setOutHandler(true);
navigation.reset({
index: 0,
routes: [{ name: "Login" }],
});
setTimeout(() => {
getBottomNavigation();
navigation.reset({
index: 0,
routes: [{ name: "Login" }],
});
}, 700);
} else {
if (!blogs.length) {
if (!sendRequest) {
setSendRequest(true);
getBottomNavigation();
getUserProducts();
getBlogs();
} else if (!books.length) {
getBooks({ vod: true });
} else if (!userProducts.length) {
getUserProducts();
} else if (!bottomNavigation) {
getBottomNavigation();
} else {
setOutHandler(true);
}
if (bottomNavigation) {
navigation.reset({
index: 0,
routes: [{ name: "Root" }],
@ -88,32 +78,7 @@ function Splash({
}
}
}
}, [isLogin, books, userProducts, blogs, bottomNavigation]);
// if (isFocused && out) {
// setOutHandler(false);
// BackHandler.exitApp();
// }
// if (isFocused && !out) {
// if (isLogin !== null) {
// if (isLogin === false) {
// setOutHandler(true);
// navigation.push("Login");
// } else {
// if (blogs.length === 0) {
// getBlogs();
// } else if (books.length === 0) {
// getBooks({ vod: true });
// } else if (userProducts.length === 0) {
// getUserProducts();
// } else {
// setOutHandler(true);
// navigation.push("Root");
// }
// }
// }
// }
}, [isLogin, bottomNavigation, userProducts]);
return (
<View
@ -145,8 +110,6 @@ function Splash({
const mapStateToProps = (state) => ({
isLogin: state.user.status,
blogs: state.blog.list,
books: state.book.list,
userProducts: state.userProduct.list,
theme: state.publicApi.theme,
bottomNavigation: state.config.bottomNavigation,

@ -53,7 +53,7 @@ function MostViewedVideo({ videos, grades, mobile, theme }) {
resizeMode="contain"
style={[
tw(
`rounded-sm h-full absolute left-2 ${mobile ? "" : "top-1/5"}`
`rounded-sm h-full absolute left-2`
),
{
width: mobile ? 70 : 105,

Loading…
Cancel
Save