reza added something

master
Reza_ashrafi 3 years ago
parent 26959d9882
commit 97fbc5d3ca
  1. 3
      src/components/CustomTextInput.js
  2. 16
      src/components/Progress.js
  3. 2
      src/components/Search.js
  4. 2
      src/components/Select.js
  5. 1
      src/redux/reducers/book.js
  6. 3
      src/redux/reducers/public.js
  7. 342
      src/screens/Product/components/Book.js
  8. 2
      src/screens/Product/components/LinkBox.js
  9. 12
      src/screens/Products/components/Header.js
  10. 25
      src/screens/Products/components/Main.js
  11. 4
      src/screens/Video/components/Season.js
  12. 11
      src/screens/Video/index.js
  13. 19
      src/screens/Videos/components/MostViewedVideo.js
  14. 2
      src/screens/Videos/components/NewestVideo.js

@ -63,7 +63,6 @@ const FloatingLabelInput = ({
: Colors.theme1[colorScheme].gray2077 + "66",
textAlign: textAlign,
fontFamily: "regular",
fontWeight: "900",
direction: direction ? direction : "rtl",
},
});
@ -87,7 +86,7 @@ const FloatingLabelInput = ({
{label}
</Text>
<TextInput
style={[styles.inputStyle, tw(`rounded-md ${mobile ? "py-2" : "py-3"} px-4`)]}
style={[styles.inputStyle, tw(`rounded-sm ${mobile ? "py-2" : "py-3"} px-4`)]}
onChangeText={(text) => onChange(name, (text = regex(text)))}
placeholder={placeholder}
onFocus={() => setIsFocused(true)}

@ -9,14 +9,14 @@ import Color from "../constants/Colors";
function Progress({ percent, alignItems }) {
const colorScheme = Appearance.getColorScheme();
const [delayPercent, setDelayPercent] = useState(0);
useEffect(() => {
if (percent) {
setTimeout(() => {
setDelayPercent(() => percent);
}, 1000);
}
}, [percent]);
const [delayPercent, setDelayPercent] = useState(60);
// useEffect(() => {
// if (percent) {
// setTimeout(() => {
// setDelayPercent(() => percent);
// }, 1000);
// }
// }, [percent]);
return (
<View
style={[

@ -35,7 +35,7 @@ const Search = ({ placeholder, textAlign, direction, onChange, value }) => {
return (
<View style={[{ marginTop: 18 }, tw("w-full relative")]}>
<TextInput
style={[styles.inputStyle, tw("rounded-md")]}
style={[styles.inputStyle, tw("rounded-sm")]}
onChangeText={(text) => onChange(text)}
placeholder={placeholder}
placeholderTextColor={Colors.theme1[colorScheme].gray20 + '88'}

@ -24,7 +24,7 @@ function Select({
width: width,
borderWidth: 1,
borderColor: Colors.theme1[colorScheme].gray2077 + "66",
borderRadius: 6,
borderRadius: 2,
height: 48,
backgroundColor: 'white',
fontFamily: "regular",

@ -22,6 +22,7 @@ const initialState = {
search: "",
},
productTypes: [
"نوع محصول",
"کتاب فیزیکی",
"کتاب دیجیتال",
"دوره ویدئویی",

@ -42,7 +42,8 @@ const initialState = {
categories: null,
bookSection: null,
grades: {
0: "پیش دبستان",
0: 'پایه تحصیلی',
// _0: "پیش دبستان",
1: "اول",
2: "دوم",
3: "سوم",

@ -4,12 +4,12 @@ import {
Text,
Image,
ScrollView,
TouchableOpacity,
TouchableHighlight,
Dimensions,
Appearance,
Pressable,
Platform,
ActivityIndicator
ActivityIndicator,
} from "react-native";
import { useNavigation } from "@react-navigation/native";
import { product, userProduct } from "../../../redux/actions";
@ -85,12 +85,13 @@ function Book({
</Pressable>
)}
{imageSlider && <ImageSlider />}
<View style={tw("flex flex-row-reverse")}>
<View style={[tw("flex flex-row-reverse")]}>
<Image
source={{ uri: `https://dnvn.ir/api/v1/file/${book?.fileIds}` }}
resizeMode="contain"
style={[
tw("rounded-md"),
{ height: height / 4, width: ((height / 4) * 3) / 4 },
tw("rounded-sm bg-red-400"),
{ height: ((width / 3) * 4) / 2.6, width: width / 3 },
]}
/>
@ -106,9 +107,9 @@ function Book({
<Text
style={{
color: Colors.theme1[colorScheme].green79,
fontSize: mobile ? fontSize.lg : fontSize.xl3,
fontSize: mobile ? fontSize.base : fontSize.xl3,
marginBottom: 5,
fontFamily: "demi",
fontFamily: "bold",
textAlign: ios ? "right" : "auto",
}}
>
@ -117,7 +118,7 @@ function Book({
<Text
style={{
color: Colors.theme1[colorScheme].green79,
fontSize: mobile ? fontSize.base : fontSize.xl,
fontSize: mobile ? fontSize.tiny : fontSize.xl,
fontFamily: "regular",
}}
>
@ -135,7 +136,7 @@ function Book({
</View>
</View>
<View
style={tw("flex flex-row-reverse items-center justify-around py-6")}
style={tw("flex flex-row-reverse items-center justify-around py-8")}
>
<View>
<Text
@ -191,7 +192,7 @@ function Book({
</Text>
</View>
</View>
<View style={"flex flex-col mt-6"}>
<View style={"flex flex-col mt-8"}>
<Text
style={[
tw("w-full text-right"),
@ -207,11 +208,10 @@ function Book({
<View style={tw("flex justify-between")}></View>
</View>
<View style={tw("flex flex-row-reverse justify-between flex-wrap py-3")}>
<Pressable
<TouchableHighlight
underlayColor={Colors.theme1[colorScheme].greenFF + "22"}
style={[
tw(
"flex flex-row-reverse w-full justify-between px-2 py-3 mb-4"
),
tw("flex flex-row-reverse w-full justify-between px-2 py-3 mb-4"),
{
borderWidth: 1,
borderColor: Colors.theme1[colorScheme].greenCF,
@ -226,126 +226,129 @@ function Book({
})
}
>
<Text
style={{
fontFamily: "bold",
fontSize: fontSize.sm,
color: Colors.theme1[colorScheme].green79,
paddingVertical: 4,
}}
>
خرید نسخه فیزیکی کتاب
</Text>
<View style={tw("flex flex-row-reverse items-center")}>
<View style={tw("w-px h-full bg-green-300")}></View>
<View style={tw("flex")}>
<Text
style={[
tw("py-1 pr-2"),
{
borderLeftWidth: 1,
borderColor: Colors.theme1[colorScheme].greenCF,
fontFamily: "bold",
color: Colors.theme1[colorScheme].green79,
fontSize: fontSize.sm,
},
]}
>
{separate(book?.product[1]?.price) + " " + "تومان"}
</Text>
{physicalAvailabileInCart && (
<View
style={tw(
`flex items-center pl-3 ${
ios ? "flex-row-reverse" : "flex-row-reverse"
}`
)}
<>
<Text
style={{
fontFamily: "bold",
fontSize: fontSize.sm,
color: Colors.theme1[colorScheme].green79,
paddingVertical: 4,
}}
>
خرید نسخه فیزیکی کتاب
</Text>
<View style={tw("flex flex-row-reverse items-center")}>
<View style={tw("w-px h-full bg-green-300")}></View>
<View style={tw("flex")}>
<Text
style={[
tw("py-1 pr-2"),
{
borderLeftWidth: 1,
borderColor: Colors.theme1[colorScheme].greenCF,
fontFamily: "bold",
color: Colors.theme1[colorScheme].green79,
fontSize: fontSize.sm,
},
]}
>
<Pressable
onPress={() =>
pushToCart({
productId: physicalAvailabileInCart?.productId,
userId: physicalAvailabileInCart.userId,
count: 1,
})
}
style={[
tw(
`rounded-md py-0 flex flex-row justify-center items-center border ${
mobile ? "px-1.5" : "px-3"
}`
),
{
borderColor: Colors.theme1[colorScheme].green79,
},
]}
{separate(book?.product[1]?.price) + " " + "تومان"}
</Text>
{physicalAvailabileInCart && (
<View
style={tw(
`flex items-center pl-3 ${
ios ? "flex-row-reverse" : "flex-row-reverse"
}`
)}
>
<Text
style={{
fontSize: mobile ? fontSize.tiny : fontSize.xl4,
color: Colors.theme1[colorScheme].green79,
fontFamily: "bold",
}}
>
+
</Text>
</Pressable>
{loading ? (
<ActivityIndicator
style={tw("mx-1.5 my-3")}
size="small"
color={Colors.theme1[colorScheme].greenBA}
/>
) : (
<Text
<Pressable
onPress={() =>
pushToCart({
productId: physicalAvailabileInCart?.productId,
userId: physicalAvailabileInCart.userId,
count: 1,
})
}
style={[
tw("mx-1.5"),
tw(
`rounded-md py-0 flex flex-row justify-center items-center border ${
mobile ? "px-1.5" : "px-3"
}`
),
{
fontSize: fontSize.xl6,
color: Colors.theme1[colorScheme].green79,
fontFamily: "bold",
borderColor: Colors.theme1[colorScheme].green79,
},
]}
>
{physicalAvailabileInCart?.count}
</Text>
)}
<Text
style={{
fontSize: mobile ? fontSize.tiny : fontSize.xl4,
color: Colors.theme1[colorScheme].green79,
fontFamily: "bold",
}}
>
+
</Text>
</Pressable>
{loading ? (
<ActivityIndicator
style={tw("mx-1.5 my-3")}
size="small"
color={Colors.theme1[colorScheme].greenBA}
/>
) : (
<Text
style={[
tw("mx-1.5"),
{
fontSize: fontSize.xl6,
color: Colors.theme1[colorScheme].green79,
fontFamily: "bold",
},
]}
>
{physicalAvailabileInCart?.count}
</Text>
)}
<Pressable
onPress={() =>
pushToCart({
productId: physicalAvailabileInCart?.productId,
userId: physicalAvailabileInCart?.userId,
count: -1,
})
}
style={[
tw(
`rounded-md flex flex-row justify-center items-center border ${
mobile ? "px-2" : "px-3.5"
}`
),
{
borderColor: Colors.theme1[colorScheme].green79,
},
]}
>
<Text
style={{
fontSize: mobile ? fontSize.tiny : fontSize.xl4,
color: Colors.theme1[colorScheme].green79,
fontFamily: "demi",
}}
<Pressable
onPress={() =>
pushToCart({
productId: physicalAvailabileInCart?.productId,
userId: physicalAvailabileInCart?.userId,
count: -1,
})
}
style={[
tw(
`rounded-md flex flex-row justify-center items-center border ${
mobile ? "px-2" : "px-3.5"
}`
),
{
borderColor: Colors.theme1[colorScheme].green79,
},
]}
>
-
</Text>
</Pressable>
</View>
)}
<Text
style={{
fontSize: mobile ? fontSize.tiny : fontSize.xl4,
color: Colors.theme1[colorScheme].green79,
fontFamily: "demi",
}}
>
-
</Text>
</Pressable>
</View>
)}
</View>
</View>
</View>
</Pressable>
<Pressable
</>
</TouchableHighlight>
<TouchableHighlight
underlayColor={Colors.theme1[colorScheme].greenFF + "22"}
style={[
tw("flex flex-row-reverse justify-between px-2 py-3 mb-4"),
{
@ -363,17 +366,18 @@ function Book({
})
}
>
<Text
style={{
fontFamily: "bold",
fontSize: fontSize.sm,
color: Colors.theme1[colorScheme].green79,
paddingVertical: 4,
}}
>
خرید نسخه دیجیتال کتاب
</Text>
<View style={tw("flex")}>
<>
<Text
style={{
fontFamily: "bold",
fontSize: fontSize.sm,
color: Colors.theme1[colorScheme].green79,
paddingVertical: 4,
}}
>
خرید نسخه دیجیتال کتاب
</Text>
<View style={tw("flex")}>
<Text
style={[
tw("py-1 pr-2"),
@ -478,8 +482,10 @@ function Book({
</View>
)}
</View>
</Pressable>
<Pressable
</>
</TouchableHighlight>
<TouchableHighlight
underlayColor={Colors.theme1[colorScheme].greenFF + "22"}
style={[
tw("flex flex-row-reverse justify-center px-2 py-3 mb-4"),
{
@ -501,8 +507,9 @@ function Book({
>
مشاهده نمونه
</Text>
</Pressable>
<Pressable
</TouchableHighlight>
<TouchableHighlight
underlayColor={Colors.theme1[colorScheme].greenFF + "22"}
style={[
tw("flex flex-row-reverse justify-between px-2 py-3 mb-4"),
{
@ -520,35 +527,38 @@ function Book({
})
}
>
<Text
style={{
fontFamily: "bold",
fontSize: fontSize.sm,
color: Colors.theme1[colorScheme].green79,
paddingVertical: 4,
}}
>
خرید دوره ویدئویی کتاب
</Text>
<View style={tw("flex flex-row-reverse")}>
<View style={tw("w-px h-full bg-green-500")}></View>
<>
<Text
style={[
tw("py-1 pr-2"),
{
borderLeftWidth: 1,
borderColor: Colors.theme1[colorScheme].greenCF,
fontFamily: "bold",
color: Colors.theme1[colorScheme].green79,
fontSize: fontSize.sm,
},
]}
style={{
fontFamily: "bold",
fontSize: fontSize.sm,
color: Colors.theme1[colorScheme].green79,
paddingVertical: 4,
}}
>
{separate(book?.product[2]?.price) + " " + "تومان"}
خرید دوره ویدئویی کتاب
</Text>
</View>
</Pressable>
<Pressable
<View style={tw("flex flex-row-reverse")}>
<View style={tw("w-px h-full bg-green-500")}></View>
<Text
style={[
tw("py-1 pr-2"),
{
borderLeftWidth: 1,
borderColor: Colors.theme1[colorScheme].greenCF,
fontFamily: "bold",
color: Colors.theme1[colorScheme].green79,
fontSize: fontSize.sm,
},
]}
>
{separate(book?.product[2]?.price) + " " + "تومان"}
</Text>
</View>
</>
</TouchableHighlight>
<TouchableHighlight
underlayColor={Colors.theme1[colorScheme].greenFF + "22"}
style={[
tw("flex flex-row-reverse justify-center px-2 py-3 mb-4"),
{
@ -570,7 +580,7 @@ function Book({
>
پیش نمایش
</Text>
</Pressable>
</TouchableHighlight>
</View>
{book?.product[type]?.description && (
<Description description={book?.description} />

@ -18,7 +18,7 @@ function Description({ title, component, height, mobile }) {
onPress={() => refRBSheet.current.open()}
style={[
tw(
`flex flex-row-reverse justify-between items-center mt-3 rounded-md px-5 ${mobile ? "py-3" : "py-4"}`
`flex flex-row-reverse justify-between items-center mt-3 rounded-sm px-5 ${mobile ? "py-4" : "py-4"}`
),
{
backgroundColor: Colors.theme1[colorScheme].greenCF + '15',

@ -19,13 +19,13 @@ const Header = ({ setFilterOptions, filterOptions, levels, productTypes }) => {
placeholder={"نام کتاب یا دوره را جستجو کنید"}
value={filterOptions.search}
/>
<View
style={[tw("flex flex-1 flex-row justify-between items-center")]}
>
<View style={[tw("flex flex-1 flex-row justify-between items-center")]}>
<Select
defaultValue={productTypes[0]}
onChange={(name, value) =>
setFilterOptions({ ...filterOptions, [name]: value })
value !== "نوع محصول"
? setFilterOptions({ ...filterOptions, [name]: value })
: setFilterOptions({ ...filterOptions, [name]: null })
}
options={productTypes}
width={"48%"}
@ -34,7 +34,9 @@ const Header = ({ setFilterOptions, filterOptions, levels, productTypes }) => {
<Select
defaultValue={Object.values(levels)[0]}
onChange={(name, value) =>
setFilterOptions({ ...filterOptions, [name]: value })
value !== "پایه تحصیلی"
? setFilterOptions({ ...filterOptions, [name]: value })
: setFilterOptions({ ...filterOptions, [name]: null })
}
options={Object.values(levels)}
width={"48%"}

@ -90,7 +90,7 @@ const Main = ({ books, filterOptions, grades, mobile }) => {
uri: `https://dnvn.ir/api/v1/file/${product?.fileIds}`,
}}
style={[
tw("w-full rounded-md"),
tw("w-full rounded-sm"),
{ height: ((mobile ? width - 25 : width / 2.2) * 9) / 16 },
]}
/>
@ -128,7 +128,8 @@ const Main = ({ books, filterOptions, grades, mobile }) => {
{ fontSize: fontSize.xl, fontFamily: "bold" },
]}
>
{separate(product?.product[2]?.price) + " " + "تومان"}
{separate(product?.product[2]?.price)}{" "}
<Text style={{ fontSize: fontSize.sm }}>تومان</Text>
</Text>
</Pressable>
))
@ -157,14 +158,17 @@ const Main = ({ books, filterOptions, grades, mobile }) => {
>
<View style={tw("w-full flex")}>
<Image
resizeMode="contain"
source={{
uri: `https://dnvn.ir/api/v1/file/${product?.fileIds}`,
}}
style={[
tw("w-full rounded-md"),
tw("rounded-sm"),
{
height:
((mobile ? width / 2 - 25 : width / 3.2) * 16) / 14,
flex: 1,
height: mobile
? ((width / 2 - 25) * 4) / 2.9
: ((width / 3.2) * 16) / 14,
},
]}
/>
@ -248,11 +252,14 @@ const Main = ({ books, filterOptions, grades, mobile }) => {
source={{
uri: `https://dnvn.ir/api/v1/file/${product?.fileIds}`,
}}
resizeMode="contain"
style={[
tw("w-full rounded-md"),
tw("rounded-sm"),
{
height:
((mobile ? width / 2 - 25 : width / 3.2) * 16) / 14,
flex: 1,
height: mobile
? ((width / 2 - 25) * 4) / 2.9
: ((width / 3.2) * 16) / 11,
},
]}
/>
@ -283,7 +290,7 @@ const Main = ({ books, filterOptions, grades, mobile }) => {
</View>
<View
style={tw(
"flex flex-row-reverse items-center justify-center pb-1 pt-2"
"flex flex-row-reverse items-center justify-center pb-1"
)}
>
<Text

@ -74,7 +74,7 @@ const Season = ({
</Text>
<Pressable
style={[
tw(`py-1 rounded-md px-4 ${mobile ? "mr-4" : "mr-8"}`),
tw(`py-1 rounded-sm px-4 ${mobile ? "mr-4" : "mr-8"}`),
{
borderWidth: 1,
borderColor:
@ -117,7 +117,7 @@ const Season = ({
<View style={tw("w-full flex flex-col mb-4")}>
<Pressable
style={[
tw("flex flex-col rounded-md py-3 px-3"),
tw("flex flex-col rounded-sm py-3 px-3"),
{
backgroundColor: Colors.theme1[colorScheme].greenCF + "05",
borderWidth: 1,

@ -27,7 +27,7 @@ import tw from "tailwind-rn";
import fontSize from "../../constants/fontSize";
import Colors from "../../constants/Colors";
const { height } = Dimensions.get("window");
const { height, width } = Dimensions.get("window");
function Product({
route,
@ -87,9 +87,10 @@ function Product({
>
<Image
source={{ uri: `https://dnvn.ir/api/v1/file/${book?.fileIds}` }}
resizeMode="contain"
style={[
tw("rounded-md h-full rounded-md ml-2"),
{ height: mobile ? 160 : 300, width: mobile ? 110 : 210 },
tw("rounded-sm ml-2 bg-red-400"),
{ height: mobile ? width / 3 * 4 / 2.6 : 300, width: mobile ? width / 3 : 210 },
]}
/>
<View style={tw("flex flex-col items-end flex-1")}>
@ -97,7 +98,7 @@ function Product({
style={{
marginTop: 5,
color: Colors.theme1[colorScheme].green79,
fontSize: mobile ? fontSize.xl : fontSize.xl3,
fontSize: mobile ? fontSize.base : fontSize.xl3,
marginBottom: 0,
fontFamily: "demi",
}}
@ -107,7 +108,7 @@ function Product({
<Text
style={{
color: Colors.theme1[colorScheme].green79,
fontSize: mobile ? fontSize.lg : fontSize.xl,
fontSize: mobile ? fontSize.tiny : fontSize.xl,
marginTop: 10,
fontFamily: "regular",
}}

@ -44,19 +44,20 @@ function MostViewedVideo({ videos, grades, mobile }) {
>
<Image
source={{ uri: `https://dnvn.ir/api/v1/file/${video.fileIds}` }}
style={tw("w-full h-full absolute left-0 top-0 rounded-md")}
style={tw("w-full h-full absolute left-0 top-0 rounded-sm")}
/>
<Image
source={{ uri: `https://dnvn.ir/api/v1/file/${video.fileIds}` }}
resizeMode="contain"
style={[
tw(
`rounded-md h-full absolute left-2 ${
mobile ? "inset-y-1/4" : "top-1/5"
} rounded-md`
`rounded-sm h-full absolute left-2 ${
mobile ? "" : "top-1/5"
}`
),
{
width: mobile ? 70 : 105,
height: mobile ? 100 : 150,
height: mobile ? 110 : 150,
borderWidth: 2,
borderColor: "white",
},
@ -65,11 +66,11 @@ function MostViewedVideo({ videos, grades, mobile }) {
</View>
<Text
style={{
fontSize: mobile ? fontSize.lg : fontSize.xl,
fontSize: mobile ? fontSize.base : fontSize.xl,
marginTop: 5,
paddingRight: 4,
color: Colors.theme1[colorScheme].gray20,
fontFamily: "bold",
fontFamily: "regular",
}}
>
{"دوره ویدئویی" + " " + video?.name}
@ -77,7 +78,7 @@ function MostViewedVideo({ videos, grades, mobile }) {
<View
style={tw(
"w-full flex flex-row justify-between items-center px-1 mt-1"
"w-full flex flex-row justify-between items-center px-1 mt-0"
)}
>
<View style={tw("flex flex-row items-center")}>
@ -111,7 +112,7 @@ function MostViewedVideo({ videos, grades, mobile }) {
color: Colors.theme1[colorScheme].gray20,
fontFamily: "light",
fontSize: mobile ? fontSize.tiny : fontSize.lg,
marginTop: 5,
marginTop: 0
}}
>
{"پایه" + " " + grades[video?.gradeId]}

@ -39,7 +39,7 @@ const NewestVideo = ({ videos, grades, mobile }) => {
<Image
source={{ uri: `https://dnvn.ir/api/v1/file/${video.fileIds}` }}
style={[
tw("rounded-md"),
tw("rounded-sm"),
{
width: "100%",
height: ((mobile ? width / 2.3 : width / 3.3) * 3) / 4,

Loading…
Cancel
Save