Before Width: | Height: | Size: 623 B |
Before Width: | Height: | Size: 626 B |
Before Width: | Height: | Size: 816 B |
Before Width: | Height: | Size: 275 B |
Before Width: | Height: | Size: 159 B |
Before Width: | Height: | Size: 728 B |
Before Width: | Height: | Size: 794 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 592 B |
Before Width: | Height: | Size: 785 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 576 B |
Before Width: | Height: | Size: 775 B |
Before Width: | Height: | Size: 843 B |
Before Width: | Height: | Size: 664 B |
Before Width: | Height: | Size: 806 B |
@ -0,0 +1,16 @@ |
||||
import React from "react"; |
||||
import { BlurView } from "expo-blur"; |
||||
import { ActivityIndicator } from "react-native"; |
||||
import tw from 'tailwind-rn'; |
||||
|
||||
export default function Blur() { |
||||
return ( |
||||
<BlurView |
||||
intensity={280} |
||||
// tint="dark"
|
||||
style={[{ width: "100%", height: "100%" }, tw('flex-1 flex justify-center items-center')]} |
||||
> |
||||
<ActivityIndicator size="large" color="#12CF7F" /> |
||||
</BlurView> |
||||
); |
||||
} |
@ -0,0 +1,18 @@ |
||||
import { View, Dimensions } from "react-native"; |
||||
import React from "react"; |
||||
import tw from "tailwind-rn"; |
||||
|
||||
const { width, height } = Dimensions.get("window"); |
||||
|
||||
const ImageSlider = ({}) => { |
||||
return ( |
||||
<View |
||||
style={[ |
||||
tw("flex flex-row justify-center items-center absolute left-0 top-0"), |
||||
{ width : width, height : height, backgroundColor: "black", zIndex : 1 }, |
||||
]} |
||||
></View> |
||||
); |
||||
}; |
||||
|
||||
export default ImageSlider; |
@ -1,20 +1,87 @@ |
||||
const Colors = { |
||||
theme1 : { |
||||
light : { |
||||
blue1 : '#E9F0FF', |
||||
blue2 : '#D7E3FC', |
||||
blue3 : '#D3E9FF', |
||||
blue4 : '#2B8DEB', |
||||
blue5 : "#196EC0", |
||||
blue6 : '#05335F', |
||||
blue7 : '#235A90', |
||||
blue8 : '#86A0B9', |
||||
theme1: { |
||||
light: { |
||||
//green
|
||||
green79: "#52796F", |
||||
greenBA: "#06BAC0", |
||||
greenC8: "#76C893",
|
||||
greenCF: "#12CF7F", |
||||
greenD9: "#99D98C",
|
||||
greenDD: "#D5DDBC",
|
||||
greenFF: "#00FF80", |
||||
greenFF1: "#DEFFF1",
|
||||
//blue
|
||||
blue90: "#235A90", |
||||
blueCB: "#98B2CB", |
||||
blueEB: "#2B8DEB", |
||||
blueFA: "#F8F9FA", |
||||
blueFA1: "#9CF1FA", |
||||
blueFD: "#F6F9FD", |
||||
blueFD1: "#F4F8FD", |
||||
blueFDOP: "rgba(6, 146, 255, 0.36)", |
||||
blueFF: "#E8FCFF", |
||||
blueFF1: "#E9F0FF", |
||||
//gray
|
||||
gray20: "#202020", |
||||
gray2077: "#2F3E46", |
||||
grayE3: "#E3E3E3", |
||||
grayF9: "#F9F9F9", |
||||
grayCC : "#CCC",
|
||||
//red
|
||||
redC0: "#C01919", |
||||
redFF: "#FFE6E6", |
||||
redFF1: "#FF2020", |
||||
//yellow
|
||||
yellow2: "#FDFFDA", |
||||
yellow3: "#EFFF00", |
||||
yellow4: "#FFEE00", |
||||
//orange
|
||||
orange1: "#FF6600", |
||||
//black
|
||||
black: "#000000", |
||||
white: "#FFFFFF" |
||||
}, |
||||
dark : { |
||||
|
||||
} |
||||
} |
||||
dark: { |
||||
//green
|
||||
green79: "#52796F", |
||||
greenBA: "#06BAC0", |
||||
greenC8: "#76C893",
|
||||
greenCF: "#12CF7F", |
||||
greenD9: "#99D98C",
|
||||
greenDD: "#D5DDBC",
|
||||
greenFF: "#00FF80", |
||||
greenFF1: "#DEFFF1",
|
||||
//blue
|
||||
blue90: "#235A90", |
||||
blueCB: "#98B2CB", |
||||
blueEB: "#2B8DEB", |
||||
blueFA: "#F8F9FA", |
||||
blueFA1: "#9CF1FA", |
||||
blueFD: "#F6F9FD", |
||||
blueFD1: "#F4F8FD", |
||||
blueFDOP: "rgba(6, 146, 255, 0.36)", |
||||
blueFF: "#E8FCFF", |
||||
blueFF1: "#E9F0FF", |
||||
//gray
|
||||
gray20: "#202020", |
||||
gray2077: "#2F3E46", |
||||
grayE3: "#E3E3E3", |
||||
grayF9: "#F9F9F9",
|
||||
//red
|
||||
redC0: "C01919", |
||||
redFF: "#FFE6E6", |
||||
redFF1: "#FF2020", |
||||
//yellow
|
||||
yellow2: "#FDFFDA", |
||||
yellow3: "#EFFF00", |
||||
yellow4: "#FFEE00", |
||||
//orange
|
||||
orange1: "#FF6600", |
||||
//black
|
||||
black: "#FFFFFF", |
||||
white: "#000000" |
||||
}, |
||||
}, |
||||
}; |
||||
|
||||
|
||||
export default Colors; |
||||
|
@ -0,0 +1,34 @@ |
||||
import proxy from "../proxy"; |
||||
|
||||
const userAddress = { |
||||
list: |
||||
(data = {}) => |
||||
async (dispatch) => { |
||||
await proxy.get("userAddress/list", data, { dispatch }); |
||||
}, |
||||
info: |
||||
(data = {}) => |
||||
async (dispatch) => { |
||||
await dispatch({ type: "userAddress/info", data }); |
||||
}, |
||||
update: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.put("userAddress/update", data); |
||||
await proxy.get("userAddress/list", data2, { dispatch }); |
||||
}, |
||||
add: |
||||
(data = {}, data2 = {}, data3 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.post("userAddress/add", data, { dispatch }); |
||||
await proxy.get("userAddress/list", data2, { dispatch }); |
||||
}, |
||||
del: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.delete("userAddress/delete", data); |
||||
await proxy.get("userAddress/list", data2, { dispatch }); |
||||
}, |
||||
}; |
||||
|
||||
export default userAddress; |
@ -0,0 +1,32 @@ |
||||
const initialState = { |
||||
loading: false, |
||||
error: null, |
||||
list: [], |
||||
info : null, |
||||
}; |
||||
export default function userAddress(state = initialState, action) { |
||||
let { type, data } = action; |
||||
switch (type) { |
||||
case "userAddress/list": |
||||
return { |
||||
...state, |
||||
loading: false, |
||||
list: data, |
||||
error: null, |
||||
}; |
||||
case "userAddress/info": |
||||
return { ...state, loading: false, info: data, error: null }; |
||||
case "userAddress/update": |
||||
return { ...state, loading: false, error: null }; |
||||
case "userAddress/add": |
||||
return { ...state, loading: false, error: null, sum: data.payPrice }; |
||||
case "userAddress/delete": |
||||
return { ...state, loading: false, error: null }; |
||||
case "userAddress/loading": |
||||
return { ...state, loading: true }; |
||||
case "userAddress/error": |
||||
return { ...state, loading: false, error: data.message }; |
||||
default: |
||||
return state; |
||||
} |
||||
} |
@ -0,0 +1,12 @@ |
||||
import { View, Text } from 'react-native' |
||||
import React from 'react' |
||||
|
||||
const Address = () => { |
||||
return ( |
||||
<View> |
||||
<Text>Address</Text> |
||||
</View> |
||||
) |
||||
} |
||||
|
||||
export default Address; |
@ -0,0 +1,12 @@ |
||||
import { View, Text } from 'react-native' |
||||
import React from 'react' |
||||
|
||||
const Address = () => { |
||||
return ( |
||||
<View> |
||||
<Text>Address</Text> |
||||
</View> |
||||
) |
||||
} |
||||
|
||||
export default Address |
@ -0,0 +1,12 @@ |
||||
import { View, Text } from 'react-native' |
||||
import React from 'react' |
||||
|
||||
const PaymentMethod = () => { |
||||
return ( |
||||
<View> |
||||
<Text>PaymentMethod</Text> |
||||
</View> |
||||
) |
||||
} |
||||
|
||||
export default PaymentMethod |
@ -0,0 +1,12 @@ |
||||
import { View, Text } from 'react-native' |
||||
import React from 'react' |
||||
|
||||
const TransportDate = () => { |
||||
return ( |
||||
<View> |
||||
<Text>TransportDate</Text> |
||||
</View> |
||||
) |
||||
} |
||||
|
||||
export default TransportDate |
@ -0,0 +1,12 @@ |
||||
import { View, Text } from 'react-native' |
||||
import React from 'react' |
||||
|
||||
const TransportMethod = () => { |
||||
return ( |
||||
<View> |
||||
<Text>TransportMethod</Text> |
||||
</View> |
||||
) |
||||
} |
||||
|
||||
export default TransportMethod |
@ -0,0 +1,104 @@ |
||||
import { |
||||
View, |
||||
Text, |
||||
SafeAreaView, |
||||
ScrollView, |
||||
StyleSheet, |
||||
StatusBar, |
||||
Platform, |
||||
Dimensions, |
||||
} from "react-native"; |
||||
import React from "react"; |
||||
import { connect } from "react-redux"; |
||||
import { userFactor, userAddress } from "../../redux/actions"; |
||||
import { useNavigation } from "@react-navigation/native"; |
||||
|
||||
//components
|
||||
import Navbar from "../../components/Navbar"; |
||||
import TransportMethod from "./PaymentMethod"; |
||||
import TransportDate from "./TransportDate"; |
||||
// import PaymentMethod from "./PaymentMethod";
|
||||
import Address from "./Address"; |
||||
|
||||
//style
|
||||
import tw from "tailwind-rn"; |
||||
|
||||
const DeliveryForm = ({ list }) => { |
||||
const navigation = useNavigation(); |
||||
return ( |
||||
<SafeAreaView |
||||
style={{ |
||||
paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0, |
||||
position: "relative", |
||||
}} |
||||
> |
||||
<Navbar |
||||
setBoxPosition={setBoxPosition} |
||||
headerOptions={{ |
||||
logo: false, |
||||
menu: true, |
||||
hamburgerMenu: false, |
||||
title: "", |
||||
bookmark: true, |
||||
qr: false, |
||||
back: true, |
||||
}} |
||||
/> |
||||
<ScrollView |
||||
contentContainerStyle={styles.contentContainerStyle} |
||||
style={styles.container} |
||||
> |
||||
<View style={tw("w-full flex flex-col pt-4 pb-4")}> |
||||
<View style={tw("w-full flex flex-row gap-5")}> |
||||
<Address addresses={list} /> |
||||
</View> |
||||
<View style={tw("w-full flex flex-row gap-5 mt-8")}> |
||||
<TransportMethod /> |
||||
</View> |
||||
<View style={tw("w-full flex flex-row gap-5 mt-8")}> |
||||
<TransportDate transportDate={form.transportDate} /> |
||||
</View> |
||||
<View |
||||
style={[ |
||||
tw("flex justify-between items-center py-3 px-4 w-full"), |
||||
{ backgroundColor: "#061B30" }, |
||||
]} |
||||
> |
||||
<Text style={tw("")}>تکمیل اطلاعات</Text> |
||||
{/* <Image |
||||
source={{ uri: isDark ? arrowWhiteIcon : arrowBlueIcon }} |
||||
style={tw(`w-6`)} |
||||
onPress={() => navigation.goBack()} |
||||
/> */} |
||||
</View> |
||||
</View> |
||||
</ScrollView> |
||||
</SafeAreaView> |
||||
); |
||||
}; |
||||
|
||||
const styles = StyleSheet.create({ |
||||
contentContainerStyle: { |
||||
paddingBottom: 100, |
||||
}, |
||||
container: { |
||||
width: Dimensions.get("window").width, |
||||
backgroundColor: "white", |
||||
flexDirection: "column", |
||||
paddingVertical: 5, |
||||
paddingHorizontal: 16, |
||||
}, |
||||
}); |
||||
|
||||
const mapStateToProps = (state) => ({ |
||||
factorInfo: state.userFactor.info, |
||||
userId: state.user.status?.id, |
||||
list: state.userAddress.list, |
||||
}); |
||||
|
||||
const mapDispatchToProps = { |
||||
getFactorInfo: userFactor.info, |
||||
getList: userAddress.list, |
||||
}; |
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(DeliveryForm); |
Before Width: | Height: | Size: 417 B |
@ -1,56 +0,0 @@ |
||||
import React from "react"; |
||||
import { Image, Text, Dimensions, Pressable } from "react-native"; |
||||
import { useNavigation } from "@react-navigation/native"; |
||||
import tw from "tailwind-react-native-classnames"; |
||||
import fontSize from '../../../constants/fontSize'; |
||||
const width = Dimensions.get("window").width; |
||||
|
||||
function Book({book, grades, type}) { |
||||
const navigation = useNavigation(); |
||||
return ( |
||||
<Pressable |
||||
style={[ |
||||
{ |
||||
width: width / 2 - 25, |
||||
// shadowColor : "#000",
|
||||
// shadowOffset : {width : 0, height : 2},
|
||||
// shadowRadius : 20,
|
||||
// shadowOpacity : 1,
|
||||
marginBottom: 15, |
||||
borderWidth: 1, |
||||
borderColor: "#ddd", |
||||
}, |
||||
tw.style("flex flex-col items-end px-2 pt-2 rounded-md"), |
||||
]} |
||||
onPress={() => navigation.navigate("Product", { id : book.id, type : 'book'})} |
||||
> |
||||
<Image |
||||
source={{ uri: `https://dnvn.ir/api/v1/file/${book.fileIds}` }} |
||||
style={[tw.style("w-full rounded-md"), { height: (width / 2 - 25) * 16 / 14 }]} |
||||
/> |
||||
<Text |
||||
style={{ |
||||
fontSize: fontSize.lg, |
||||
marginTop: 5, |
||||
color: "#05335F", |
||||
fontFamily: "bold", |
||||
}} |
||||
> |
||||
{ (type === 1 ? 'کتاب فیزیکی' : 'کتاب دیجیتال') + ' ' + book.name} |
||||
</Text> |
||||
<Text style={{ color: "#196EC0", fontSize: fontSize.sm, marginTop: 5, fontFamily : 'light' }}> |
||||
{'پایه' + ' ' + grades[book.gradeId]} |
||||
</Text> |
||||
<Text |
||||
style={[ |
||||
tw.style("w-full text-center mb-1"), |
||||
{ marginTop: 10, color: "#132F52", fontFamily : 'bold', fontSize: fontSize.base }, |
||||
]} |
||||
> |
||||
{( type=== 1 ? book.product[1].price : book.product[0].price ) + ' ' + 'تومان'} |
||||
</Text> |
||||
</Pressable> |
||||
); |
||||
} |
||||
|
||||
export default Book; |
@ -0,0 +1,57 @@ |
||||
import { View, Text } from "react-native"; |
||||
import React from "react"; |
||||
import _ from "lodash"; |
||||
import { connect } from "react-redux"; |
||||
import { book } from "../../../redux/actions"; |
||||
|
||||
//style
|
||||
import tw from "tailwind-rn"; |
||||
|
||||
//components
|
||||
import Search from "../../../components/Search"; |
||||
import Select from "../../../components/Select"; |
||||
|
||||
const Header = ({ setFilterOptions, filterOptions, levels, productTypes }) => { |
||||
return ( |
||||
<View style={tw("flex flex-col px-4 h-28 bg-white")}> |
||||
<Search |
||||
onChange={(val) => setFilterOptions({ ...filterOptions, search: val })} |
||||
placeholder={"نام کتاب یا دوره را جستجو کنید"} |
||||
/> |
||||
<View |
||||
style={[tw("flex flex-1 flex-row justify-between items-center my-2")]} |
||||
> |
||||
<Select |
||||
defaultValue={productTypes[0]} |
||||
onChange={(name, value) => |
||||
setFilterOptions({ ...filterOptions, [name]: value }) |
||||
} |
||||
options={productTypes} |
||||
width={"48%"} |
||||
name="productType" |
||||
/> |
||||
<Select |
||||
defaultValue={Object.values(levels)[0]} |
||||
onChange={(name, value) => |
||||
setFilterOptions({ ...filterOptions, [name]: value }) |
||||
} |
||||
options={Object.values(levels)} |
||||
width={"48%"} |
||||
name="grade" |
||||
/> |
||||
</View> |
||||
</View> |
||||
); |
||||
}; |
||||
|
||||
const mapStateToProps = (state) => ({ |
||||
levels: state.publicApi.grades, |
||||
productTypes: state.book.productTypes, |
||||
filterOptions: state.book.filterOptions, |
||||
}); |
||||
|
||||
const mapDispatchToProps = { |
||||
setFilterOptions: book.setFilterOptions, |
||||
}; |
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(Header); |
@ -0,0 +1,297 @@ |
||||
import { |
||||
View, |
||||
Text, |
||||
Pressable, |
||||
Image, |
||||
Dimensions, |
||||
Appearance, |
||||
} from "react-native"; |
||||
import React from "react"; |
||||
import { connect } from "react-redux"; |
||||
import separate from "../../../utils/separate"; |
||||
import { useNavigation } from "@react-navigation/native"; |
||||
|
||||
//style
|
||||
import tw from "tailwind-rn"; |
||||
import Colors from "../../../constants/Colors"; |
||||
import fontSize from "../../../constants/fontSize"; |
||||
|
||||
const width = Dimensions.get("window").width; |
||||
|
||||
const Main = ({ books, filterOptions, grades }) => { |
||||
const colorScheme = Appearance.getColorScheme(); |
||||
const navigation = useNavigation(); |
||||
const [filterLoading, setFilterLoading] = React.useState(false); |
||||
|
||||
React.useEffect(() => { |
||||
setFilterLoading(() => true); |
||||
setTimeout(() => { |
||||
setFilterLoading(() => false); |
||||
}, 500); |
||||
}, [filterOptions]); |
||||
|
||||
const Items = (type) => { |
||||
const { grade, subject, available, sort, productType, search } = |
||||
filterOptions; |
||||
let byGradeFilter; |
||||
let bySubjectFilter; |
||||
let byAvailableFilter; |
||||
let bySearchFilter; |
||||
if (grade && grade !== "همه پایه ها") { |
||||
byGradeFilter = books?.filter((book) => grades[book?.gradeId] === grade); |
||||
} else { |
||||
byGradeFilter = books; |
||||
} |
||||
if (subject) { |
||||
bySubjectFilter = byGradeFilter?.filter( |
||||
(book) => |
||||
book?.product[type]?.name?.indexOf(subject) !== -1 || |
||||
book?.name.indexOf(subject) !== -1 |
||||
); |
||||
} else { |
||||
bySubjectFilter = byGradeFilter; |
||||
} |
||||
if (available) { |
||||
byAvailableFilter = bySubjectFilter?.filter( |
||||
(book) => book.product[type].price |
||||
); |
||||
} else { |
||||
byAvailableFilter = bySubjectFilter; |
||||
} |
||||
if (search) { |
||||
bySearchFilter = byAvailableFilter?.filter( |
||||
(book) => |
||||
book?.product[type]?.name?.indexOf(search) !== -1 || |
||||
book?.name.indexOf(search) !== -1 |
||||
); |
||||
} else { |
||||
bySearchFilter = byAvailableFilter; |
||||
} |
||||
|
||||
return filterOptions.productType === "دوره ویدئویی" |
||||
? bySearchFilter?.map((product, index) => ( |
||||
<Pressable |
||||
style={[tw(`w-full flex flex-col mb-5`)]} |
||||
key={Math.random()} |
||||
onPress={() => navigation.navigate("Product")} |
||||
> |
||||
<View style={[tw("relative w-full mb-1")]}> |
||||
<Image |
||||
source={{ |
||||
uri: `https://dnvn.ir/api/v1/file/${product?.fileIds}`, |
||||
}} |
||||
style={[ |
||||
tw("w-full rounded-md"), |
||||
{ height: ((width - 25) * 9) / 16 }, |
||||
]} |
||||
/> |
||||
</View> |
||||
|
||||
<Text |
||||
style={[ |
||||
tw("mb-1"), |
||||
{ fontFamily: "bold", fontSize: fontSize.xl2, color : Colors.theme1[colorScheme].gray20 }, |
||||
]} |
||||
> |
||||
{'دوره ویدئویی' + ' ' + product?.name} |
||||
</Text> |
||||
<Text style={[tw("mb-4"), { fontSize: fontSize.tiny, fontFamily : 'regular', color : Colors.theme1[colorScheme].greenBA }]}> |
||||
{"پایه" + " " + grades[product?.gradeId]} |
||||
</Text> |
||||
<Text style={[tw("w-full flex flex-row text-left"), {fontSize : fontSize.xl, fontFamily : 'bold'}]}> |
||||
{separate(product?.product[2]?.price) + " " + "تومان"} |
||||
</Text> |
||||
</Pressable> |
||||
)) |
||||
: bySearchFilter?.map((product, index) => ( |
||||
<> |
||||
{(productType |
||||
? productType === ("کتاب دیجیتال" || "همه محصولات") |
||||
: true) && ( |
||||
<Pressable |
||||
key={product?.product[0]?.id} |
||||
style={[ |
||||
{ |
||||
width: width / 2 - 25, |
||||
marginBottom: 15, |
||||
borderWidth: 1, |
||||
borderColor: Colors.theme1[colorScheme].grayE3, |
||||
}, |
||||
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 |
||||
source={{ |
||||
uri: `https://dnvn.ir/api/v1/file/${product?.fileIds}`, |
||||
}} |
||||
style={[ |
||||
tw("w-full rounded-md"), |
||||
{ height: ((width / 2 - 25) * 16) / 14 }, |
||||
]} |
||||
/> |
||||
<Text |
||||
style={{ |
||||
fontSize: fontSize.lg, |
||||
marginTop: 5, |
||||
color: "#05335F", |
||||
fontFamily: "bold", |
||||
width: "100%", |
||||
}} |
||||
> |
||||
{"کتاب دیجیتال" + " " + product?.name} |
||||
</Text> |
||||
<Text |
||||
style={{ |
||||
color: Colors.theme1[colorScheme].greenBA, |
||||
fontSize: fontSize.tiny, |
||||
marginTop: 5, |
||||
fontFamily: "regular", |
||||
width: "100%", |
||||
}} |
||||
> |
||||
{"پایه" + " " + 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: Colors.theme1[colorScheme].gray20, |
||||
fontFamily: "bold", |
||||
fontSize: fontSize.xl2, |
||||
}, |
||||
]} |
||||
> |
||||
{separate(product?.product[0].price)} |
||||
</Text> |
||||
<Text |
||||
style={{ |
||||
fontSize: fontSize.sm, |
||||
color: Colors.theme1[colorScheme].grayCC, |
||||
fontFamily: "regular", |
||||
}} |
||||
> |
||||
تومان |
||||
</Text> |
||||
</View> |
||||
</Pressable> |
||||
)} |
||||
{(productType |
||||
? productType === ("کتاب فیزیکی" || "همه محصولات") |
||||
: true) && ( |
||||
<Pressable |
||||
key={product?.product[1]?.id} |
||||
style={[ |
||||
{ |
||||
width: width / 2 - 25, |
||||
marginBottom: 15, |
||||
borderWidth: 1, |
||||
borderColor: Colors.theme1[colorScheme].grayE3, |
||||
}, |
||||
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 |
||||
source={{ |
||||
uri: `https://dnvn.ir/api/v1/file/${product?.fileIds}`, |
||||
}} |
||||
style={[ |
||||
tw("w-full rounded-md"), |
||||
{ height: ((width / 2 - 25) * 16) / 14 }, |
||||
]} |
||||
/> |
||||
<Text |
||||
style={{ |
||||
fontSize: fontSize.lg, |
||||
marginTop: 5, |
||||
color: "#05335F", |
||||
fontFamily: "bold", |
||||
width: "100%", |
||||
}} |
||||
> |
||||
{"کتاب فیزیکی" + " " + product?.name} |
||||
</Text> |
||||
<Text |
||||
style={{ |
||||
color: Colors.theme1[colorScheme].greenBA, |
||||
fontSize: fontSize.tiny, |
||||
marginTop: 5, |
||||
fontFamily: "regular", |
||||
width: "100%", |
||||
}} |
||||
> |
||||
{"پایه" + " " + 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: Colors.theme1[colorScheme].gray20, |
||||
fontFamily: "bold", |
||||
fontSize: fontSize.xl2, |
||||
}, |
||||
]} |
||||
> |
||||
{separate(product?.product[1].price)} |
||||
</Text> |
||||
<Text |
||||
style={{ |
||||
fontSize: fontSize.sm, |
||||
color: Colors.theme1[colorScheme].grayCC, |
||||
fontFamily: "regular", |
||||
}} |
||||
> |
||||
تومان |
||||
</Text> |
||||
</View> |
||||
</Pressable> |
||||
)} |
||||
</> |
||||
)); |
||||
}; |
||||
|
||||
return ( |
||||
<View |
||||
style={[tw( |
||||
"flex w-full px-4 flex-row flex-wrap justify-between bg-white pb-20" |
||||
)]} |
||||
> |
||||
{filterOptions?.productType === "دوره ویدئویی" && Items(2)} |
||||
{filterOptions?.productType === "کتاب دیجیتال" && Items(0)} |
||||
{filterOptions?.productType === "کتاب فیزیکی" && Items(1)} |
||||
{!filterOptions?.productType && Items(0)} |
||||
{/* {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"> |
||||
<Loading size={4} color="bg-green-400" /> |
||||
</View> |
||||
)} */} |
||||
</View> |
||||
); |
||||
}; |
||||
|
||||
const mapStateToProps = (state) => ({ |
||||
filterOptions: state.book.filterOptions, |
||||
}); |
||||
|
||||
const mapDispatchToProps = {}; |
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(Main); |
@ -1,100 +0,0 @@ |
||||
import React from "react"; |
||||
import { View, Image, Text, Dimensions, Pressable } from "react-native"; |
||||
import { useNavigation } from "@react-navigation/native"; |
||||
import tw from "tailwind-react-native-classnames"; |
||||
import fontSize from '../../../constants/fontSize'; |
||||
import posterImage from "../assets/poster.png"; |
||||
|
||||
const width = Dimensions.get("window").width; |
||||
const height = Dimensions.get("window").height; |
||||
|
||||
function Video({ |
||||
item = { |
||||
name: "ریاضی", |
||||
price: "145.000 تومان", |
||||
grade: "4", |
||||
imageUrl: "https://dnvn.ir/api/v1/file/2105", |
||||
poster: posterImage, |
||||
}, |
||||
}) { |
||||
const navigation = useNavigation(); |
||||
return ( |
||||
<Pressable |
||||
style={[ |
||||
{ |
||||
marginBottom: 15, |
||||
borderWidth: 1, |
||||
borderColor: "#ddd", |
||||
}, |
||||
tw.style("w-full flex flex-col items-end p-2 rounded-md"), |
||||
]} |
||||
onPress={() => navigation.navigate("Product")} |
||||
> |
||||
<View |
||||
style={[ |
||||
tw.style( |
||||
"w-full flex flex-row flex-1 justify-between items-center relative overflow-hidden" |
||||
), |
||||
{ height: height / 3.8 }, |
||||
]} |
||||
> |
||||
{/* <View |
||||
style={[ |
||||
tw.style('rounded-full bg-black bg-opacity-20 z-50'), |
||||
{width: 50, height: 50}, |
||||
]}></View> */} |
||||
<Image |
||||
source={item.poster} |
||||
style={tw.style("w-full h-full absolute left-0 top-0")} |
||||
/> |
||||
<Image |
||||
source={{ uri: item.imageUrl }} |
||||
style={[ |
||||
tw.style("rounded-md h-full absolute left-2 bottom-2 rounded-md"), |
||||
{ width: 70, height: 100 }, |
||||
]} |
||||
/> |
||||
</View> |
||||
<Text |
||||
style={{ |
||||
fontSize: fontSize.lg, |
||||
marginTop: 5, |
||||
color: "#05335F", |
||||
fontFamily: "bold", |
||||
}} |
||||
> |
||||
{item.name} |
||||
</Text> |
||||
|
||||
<View |
||||
style={tw.style("w-full flex flex-row justify-between items-center")} |
||||
> |
||||
<Text |
||||
style={[ |
||||
tw.style(""), |
||||
{ |
||||
marginTop: 10, |
||||
color: "#132F52", |
||||
fontFamily: "bold", |
||||
fontSize: fontSize.base, |
||||
}, |
||||
]} |
||||
> |
||||
{item.price} |
||||
</Text> |
||||
<Text |
||||
style={{ |
||||
color: "#196EC0", |
||||
fontFamily: "light", |
||||
fontSize: fontSize.sm, |
||||
marginTop: 5, |
||||
}} |
||||
> |
||||
{"پایه" + " " + item.grade} |
||||
</Text> |
||||
</View> |
||||
</Pressable> |
||||
); |
||||
} |
||||
|
||||
export default Video; |
@ -0,0 +1,12 @@ |
||||
const separate = (number) => { |
||||
number += ""; |
||||
number = number.replace(",", ""); |
||||
let x = number.split("."); |
||||
let y = x[0]; |
||||
let z = x.length > 1 ? "." + x[1] : ""; |
||||
let rgx = /(\d+)(\d{3})/; |
||||
while (rgx.test(y)) y = y.replace(rgx, "$1" + "," + "$2"); |
||||
return y + z; |
||||
}; |
||||
|
||||
export default separate; |