update 11 files

master
Reza_ashrafi 3 years ago
parent 8931e08769
commit 9af3148b36
  1. 3
      app.json
  2. 8
      src/components/Drawer.js
  3. 6
      src/redux/actions/comment.js
  4. 25
      src/redux/actions/file.js
  5. 3
      src/redux/reducers/comment.js
  6. 7
      src/redux/reducers/file.js
  7. 79
      src/screens/Contact/layouts/Tickets.js
  8. 24
      src/screens/Product/components/Comments.js
  9. 4
      src/screens/Product/components/Rates.js
  10. 4
      src/screens/Profile/components/User.js
  11. 2
      src/screens/ShoppingCart/index.js

@ -25,7 +25,8 @@
"foregroundImage": "",
"backgroundColor": "#FFFFFF"
},
"package": "com.appsazz.RnDanovinExpo"
"package": "com.appsazz.RnDanovinExpo",
"permissions": ["READ_EXTERNAL_STORAGE", "WRITE_EXTERNAL_STORAGE"]
},
"web": {
"favicon": ""

@ -397,7 +397,13 @@ const Drawer = ({
"flex flex-row-reverse items-center w-full justify-between"
)}
>
<Avatar source={user?.picFileIds || image} size={width / 6} action={() => pickImage()} />
<Avatar
source={
`https://dnvn.ir/api/v1/file/${user?.picFileIds}` || image
}
size={width / 6}
action={() => pickImage()}
/>
{theme === "light" ? (
<Svg
xmlns="http://www.w3.org/2000/svg"

@ -4,6 +4,10 @@ const comment = {
(data = {}) =>
async (dispatch) =>
await proxy.get("comment/list", data, { dispatch }),
myList:
(data = {}) =>
async (dispatch) =>
await proxy.get("comment/myList", data, { dispatch }),
info:
(data = {}) =>
async (dispatch) => {
@ -29,4 +33,4 @@ const comment = {
},
};
export default comment;
export default comment;

@ -4,8 +4,10 @@ const file = {
(data = {}) =>
async (dispatch) => {
var formData = new FormData();
const myData = { ...data, file: { ...data.file, type: "image/jpg" } }
for (let key in myData) formData.append(key, myData[key]);
const myData = { ...data, file: { ...data.file, type: "image/jpg" } };
formData.append("file", myData.file);
formData.append("target", "file");
console.log(formData);
return await proxy.post(
"file/upload",
formData,
@ -18,6 +20,25 @@ const file = {
formData
);
},
upload2:
(data = {}) =>
async (dispatch) => {
var formData = new FormData();
const myData = { ...data, file: { ...data.file, type: "image/jpg" } };
for (let key in myData) formData.append(key, myData[key]);
console.log(formData);
// return await proxy.post(
// "file/upload2",
// formData,
// {
// dispatch,
// headers: {
// "Content-Type": "multipart/form-data",
// },
// },
// formData
// );
},
};
export default file;

@ -4,6 +4,7 @@ const initialState = {
loading: false,
error: null,
list: null,
myList: [],
};
export default function comment(state = initialState, action) {
@ -11,6 +12,8 @@ export default function comment(state = initialState, action) {
switch (type) {
case "comment/list":
return { ...state, loading: false, error: null };
case "comment/myList":
return { ...state, myList: data, loading: false, error: null };
case "comment/update":
return { ...state, loading: false, error: null };
case "comment/add":

@ -7,6 +7,13 @@ export default function file(state = initialState, action) {
let { type, data, params } = action;
switch (type) {
case "file/upload":
console.log(data, params);
return {
...state,
loading: false,
error: null,
};
case "file/upload2":
return {
...state,
loading: false,

@ -10,6 +10,9 @@ import {
} from "react-native";
import { connect } from "react-redux";
import { useNavigation } from "@react-navigation/native";
import { comment } from "../../../redux/actions";
import moment from "jalali-moment";
//components
import CustomPressable from "../../../components/Pressable";
import Navbar from "../../../components/Navbar";
@ -20,29 +23,33 @@ import tw from "tailwind-rn";
import Colors from "../../../constants/Colors";
import fontSize from "../../../constants/fontSize";
export const Tickets = ({ theme }) => {
export const Tickets = ({ theme, getTicketList, list }) => {
const navigation = useNavigation();
const tickets = React.useMemo(() => {
return [
{
title: "موضوع تیکت",
message: "دریافت اشتباه کتاب های ارسالی از سامانه سفارشات",
target: "دپارتمان فروش و بازاریابی",
date: "1400/09/12",
isNew: true,
isAnswered: true,
},
{
title: "موضوع تیکت",
message: "دریافت اشتباه کتاب های ارسالی از سامانه سفارشات",
target: "دپارتمان فروش و بازاریابی",
date: "1400/09/12",
isNew: false,
isAnswered: false,
},
];
}, [theme]);
React.useEffect(() => {
getTicketList({ type: 2 });
}, []);
// const tickets = React.useMemo(() => {
// return [
// {
// title: "موضوع تیکت",
// message: "دریافت اشتباه کتاب های ارسالی از سامانه سفارشات",
// target: "دپارتمان فروش و بازاریابی",
// date: "1400/09/12",
// isNew: true,
// isAnswered: true,
// },
// {
// title: "موضوع تیکت",
// message: "دریافت اشتباه کتاب های ارسالی از سامانه سفارشات",
// target: "دپارتمان فروش و بازاریابی",
// date: "1400/09/12",
// isNew: false,
// isAnswered: false,
// },
// ];
// }, [theme]);
return (
<SafeAreaView
style={{
@ -62,14 +69,21 @@ export const Tickets = ({ theme }) => {
back: true,
}}
/>
{tickets.length ? (
{list?.length ? (
<ScrollView
contentContainerStyle={{ paddingBottom: 100 }}
style={tw("px-4 pt-4 flex")}
>
{tickets.map((ticket, index) => (
<Ticket ticket={ticket} key={index} theme={theme} />
))}
{list
?.filter((ticket) => ticket?.pid === null)
?.map((ticket, index) => (
<Ticket
ticket={ticket}
key={index}
theme={theme}
isAnswered={list?.filter((tickett) => tickett?.pid === ticket?.id)?.length}
/>
))}
</ScrollView>
) : (
<Empty text="هیچ تیکتی وجود ندارد." />
@ -88,9 +102,9 @@ export const Tickets = ({ theme }) => {
);
};
const Ticket = ({ ticket, theme }) => {
const Ticket = ({ ticket, theme, isAnswered }) => {
const navigation = useNavigation();
const { title, message, isNew, date, target, isAnswered } = ticket;
const { title, text, isNew, date, unit, createdAt } = ticket;
const light = React.useMemo(() => {
return theme === "light";
@ -124,7 +138,7 @@ const Ticket = ({ ticket, theme }) => {
textAlign: "left",
}}
>
{date}
{moment(createdAt).format("jYYYY/jMM/jDD")}
</Text>
<Text
style={{
@ -153,7 +167,7 @@ const Ticket = ({ ticket, theme }) => {
marginTop: 5,
}}
>
{message}
{text}
</Text>
<View style={tw("flex flex-row-reverse justify-between mt-4")}>
<Text
@ -168,7 +182,7 @@ const Ticket = ({ ticket, theme }) => {
: Colors.theme1.white,
}}
>
{target}
{unit}
</Text>
<Text
style={{
@ -201,8 +215,11 @@ const Ticket = ({ ticket, theme }) => {
const mapStateToProps = (state) => ({
theme: state.publicApi.theme,
list: state.comment.myList,
});
const mapDispatchToProps = {};
const mapDispatchToProps = {
getTicketList: comment.myList,
};
export default connect(mapStateToProps, mapDispatchToProps)(Tickets);

@ -33,6 +33,7 @@ function Commnets({
orderFullList,
theme,
mobile,
user,
}) {
React.useEffect(() => {
if (!orderFullList?.length) {
@ -51,7 +52,13 @@ function Commnets({
renderItem={({ item }) => <Comment comment={item} theme={theme} />}
keyExtractor={(item) => item?.id}
/>
<AddComment addComment={addComment} productId={productId} theme={theme} mobile={mobile} />
<AddComment
addComment={addComment}
productId={productId}
theme={theme}
mobile={mobile}
user={user}
/>
</View>
);
}
@ -125,7 +132,14 @@ const Comment = ({ comment, theme }) => {
);
};
const AddComment = ({ addComment, productId, theme, mobile, ...props }) => {
const AddComment = ({
user,
addComment,
productId,
theme,
mobile,
...props
}) => {
const [commentForm, setCommentForm] = React.useState({
title: "",
text: "",
@ -138,7 +152,10 @@ const AddComment = ({ addComment, productId, theme, mobile, ...props }) => {
behavior={ios ? "padding" : "height"}
style={[tw("flex items-end")]}
>
<Avatar source={null} size={mobile ? width / 5.5 : width / 7} />
<Avatar
source={`https://dnvn.ir/api/v1/file/${user?.picFileId}`}
size={mobile ? width / 5.5 : width / 7}
/>
<TextInput
style={[
tw("w-full mt-4 px-2 rounded-md"),
@ -215,6 +232,7 @@ const mapStateToProps = (state) => ({
orderFullList: state.userFactor.fullList,
theme: state.publicApi.theme,
mobile: state.publicApi.mobile,
user: state.user.status,
});
const mapDispatchToProps = {

@ -38,11 +38,11 @@ function Rates({ productId, addVote, isBuyed = null, theme, rateDetail }) {
}, [rateDetail]);
const rate = React.useMemo(() => {
return ((oneCount?.count || 0) * 1 +
return rateDetail?.length ? ((oneCount?.count || 0) * 1 +
(twoCount?.count || 0) * 2 +
(threeCount?.count || 0) * 3 +
(fourCount?.count || 0) * 4 +
(fiveCount?.count || 0) * 5) / rateDetail?.length;
(fiveCount?.count || 0) * 5) / rateDetail?.length : 0;
}, [rateDetail]);
return (

@ -26,7 +26,7 @@ const User = ({ user, mobile, theme, upload }) => {
const pickImage = React.useCallback(async () => {
// No permissions request is necessary for launching the image library
let result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaTypeOptions.All,
mediaTypes: ImagePicker.MediaTypeOptions.Images,
allowsEditing: true,
aspect: [1, 1],
quality: 1,
@ -55,7 +55,7 @@ const User = ({ user, mobile, theme, upload }) => {
>
<View style={tw(`flex items-center flex-row-reverse`)}>
<Avatar
source={user?.picFileIds || image}
source={`https://dnvn.ir/api/v1/file/${user?.picFileId}` || image}
size={mobile ? width / 5.5 : width / 7}
action={() => pickImage()}
/>

@ -220,7 +220,7 @@ function ShoppingCart({
},
]}
>
{isEmpty ? 0 : separate(factorInfo?.payPrice)}
{isEmpty ? 0 : separate(factorInfo?.payPrice - factorInfo?.transportPrice)}
</Text>
<Text

Loading…
Cancel
Save