wip4
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import { PageBody, PageHeader } from '@/packages/ui/src/makerkit/page';
|
||||||
import { Metadata } from 'next';
|
import { Metadata } from 'next';
|
||||||
|
|
||||||
import { notFound } from 'next/navigation';
|
import { notFound } from 'next/navigation';
|
||||||
@@ -12,12 +13,47 @@ export const metadata: Metadata = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default async function Cart() {
|
export default async function Cart() {
|
||||||
const cart = await retrieveCart().catch((error) => {
|
const cart2 = await retrieveCart().catch((error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return notFound();
|
return notFound();
|
||||||
});
|
});
|
||||||
|
|
||||||
const customer = await retrieveCustomer();
|
const customer = await retrieveCustomer();
|
||||||
|
|
||||||
return <CartTemplate cart={cart} customer={customer} />;
|
const cart: NonNullable<typeof cart2> = {
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
id: '1',
|
||||||
|
quantity: 1,
|
||||||
|
cart: cart2!,
|
||||||
|
item_total: 100,
|
||||||
|
item_subtotal: 100,
|
||||||
|
item_tax_total: 100,
|
||||||
|
original_total: 100,
|
||||||
|
original_subtotal: 100,
|
||||||
|
original_tax_total: 100,
|
||||||
|
total: 100,
|
||||||
|
subtotal: 100,
|
||||||
|
tax_total: 100,
|
||||||
|
title: 'Test',
|
||||||
|
requires_shipping: true,
|
||||||
|
discount_total: 0,
|
||||||
|
discount_tax_total: 0,
|
||||||
|
metadata: {},
|
||||||
|
created_at: new Date(),
|
||||||
|
is_discountable: true,
|
||||||
|
is_tax_inclusive: true,
|
||||||
|
unit_price: 100,
|
||||||
|
cart_id: '1',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PageBody>
|
||||||
|
<PageHeader title={`Ostukorv`} description={`Vali kalendrist sobiv kuupäev ja broneeri endale vastuvõtuaeg.`} />
|
||||||
|
|
||||||
|
<CartTemplate cart={cart} customer={customer} />
|
||||||
|
</PageBody>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,6 @@
|
|||||||
import { Heading, Text } from "@medusajs/ui"
|
|
||||||
|
|
||||||
import InteractiveLink from "@modules/common/components/interactive-link"
|
|
||||||
|
|
||||||
const EmptyCartMessage = () => {
|
const EmptyCartMessage = () => {
|
||||||
return (
|
return (
|
||||||
<div className="py-48 px-2 flex flex-col justify-center items-start" data-testid="empty-cart-message">
|
<div className="py-48 px-2 flex flex-col justify-center items-start" data-testid="empty-cart-message">
|
||||||
<Heading
|
|
||||||
level="h1"
|
|
||||||
className="flex flex-row text-3xl-regular gap-x-2 items-baseline"
|
|
||||||
>
|
|
||||||
Cart
|
|
||||||
</Heading>
|
|
||||||
<Text className="text-base-regular mt-4 mb-6 max-w-[32rem]">
|
|
||||||
You don't have anything in your cart. Let's change that, use
|
|
||||||
the link below to start browsing our products.
|
|
||||||
</Text>
|
|
||||||
<div>
|
|
||||||
<InteractiveLink href="/store">Explore products</InteractiveLink>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,12 +18,12 @@ const CartTemplate = ({
|
|||||||
{cart?.items?.length ? (
|
{cart?.items?.length ? (
|
||||||
<div className="grid grid-cols-1 small:grid-cols-[1fr_360px] gap-x-40">
|
<div className="grid grid-cols-1 small:grid-cols-[1fr_360px] gap-x-40">
|
||||||
<div className="flex flex-col bg-white py-6 gap-y-6">
|
<div className="flex flex-col bg-white py-6 gap-y-6">
|
||||||
{!customer && (
|
{/* {!customer && (
|
||||||
<>
|
<>
|
||||||
<SignInPrompt />
|
<SignInPrompt />
|
||||||
<Divider />
|
<Divider />
|
||||||
</>
|
</>
|
||||||
)}
|
)} */}
|
||||||
<ItemsTemplate cart={cart} />
|
<ItemsTemplate cart={cart} />
|
||||||
</div>
|
</div>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ const ItemsTemplate = ({ cart }: ItemsTemplateProps) => {
|
|||||||
const items = cart?.items
|
const items = cart?.items
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className="pb-3 flex items-center">
|
{/* <div className="pb-3 flex items-center">
|
||||||
<Heading className="text-[2rem] leading-[2.75rem]">Cart</Heading>
|
<Heading className="text-[2rem] leading-[2.75rem]">Cart</Heading>
|
||||||
</div>
|
</div> */}
|
||||||
<Table>
|
<Table>
|
||||||
<Table.Header className="border-t-0">
|
<Table.Header className="border-t-0">
|
||||||
<Table.Row className="text-ui-fg-subtle txt-medium-plus">
|
<Table.Row className="text-ui-fg-subtle txt-medium-plus">
|
||||||
|
|||||||
Reference in New Issue
Block a user