bug fix
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
'use client';
|
'use client';
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
import LogosProduct from '@/assets/product.png';
|
||||||
import { BASE_URL } from '@/shared/config/api/URLs';
|
import { BASE_URL } from '@/shared/config/api/URLs';
|
||||||
import { useCartId } from '@/shared/hooks/cartId';
|
import { useCartId } from '@/shared/hooks/cartId';
|
||||||
import formatDate from '@/shared/lib/formatDate';
|
import formatDate from '@/shared/lib/formatDate';
|
||||||
@@ -289,9 +290,11 @@ const OrderPage = () => {
|
|||||||
robot_code: 'r2',
|
robot_code: 'r2',
|
||||||
status: 'B#N',
|
status: 'B#N',
|
||||||
sales_manager_code: '1',
|
sales_manager_code: '1',
|
||||||
person_code: user?.person_id.toString(),
|
person_code: '1234567',
|
||||||
|
// user?.username.toString(),
|
||||||
currency_code: '860',
|
currency_code: '860',
|
||||||
owner_person_code: user?.person_id.toString(),
|
owner_person_code: '1234567',
|
||||||
|
// user?.username.toString(),
|
||||||
note: value.comment,
|
note: value.comment,
|
||||||
order_products: order_products,
|
order_products: order_products,
|
||||||
},
|
},
|
||||||
@@ -557,7 +560,11 @@ const OrderPage = () => {
|
|||||||
<Image
|
<Image
|
||||||
width={500}
|
width={500}
|
||||||
height={500}
|
height={500}
|
||||||
src={BASE_URL + item.product.images}
|
src={
|
||||||
|
item.product.images.length !== 0
|
||||||
|
? BASE_URL + item.product.images[0].image
|
||||||
|
: LogosProduct
|
||||||
|
}
|
||||||
alt={item.product.name}
|
alt={item.product.name}
|
||||||
className="w-16 h-16 object-contain bg-gray-100 rounded"
|
className="w-16 h-16 object-contain bg-gray-100 rounded"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
|
import LogosProduct from '@/assets/product.png';
|
||||||
import { ProductListResult } from '@/shared/config/api/product/type';
|
import { ProductListResult } from '@/shared/config/api/product/type';
|
||||||
import { BASE_URL } from '@/shared/config/api/URLs';
|
import { BASE_URL } from '@/shared/config/api/URLs';
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
@@ -186,9 +187,11 @@ const Animation: React.FC<AnimationProps> = ({
|
|||||||
<div className="relative w-full h-full bg-white">
|
<div className="relative w-full h-full bg-white">
|
||||||
<Image
|
<Image
|
||||||
src={
|
src={
|
||||||
product?.images[0].image?.includes(BASE_URL)
|
product?.images.length !== 0
|
||||||
|
? product?.images[0].image?.includes(BASE_URL)
|
||||||
? product.images[0].image
|
? product.images[0].image
|
||||||
: BASE_URL + product.images[0].image
|
: BASE_URL + product.images[0].image
|
||||||
|
: LogosProduct
|
||||||
}
|
}
|
||||||
width={500}
|
width={500}
|
||||||
height={500}
|
height={500}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { category_api } from '@/shared/config/api/category/api';
|
|||||||
import { product_api } from '@/shared/config/api/product/api';
|
import { product_api } from '@/shared/config/api/product/api';
|
||||||
import { BASE_URL } from '@/shared/config/api/URLs';
|
import { BASE_URL } from '@/shared/config/api/URLs';
|
||||||
import { Link } from '@/shared/config/i18n/navigation';
|
import { Link } from '@/shared/config/i18n/navigation';
|
||||||
|
import { cn } from '@/shared/lib/utils';
|
||||||
import { AspectRatio } from '@/shared/ui/aspect-ratio';
|
import { AspectRatio } from '@/shared/ui/aspect-ratio';
|
||||||
import { Button } from '@/shared/ui/button';
|
import { Button } from '@/shared/ui/button';
|
||||||
import { Card } from '@/shared/ui/card';
|
import { Card } from '@/shared/ui/card';
|
||||||
@@ -20,12 +21,15 @@ import { ProductCard } from '@/widgets/categories/ui/product-card';
|
|||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import { AlertCircle, ChevronLeft, ChevronRight } from 'lucide-react';
|
import { AlertCircle, ChevronLeft, ChevronRight } from 'lucide-react';
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import { useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import 'swiper/css';
|
import 'swiper/css';
|
||||||
import { banner_api } from '../lib/api';
|
import { banner_api } from '../lib/api';
|
||||||
|
|
||||||
const Welcome = () => {
|
const Welcome = () => {
|
||||||
const [api, setApi] = useState<CarouselApi>();
|
const [api, setApi] = useState<CarouselApi>();
|
||||||
|
const [apiPro, setApiPro] = useState<CarouselApi>();
|
||||||
|
const [canScrollPrev, setCanScrollPrev] = useState(false);
|
||||||
|
const [canScrollNext, setCanScrollNext] = useState(false);
|
||||||
const [apiCat, setApiCat] = useState<CarouselApi>();
|
const [apiCat, setApiCat] = useState<CarouselApi>();
|
||||||
|
|
||||||
const { data, isLoading, isError } = useQuery({
|
const { data, isLoading, isError } = useQuery({
|
||||||
@@ -36,6 +40,36 @@ const Welcome = () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!apiPro) return;
|
||||||
|
|
||||||
|
const updateButtons = () => {
|
||||||
|
setCanScrollPrev(apiPro.canScrollPrev());
|
||||||
|
setCanScrollNext(apiPro.canScrollNext());
|
||||||
|
};
|
||||||
|
|
||||||
|
updateButtons();
|
||||||
|
apiPro.on('select', updateButtons);
|
||||||
|
apiPro.on('reInit', updateButtons);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
apiPro.off('select', updateButtons);
|
||||||
|
apiPro.off('reInit', updateButtons);
|
||||||
|
};
|
||||||
|
}, [apiPro]);
|
||||||
|
|
||||||
|
const scrollPrevPro = () => {
|
||||||
|
if (apiPro) {
|
||||||
|
apiPro?.scrollPrev();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const scrollNextPro = () => {
|
||||||
|
if (apiPro) {
|
||||||
|
apiPro?.scrollNext();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const { data: category } = useQuery({
|
const { data: category } = useQuery({
|
||||||
queryKey: ['category_list'],
|
queryKey: ['category_list'],
|
||||||
queryFn: () => category_api.getCategory({ page: 1, page_size: 99 }),
|
queryFn: () => category_api.getCategory({ page: 1, page_size: 99 }),
|
||||||
@@ -182,7 +216,12 @@ const Welcome = () => {
|
|||||||
</Carousel>
|
</Carousel>
|
||||||
</div>
|
</div>
|
||||||
<section className="relative custom-container mt-5 justify-center items-center border-b border-slate-200">
|
<section className="relative custom-container mt-5 justify-center items-center border-b border-slate-200">
|
||||||
<Carousel className="w-full mt-2" setApi={setApi}>
|
<div className="flex items-center justify-between pb-3">
|
||||||
|
<div className="flex items-center gap-2 group cursor-pointer">
|
||||||
|
<div className="p-1.5 bg-slate-100 rounded-full group-hover:bg-blue-100 transition-all"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Carousel className="w-full mt-5" setApi={setApiPro}>
|
||||||
<CarouselContent className="pr-[12%] sm:pr-0">
|
<CarouselContent className="pr-[12%] sm:pr-0">
|
||||||
{productLoading &&
|
{productLoading &&
|
||||||
Array.from({ length: 6 }).map((__, index) => (
|
Array.from({ length: 6 }).map((__, index) => (
|
||||||
@@ -211,7 +250,35 @@ const Welcome = () => {
|
|||||||
</CarouselItem>
|
</CarouselItem>
|
||||||
))}
|
))}
|
||||||
</CarouselContent>
|
</CarouselContent>
|
||||||
</Carousel>
|
</Carousel>{' '}
|
||||||
|
<Button
|
||||||
|
onClick={scrollNextPro}
|
||||||
|
className={cn(
|
||||||
|
'absolute top-0 right-4 max-lg:hidden text-white cursor-pointer',
|
||||||
|
canScrollNext
|
||||||
|
? 'bg-green-600 hover:bg-green-600/70'
|
||||||
|
: 'bg-green-600/50 cursor-not-allowed',
|
||||||
|
)}
|
||||||
|
disabled={!canScrollNext}
|
||||||
|
aria-label="next images"
|
||||||
|
size="icon"
|
||||||
|
>
|
||||||
|
<ChevronRight className="size-6" />
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
onClick={scrollPrevPro}
|
||||||
|
className={cn(
|
||||||
|
'absolute top-0 right-16 max-lg:hidden text-white cursor-pointer',
|
||||||
|
canScrollPrev
|
||||||
|
? 'bg-green-600 hover:bg-green-600/70'
|
||||||
|
: 'bg-green-600/50 cursor-not-allowed',
|
||||||
|
)}
|
||||||
|
aria-label="prev images"
|
||||||
|
disabled={!canScrollPrev}
|
||||||
|
size="icon"
|
||||||
|
>
|
||||||
|
<ChevronLeft className="size-6" />
|
||||||
|
</Button>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{category &&
|
{category &&
|
||||||
|
|||||||
Reference in New Issue
Block a user