summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorMiqdad <ahmadmiqdad27@gmail.com>2025-10-29 11:16:06 +0700
committerMiqdad <ahmadmiqdad27@gmail.com>2025-10-29 11:16:06 +0700
commit30fed8b12bcfd7f117716cb75254bca99f5a43cb (patch)
tree7a9fc7276d9e068486d7c53a41e2fdecb6da5689 /src/lib
parentf091d443fe0cdbcb1500a5b396b180bab30affd5 (diff)
<MIqdad> cr renca
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/product/components/Product/ProductDesktopVariant.jsx13
-rw-r--r--src/lib/product/components/Product/ProductMobileVariant.jsx113
-rw-r--r--src/lib/product/components/ProductCard.jsx10
-rw-r--r--src/lib/product/components/ProductSearch.jsx2
4 files changed, 72 insertions, 66 deletions
diff --git a/src/lib/product/components/Product/ProductDesktopVariant.jsx b/src/lib/product/components/Product/ProductDesktopVariant.jsx
index 13b22802..bc07507b 100644
--- a/src/lib/product/components/Product/ProductDesktopVariant.jsx
+++ b/src/lib/product/components/Product/ProductDesktopVariant.jsx
@@ -454,7 +454,10 @@ const ProductDesktopVariant = ({
</div>
<div className='flex p-3 items-center '>
<div className='w-4/12 text-gray_r-12/70'>Terjual</div>
- <div className='w-8/12'>-</div>
+ <div className='w-8/12'>
+ {product.qtySold > 0 && <span>{product.qtySold}</span>}
+ {product.qtySold == 0 && <span>-</span>}
+ </div>
</div>
<div className='flex p-3 items-center bg-gray_r-4 '>
@@ -678,10 +681,10 @@ const ProductDesktopVariant = ({
</Button>
{discount > 0 && (product?.isFlashSale ?? 0) < 1 && (
<div className='mt-3'>
- <div className='inline-flex items-center border border-red-100 p-3 bg-orange-100 rounded-md'>
- <span className='text-sm font-semibold'>
- Pakai Voucher Hemat {currencyFormat(discount)} & potongan
- ongkir hingga Rp. 20.000
+ <div className='inline-flex items-center border border-green-500 p-3 bg-green-50 rounded-md'>
+ <span className='text-sm font-semibold text-green-700'>
+ Pakai Voucher Belanja <b>{currencyFormat(discount)} </b> &
+ Potongan Ongkir hingga <b>Rp 20.000 </b> Saat Checkout
</span>
</div>
</div>
diff --git a/src/lib/product/components/Product/ProductMobileVariant.jsx b/src/lib/product/components/Product/ProductMobileVariant.jsx
index 39cdebf0..c44de561 100644
--- a/src/lib/product/components/Product/ProductMobileVariant.jsx
+++ b/src/lib/product/components/Product/ProductMobileVariant.jsx
@@ -176,7 +176,7 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
};
fetchData();
}, [product]);
- // console.log(product);
+ console.log(product);
// console.log(product.parent.description);
const [fakeStock] = useState(() => {
@@ -204,7 +204,7 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
{currencyFormat(activeVariant?.price?.priceDiscount)}
</div>
</div>
- <div className='text-md text-gray-500 shadow-0 mt-1'>
+ <div className='text-sm text-gray-400 mt-1'>
Termasuk PPN:{' '}
{currencyFormat(
activeVariant?.price.priceDiscount * process.env.NEXT_PUBLIC_PPN
@@ -216,7 +216,7 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
{activeVariant?.price?.price > 0 ? (
<>
{currencyFormat(activeVariant?.price?.price)}
- <div className='text-sm text-gray-500 shadow-0 mt-1'>
+ <div className='text-sm text-gray-500 mt-1'>
Termasuk PPN:{' '}
{currencyFormat(
activeVariant?.price.price * process.env.NEXT_PUBLIC_PPN
@@ -399,7 +399,59 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
active={informationTab == 'specification'}
className='rounded border border-gray_r-6 divide-y divide-gray_r-6'
>
- <SpecificationContent label='Ketersediaan'>
+ {/* <SpecificationContent label='Nomor SKU'>
+ <span>SKU-{product?.id}</span>
+ </SpecificationContent> */}
+ <SpecificationContent label='Item Code'>
+ <span>{activeVariant?.code || '-'}</span>
+ </SpecificationContent>
+ <SpecificationContent label='Manufacture'>
+ <Link
+ href={createSlug(
+ '/shop/brands/',
+ product.manufacture.name,
+ product.manufacture.id.toString()
+ )}
+ >
+ {product?.manufacture.logo ? (
+ <Image
+ width={55}
+ objectFit='contain'
+ src={product.manufacture.logo}
+ alt={product.manufacture.name}
+ />
+ ) : (
+ <p className='font-bold text-red-500'>
+ {product.manufacture.name}
+ </p>
+ )}
+ </Link>
+ </SpecificationContent>{' '}
+ <SpecificationContent label='Terjual'>
+ <span className='text-sm'>{product.qtySold || '-'}</span>
+ </SpecificationContent>{' '}
+ <SpecificationContent label='Berat Barang'>
+ {activeVariant?.weight > 0 && (
+ <span>{activeVariant?.weight} KG</span>
+ )}
+ {activeVariant?.weight == 0 && (
+ <a
+ href={whatsappUrl('productWeight', {
+ name: product.name,
+ url: createSlug(
+ '/shop/product/',
+ product.name,
+ product.id,
+ true
+ ),
+ })}
+ className='text-danger-500 font-medium'
+ >
+ Tanya Berat
+ </a>
+ )}
+ </SpecificationContent>
+ <SpecificationContent label='Persiapan Barang'>
<span>
{isLoadingSLA ? (
<Skeleton width='100px' height='full' />
@@ -443,59 +495,6 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
)}
</span>
</SpecificationContent>
- {/* <SpecificationContent label='Nomor SKU'>
- <span>SKU-{product?.id}</span>
- </SpecificationContent> */}
- <SpecificationContent label='Part Number'>
- <span>{activeVariant?.code || '-'}</span>
- </SpecificationContent>
- <SpecificationContent label='Stok'>
- {activeVariant?.stock > 0 && (
- <span className='flex gap-x-1.5'>
- <div className='badge-solid-red'>Ready Stock</div>
- <div className='badge-gray'>
- {activeVariant?.stock > 5 ? '> 5' : '< 5'}
- </div>
- </span>
- )}
- {activeVariant?.stock == 0 && (
- <a
- href={whatsappUrl('product', {
- name: product.name,
- url: createSlug(
- '/shop/product/',
- product.name,
- product.id,
- true
- ),
- })}
- className='text-danger-500 font-medium'
- >
- Tanya Stok
- </a>
- )}
- </SpecificationContent>
- <SpecificationContent label='Berat Barang'>
- {activeVariant?.weight > 0 && (
- <span>{activeVariant?.weight} KG</span>
- )}
- {activeVariant?.weight == 0 && (
- <a
- href={whatsappUrl('productWeight', {
- name: product.name,
- url: createSlug(
- '/shop/product/',
- product.name,
- product.id,
- true
- ),
- })}
- className='text-danger-500 font-medium'
- >
- Tanya Berat
- </a>
- )}
- </SpecificationContent>
</TabContent>
<TabContent
diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx
index fbd5021f..b6a3cfad 100644
--- a/src/lib/product/components/ProductCard.jsx
+++ b/src/lib/product/components/ProductCard.jsx
@@ -426,7 +426,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
<Link
href={URL.product}
aria-label={product?.name}
- className='block mb-1 leading-6 !text-gray_r-12'
+ className='block mb-1 leading-6 !text-gray_r-12 line-clamp-2'
title={product?.name}
style={{
display: '-webkit-box',
@@ -625,7 +625,13 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
<Link
href={URL.product}
aria-label={product?.name}
- className={`mb-3 !text-gray_r-12 leading-6 line-clamp-3`}
+ className={`mb-3 !text-gray_r-12 leading-6 `}
+ style={{
+ display: '-webkit-box',
+ WebkitLineClamp: 2,
+ WebkitBoxOrient: 'vertical',
+ overflow: 'hidden',
+ }}
>
{product?.name}
</Link>
diff --git a/src/lib/product/components/ProductSearch.jsx b/src/lib/product/components/ProductSearch.jsx
index 805cc0e0..0c106df7 100644
--- a/src/lib/product/components/ProductSearch.jsx
+++ b/src/lib/product/components/ProductSearch.jsx
@@ -71,10 +71,8 @@ const ProductSearch = ({
params = _.pickBy(params, _.identity);
const qs = toQuery(params);
- // ganti URL tanpa nambah history & tanpa full reload
router.replace(`${prefixUrl}?${qs}`, undefined, { shallow: true });
- // sinkronkan state lokal
setOrderBy('popular');
appliedDefaultBrandOrder.current = true;