Skip to content

Commit

Permalink
Merge pull request #68 from Rossen27/develop
Browse files Browse the repository at this point in the history
Refactor ConfirmOrder and Shipping components
  • Loading branch information
Rossen27 authored May 7, 2024
2 parents 5e1f541 + f4fb9e0 commit 69caf9e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
4 changes: 2 additions & 2 deletions frontend/src/components/cart/ConfirmOrder.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import CheckoutSteps from "./CheckoutSteps";

const ConfirmOrder = () => {
const { cartItems, shippingInfo } = useSelector((state) => state.cart);
const { user } = useSelector((state) => state.auth);
// const { user } = useSelector((state) => state.auth);
const navigate = useNavigate();

const { itemsPrice, shippingPrice, taxPrice, totalPrice } =
Expand All @@ -30,7 +30,7 @@ const ConfirmOrder = () => {
<dl className="mt-1 -my-3 divide-y divide-gray-100 text-sm">
<div className="grid grid-cols-1 gap-1 py-3 sm:grid-cols-3 sm:gap-4">
<dt className="font-medium text-gray-900">姓名</dt>
<dd className="text-gray-700 sm:col-span-2">{user?.name}</dd>
<dd className="text-gray-700 sm:col-span-2">{shippingInfo?.name}</dd>
</div>

<div className="grid grid-cols-1 gap-1 py-3 sm:grid-cols-3 sm:gap-4">
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/cart/Shipping.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const Shipping = () => {
const submitHandler = (e) => {
e.preventDefault();

dispatch(saveShippingInfo({ address, city, phoneNo, zipCode, country }));
dispatch(saveShippingInfo({ name, address, city, phoneNo, zipCode, country }));
navigate("/confirm_order");
};

Expand All @@ -44,7 +44,7 @@ const Shipping = () => {
<section className="">
<div className="mx-auto max-w-screen-xl px-4 py-16 sm:px-6 lg:px-8">
<div className="grid grid-cols-1 gap-x-16 gap-y-8 lg:grid-cols-5">
<h1 className="text-4xl font-medium">Contact us</h1>
<h1 className="text-3xl font-medium">收件資料確認</h1>
{/* <div className="lg:col-span-2 lg:py-12">
<p className="max-w-xl text-lg">
在這裡,我們為您帶來一系列精選的無麩質美食,讓您可以享受美味的飲食體驗,同時不用擔心麩質對您的身體健康造成的影響。
Expand Down
15 changes: 4 additions & 11 deletions frontend/src/components/layout/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ const Header = () => {
{ name: "部落格", path: "/" },
{ name: "聯絡", path: "/" },
];


return (
<>
Expand Down Expand Up @@ -90,11 +89,7 @@ const Header = () => {
<NavbarMenu>
{menuItems.map((item) => (
<NavbarMenuItem key={item.name}>
<Link
className="w-full"
to={item.path}
size="lg"
>
<Link className="w-full" to={item.path} size="lg">
{item.name}
</Link>
</NavbarMenuItem>
Expand All @@ -103,8 +98,7 @@ const Header = () => {

<NavbarContent as="div" className="items-center" justify="end">
<Dropdown placement="bottom-end">
<Link to="/cart">
<Badge
<Link to="/cart"><Badge
content={cartItems?.length}
isInvisible={isInvisible}
shape="circle"
Expand All @@ -118,10 +112,9 @@ const Header = () => {
>
<FiShoppingCart size={24} />
</Button>
</Badge>
</Link>
</Badge></Link>
</Dropdown>

<Dropdown placement="bottom-end">
<DropdownTrigger>
<Avatar
Expand Down

0 comments on commit 69caf9e

Please sign in to comment.