From 4f3f76a484c19b983f70f91a6ebf9146f3aef22f Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Tue, 23 Jan 2024 16:20:42 +0700 Subject: Add watermark on product card image --- src/lib/product/components/ProductCard.jsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index fa555bcf..0b42d28a 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -6,6 +6,7 @@ import { createSlug } from '@/core/utils/slug' import whatsappUrl from '@/core/utils/whatsappUrl' import ImageNext from 'next/image' import { useRouter } from 'next/router' +import { useMemo } from 'react' const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { const router = useRouter() @@ -16,6 +17,11 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { url: createSlug('/shop/product/', product.name, product.id, true) }) + const image = useMemo(() => { + if (product.image) return product.image + '?watermark=true' + return '/images/noimage.jpeg' + }, [product.image]) + if (variant == 'vertical') { return (
@@ -24,7 +30,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { className='border-b border-gray_r-4 relative' > {product?.name} @@ -150,7 +156,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { className='relative' > {product?.name} -- cgit v1.2.3 From 8ddb3b49117d60f4e389161b356a12f3355b5a78 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 25 Jan 2024 14:51:22 +0700 Subject: Add square ratio on product image --- src/lib/product/components/ProductCard.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 0b42d28a..1cec0804 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -18,7 +18,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { }) const image = useMemo(() => { - if (product.image) return product.image + '?watermark=true' + if (product.image) return product.image + '?ratio=square' return '/images/noimage.jpeg' }, [product.image]) -- cgit v1.2.3 From 03822992ac1eb2fb930ca2a6298c75df44dfa527 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Thu, 25 Jan 2024 15:04:33 +0700 Subject: fixing error page search muncul brand logo nya --- src/lib/product/components/ProductSearch.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/product/components/ProductSearch.jsx b/src/lib/product/components/ProductSearch.jsx index ed4365a8..90e93aa0 100644 --- a/src/lib/product/components/ProductSearch.jsx +++ b/src/lib/product/components/ProductSearch.jsx @@ -105,7 +105,7 @@ const ProductSearch = ({ setIsBrand(null); } }; - if (router.pathname.includes('search')) { + if (router.pathname.includes('search') && q !== '*') { checkIfBrand(); } }, [q]); -- cgit v1.2.3 From f7701abcbe05510c3672c4768df03fee535956e3 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Tue, 30 Jan 2024 09:03:20 +0700 Subject: handling form form --- src/lib/form/components/KunjunganSales.jsx | 11 +++++++++++ src/lib/form/components/KunjunganService.jsx | 10 ++++++++++ src/lib/form/components/Merchant.jsx | 9 +++++++++ src/lib/form/components/PembayaranTempo.jsx | 14 +++++++++++++- src/lib/form/components/RequestForQuotation.jsx | 10 ++++++++++ src/lib/form/components/SuratDukungan.jsx | 9 +++++++++ 6 files changed, 62 insertions(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/form/components/KunjunganSales.jsx b/src/lib/form/components/KunjunganSales.jsx index 7470395a..29940edf 100644 --- a/src/lib/form/components/KunjunganSales.jsx +++ b/src/lib/form/components/KunjunganSales.jsx @@ -10,6 +10,9 @@ import * as Yup from 'yup' import createLeadApi from '../api/createLeadApi' import PageContent from '@/lib/content/components/PageContent' +import useAuth from '@/core/hooks/useAuth' +import { useRouter } from 'next/router' + const KunjunganSales = () => { const { register, @@ -23,10 +26,18 @@ const KunjunganSales = () => { }) const [cities, setCities] = useState([]) const [companyTypes, setCompanyTypes] = useState([]) + const router = useRouter() + + const auth = useAuth() + + const recaptchaRef = useRef(null) useEffect(() => { + if(!auth) { + router.push('/login') + } const loadCities = async () => { let dataCities = await cityApi() dataCities = dataCities.map((obj) => ({ value: obj.name, label: obj.name })) diff --git a/src/lib/form/components/KunjunganService.jsx b/src/lib/form/components/KunjunganService.jsx index 1cb0b446..0e1d1ab3 100644 --- a/src/lib/form/components/KunjunganService.jsx +++ b/src/lib/form/components/KunjunganService.jsx @@ -8,6 +8,9 @@ import { toast } from 'react-hot-toast' import * as Yup from 'yup' import createLeadApi from '../api/createLeadApi' import PageContent from '@/lib/content/components/PageContent' +import { useRouter } from 'next/router' + +import useAuth from '@/core/hooks/useAuth' const CreateKunjunganService = () => { const { @@ -22,10 +25,17 @@ const CreateKunjunganService = () => { }) const [cities, setCities] = useState([]) const [company_unit, setCompany_unit] = useState([]) + + const router = useRouter() + + const auth = useAuth() const recaptchaRef = useRef(null) useEffect(() => { + if(!auth) { + router.push('/login') + } const loadCities = async () => { let dataCities = await cityApi() dataCities = dataCities.map((city) => ({ value: city.id, label: city.name })) diff --git a/src/lib/form/components/Merchant.jsx b/src/lib/form/components/Merchant.jsx index 6c1af231..770bfb82 100644 --- a/src/lib/form/components/Merchant.jsx +++ b/src/lib/form/components/Merchant.jsx @@ -8,6 +8,9 @@ import { toast } from 'react-hot-toast'; import * as Yup from 'yup'; import createLeadApi from '../api/createLeadApi'; import PageContent from '@/lib/content/components/PageContent'; +import { useRouter } from 'next/router'; +import useAuth from '@/core/hooks/useAuth' + const CreateMerchant = () => { const { @@ -50,8 +53,14 @@ const CreateMerchant = () => { const [company_unit, setCompany_unit] = useState(list_unit); const recaptchaRef = useRef(null); + const router = useRouter() + + const auth = useAuth() useEffect(() => { + if(!auth) { + router.push('/login') + } const loadCities = async () => { let dataCities = await cityApi(); dataCities = dataCities.map((city) => ({ diff --git a/src/lib/form/components/PembayaranTempo.jsx b/src/lib/form/components/PembayaranTempo.jsx index 8c624fe2..73ceee49 100644 --- a/src/lib/form/components/PembayaranTempo.jsx +++ b/src/lib/form/components/PembayaranTempo.jsx @@ -1,12 +1,15 @@ import getFileBase64 from '@/core/utils/getFileBase64' import { yupResolver } from '@hookform/resolvers/yup' -import React, { useRef } from 'react' +import React, { useEffect, useRef } from 'react' import ReCAPTCHA from 'react-google-recaptcha' import { useForm } from 'react-hook-form' import { toast } from 'react-hot-toast' import * as Yup from 'yup' import createLeadApi from '../api/createLeadApi' import PageContent from '@/lib/content/components/PageContent' +import { useRouter } from 'next/router' + +import useAuth from '@/core/hooks/useAuth' const PembayaranTempo = () => { @@ -21,6 +24,15 @@ const PembayaranTempo = () => { }) const recaptchaRef = useRef(null) + const router = useRouter() + + const auth = useAuth() + + useEffect(() => { + if(!auth) { + router.push('/login') + } + },[]) const onSubmitHandler = async (values) => { const recaptchaValue = recaptchaRef.current.getValue() diff --git a/src/lib/form/components/RequestForQuotation.jsx b/src/lib/form/components/RequestForQuotation.jsx index fa526d5f..34434dd5 100644 --- a/src/lib/form/components/RequestForQuotation.jsx +++ b/src/lib/form/components/RequestForQuotation.jsx @@ -10,6 +10,9 @@ import * as Yup from 'yup' import createLeadApi from '../api/createLeadApi' import getFileBase64 from '@/core/utils/getFileBase64' import PageContent from '@/lib/content/components/PageContent' +import { useRouter } from 'next/router' + +import useAuth from '@/core/hooks/useAuth' const RequestForQuotation = () => { const { @@ -26,8 +29,15 @@ const RequestForQuotation = () => { const quotationFileRef = useRef(null) const recaptchaRef = useRef(null) + const router = useRouter() + + const auth = useAuth() + useEffect(() => { + if(!auth) { + router.push('/login') + } const loadCities = async () => { let dataCities = await cityApi() dataCities = dataCities.map((obj) => ({ value: obj.name, label: obj.name })) diff --git a/src/lib/form/components/SuratDukungan.jsx b/src/lib/form/components/SuratDukungan.jsx index d73c3fab..0b3b650e 100644 --- a/src/lib/form/components/SuratDukungan.jsx +++ b/src/lib/form/components/SuratDukungan.jsx @@ -10,6 +10,9 @@ import createLeadsApi from '../api/createLeadApi'; import PageContent from '@/lib/content/components/PageContent'; +import useAuth from '@/core/hooks/useAuth' +import { useRouter } from 'next/router'; + const CreateSuratDukungan = () => { const { register, @@ -25,8 +28,14 @@ const CreateSuratDukungan = () => { const [company_unit, setCompany_unit] = useState([]); const recaptchaRef = useRef(null); + const router = useRouter() + + const auth = useAuth() useEffect(() => { + if(!auth) { + router.push('/login') + } const loadCities = async () => { let dataCities = await cityApi(); dataCities = dataCities.map((city) => ({ -- cgit v1.2.3