reza added some change

temp
Reza_ashrafi 3 years ago
parent 81b8aa79b0
commit 79ae51e795
  1. 99
      src/components/Comments/index.js
  2. 17
      src/components/Footer/index.js
  3. 27
      src/components/ProductStatusCard/index.js
  4. 8
      src/redux/actions/public.js
  5. 8
      src/redux/reducers/blog.js
  6. 4
      src/redux/reducers/public.js
  7. 4
      src/views/Blogs/layouts/Hashtags.js
  8. 31
      src/views/Product/Desktop/index.js

@ -7,32 +7,33 @@ import Avatar from "../Avatar";
import moment from "jalali-moment";
import StarRating from "../StarRating";
export const Comments = ({ comments }) => {
export const Comments = ({ comments, indent }) => {
const [list, setList] = useState([]);
useEffect(() => {
let indentComments = comments?.sort((i, j) => i.pid - j.pid);
if (indent) {
let indentComments = comments?.sort((i, j) => i.pid - j.pid);
let result = [];
indentComments?.reduce((acc, comment) => {
let cmnt = {
id: comment?.id,
title: comment?.title,
text: comment?.text,
pid: comment?.pid,
childs: [],
};
let result = [];
indentComments?.reduce((acc, comment) => {
let cmnt = {
id: comment?.id,
title: comment?.title,
text: comment?.text,
pid: comment?.pid,
childs: [],
};
if (comment.pid) {
acc[comment.pid]?.childs?.push(cmnt);
} else {
result?.push(cmnt);
}
acc[comment?.id] = cmnt;
if (comment.pid) {
acc[comment.pid]?.childs?.push(cmnt);
} else {
result?.push(cmnt);
}
acc[comment?.id] = cmnt;
return acc;
}, []);
setList(result);
return acc;
}, []);
setList(result);
}
}, [comments]);
const Comment = ({ comment }) => {
@ -42,27 +43,19 @@ export const Comments = ({ comments }) => {
<div className="flex flex-row items-end">
<Avatar source={comment?.userImage} size={60} rounded={true} />
<div className="flex flex-col">
<strong className="text-lg mr-2">{comment.id}</strong>
{/* {comment.pid && (
<strong className="text-lg mr-2">
{"در پاسخ به" +
" " +
comments.filter(
(commentt) => commentt.id === comment.pid
)[0].id}
</strong>
)} */}
{/* <div
<div className="flex items-center">
<strong className="text-base mr-2">{comment.userId}</strong>
<span className="text-tiny text-greenBA mr-3">
{comment?.userRoll || "خریدار محصول"}
</span>
<div className="flex flex-row items-center mr-10 font-semibold">
<StarRating />
</div>
</div>
<div
className="flex flex-row divide-x divide-gray-300 mt-4 divided items-center"
style={{ direction: "ltr" }}
>
<span className="px-2 text-xs text-gray-500">
{comment?.product?.color}
</span>
<span className="px-2 text-xs text-gray-500">
{comment?.product?.name}
</span>
</div> */}
></div>
</div>
</div>
<div
@ -77,14 +70,12 @@ export const Comments = ({ comments }) => {
</span>
</div>
</header>
<div className="flex flex-row py-4">
<div className="flex flex-row">
<div style={{ width: 60 }} className="min-h-full"></div>
<div className="flex flex-1 flex-col px-3">
<header className="w-full flex flex-row justify-between items-center">
{/* <div className="flex flex-row items-center">
<StarRating />
</div> */}
{/* <div className="flex flex-row items-center">
<div>&nbsp;</div>
<div className="flex flex-row items-center">
{comment?.status === true && (
<>
<img src={positiveIcon} alt="" className="w-6 ml-2" />
@ -101,7 +92,7 @@ export const Comments = ({ comments }) => {
</span>
</>
)}
</div> */}
</div>
</header>
<p className="text-gray-500 h-auto leading-7 mt-2">
{comment?.text}
@ -111,18 +102,20 @@ export const Comments = ({ comments }) => {
</div>
</div>
</div>
<div className="flex pr-12">
{comment?.childs?.map((object, index) => (
<Comment comment={object} key={index} />
))}
</div>
{indent && (
<div className="flex pr-12">
{comment?.childs?.map((object, index) => (
<Comment comment={object} key={index} />
))}
</div>
)}
</div>
);
};
return (
<div className="w-full flex flex-col">
{list?.map((comment, index) => (
<div className="w-full flex flex-col divide-y divide-solid divide-gray-200">
{(indent ? list : comments)?.map((comment, index) => (
<Comment comment={comment} key={index} />
))}
</div>

@ -29,16 +29,21 @@ const FooterDesign1 = ({ color, bg, items, hasHeader }) => {
</p>
</div>
</div>
<div className="mr-8 text-lg font-black transform translate-y-0.5">
<h1 className="text-left mb-5">654412 021</h1>
<h1>Info[at]danovin.ir</h1>
<div className="mr-8 text-lg flex flex-col font-black transform translate-y-0.5">
<a href="tel:654412 021" className="text-left mb-5">
654412 021
</a>
<a href="https://info@danovin.ir">Info@danovin.ir</a>
</div>
</div>
<div className="flex items-center">
{/* <img src={iosIcon} alt="" className="cursor-pointer" /> */}
<a href="http://danovin.ir/app.apk" download>
<img src={bazarIcon} alt="" className="w-52 mr-6" />
<a
href="http://danovin.ir/app.apk"
download
className="py-4 px-5 text-base font-bold rounded-md bg-blueC0 transition-all transform hover:scale-110 text-white"
>
دانلود اپلیکیشن اندروید
</a>
</div>
</div>

@ -30,7 +30,7 @@ const ProductStatusCard = ({
shippingTime,
}) => {
return (
<section className="w-full" style={{minWidth: 350 }}>
<section className="w-full" style={{ minWidth: 350 }}>
<div className="bg-grayF9 rounded-md px-4 py-2 divide-y divide-solid divide-gray-200">
<div className="flex flex-row items-center justify-between py-3">
<div className="flex flex-row items-center">
@ -39,7 +39,6 @@ const ProductStatusCard = ({
<div className="text-sm">{`توصیه به خرید توسط ${suggestedCounter} نفر`}</div>
</div>
</div>
<img src={circle} alt="" className="w-5" />
</div>
{seller && (
<div className="flex flex-row items-center justify-between py-3">
@ -61,7 +60,6 @@ const ProductStatusCard = ({
</div>
</div>
</div>
<img src={circle} alt="" className="w-5" />
</div>
{garanty && (
<div className="flex flex-row items-center justify-between py-3">
@ -71,24 +69,23 @@ const ProductStatusCard = ({
<div className="flex flex-row gap-1 text-sm">{garanty}</div>
</div>
</div>
<img src={circle} alt="" className="w-5" />
</div>
)}
{offerPrice && (
<div className="flex flex-col items-center py-3">
<p className="text-xl text-blueC0 font-bold">
{separate(price)}
<span className="text-sm text-gray-700 font-light mr-1">
تومان
</span>
</p>
<div className="flex flex-col items-center py-3">
<p className="text-6xl text-blueC0 font-bold">
{separate(price)}
<span className="text-sm text-gray-700 font-light mr-1">تومان</span>
</p>
{offerPrice && (
<p className="text-xs font-light text-gray-600 mt-2">
با خرید این کالا
<span>{offerPrice}</span>
<span className="text-sm font-bold">{' ' + separate(price - offerPrice) + ' ' + 'تومان '}</span>
صرفه جویی کنید
</p>
</div>
)}
)}
</div>
<Button
title="اضافه کردن به سبد خرید"
backgroundColor={isDark ? "bg-blueC0" : "bg-blueC0"}

@ -1,4 +1,5 @@
import proxy from "../proxy";
const publicApi = {
setOverLayer: (data) => async (dispatch) =>
await dispatch({ type: "public/setOverLayer", data }),
@ -19,7 +20,6 @@ const publicApi = {
await proxy.get("public/vod/bookCourse", data, { dispatch });
await proxy.get("book/info", data2, { dispatch });
},
bookSection:
(data = {}) =>
async (dispatch) =>
@ -28,12 +28,6 @@ const publicApi = {
(data = {}) =>
async (dispatch) =>
await proxy.get("public/contact", data, { dispatch }),
getBlogList: (data) => async (dispatch) =>
await proxy.get("public/blogList", data, { dispatch }),
getBlogInfo: (data) => async (dispatch) =>
await proxy.get("public/blogInfo", data, { dispatch }),
setSubscribe: (data) => async (dispatch) =>
await dispatch({ type: "public/setSubscribe", data }),
getProvince:

@ -40,7 +40,13 @@ export default function blog(state = initialState, action) {
let { type, data } = action;
switch (type) {
case "public/blogList":
return { ...state, loading: false, list: data, error: null };
return {
...state,
loading: false,
list: data,
hashtags: [...new Set(data.map((object) => object.tag))],
error: null,
};
case "public/blogInfo":
return { ...state, loading: false, error: null, blog: data };
case "blog/loading":

@ -175,10 +175,6 @@ export default function publicApi(state = initialState, action) {
return { ...state, loading: false, error: null, arList: data };
case "public/contact":
return { ...state, loading: false, error: null, contactData: data };
case "public/blogList":
return { ...state, loading: false, error: null, blogList: data };
case "public/blogInfo":
return { ...state, loading: false, error: null, blog: data };
case "public/setSubscribe":
return { ...state, loading: false, error: null, selectedSubscribe: data };
case "public/province":

@ -10,8 +10,8 @@ export const Hashtags = ({ hashtags }) => {
<img src={arrowIcon} alt="" className="w-7" />
<ul className="list-none flex justify-around items-center lg:flex-1 lg:ml-0 ml-4">
{hashtags.map((hashtag, index) => (
<li className="text-tiny font-semibold cursor-pointer w-32 lg:px-0 flex-1 lg:w-auto" style={{ color: hashtag.color }}>
{"#" + " " + hashtag.title}
<li className="text-tiny font-semibold cursor-pointer w-32 lg:px-0 flex-1 lg:w-auto">
{"#" + " " + hashtag}
</li>
))}
</ul>

@ -1,10 +1,14 @@
import React, { useEffect } from "react";
//components
import ProductOverAll from "./ProductOverAll";
import ProductTab from "../../../components/ProductTab";
import ProductSuggestions from "../../../components/ProductSuggestion";
import Rate from "../Rate";
import Comments from "../../../components/Comments";
import QandA from "../../../components/QandA";
import Table from "../../Video/components/Desktop/Table";
const DesktopProductLayout = () =>{
useEffect(() => {
@ -13,7 +17,30 @@ const DesktopProductLayout = () =>{
return (
<div className="w-11/12 flex flex-col overflow-y-hidden mt-3 mb-64 items-center">
<ProductOverAll />
<ProductTab />
<ProductTab
tabs={[
{
title: "مشخصات",
components: <Table />,
},
{
title: "نقد و بررسی",
components: (
<div className="bg-gray-100 rounded-md mt-4 w-full flex justify-center items-center h-40 text-green4F text-tiny">
این بخش فعلا قابل دسترسی نیست.
</div>
),
},
{
title: "پرسش و پاسخ",
components: (
<div className="bg-gray-100 rounded-md mt-4 w-full flex justify-center items-center h-40 text-green4F text-tiny">
این بخش فعلا قابل دسترسی نیست.
</div>
),
},
]}
/>
<div className="w-full">
<ProductSuggestions />
</div>
@ -21,7 +48,7 @@ const DesktopProductLayout = () =>{
<Rate desktop />
</div>
<div className="w-4/5">
<Comments />
<Comments indent={false} />
{/* <QandA /> */}
</div>

Loading…
Cancel
Save