| @@ -1,3 +1,4 @@ | |||
| import Image from 'next/image'; | |||
| import styles from './hover-image-card.module.css'; | |||
| const HoverImageCard = () => { | |||
| @@ -10,7 +11,7 @@ const HoverImageCard = () => { | |||
| <button className={styles.btn}>More Details</button> | |||
| </div> | |||
| {/*Change with Next Image*/} | |||
| <img src="/images/image-one.jpg" alt="text" /> | |||
| <Image src="/images/image-one.jpg" alt="text" /> | |||
| </div> | |||
| <div className={styles.card}> | |||
| <div className={styles.content}> | |||
| @@ -19,7 +20,7 @@ const HoverImageCard = () => { | |||
| <button className={styles.btn}>Button Text</button> | |||
| </div> | |||
| {/*Change with Next Image*/} | |||
| <img src="/images/image-one.jpg" alt="text" /> | |||
| <Image src="/images/image-one.jpg" alt="text" /> | |||
| </div> | |||
| <div className={styles.card}> | |||
| <div className={styles.content}> | |||
| @@ -28,7 +29,7 @@ const HoverImageCard = () => { | |||
| <button className={styles.btn}>Button Text</button> | |||
| </div> | |||
| {/*Change with Next Image*/} | |||
| <img src="/images/image-one.jpg" alt="text" /> | |||
| <Image src="/images/image-one.jpg" alt="text" /> | |||
| </div> | |||
| </div> | |||
| ); | |||
| @@ -20,10 +20,11 @@ const ContactPageForm = () => { | |||
| const { t } = useTranslation('contact'); | |||
| const [open, setOpen] = useState(false); | |||
| const handleSubmit = async (values) => { | |||
| const handleSubmit = async (values, { resetForm }) => { | |||
| try { | |||
| postQuestion(values); | |||
| setOpen(true); | |||
| resetForm({ values: '' }); | |||
| } catch (error) { | |||
| console.log(error); | |||
| } | |||
| @@ -37,7 +37,7 @@ const RegisterForm = () => { | |||
| const submitHandler = async (values) => { | |||
| try { | |||
| const result = await createUser( | |||
| await createUser( | |||
| values.fullName, | |||
| values.username, | |||
| values.email, | |||
| @@ -4,7 +4,7 @@ import { useTranslation } from 'next-i18next'; | |||
| import { useRouter } from 'next/router'; | |||
| import PropType from 'prop-types'; | |||
| import { useState } from 'react'; | |||
| import { shippingDetailsSchema } from '../../../schemas/shippingDetailsSchema'; | |||
| import shippingDetailsSchema from '../../../schemas/shippingDetailsSchema'; | |||
| import { useUserData } from '../../../store/user-context'; | |||
| import ErrorMessageComponent from '../../mui/ErrorMessageComponent'; | |||
| @@ -44,6 +44,7 @@ const ReviewContent = () => { | |||
| }); | |||
| }; | |||
| } | |||
| // eslint-disable-next-line react-hooks/exhaustive-deps | |||
| }, [checkoutStorage]); | |||
| return ( | |||
| @@ -62,13 +62,8 @@ const OrderSchema = new mongoose.Schema( | |||
| }, | |||
| ], | |||
| time: { | |||
| type: Date, | |||
| type: String, | |||
| required: [true, 'Please provide a date.'], | |||
| validate(value) { | |||
| if (!validator.isDate(value)) { | |||
| throw new Error('Not a date'); | |||
| } | |||
| }, | |||
| }, | |||
| shippingAddress: { | |||
| country: { | |||
| @@ -35,6 +35,7 @@ | |||
| "react": "18.2.0", | |||
| "react-dom": "18.2.0", | |||
| "sass": "^1.54.0", | |||
| "sharp": "^0.31.2", | |||
| "stripe": "^10.8.0", | |||
| "swr": "^1.3.0", | |||
| "validator": "^13.7.0", | |||
| @@ -42,11 +42,10 @@ const Home = (props) => { | |||
| export async function getStaticProps({ locale }) { | |||
| try { | |||
| const { message, featuredProducts } = await getFeaturedProducts(); | |||
| const { featuredProducts } = await getFeaturedProducts(); | |||
| return { | |||
| props: { | |||
| ...(await serverSideTranslations(locale, ['home'])), | |||
| message, | |||
| featuredProducts, | |||
| }, | |||
| }; | |||
| @@ -54,7 +53,6 @@ export async function getStaticProps({ locale }) { | |||
| return { | |||
| props: { | |||
| ...(await serverSideTranslations(locale, ['home'])), | |||
| errorMessage: error, | |||
| featuredProducts: [], | |||
| }, | |||
| }; | |||
| @@ -1,6 +1,6 @@ | |||
| import * as Yup from 'yup'; | |||
| export const registerSchema = Yup.object().shape({ | |||
| const registerSchema = Yup.object().shape({ | |||
| fullName: Yup.string().required('Full name is required'), | |||
| address: Yup.string().required('Address is required'), | |||
| address2: Yup.string(), | |||
| @@ -8,3 +8,5 @@ export const registerSchema = Yup.object().shape({ | |||
| country: Yup.string().required('Country name is required'), | |||
| postcode: Yup.string().required('Postal code name is required'), | |||
| }); | |||
| export default registerSchema; | |||