fixed some bugs: filter, detail
This commit is contained in:
@@ -27,7 +27,7 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
margin: 8px 14px 6px;
|
margin: 8px 14px 6px;
|
||||||
@media screen and (max-width: 426px) {
|
@media screen and (max-width: 500px) {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
margin: 8px 10px 6px;
|
margin: 8px 10px 6px;
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
gap: 10px;
|
gap: 10px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@media screen and (max-width: 426px) {
|
@media screen and (max-width: 500px) {
|
||||||
height: 40px;
|
height: 40px;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
padding: 10px 15px 6px;
|
padding: 10px 15px 6px;
|
||||||
@@ -73,11 +73,11 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
img{
|
img{
|
||||||
width: 300px;
|
width: 300px;
|
||||||
@media screen and (max-width: 426px) {
|
@media screen and (max-width: 500px) {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@media screen and (max-width: 426px) {
|
@media screen and (max-width: 500px) {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@
|
|||||||
@media screen and (min-width: 1024px) {
|
@media screen and (min-width: 1024px) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@media screen and (max-width: 426px) {
|
@media screen and (max-width: 500px) {
|
||||||
padding: 9px 0;
|
padding: 9px 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -276,7 +276,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
@media screen and (max-width: 426px) {
|
@media screen and (max-width: 500px) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,15 +29,15 @@ const ImageCarousel = ({
|
|||||||
: images[0]?.images_1200x1200 || "";
|
: images[0]?.images_1200x1200 || "";
|
||||||
|
|
||||||
// Auto-slide functionality
|
// Auto-slide functionality
|
||||||
useEffect(() => {
|
// useEffect(() => {
|
||||||
if (!hasMultipleImages || isModalOpen) return;
|
// if (!hasMultipleImages || isModalOpen) return;
|
||||||
|
|
||||||
const interval = setInterval(() => {
|
// const interval = setInterval(() => {
|
||||||
setCurrentIndex((prev) => (prev === images.length - 1 ? 0 : prev + 1));
|
// setCurrentIndex((prev) => (prev === images.length - 1 ? 0 : prev + 1));
|
||||||
}, 9000);
|
// }, 9000);
|
||||||
|
|
||||||
return () => clearInterval(interval);
|
// return () => clearInterval(interval);
|
||||||
}, [hasMultipleImages, images, isModalOpen]);
|
// }, [hasMultipleImages, images, isModalOpen]);
|
||||||
|
|
||||||
// Reset zoom/rotation when modal closes or image changes
|
// Reset zoom/rotation when modal closes or image changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -179,6 +179,8 @@ export default {
|
|||||||
similarProducts: "Similar Products",
|
similarProducts: "Similar Products",
|
||||||
description: "Product description",
|
description: "Product description",
|
||||||
price: "Price",
|
price: "Price",
|
||||||
|
readMore: "Read more...",
|
||||||
|
readLess: "Show less",
|
||||||
},
|
},
|
||||||
wishtList: {
|
wishtList: {
|
||||||
likedProducts: "Favorites",
|
likedProducts: "Favorites",
|
||||||
|
|||||||
@@ -176,6 +176,8 @@ export default {
|
|||||||
similarProducts: "Похожие товары",
|
similarProducts: "Похожие товары",
|
||||||
description: "Описание товара",
|
description: "Описание товара",
|
||||||
price: "Цена",
|
price: "Цена",
|
||||||
|
readMore: "Читать далее...",
|
||||||
|
readLess: "Свернуть",
|
||||||
},
|
},
|
||||||
wishtList: {
|
wishtList: {
|
||||||
likedProducts: "Избранные",
|
likedProducts: "Избранные",
|
||||||
|
|||||||
@@ -179,6 +179,8 @@ export default {
|
|||||||
similarProducts: "Meňzeş harytlar",
|
similarProducts: "Meňzeş harytlar",
|
||||||
description: "Haryt barada düşündiriş",
|
description: "Haryt barada düşündiriş",
|
||||||
price: "Bahasy",
|
price: "Bahasy",
|
||||||
|
readMore: "Giňişleýin oka...",
|
||||||
|
readLess: "Gysgaltmak",
|
||||||
},
|
},
|
||||||
wishtList: {
|
wishtList: {
|
||||||
likedProducts: "Halanlarym",
|
likedProducts: "Halanlarym",
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ const useCategoryProducts = ({
|
|||||||
!isSubCategory &&
|
!isSubCategory &&
|
||||||
!searchQuery &&
|
!searchQuery &&
|
||||||
!selectedFilterCategory &&
|
!selectedFilterCategory &&
|
||||||
!selectedFilterBrand &&
|
|
||||||
!brandId &&
|
!brandId &&
|
||||||
!collectionId;
|
!collectionId;
|
||||||
|
|
||||||
@@ -79,6 +78,7 @@ const useCategoryProducts = ({
|
|||||||
page: currentPage,
|
page: currentPage,
|
||||||
min_price: minPrice || undefined,
|
min_price: minPrice || undefined,
|
||||||
max_price: maxPrice || undefined,
|
max_price: maxPrice || undefined,
|
||||||
|
brands: selectedFilterBrand || undefined,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
skip: !shouldUseBaseQuery,
|
skip: !shouldUseBaseQuery,
|
||||||
@@ -158,14 +158,6 @@ const useCategoryProducts = ({
|
|||||||
|
|
||||||
const executeFetch = async () => {
|
const executeFetch = async () => {
|
||||||
try {
|
try {
|
||||||
if (selectedFilterBrand) {
|
|
||||||
await fetchBrandPaginated({
|
|
||||||
id: selectedFilterBrand,
|
|
||||||
...fetchParams,
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selectedFilterCategory) {
|
if (selectedFilterCategory) {
|
||||||
await fetchCategoryPaginated({
|
await fetchCategoryPaginated({
|
||||||
category: {
|
category: {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
background: #fff;
|
background: #fff;
|
||||||
// padding: 20px;
|
// padding: 20px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
width: 35%;
|
width: 36%;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
|
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
|
||||||
|
|
||||||
@@ -167,6 +167,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.addToCartButton {
|
.addToCartButton {
|
||||||
@@ -350,6 +351,29 @@
|
|||||||
line-height: 1.7;
|
line-height: 1.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.productDescriptionCollapsed {
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-line-clamp: 10;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.readMoreBtn {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
color: #1890ff;
|
||||||
|
font-weight: 500;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 8px 0 0 0;
|
||||||
|
font-size: 14px;
|
||||||
|
display: inline-block;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ─── Mobile sticky bar ────────────────────────────────────────────
|
// ─── Mobile sticky bar ────────────────────────────────────────────
|
||||||
.productActionsMobile {
|
.productActionsMobile {
|
||||||
display: none;
|
display: none;
|
||||||
@@ -376,7 +400,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 2px;
|
gap: 2px;
|
||||||
width: 35%;
|
width: 45%;
|
||||||
|
|
||||||
.price {
|
.price {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
@@ -395,7 +419,7 @@
|
|||||||
.mobileBtnContainer {
|
.mobileBtnContainer {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
width: 65%;
|
width: 55%;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── Similar products ─────────────────────────────────────────────
|
// ─── Similar products ─────────────────────────────────────────────
|
||||||
|
|||||||
@@ -63,6 +63,18 @@ const ProductPage = ({
|
|||||||
favoriteProducts.some((fav) => fav.product?.id === product?.id),
|
favoriteProducts.some((fav) => fav.product?.id === product?.id),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const [isDescExpanded, setIsDescExpanded] = useState(false);
|
||||||
|
const [showReadMore, setShowReadMore] = useState(false);
|
||||||
|
const descRef = React.useRef(null);
|
||||||
|
const productInfoRef = React.useRef(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!product?.description) return;
|
||||||
|
|
||||||
|
const plainText = product.description.replace(/<[^>]*>/g, "").trim();
|
||||||
|
setShowReadMore(plainText.length > 300);
|
||||||
|
}, [product?.description]);
|
||||||
|
|
||||||
const { getCartItem } = useCart();
|
const { getCartItem } = useCart();
|
||||||
|
|
||||||
const [addToCart] = useAddToCartMutation();
|
const [addToCart] = useAddToCartMutation();
|
||||||
@@ -319,7 +331,7 @@ const ProductPage = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* KOLON 2: İsim + Meta + Description */}
|
{/* KOLON 2: İsim + Meta + Description */}
|
||||||
<div className={styles.productInfo}>
|
<div className={styles.productInfo} ref={productInfoRef}>
|
||||||
{/* Meta tablo */}
|
{/* Meta tablo */}
|
||||||
<div className={styles.productMeta}>
|
<div className={styles.productMeta}>
|
||||||
<h1 className={styles.productTitle}>{product.name}</h1>
|
<h1 className={styles.productTitle}>{product.name}</h1>
|
||||||
@@ -374,9 +386,28 @@ const ProductPage = ({
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className={styles.productDescription}
|
ref={descRef}
|
||||||
|
className={`${styles.productDescription} ${
|
||||||
|
!isDescExpanded ? styles.productDescriptionCollapsed : ""
|
||||||
|
}`}
|
||||||
dangerouslySetInnerHTML={{ __html: product.description }}
|
dangerouslySetInnerHTML={{ __html: product.description }}
|
||||||
/>
|
/>
|
||||||
|
{showReadMore && !isDescExpanded && (
|
||||||
|
<button
|
||||||
|
className={styles.readMoreBtn}
|
||||||
|
onClick={() => setIsDescExpanded(true)}
|
||||||
|
>
|
||||||
|
{t("product.readMore")}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
{showReadMore && isDescExpanded && (
|
||||||
|
<button
|
||||||
|
className={styles.readMoreBtn}
|
||||||
|
onClick={() => setIsDescExpanded(false)}
|
||||||
|
>
|
||||||
|
{t("product.readLess")}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user