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. 56
      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", : Colors.theme1[colorScheme].gray2077 + "66",
textAlign: textAlign, textAlign: textAlign,
fontFamily: "regular", fontFamily: "regular",
fontWeight: "900",
direction: direction ? direction : "rtl", direction: direction ? direction : "rtl",
}, },
}); });
@ -87,7 +86,7 @@ const FloatingLabelInput = ({
{label} {label}
</Text> </Text>
<TextInput <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)))} onChangeText={(text) => onChange(name, (text = regex(text)))}
placeholder={placeholder} placeholder={placeholder}
onFocus={() => setIsFocused(true)} onFocus={() => setIsFocused(true)}

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

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

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

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

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

@ -4,12 +4,12 @@ import {
Text, Text,
Image, Image,
ScrollView, ScrollView,
TouchableOpacity, TouchableHighlight,
Dimensions, Dimensions,
Appearance, Appearance,
Pressable, Pressable,
Platform, Platform,
ActivityIndicator ActivityIndicator,
} from "react-native"; } from "react-native";
import { useNavigation } from "@react-navigation/native"; import { useNavigation } from "@react-navigation/native";
import { product, userProduct } from "../../../redux/actions"; import { product, userProduct } from "../../../redux/actions";
@ -85,12 +85,13 @@ function Book({
</Pressable> </Pressable>
)} )}
{imageSlider && <ImageSlider />} {imageSlider && <ImageSlider />}
<View style={tw("flex flex-row-reverse")}> <View style={[tw("flex flex-row-reverse")]}>
<Image <Image
source={{ uri: `https://dnvn.ir/api/v1/file/${book?.fileIds}` }} source={{ uri: `https://dnvn.ir/api/v1/file/${book?.fileIds}` }}
resizeMode="contain"
style={[ style={[
tw("rounded-md"), tw("rounded-sm bg-red-400"),
{ height: height / 4, width: ((height / 4) * 3) / 4 }, { height: ((width / 3) * 4) / 2.6, width: width / 3 },
]} ]}
/> />
@ -106,9 +107,9 @@ function Book({
<Text <Text
style={{ style={{
color: Colors.theme1[colorScheme].green79, color: Colors.theme1[colorScheme].green79,
fontSize: mobile ? fontSize.lg : fontSize.xl3, fontSize: mobile ? fontSize.base : fontSize.xl3,
marginBottom: 5, marginBottom: 5,
fontFamily: "demi", fontFamily: "bold",
textAlign: ios ? "right" : "auto", textAlign: ios ? "right" : "auto",
}} }}
> >
@ -117,7 +118,7 @@ function Book({
<Text <Text
style={{ style={{
color: Colors.theme1[colorScheme].green79, color: Colors.theme1[colorScheme].green79,
fontSize: mobile ? fontSize.base : fontSize.xl, fontSize: mobile ? fontSize.tiny : fontSize.xl,
fontFamily: "regular", fontFamily: "regular",
}} }}
> >
@ -135,7 +136,7 @@ function Book({
</View> </View>
</View> </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> <View>
<Text <Text
@ -191,7 +192,7 @@ function Book({
</Text> </Text>
</View> </View>
</View> </View>
<View style={"flex flex-col mt-6"}> <View style={"flex flex-col mt-8"}>
<Text <Text
style={[ style={[
tw("w-full text-right"), tw("w-full text-right"),
@ -207,11 +208,10 @@ function Book({
<View style={tw("flex justify-between")}></View> <View style={tw("flex justify-between")}></View>
</View> </View>
<View style={tw("flex flex-row-reverse justify-between flex-wrap py-3")}> <View style={tw("flex flex-row-reverse justify-between flex-wrap py-3")}>
<Pressable <TouchableHighlight
underlayColor={Colors.theme1[colorScheme].greenFF + "22"}
style={[ style={[
tw( tw("flex flex-row-reverse w-full justify-between px-2 py-3 mb-4"),
"flex flex-row-reverse w-full justify-between px-2 py-3 mb-4"
),
{ {
borderWidth: 1, borderWidth: 1,
borderColor: Colors.theme1[colorScheme].greenCF, borderColor: Colors.theme1[colorScheme].greenCF,
@ -226,6 +226,7 @@ function Book({
}) })
} }
> >
<>
<Text <Text
style={{ style={{
fontFamily: "bold", fontFamily: "bold",
@ -344,8 +345,10 @@ function Book({
)} )}
</View> </View>
</View> </View>
</Pressable> </>
<Pressable </TouchableHighlight>
<TouchableHighlight
underlayColor={Colors.theme1[colorScheme].greenFF + "22"}
style={[ style={[
tw("flex flex-row-reverse justify-between px-2 py-3 mb-4"), tw("flex flex-row-reverse justify-between px-2 py-3 mb-4"),
{ {
@ -363,6 +366,7 @@ function Book({
}) })
} }
> >
<>
<Text <Text
style={{ style={{
fontFamily: "bold", fontFamily: "bold",
@ -478,8 +482,10 @@ function Book({
</View> </View>
)} )}
</View> </View>
</Pressable> </>
<Pressable </TouchableHighlight>
<TouchableHighlight
underlayColor={Colors.theme1[colorScheme].greenFF + "22"}
style={[ style={[
tw("flex flex-row-reverse justify-center px-2 py-3 mb-4"), tw("flex flex-row-reverse justify-center px-2 py-3 mb-4"),
{ {
@ -501,8 +507,9 @@ function Book({
> >
مشاهده نمونه مشاهده نمونه
</Text> </Text>
</Pressable> </TouchableHighlight>
<Pressable <TouchableHighlight
underlayColor={Colors.theme1[colorScheme].greenFF + "22"}
style={[ style={[
tw("flex flex-row-reverse justify-between px-2 py-3 mb-4"), tw("flex flex-row-reverse justify-between px-2 py-3 mb-4"),
{ {
@ -520,6 +527,7 @@ function Book({
}) })
} }
> >
<>
<Text <Text
style={{ style={{
fontFamily: "bold", fontFamily: "bold",
@ -547,8 +555,10 @@ function Book({
{separate(book?.product[2]?.price) + " " + "تومان"} {separate(book?.product[2]?.price) + " " + "تومان"}
</Text> </Text>
</View> </View>
</Pressable> </>
<Pressable </TouchableHighlight>
<TouchableHighlight
underlayColor={Colors.theme1[colorScheme].greenFF + "22"}
style={[ style={[
tw("flex flex-row-reverse justify-center px-2 py-3 mb-4"), tw("flex flex-row-reverse justify-center px-2 py-3 mb-4"),
{ {
@ -570,7 +580,7 @@ function Book({
> >
پیش نمایش پیش نمایش
</Text> </Text>
</Pressable> </TouchableHighlight>
</View> </View>
{book?.product[type]?.description && ( {book?.product[type]?.description && (
<Description description={book?.description} /> <Description description={book?.description} />

@ -18,7 +18,7 @@ function Description({ title, component, height, mobile }) {
onPress={() => refRBSheet.current.open()} onPress={() => refRBSheet.current.open()}
style={[ style={[
tw( 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', backgroundColor: Colors.theme1[colorScheme].greenCF + '15',

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

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

@ -74,7 +74,7 @@ const Season = ({
</Text> </Text>
<Pressable <Pressable
style={[ 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, borderWidth: 1,
borderColor: borderColor:
@ -117,7 +117,7 @@ const Season = ({
<View style={tw("w-full flex flex-col mb-4")}> <View style={tw("w-full flex flex-col mb-4")}>
<Pressable <Pressable
style={[ 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", backgroundColor: Colors.theme1[colorScheme].greenCF + "05",
borderWidth: 1, borderWidth: 1,

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

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

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

Loading…
Cancel
Save