From 325d2944fe78058d4bcdfe2470dc0d5a2a2d5894 Mon Sep 17 00:00:00 2001 From: tester Date: Sat, 21 Feb 2026 22:06:25 +0000 Subject: [PATCH] feat: Order & Checkout System - cart, checkout, order history, tracking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Backend: Add GET /api/orders/:id, PUT /api/orders/:id/cancel, GET /api/orders/:id/tracking with mock Yamato data - Frontend: Zustand cart store with localStorage persistence (key 'cart') - Frontend: CartPage (/cart) with quantity controls, item removal, JPY totals - Frontend: CheckoutPage (/checkout) with shipping address form, auth guard, POST to /api/orders - Frontend: OrderHistoryPage (/account/orders) with Japanese status labels, auth guard - Frontend: OrderDetailPage (/account/orders/:id) with cancel button, tracking section, auth guard - Updated App.tsx with all four new routes - Updated ProductDetail.tsx to use cart store with View Cart link after adding - Updated Navbar.tsx with cart icon badge (item count) and 注文履歴 order history link --- .saac/config.json | 7 + client/src/App.tsx | 8 + client/src/components/Navbar.tsx | 32 ++- client/src/pages/CartPage.tsx | 114 +++++++++ client/src/pages/CheckoutPage.tsx | 226 ++++++++++++++++++ client/src/pages/OrderDetailPage.tsx | 317 ++++++++++++++++++++++++++ client/src/pages/OrderHistoryPage.tsx | 138 +++++++++++ client/src/pages/ProductDetail.tsx | 77 +++---- client/src/store/cart.ts | 70 ++++++ src/routes/orders.js | 99 ++++++++ 10 files changed, 1045 insertions(+), 43 deletions(-) create mode 100644 .saac/config.json create mode 100644 client/src/pages/CartPage.tsx create mode 100644 client/src/pages/CheckoutPage.tsx create mode 100644 client/src/pages/OrderDetailPage.tsx create mode 100644 client/src/pages/OrderHistoryPage.tsx create mode 100644 client/src/store/cart.ts diff --git a/.saac/config.json b/.saac/config.json new file mode 100644 index 0000000..3a3d1ac --- /dev/null +++ b/.saac/config.json @@ -0,0 +1,7 @@ +{ + "applicationUuid": "7a82508b-9f93-46dc-acb4-f925182d7e30", + "applicationName": "shokuninmarche", + "subdomain": "shokuninmarche", + "domainSuffix": "startanaicompany.com", + "gitRepository": "https://git.startanaicompany.com/tester/shokuninmarche.git" +} diff --git a/client/src/App.tsx b/client/src/App.tsx index 638367b..934445a 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -8,6 +8,10 @@ import { Products } from '@/pages/Products' import { ProductDetail } from '@/pages/ProductDetail' import { CraftsmenList } from '@/pages/CraftsmenList' import { CraftsmanProfile } from '@/pages/CraftsmanProfile' +import { CartPage } from '@/pages/CartPage' +import { CheckoutPage } from '@/pages/CheckoutPage' +import { OrderHistoryPage } from '@/pages/OrderHistoryPage' +import { OrderDetailPage } from '@/pages/OrderDetailPage' import { useAuthStore } from '@/store/auth' function App() { @@ -28,6 +32,10 @@ function App() { } /> } /> } /> + } /> + } /> + } /> + } /> } /> diff --git a/client/src/components/Navbar.tsx b/client/src/components/Navbar.tsx index 948d792..ebd2782 100644 --- a/client/src/components/Navbar.tsx +++ b/client/src/components/Navbar.tsx @@ -1,11 +1,14 @@ import { Link, useNavigate } from 'react-router-dom' import { useAuthStore } from '@/store/auth' +import { useCartStore } from '@/store/cart' import { Button } from '@/components/ui/button' -import { ShoppingBag, User } from 'lucide-react' +import { ShoppingCart, User, ClipboardList } from 'lucide-react' export function Navbar() { const { user, logout } = useAuthStore() const navigate = useNavigate() + const { items } = useCartStore() + const cartCount = items.reduce((sum, item) => sum + item.quantity, 0) return (