reza fixed and build app

master
Reza_ashrafi 3 years ago
parent 45773daa26
commit 75b33697d5
  1. 4
      src/components/Drawer.js
  2. 41
      src/screens/Address/index.js
  3. 55
      src/screens/Blog/index.js
  4. 3
      src/screens/Blogs/layouts/Header.js
  5. 17
      src/screens/DeliveryForm/Address/index.js
  6. 1
      src/screens/Home/components/MyBooks.js
  7. 2
      src/screens/Home/index.js
  8. 120
      src/screens/Product/components/Book.js
  9. 6
      src/screens/Products/components/Header.js
  10. 350
      src/screens/Products/components/Main.js
  11. 59
      src/screens/Profile/components/ProfileAddress/index.js
  12. 8
      src/screens/Profile/components/User.js
  13. 2
      src/screens/Profile/index.js
  14. 2
      src/screens/QR/layouts/Scan/index.js

@ -270,8 +270,10 @@ const Drawer = ({
{},
]}
onPress={() => {
navigation.navigate(route.route);
setBoxPosition();
setTimeout(() => {
navigation.navigate(route.route);
}, 300);
}}
>
{route.icon}

@ -9,6 +9,7 @@ import {
Dimensions,
Appearance,
KeyboardAvoidingView,
TextInput,
TouchableWithoutFeedback,
} from "react-native";
import React, { useEffect, useState } from "react";
@ -151,7 +152,7 @@ const Address = ({
}
);
}
if (cel.length !== 11) {
if (cellphone.length !== 11) {
return asyncAwesomeAlert(
"خطا",
"شماره موبایل میبایست یازده رقم باشد.",
@ -361,7 +362,6 @@ const Address = ({
title="اطلاعات هویتی"
text="( لطفا نام و نام خانوادگی خود را به طور کامل وارد نمایید )"
/>
<MapSelector />
<CustomTextInput
label={profilePage ? "نام" : "نام تحویل گیرنده"}
placeholder=""
@ -443,7 +443,6 @@ const Address = ({
}
autoFocus={false}
regex={(text) => onInput.numberOnly(text)}
editable={false}
/>
<CustomTextInput
keyboardType="numeric"
@ -474,7 +473,7 @@ const Address = ({
? provinces?.filter(
(province) => province.id === profileFields.provinceId
)[0]?.name || province[0]
: city[0]
: province[0]
}
onChange={(name, value) =>
value === "استان" ? {} : onChange(name, value)
@ -501,6 +500,40 @@ const Address = ({
name="cityId"
/>
</View>
{!profilePage ? (
<TextInput
style={[
tw("w-full mt-4 py-4 px-2 rounded-md h-40"),
{
backgroundColor:
theme === "light" ? Colors.theme1.grayF9 : null,
color:
theme === "light"
? Colors.theme1.gray20
: Colors.theme1.white,
fontSize: fontSize.tiny,
textAlign: "right",
fontFamily: "light",
borderWidth: 1,
borderColor:
theme === "light"
? Colors.theme1.grayE3
: Colors.theme1.white + "55",
},
]}
value={mapAddress}
multiline={true}
textAlignVertical="top"
placeholder="آدرس مورد نظر ..."
onChangeText={(text) => setMapAddress(text)}
placeholderTextColor={
theme === "light"
? Colors.theme1.gray2077
: Colors.theme1.white + "aa"
}
/>
) : null}
<View style={tw("mb-4")}>
<CustomTextInput
keyboardType="numeric"

@ -15,6 +15,7 @@ import { connect } from "react-redux";
import { blog, publicApi } from "../../redux/actions";
import { LinearGradient } from "expo-linear-gradient";
import HTMLView from "react-native-htmlview";
import moment from "jalali-moment";
//components
import Header from "../Blogs/layouts/Header";
@ -121,7 +122,7 @@ export const Blog = ({ getInfo, blog, getList, blogs, route, theme }) => {
textAlign: ios ? "right" : "auto",
}}
>
{"نوشته از:" + " " + "کامران ایزدی"}
{/* {"نوشته از:" + " " + "کامران ایزدی"} */}
</Text>
<Text
style={{
@ -136,7 +137,8 @@ export const Blog = ({ getInfo, blog, getList, blogs, route, theme }) => {
</View>
</View>
<View style="flex justify-center items-end">
<Text
{
blog?.duration ? <Text
style={{
fontFamily: "regular",
color: Colors.theme1.white,
@ -144,8 +146,10 @@ export const Blog = ({ getInfo, blog, getList, blogs, route, theme }) => {
textAlign: ios ? "left" : "left",
}}
>
{"زمان مطالعه" + " " + "۳۰ دقیقه"}
</Text>
{"زمان مطالعه" + " " + blog?.duration + " دقیقه"}
</Text> : null
}
<Text
style={{
fontFamily: "regular",
@ -154,7 +158,9 @@ export const Blog = ({ getInfo, blog, getList, blogs, route, theme }) => {
textAlign: ios ? "left" : "left",
}}
>
{"1400/11/24"}
{
moment(blog?.createdAt).format('jYYYY/jMM/jDD')
}
</Text>
</View>
</View>
@ -189,6 +195,40 @@ export const Blog = ({ getInfo, blog, getList, blogs, route, theme }) => {
value={blog?.text}
renderNode={renderNode}
stylesheet={{
h1 : {
color:
theme === "light"
? Colors.theme1.gray20
: Colors.theme1.grayF9,
textAlign: "right",
fontFamily: "bold",
lineHeight: 25,
fontSize: fontSize.xl4,
marginVertical: -15,
paddingTop: 5,
},
h2 : {
color:
theme === "light"
? Colors.theme1.gray20
: Colors.theme1.grayF9,
textAlign: "right",
fontFamily: "bold",
lineHeight: 25,
fontSize: fontSize.xl,
marginVertical: -10,
},
h3 : {
color:
theme === "light"
? Colors.theme1.gray20
: Colors.theme1.grayF9,
textAlign: "right",
fontFamily: "bold",
lineHeight: 25,
fontSize: fontSize.lg,
marginVertical: -10,
},
p: {
color:
theme === "light"
@ -197,7 +237,7 @@ export const Blog = ({ getInfo, blog, getList, blogs, route, theme }) => {
textAlign: "right",
fontFamily: "light",
lineHeight: 25,
marginVertical: -35,
marginVertical: -20,
},
strong: {
color:
@ -221,6 +261,9 @@ export const Blog = ({ getInfo, blog, getList, blogs, route, theme }) => {
fontFamily: "light",
lineHeight: 25,
},
span : {
color : 'red'
}
}}
/>
</View>

@ -58,8 +58,7 @@ export const Header = ({ title, theme }) => {
<Text
style={{
fontSize: fontSize.sm,
fontWeight: "light",
color: Colors.theme1.green79,
color: theme === "light" ? Colors.theme1.green79 : Colors.theme1.grayE3,
}}
>
مشاهده بیشتر

@ -58,18 +58,13 @@ const Address = ({
>
{loading ? (
userAddressId !== address?.id ? (
<ActivityIndicator
size="small"
color={Colors.theme1.greenC8}
/>
<ActivityIndicator size="small" color={Colors.theme1.greenC8} />
) : (
<View
style={[
tw("w-5 h-5 rounded-full"),
{
backgroundColor: active
? Colors.theme1.greenCF
: "white",
backgroundColor: active ? Colors.theme1.greenCF : "white",
borderWidth: userAddressId === address?.id ? 4 : 1,
borderColor:
userAddressId === address?.id
@ -99,8 +94,8 @@ const Address = ({
};
const light = React.useMemo(() => {
return theme === 'light';
},[theme]);
return theme === "light";
}, [theme]);
return (
<View style={tw("w-full mt-2")}>
@ -117,7 +112,9 @@ const Address = ({
style={[
{
backgroundColor: light ? Colors.theme1.grayE3 + "44" : null,
borderColor: light ? Colors.theme1.gray2077 + "55" : Colors.theme1.grayE3,
borderColor: light
? Colors.theme1.gray2077 + "55"
: Colors.theme1.grayE3,
borderWidth: 1.5,
},
tw(

@ -20,6 +20,7 @@ import fontSize from "../../../constants/fontSize";
const ios = Platform.OS === "ios";
function MyBooks({ books, grades, theme }) {
console.log(books);
return books?.filter((book) => book.condition >= 2).length ? (
<View style={[tw("flex w-full mb-5")]}>
<View

@ -82,7 +82,7 @@ const Home = ({
) : null}
<Scroll books={books} />
<Videos videos={books} />
{/* <Videos videos={books} /> */}
<Blogs blogs={blogs} />
</ScrollView>
</SafeAreaView>

@ -53,6 +53,18 @@ function Book({
}, 500);
}, [type]);
const physicalProduct = React.useMemo(() => {
return book?.product?.filter((product) => product?.productType === 2)[0];
});
const digitalProduct = React.useMemo(() => {
return book?.product?.filter((product) => product?.productType === 1)[0];
});
const videoProduct = React.useMemo(() => {
return book?.product?.filter((product) => product?.productType === 4)[0];
});
const physicalAvailabileInCart = React.useMemo(() => {
return userProducts?.filter(
(product) => product?.productId === book?.product[1]?.id
@ -206,7 +218,15 @@ function Book({
}}
>
{" "}
{"فیزیکی- دیجیتالی - ویدئو" + "\n" + "در دسترس"}
{`${
videoProduct
? "ویدئو"
: "" + physicalProduct
? "فیزیکی"
: "" + digitalProduct
? "دیجیتال"
: ""
} \n در دسترس`}
</Text>
</View>
<View
@ -231,13 +251,16 @@ function Book({
</Text>
</View>
</View>
{book?.product?.length > 1 ? (
<View style={"flex mt-8"}>
<Text
style={[
tw("w-full text-right"),
{
color:
theme === "light" ? Colors.theme1.green79 : Colors.theme1.white,
theme === "light"
? Colors.theme1.green79
: Colors.theme1.white,
fontSize: mobile ? fontSize.tiny : fontSize.lg,
fontFamily: "demi",
@ -248,16 +271,19 @@ function Book({
</Text>
<View style={tw("flex justify-between")}></View>
</View>
) : null}
<View style={tw("flex flex-row-reverse justify-between flex-wrap py-3")}>
{physicalProduct ? (
<TouchableHighlight
underlayColor={Colors.theme1.greenFF + "22"}
style={[
tw("flex flex-row-reverse w-full justify-between px-2 py-3 mb-4"),
tw("flex flex-row-reverse justify-between px-2 py-3 mb-4"),
{
borderWidth: 1,
borderColor: Colors.theme1.greenCF,
backgroundColor:
theme === "light" ? Colors.theme1.greenFF + "0a" : null,
width: width - 32 - 8 - (fontSize.sm * 6 + 18),
},
]}
onPress={() =>
@ -277,7 +303,7 @@ function Book({
)
: addToCart(
pushToCart({
productId: book?.product[1]?.id,
productId: physicalProduct?.id,
userId: userId,
count: 1,
}),
@ -329,12 +355,48 @@ function Book({
},
]}
>
{(separate(book?.product[1]?.price) || " ") + " " + "تومان"}
{(separate(physicalProduct?.price) || " ") + " " + "تومان"}
</Text>
</View>
</View>
</>
</TouchableHighlight>
) : null}
{physicalProduct ? (
<TouchableHighlight
underlayColor={Colors.theme1.greenFF + "22"}
style={[
tw("flex flex-row-reverse justify-center px-2 py-3 mb-4"),
{
borderWidth: 1,
borderColor: Colors.theme1.greenCF,
backgroundColor:
theme === "light" ? Colors.theme1.greenFF + "0a" : null,
width: fontSize.sm * 6 + 18,
},
]}
onPress={() =>
navigation.push("Sample", { id: book?.sampleFileId })
}
>
<Text
style={{
fontFamily: "bold",
fontSize: fontSize.xs,
color:
theme === "light"
? Colors.theme1.green79
: Colors.theme1.greenCF,
paddingVertical: 4,
}}
>
مشاهده نمونه
</Text>
</TouchableHighlight>
) : null}
{digitalProduct ? (
<TouchableHighlight
underlayColor={Colors.theme1.greenFF + "22"}
style={[
@ -364,7 +426,7 @@ function Book({
)
: addToCart(
pushToCart({
productId: book?.product[0]?.id,
productId: digitalProduct?.id,
userId: userId,
count: 1,
}),
@ -415,11 +477,13 @@ function Book({
},
]}
>
{(separate(book?.product[0]?.price) || " ") + " " + "تومان"}
{(separate(digitalProduct?.price) || " ") + " " + "تومان"}
</Text>
</View>
</>
</TouchableHighlight>
) : null}
{digitalProduct ? (
<TouchableHighlight
underlayColor={Colors.theme1.greenFF + "22"}
style={[
@ -432,7 +496,7 @@ function Book({
width: fontSize.sm * 6 + 18,
},
]}
onPress={() => navigation.push("Sample", { id: book?.sampleFileId })}
onPress={() => navigation.navigate("Video", { id: book?.id })}
>
<Text
style={{
@ -446,9 +510,12 @@ function Book({
paddingVertical: 4,
}}
>
مشاهده نمونه
پیش نمایش
</Text>
</TouchableHighlight>
) : null}
{videoProduct ? (
<TouchableHighlight
underlayColor={Colors.theme1.greenFF + "22"}
style={[
@ -478,7 +545,7 @@ function Book({
)
: addToCart(
pushToCart({
productId: book?.product[2]?.id,
productId: videoProduct?.id,
userId: userId,
count: 1,
}),
@ -528,42 +595,13 @@ function Book({
},
]}
>
{(separate(book?.product[2]?.price) || " ") + " " + "تومان"}
{(separate(videoProduct?.price) || " ") + " " + "تومان"}
</Text>
</View>
</>
</TouchableHighlight>
<TouchableHighlight
underlayColor={Colors.theme1.greenFF + "22"}
style={[
tw("flex flex-row-reverse justify-center px-2 py-3 mb-4"),
{
borderWidth: 1,
borderColor: Colors.theme1.greenCF,
backgroundColor:
theme === "light" ? Colors.theme1.greenFF + "0a" : null,
width: fontSize.sm * 6 + 18,
},
]}
onPress={() => navigation.navigate("Video", { id: book?.id })}
>
<Text
style={{
fontFamily: "bold",
fontSize: fontSize.xs,
color:
theme === "light"
? Colors.theme1.green79
: Colors.theme1.greenCF,
paddingVertical: 4,
}}
>
پیش نمایش
</Text>
</TouchableHighlight>
) : null}
</View>
{console.log(book?.text)}
{book?.text ? (
<LinkBox
title="توضیحات"

@ -19,7 +19,7 @@ const Header = ({ setFilterOptions, filterOptions, levels, productTypes }) => {
value={filterOptions.search}
/>
<View style={[tw("flex flex-1 flex-row justify-between items-center")]}>
<Select
{/* <Select
defaultValue={productTypes[0]}
onChange={(name, value) =>
value !== "نوع محصول"
@ -29,7 +29,7 @@ const Header = ({ setFilterOptions, filterOptions, levels, productTypes }) => {
options={productTypes}
width={"48%"}
name="productType"
/>
/> */}
<Select
defaultValue={Object.values(levels)[0]}
onChange={(name, value) =>
@ -38,7 +38,7 @@ const Header = ({ setFilterOptions, filterOptions, levels, productTypes }) => {
: setFilterOptions({ ...filterOptions, [name]: null })
}
options={Object.values(levels)}
width={"48%"}
width={"100%"}
name="grade"
/>
</View>

@ -70,77 +70,82 @@ const Main = ({ books, filterOptions, grades, mobile, theme }) => {
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[2]?.price)}{" "}
<Text style={{ fontSize: fontSize.sm }}>تومان</Text>
</Text>
</Pressable>
// <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>
<></>
))
: bySearchFilter?.map((product, index) => (
<React.Fragment key={index}>
@ -149,103 +154,108 @@ const Main = ({ books, filterOptions, grades, mobile, theme }) => {
? 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[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 : 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>
<></>
) : null}
{(
productType
@ -333,7 +343,7 @@ const Main = ({ books, filterOptions, grades, mobile, theme }) => {
},
]}
>
{separate(product?.product[1].price)}
{separate(product?.product[0].price)}
</Text>
<Text
style={{
@ -365,8 +375,8 @@ const Main = ({ books, filterOptions, grades, mobile, theme }) => {
),
]}
>
{filterOptions?.productType === "دوره ویدئویی" ? Items(2) : null}
{filterOptions?.productType === "کتاب دیجیتال" ? Items(0) : null}
{/* {filterOptions?.productType === "دوره ویدئویی" ? Items(2) : null} */}
{/* {filterOptions?.productType === "کتاب دیجیتال" ? Items(0) : null} */}
{filterOptions?.productType === "کتاب فیزیکی" ? Items(1) : null}
{!filterOptions?.productType ? Items(0) : null}
{/* {filterLoading && (

@ -12,7 +12,9 @@ import {
} from "react-native";
import React from "react";
import { connect } from "react-redux";
import { asyncAwesomeAlert } from "../../../../utils/AsyncWrappers";
import { useNavigation } from "@react-navigation/native";
import { Ionicons, Entypo } from "@expo/vector-icons";
import { userAddress, userFactor } from "../../../../redux/actions";
import Svg, { G, Path } from "react-native-svg";
@ -36,7 +38,9 @@ const ProfileAddress = ({
userAddressId,
getFactorInfo,
mobile,
theme
loading,
theme,
deleteItem,
}) => {
const navigation = useNavigation();
const [height, setHeight] = React.useState(Dimensions.get("window").height);
@ -91,15 +95,11 @@ const ProfileAddress = ({
فعال
</Text>
</View>
<Svg xmlns="http://www.w3.org/2000/svg" width={24} height={24}>
<G fill="#07612c" data-name="vuesax/linear/more">
<Path d="M10 19a2 2 0 1 0 2-2 2.006 2.006 0 0 0-2 2Z" />
<Path
data-name="Vector"
d="M10 5a2 2 0 1 0 2-2 2.006 2.006 0 0 0-2 2ZM10 12a2 2 0 1 0 2-2 2.006 2.006 0 0 0-2 2Z"
<Entypo
name="dots-three-vertical"
size={24}
color={theme === "light" ? "#52796F" : Colors.theme1.white}
/>
</G>
</Svg>
</View>
) : null}
<View style={tw(`flex w-full ${active ? "" : "flex-row-reverse"}`)}>
@ -157,22 +157,35 @@ const ProfileAddress = ({
</Text>
</View>
{!active ? (
<Svg xmlns="http://www.w3.org/2000/svg" width={24} height={24}>
<G
fill={Colors.theme1.gray20}
data-name="vuesax/linear/more"
<View style={tw("flex flex-row-reverse")}>
<Pressable style={tw("ml-2")}>
<Ionicons
name="ios-pencil-sharp"
size={20}
color={theme === "light" ? "#52796F" : Colors.theme1.white}
/>
</Pressable>
<Pressable
onPress={() =>
asyncAwesomeAlert("", "آدرس مورد نظر حذف شود؟", {
showCancelButton: true,
confirmText: "بله",
cancelText: "لغو",
onConfirm: () => deleteItem({ id: address.id }),
})
}
>
<Path d="M10 19a2 2 0 1 0 2-2 2.006 2.006 0 0 0-2 2Z" />
<Path
data-name="Vector"
d="M10 5a2 2 0 1 0 2-2 2.006 2.006 0 0 0-2 2ZM10 12a2 2 0 1 0 2-2 2.006 2.006 0 0 0-2 2Z"
<Ionicons
name="trash-bin"
size={20}
color={theme === "light" ? "#52796F" : Colors.theme1.white}
/>
</G>
</Svg>
</Pressable>
</View>
) : null}
</View>
<CustomPressable
{/* <CustomPressable
title={"مشاهده روی نقشه"}
backgroundColor={
active
@ -183,7 +196,7 @@ const ProfileAddress = ({
border={{ color: "#196EC0", width: 0 }}
width={"100%"}
onPress={() => {}}
/>
/> */}
</View>
</Pressable>
);
@ -281,13 +294,14 @@ const mapStateToProps = (state) => ({
loading: state.userFactor.loading,
addresses: state.userAddress.list,
mobile: state.publicApi.mobile,
theme: state.publicApi.theme
theme: state.publicApi.theme,
});
const mapDispatchToProps = {
getFactorInfo: userFactor.info,
update: userFactor.update,
getList: userAddress.list,
deleteItem: userAddress.del,
};
export default connect(mapStateToProps, mapDispatchToProps)(ProfileAddress);
@ -298,7 +312,6 @@ const styles = StyleSheet.create({
position: "relative",
},
container: {
backgroundColor: "white",
flexDirection: "column",
paddingVertical: 0,
paddingHorizontal: 0,

@ -67,7 +67,7 @@ const User = ({ user, mobile, theme }) => {
</Text>
</View>
</View>
<Svg
{/* <Svg
xmlns="http://www.w3.org/2000/svg"
width={24}
height={24}
@ -78,9 +78,9 @@ const User = ({ user, mobile, theme }) => {
fill="#c6c6c6"
data-name="vuesax/bold/arrow-down"
/>
</Svg>
</Svg> */}
</Pressable>
{dropdown ? (
{/* {dropdown ? (
<View style={tw(`flex flex-col pr-16 ${ios ? "items-end" : " "}`)}>
<Pressable
style={tw(`flex w-full ${mobile ? "mt-0" : "mt-4"}`)}
@ -130,7 +130,7 @@ const User = ({ user, mobile, theme }) => {
</View>
</Pressable>
</View>
) : null}
) : null} */}
</View>
);
};

@ -65,7 +65,7 @@ function Profile({ mobile, theme, logout, loading }) {
style={styles.container}
>
<User />
<Trophy />
{/* <Trophy /> */}
<List />
<Pressable
style={tw(`flex w-full ${mobile ? "mt-0" : "mt-4"}`)}

@ -57,10 +57,12 @@ function Scan({ theme, page }) {
)}
>
<View style={{ width: height / 2.5, height: height / 2.5 }}>
{hasPermission ? (
<BarCodeScanner
onBarCodeScanned={scanned ? undefined : handleBarCodeScanned}
style={{ width: "100%", height: "100%" }}
/>
) : null}
</View>
{/* {scanned && ( */}

Loading…
Cancel
Save