diff --git a/components/auth/LoginView.tsx b/components/auth/LoginView.tsx index 5e513deb9..32769fa2b 100644 --- a/components/auth/LoginView.tsx +++ b/components/auth/LoginView.tsx @@ -1,6 +1,6 @@ import { FC, useEffect, useState, useCallback } from 'react' import { Logo, Button, Input } from '@components/ui' -import useLogin from '@framework/auth/use-login' +// import useLogin from '@framework/auth/use-login' import { useUI } from '@components/ui/context' import { validate } from 'email-validator' @@ -16,7 +16,7 @@ const LoginView: FC = () => { const [disabled, setDisabled] = useState(false) const { setModalView, closeModal } = useUI() - const login = useLogin() + // const login = useLogin() const handleLogin = async (e: React.SyntheticEvent) => { e.preventDefault() @@ -29,14 +29,14 @@ const LoginView: FC = () => { try { setLoading(true) setMessage('') - await login({ - email, - password, - }) + // await login({ + // email, + // password, + // }) setLoading(false) closeModal() } catch ({ errors }) { - setMessage(errors[0].message) + // setMessage(errors[0].message) setLoading(false) setDisabled(false) } @@ -59,17 +59,17 @@ const LoginView: FC = () => { return (
{message && ( -
+
{message}. Did you {` `} setModalView('FORGOT_VIEW')} > forgot your password? @@ -87,11 +87,11 @@ const LoginView: FC = () => { > Log In -
+
Don't have an account? {` `} setModalView('SIGNUP_VIEW')} > Sign Up diff --git a/components/auth/SignUpView.tsx b/components/auth/SignUpView.tsx index a85a3bc27..55ae8dbd9 100644 --- a/components/auth/SignUpView.tsx +++ b/components/auth/SignUpView.tsx @@ -3,7 +3,7 @@ import { validate } from 'email-validator' import { Info } from '@components/icons' import { useUI } from '@components/ui/context' import { Logo, Button, Input } from '@components/ui' -import useSignup from '@framework/auth/use-signup' +// import useSignup from '@framework/auth/use-signup' interface Props {} @@ -18,7 +18,7 @@ const SignUpView: FC = () => { const [dirty, setDirty] = useState(false) const [disabled, setDisabled] = useState(false) - const signup = useSignup() + // const signup = useSignup() const { setModalView, closeModal } = useUI() const handleSignup = async (e: React.SyntheticEvent) => { @@ -32,12 +32,12 @@ const SignUpView: FC = () => { try { setLoading(true) setMessage('') - await signup({ - email, - firstName, - lastName, - password, - }) + // await signup({ + // email, + // firstName, + // lastName, + // password, + // }) setLoading(false) closeModal() } catch ({ errors }) { @@ -63,14 +63,14 @@ const SignUpView: FC = () => { return (
{message && ( -
{message}
+
{message}
)} @@ -80,12 +80,12 @@ const SignUpView: FC = () => { {' '} - + Info: Passwords must be longer than 7 chars and include numbers.{' '} -
+
- + Do you have an account? {` `}
setModalView('LOGIN_VIEW')} > Log In diff --git a/components/cart/CartItem/CartItem.tsx b/components/cart/CartItem/CartItem.tsx index 334761b54..180e7dd63 100644 --- a/components/cart/CartItem/CartItem.tsx +++ b/components/cart/CartItem/CartItem.tsx @@ -6,9 +6,9 @@ import s from './CartItem.module.css' import { Trash, Plus, Minus, Cross } from '@components/icons' import { useUI } from '@components/ui/context' import type { LineItem } from '@commerce/types/cart' -import usePrice from '@framework/product/use-price' -import useUpdateItem from '@framework/cart/use-update-item' -import useRemoveItem from '@framework/cart/use-remove-item' +// import usePrice from '@framework/product/use-price' +// import useUpdateItem from '@framework/cart/use-update-item' +// import useRemoveItem from '@framework/cart/use-remove-item' import Quantity from '@components/ui/Quantity' type ItemOption = { @@ -31,36 +31,36 @@ const CartItem = ({ const { closeSidebarIfPresent } = useUI() const [removing, setRemoving] = useState(false) const [quantity, setQuantity] = useState(item.quantity) - const removeItem = useRemoveItem() - const updateItem = useUpdateItem({ item }) + // const removeItem = useRemoveItem() + // const updateItem = useUpdateItem({ item }) - const { price } = usePrice({ - amount: item.variant.price * item.quantity, - baseAmount: item.variant.listPrice * item.quantity, - currencyCode, - }) + // const { price } = usePrice({ + // amount: item.variant.price * item.quantity, + // baseAmount: item.variant.listPrice * item.quantity, + // currencyCode, + // }) - const handleChange = async ({ - target: { value }, - }: ChangeEvent) => { - setQuantity(Number(value)) - await updateItem({ quantity: Number(value) }) - } + // const handleChange = async ({ + // target: { value }, + // }: ChangeEvent) => { + // setQuantity(Number(value)) + // await updateItem({ quantity: Number(value) }) + // } - const increaseQuantity = async (n = 1) => { - const val = Number(quantity) + n - setQuantity(val) - await updateItem({ quantity: val }) - } + // const increaseQuantity = async (n = 1) => { + // const val = Number(quantity) + n + // setQuantity(val) + // await updateItem({ quantity: val }) + // } - const handleRemove = async () => { - setRemoving(true) - try { - await removeItem(item) - } catch (error) { - setRemoving(false) - } - } + // const handleRemove = async () => { + // setRemoving(true) + // try { + // await removeItem(item) + // } catch (error) { + // setRemoving(false) + // } + // } // TODO: Add a type for this const options = (item as any).options @@ -82,8 +82,8 @@ const CartItem = ({ })} {...rest} > -
-
+
+ -
+ - {variant === 'default' && ( + {/* {variant === 'default' && ( increaseQuantity(1)} decrease={() => increaseQuantity(-1)} /> - )} + )} */} ) } diff --git a/components/cart/CartSidebarView/CartSidebarView.tsx b/components/cart/CartSidebarView/CartSidebarView.tsx index 2fa7980f2..ef6e6a69b 100644 --- a/components/cart/CartSidebarView/CartSidebarView.tsx +++ b/components/cart/CartSidebarView/CartSidebarView.tsx @@ -6,54 +6,54 @@ import CartItem from '../CartItem' import { Button, Text } from '@components/ui' import { useUI } from '@components/ui/context' import { Bag, Cross, Check } from '@components/icons' -import useCart from '@framework/cart/use-cart' -import usePrice from '@framework/product/use-price' +// import useCart from '@framework/cart/use-cart' +// import usePrice from '@framework/product/use-price' import SidebarLayout from '@components/common/SidebarLayout' const CartSidebarView: FC = () => { const { closeSidebar, setSidebarView } = useUI() - const { data, isLoading, isEmpty } = useCart() + // const { data, isLoading, isEmpty } = useCart() - const { price: subTotal } = usePrice( - data && { - amount: Number(data.subtotalPrice), - currencyCode: data.currency.code, - } - ) - const { price: total } = usePrice( - data && { - amount: Number(data.totalPrice), - currencyCode: data.currency.code, - } - ) + // const { price: subTotal } = usePrice( + // data && { + // amount: Number(data.subtotalPrice), + // currencyCode: data.currency.code, + // } + // ) + // const { price: total } = usePrice( + // data && { + // amount: Number(data.totalPrice), + // currencyCode: data.currency.code, + // } + // ) const handleClose = () => closeSidebar() - const goToCheckout = () => setSidebarView('CHECKOUT_VIEW') + // const goToCheckout = () => setSidebarView('CHECKOUT_VIEW') - const error = null - const success = null + // const error = null + // const success = null return ( - {isLoading || isEmpty ? ( -
- + {/* {isLoading || isEmpty ? ( +
+

Your cart is empty

-

+

Biscuit oat cake wafer icing ice cream tiramisu pudding cupcake.

) : error ? ( -
- +
+

@@ -62,8 +62,8 @@ const CartSidebarView: FC = () => {

) : success ? ( -
- +
+

@@ -72,7 +72,7 @@ const CartSidebarView: FC = () => {

) : ( <> -
+ -
+
  • Subtotal @@ -106,7 +106,7 @@ const CartSidebarView: FC = () => { FREE
-
+
Total {total}
@@ -123,7 +123,7 @@ const CartSidebarView: FC = () => {
- )} + )} */} ) } diff --git a/components/checkout/CheckoutSidebarView/CheckoutSidebarView.tsx b/components/checkout/CheckoutSidebarView/CheckoutSidebarView.tsx index 9d8661bfa..4aa607a53 100644 --- a/components/checkout/CheckoutSidebarView/CheckoutSidebarView.tsx +++ b/components/checkout/CheckoutSidebarView/CheckoutSidebarView.tsx @@ -4,80 +4,80 @@ import CartItem from '@components/cart/CartItem' import { Button, Text } from '@components/ui' import { useUI } from '@components/ui/context' import SidebarLayout from '@components/common/SidebarLayout' -import useCart from '@framework/cart/use-cart' -import usePrice from '@framework/product/use-price' -import useCheckout from '@framework/checkout/use-checkout' +// import useCart from '@framework/cart/use-cart' +// import usePrice from '@framework/product/use-price' +// import useCheckout from '@framework/checkout/use-checkout' import ShippingWidget from '../ShippingWidget' import PaymentWidget from '../PaymentWidget' import s from './CheckoutSidebarView.module.css' const CheckoutSidebarView: FC = () => { const { setSidebarView, closeSidebar } = useUI() - const { data: cartData } = useCart() - const { data: checkoutData, submit: onCheckout } = useCheckout() + // const { data: cartData } = useCart() + // const { data: checkoutData, submit: onCheckout } = useCheckout() - async function handleSubmit(event: React.ChangeEvent) { - event.preventDefault() + // async function handleSubmit(event: React.ChangeEvent) { + // event.preventDefault() - await onCheckout() + // await onCheckout() - closeSidebar() - } + // closeSidebar() + // } - const { price: subTotal } = usePrice( - cartData && { - amount: Number(cartData.subtotalPrice), - currencyCode: cartData.currency.code, - } - ) - const { price: total } = usePrice( - cartData && { - amount: Number(cartData.totalPrice), - currencyCode: cartData.currency.code, - } - ) + // const { price: subTotal } = usePrice( + // cartData && { + // amount: Number(cartData.subtotalPrice), + // currencyCode: cartData.currency.code, + // } + // ) + // const { price: total } = usePrice( + // cartData && { + // amount: Number(cartData.totalPrice), + // currencyCode: cartData.currency.code, + // } + // ) return ( setSidebarView('CART_VIEW')} > -
+
Checkout - setSidebarView('PAYMENT_VIEW')} /> setSidebarView('SHIPPING_VIEW')} - /> + /> */}
    - {cartData!.lineItems.map((item: any) => ( + {/* {cartData!.lineItems.map((item: any) => ( - ))} + ))} */}
  • Subtotal - {subTotal} + {/* {subTotal} */}
  • Taxes @@ -88,16 +88,16 @@ const CheckoutSidebarView: FC = () => { FREE
-
+
Total - {total} + {/* {total} */}
{/* Once data is correcly filled */} diff --git a/components/common/UserNav/DropdownMenu.tsx b/components/common/UserNav/DropdownMenu.tsx index f79fd5821..f7cff6950 100644 --- a/components/common/UserNav/DropdownMenu.tsx +++ b/components/common/UserNav/DropdownMenu.tsx @@ -8,7 +8,7 @@ import { Avatar } from '@components/common' import { Moon, Sun } from '@components/icons' import { useUI } from '@components/ui/context' import ClickOutside from '@lib/click-outside' -import useLogout from '@framework/auth/use-logout' +// import useLogout from '@framework/auth/use-logout' import { disableBodyScroll, @@ -36,7 +36,7 @@ const LINKS = [ ] const DropdownMenu: FC = ({ open = false }) => { - const logout = useLogout() + // const logout = useLogout() const { pathname } = useRouter() const { theme, setTheme } = useTheme() const [display, setDisplay] = useState(false) @@ -110,7 +110,7 @@ const DropdownMenu: FC = ({ open = false }) => {
  • logout()} + // onClick={() => logout()} > Logout diff --git a/components/common/UserNav/UserNav.tsx b/components/common/UserNav/UserNav.tsx index 1df559953..10263e645 100644 --- a/components/common/UserNav/UserNav.tsx +++ b/components/common/UserNav/UserNav.tsx @@ -2,8 +2,8 @@ import { FC } from 'react' import Link from 'next/link' import cn from 'classnames' import type { LineItem } from '@commerce/types/cart' -import useCart from '@framework/cart/use-cart' -import useCustomer from '@framework/customer/use-customer' +// import useCart from '@framework/cart/use-cart' +// import useCustomer from '@framework/customer/use-customer' import { Avatar } from '@components/common' import { Heart, Bag } from '@components/icons' import { useUI } from '@components/ui/context' @@ -19,7 +19,7 @@ const countItem = (count: number, item: LineItem) => count + item.quantity const UserNav: FC = ({ className }) => { // const { data } = useCart() - const { data: customer } = useCustomer() + // const { data: customer } = useCustomer() const { toggleSidebar, closeSidebarIfPresent, openModal } = useUI() // const itemsCount = data?.lineItems.reduce(countItem, 0) ?? 0 @@ -50,17 +50,17 @@ const UserNav: FC = ({ className }) => { )} {process.env.COMMERCE_CUSTOMERAUTH_ENABLED && (
  • - {customer ? ( + {/* {customer ? ( - ) : ( - - )} + ) : ( */} + + {/* )} */}
  • )} diff --git a/components/product/ProductCard/ProductCard.tsx b/components/product/ProductCard/ProductCard.tsx index 95f2f3f07..0e539160b 100644 --- a/components/product/ProductCard/ProductCard.tsx +++ b/components/product/ProductCard/ProductCard.tsx @@ -5,7 +5,7 @@ import type { Product } from '@commerce/types/product' import s from './ProductCard.module.css' import Image, { ImageProps } from 'next/image' import WishlistButton from '@components/wishlist/WishlistButton' -import usePrice from '@framework/product/use-price' +// import usePrice from '@framework/product/use-price' import ProductTag from '../ProductTag' interface Props { @@ -25,11 +25,11 @@ const ProductCard: FC = ({ noNameTag = false, variant = 'default', }) => { - const { price } = usePrice({ - amount: product.price.value, - baseAmount: product.price.retailPrice, - currencyCode: product.price.currencyCode!, - }) + // const { price } = usePrice({ + // amount: product.price.value, + // baseAmount: product.price.retailPrice, + // currencyCode: product.price.currencyCode!, + // }) const rootClassName = cn( s.root, @@ -74,7 +74,7 @@ const ProductCard: FC = ({ {product.name}
    - {`${price} ${product.price?.currencyCode}`} + {/* {`${price} ${product.price?.currencyCode}`} */}
    )} @@ -104,10 +104,10 @@ const ProductCard: FC = ({ variant={product.variants[0] as any} /> )} - + /> */}
    {product?.images && ( = ({ product, className }) => { - const addItem = useAddItem() + // const addItem = useAddItem() const { openSidebar } = useUI() const [loading, setLoading] = useState(false) const [selectedOptions, setSelectedOptions] = useState({}) @@ -29,11 +29,11 @@ const ProductSidebar: FC = ({ product, className }) => { const addToCart = async () => { setLoading(true) try { - await addItem({ - productId: String(product.id), - variantId: String(variant ? variant.id : product.variants[0].id), - }) - openSidebar() + // await addItem({ + // productId: String(product.id), + // variantId: String(variant ? variant.id : product.variants[0].id), + // }) + // openSidebar() setLoading(false) } catch (err) { setLoading(false) @@ -48,12 +48,12 @@ const ProductSidebar: FC = ({ product, className }) => { setSelectedOptions={setSelectedOptions} /> -
    +
    -
    36 reviews
    +
    36 reviews
    {process.env.COMMERCE_CART_ENABLED && ( diff --git a/components/product/ProductView/ProductView.tsx b/components/product/ProductView/ProductView.tsx index 5c85eb084..a0d900ecc 100644 --- a/components/product/ProductView/ProductView.tsx +++ b/components/product/ProductView/ProductView.tsx @@ -4,7 +4,7 @@ import { NextSeo } from 'next-seo' import s from './ProductView.module.css' import { FC } from 'react' import type { Product } from '@commerce/types/product' -import usePrice from '@framework/product/use-price' +// import usePrice from '@framework/product/use-price' import { WishlistButton } from '@components/wishlist' import { ProductSlider, ProductCard } from '@components/product' import { Container, Text } from '@components/ui' @@ -16,22 +16,22 @@ interface ProductViewProps { } const ProductView: FC = ({ product, relatedProducts }) => { - const { price } = usePrice({ - amount: product.price.value, - baseAmount: product.price.retailPrice, - currencyCode: product.price.currencyCode!, - }) + // const { price } = usePrice({ + // amount: product.price.value, + // baseAmount: product.price.retailPrice, + // currencyCode: product.price.currencyCode!, + // }) return ( <> - +
    - + /> */}
    {product.images.map((image, i) => ( @@ -61,13 +61,13 @@ const ProductView: FC = ({ product, relatedProducts }) => {

    -
    +
    Related Products
    {relatedProducts.map((p) => (
    cat.slug === category) - const activeBrand = brands.find( - (b: any) => getSlug(b.node.path) === `brands/${brand}` - )?.node - - const { data } = useSearch({ - search: typeof q === 'string' ? q : '', - categoryId: activeCategory?.id, - brandId: (activeBrand as any)?.entityId, - sort: typeof sort === 'string' ? sort : '', - locale, - }) - - const handleClick = (event: any, filter: string) => { - if (filter !== activeFilter) { - setToggleFilter(true) - } else { - setToggleFilter(!toggleFilter) - } - setActiveFilter(filter) - } - - return ( - -
    -
    - {/* Categories */} -
    -
    - - - -
    - -
    - - {/* Designs */} -
    -
    - - - -
    - -
    -
    - {/* Products */} -
    - {(q || activeCategory || activeBrand) && ( -
    - {data ? ( - <> - - Showing {data.products.length} results{' '} - {q && ( - <> - for "{q}" - - )} - - - {q ? ( - <> - There are no products that match "{q}" - - ) : ( - <> - There are no products that match the selected category. - - )} - - - ) : q ? ( - <> - Searching for: "{q}" - - ) : ( - <>Searching... - )} -
    - )} - {data ? ( -
    - {data.products.map((product: Product) => ( - - ))} -
    - ) : ( -
    - {rangeMap(12, (i) => ( - -
    - - ))} -
    - )}{' '} -
    - - {/* Sort */} -
    -
    -
    - - - -
    - -
    -
    -
    - - ) +export default function Search() { + return
    } +// export default function Search({ categories, brands }: SearchPropsType) { +// const [activeFilter, setActiveFilter] = useState('') +// const [toggleFilter, setToggleFilter] = useState(false) + +// const router = useRouter() +// const { asPath, locale } = router +// const { q, sort } = router.query +// // `q` can be included but because categories and designers can't be searched +// // in the same way of products, it's better to ignore the search input if one +// // of those is selected +// const query = filterQuery({ sort }) + +// const { pathname, category, brand } = useSearchMeta(asPath) +// const activeCategory = categories.find((cat: any) => cat.slug === category) +// const activeBrand = brands.find( +// (b: any) => getSlug(b.node.path) === `brands/${brand}` +// )?.node + +// const { data } = useSearch({ +// search: typeof q === 'string' ? q : '', +// categoryId: activeCategory?.id, +// brandId: (activeBrand as any)?.entityId, +// sort: typeof sort === 'string' ? sort : '', +// locale, +// }) + +// const handleClick = (event: any, filter: string) => { +// if (filter !== activeFilter) { +// setToggleFilter(true) +// } else { +// setToggleFilter(!toggleFilter) +// } +// setActiveFilter(filter) +// } + +// return ( +// +//
    +//
    +// {/* Categories */} +//
    +//
    +// +// +// +//
    +// +//
    + +// {/* Designs */} +//
    +//
    +// +// +// +//
    +// +//
    +//
    +// {/* Products */} +//
    +// {(q || activeCategory || activeBrand) && ( +//
    +// {data ? ( +// <> +// +// Showing {data.products.length} results{' '} +// {q && ( +// <> +// for "{q}" +// +// )} +// +// +// {q ? ( +// <> +// There are no products that match "{q}" +// +// ) : ( +// <> +// There are no products that match the selected category. +// +// )} +// +// +// ) : q ? ( +// <> +// Searching for: "{q}" +// +// ) : ( +// <>Searching... +// )} +//
    +// )} +// {data ? ( +//
    +// {data.products.map((product: Product) => ( +// +// ))} +//
    +// ) : ( +//
    +// {rangeMap(12, (i) => ( +// +//
    +// +// ))} +//
    +// )}{' '} +//
    + +// {/* Sort */} +//
    +//
    +//
    +// +// +// +//
    +// +//
    +//
    +//
    +// +// ) +// } Search.Layout = Layout diff --git a/components/wishlist/WishlistButton/WishlistButton.tsx b/components/wishlist/WishlistButton/WishlistButton.tsx index a48eac170..abf071e80 100644 --- a/components/wishlist/WishlistButton/WishlistButton.tsx +++ b/components/wishlist/WishlistButton/WishlistButton.tsx @@ -2,10 +2,10 @@ import React, { FC, useState } from 'react' import cn from 'classnames' import { useUI } from '@components/ui' import { Heart } from '@components/icons' -import useAddItem from '@framework/wishlist/use-add-item' -import useCustomer from '@framework/customer/use-customer' -import useWishlist from '@framework/wishlist/use-wishlist' -import useRemoveItem from '@framework/wishlist/use-remove-item' +// import useAddItem from '@framework/wishlist/use-add-item' +// import useCustomer from '@framework/customer/use-customer' +// import useWishlist from '@framework/wishlist/use-wishlist' +// import useRemoveItem from '@framework/wishlist/use-remove-item' import s from './WishlistButton.module.css' import type { Product, ProductVariant } from '@commerce/types/product' @@ -20,10 +20,10 @@ const WishlistButton: FC = ({ className, ...props }) => { - const { data } = useWishlist() - const addItem = useAddItem() - const removeItem = useRemoveItem() - const { data: customer } = useCustomer() + // const { data } = useWishlist() + // const addItem = useAddItem() + // const removeItem = useRemoveItem() + // const { data: customer } = useCustomer() const { openModal, setModalView } = useUI() const [loading, setLoading] = useState(false) @@ -41,22 +41,22 @@ const WishlistButton: FC = ({ if (loading) return // A login is required before adding an item to the wishlist - if (!customer) { - setModalView('LOGIN_VIEW') - return openModal() - } + // if (!customer) { + // setModalView('LOGIN_VIEW') + // return openModal() + // } setLoading(true) try { - if (itemInWishlist) { - await removeItem({ id: itemInWishlist.id! }) - } else { - await addItem({ - productId, - variantId: variant?.id!, - }) - } + // if (itemInWishlist) { + // await removeItem({ id: itemInWishlist.id! }) + // } else { + // await addItem({ + // productId, + // variantId: variant?.id!, + // }) + // } setLoading(false) } catch (err) { diff --git a/components/wishlist/WishlistCard/WishlistCard.tsx b/components/wishlist/WishlistCard/WishlistCard.tsx index dfc1165c2..cc1ff51cb 100644 --- a/components/wishlist/WishlistCard/WishlistCard.tsx +++ b/components/wishlist/WishlistCard/WishlistCard.tsx @@ -8,9 +8,9 @@ import { Button, Text } from '@components/ui' import { useUI } from '@components/ui/context' import type { Product } from '@commerce/types/product' -import usePrice from '@framework/product/use-price' -import useAddItem from '@framework/cart/use-add-item' -import useRemoveItem from '@framework/wishlist/use-remove-item' +// import usePrice from '@framework/product/use-price' +// import useAddItem from '@framework/cart/use-add-item' +// import useRemoveItem from '@framework/wishlist/use-remove-item' interface Props { product: Product @@ -19,11 +19,11 @@ interface Props { const placeholderImg = '/product-img-placeholder.svg' const WishlistCard: FC = ({ product }) => { - const { price } = usePrice({ - amount: product.price?.value, - baseAmount: product.price?.retailPrice, - currencyCode: product.price?.currencyCode!, - }) + // const { price } = usePrice({ + // amount: product.price?.value, + // baseAmount: product.price?.retailPrice, + // currencyCode: product.price?.currencyCode!, + // }) // @ts-ignore Wishlist is not always enabled const removeItem = useRemoveItem({ wishlist: { includeProducts: true } }) const [loading, setLoading] = useState(false) @@ -71,7 +71,7 @@ const WishlistCard: FC = ({ product }) => {
    -

    +

    {product.name} @@ -91,8 +91,8 @@ const WishlistCard: FC = ({ product }) => { Add to Cart

    -
    -
    {price}
    +
    + {/*
    {price}
    */}
    - ) : ( - - )} -
    -
    -
    -
    -
    - ) + // const { price: subTotal } = usePrice( + // data && { + // amount: Number(data.subtotalPrice), + // currencyCode: data.currency.code, + // } + // ) + // const { price: total } = usePrice( + // data && { + // amount: Number(data.totalPrice), + // currencyCode: data.currency.code, + // } + // ) + return
    } Cart.Layout = Layout diff --git a/pages/orders.tsx b/pages/orders.tsx index b8b10814b..7560acf6c 100644 --- a/pages/orders.tsx +++ b/pages/orders.tsx @@ -4,34 +4,34 @@ import { Bag } from '@components/icons' import { Layout } from '@components/common' import { Container, Text } from '@components/ui' -export async function getStaticProps({ - preview, - locale, - locales, -}: GetStaticPropsContext) { - const config = { locale, locales } - const pagesPromise = commerce.getAllPages({ config, preview }) - const siteInfoPromise = commerce.getSiteInfo({ config, preview }) - const { pages } = await pagesPromise - const { categories } = await siteInfoPromise +// export async function getStaticProps({ +// preview, +// locale, +// locales, +// }: GetStaticPropsContext) { +// const config = { locale, locales } +// const pagesPromise = commerce.getAllPages({ config, preview }) +// const siteInfoPromise = commerce.getSiteInfo({ config, preview }) +// const { pages } = await pagesPromise +// const { categories } = await siteInfoPromise - return { - props: { pages, categories }, - } -} +// return { +// props: { pages, categories }, +// } +// } export default function Orders() { return ( My Orders -
    - +
    +

    No orders found

    -

    +

    Biscuit oat cake wafer icing ice cream tiramisu pudding cupcake.

    diff --git a/pages/profile.tsx b/pages/profile.tsx index eb54004ee..52394c3b4 100644 --- a/pages/profile.tsx +++ b/pages/profile.tsx @@ -1,33 +1,33 @@ import type { GetStaticPropsContext } from 'next' -import useCustomer from '@framework/customer/use-customer' +// import useCustomer from '@framework/customer/use-customer' import commerce from '@lib/api/commerce' import { Layout } from '@components/common' import { Container, Text } from '@components/ui' -export async function getStaticProps({ - preview, - locale, - locales, -}: GetStaticPropsContext) { - const config = { locale, locales } - const pagesPromise = commerce.getAllPages({ config, preview }) - const siteInfoPromise = commerce.getSiteInfo({ config, preview }) - const { pages } = await pagesPromise - const { categories } = await siteInfoPromise +// export async function getStaticProps({ +// preview, +// locale, +// locales, +// }: GetStaticPropsContext) { +// const config = { locale, locales } +// const pagesPromise = commerce.getAllPages({ config, preview }) +// const siteInfoPromise = commerce.getSiteInfo({ config, preview }) +// const { pages } = await pagesPromise +// const { categories } = await siteInfoPromise - return { - props: { pages, categories }, - } -} +// return { +// props: { pages, categories }, +// } +// } export default function Profile() { - const { data } = useCustomer() + // const { data } = useCustomer() return ( My Profile - {data && ( + {/* {data && (
    -
    +
    Full Name @@ -40,7 +40,7 @@ export default function Profile() {
    - )} + )} */} ) } diff --git a/pages/wishlist.tsx b/pages/wishlist.tsx index 93f1c96d3..29522c2f9 100644 --- a/pages/wishlist.tsx +++ b/pages/wishlist.tsx @@ -1,50 +1,51 @@ -import type { GetStaticPropsContext } from 'next' -import commerce from '@lib/api/commerce' -import { Heart } from '@components/icons' +// import type { GetStaticPropsContext } from 'next' +// import commerce from '@lib/api/commerce' +// import { Heart } from '@components/icons' import { Layout } from '@components/common' + import { Text, Container, Skeleton } from '@components/ui' -import { useCustomer } from '@framework/customer' -import { WishlistCard } from '@components/wishlist' -import useWishlist from '@framework/wishlist/use-wishlist' +// import { useCustomer } from '@framework/customer' +// import { WishlistCard } from '@components/wishlist' +// import useWishlist from '@framework/wishlist/use-wishlist' import rangeMap from '@lib/range-map' -export async function getStaticProps({ - preview, - locale, - locales, -}: GetStaticPropsContext) { - // Disabling page if Feature is not available - if (!process.env.COMMERCE_WISHLIST_ENABLED) { - return { - notFound: true, - } - } +// export async function getStaticProps({ +// preview, +// locale, +// locales, +// }: GetStaticPropsContext) { +// // Disabling page if Feature is not available +// if (!process.env.COMMERCE_WISHLIST_ENABLED) { +// return { +// notFound: true, +// } +// } - const config = { locale, locales } - const pagesPromise = commerce.getAllPages({ config, preview }) - const siteInfoPromise = commerce.getSiteInfo({ config, preview }) - const { pages } = await pagesPromise - const { categories } = await siteInfoPromise +// const config = { locale, locales } +// const pagesPromise = commerce.getAllPages({ config, preview }) +// const siteInfoPromise = commerce.getSiteInfo({ config, preview }) +// const { pages } = await pagesPromise +// const { categories } = await siteInfoPromise - return { - props: { - pages, - categories, - }, - } -} +// return { +// props: { +// pages, +// categories, +// }, +// } +// } export default function Wishlist() { - const { data: customer } = useCustomer() - // @ts-ignore Shopify - Fix this types - const { data, isLoading, isEmpty } = useWishlist({ includeProducts: true }) + // const { data: customer } = useCustomer() + // // @ts-ignore Shopify - Fix this types + // const { data, isLoading, isEmpty } = useWishlist({ includeProducts: true }) return (
    My Wishlist -
    - {isLoading ? ( +
    + {/* {isLoading ? (
    {rangeMap(12, (i) => ( @@ -53,14 +54,14 @@ export default function Wishlist() { ))}
    ) : isEmpty ? ( -
    - +
    +

    Your wishlist is empty

    -

    +

    Biscuit oat cake wafer icing ice cream tiramisu pudding cupcake.

    @@ -72,7 +73,7 @@ export default function Wishlist() { ))}
    - )} + )}*/}