diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 02f27a0..6bee6b7 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -187,6 +187,9 @@ model Order { customerId String? // set when the buyer was logged in at checkout — null for guest orders customer Customer? @relation(fields: [customerId], references: [id]) + guestName String? // full name for guest orders + guestPhone String? // contact phone for guest orders + items OrderItem[] } diff --git a/src/app/account/login/page.tsx b/src/app/account/login/page.tsx index c2eda81..e4e2621 100644 --- a/src/app/account/login/page.tsx +++ b/src/app/account/login/page.tsx @@ -56,6 +56,13 @@ export default function LoginPage({ searchParams }: { searchParams: { error?: st Forgot your password?
+ +Shop owner?
+ + Admin login + +{checkoutError}
}You'll enter payment details on the next step.
By placing an order you agree to our{' '}
diff --git a/src/app/checkout/page.tsx b/src/app/checkout/page.tsx
new file mode 100644
index 0000000..f71e0fc
--- /dev/null
+++ b/src/app/checkout/page.tsx
@@ -0,0 +1,249 @@
+'use client';
+
+import { useEffect, useState } from 'react';
+import Link from 'next/link';
+import { useCart } from '@/lib/cartStore';
+import { loginCustomer } from '@/app/account/actions';
+import Price from '@/components/Price';
+
+export default function CheckoutPage() {
+ const [mounted, setMounted] = useState(false);
+ const [mode, setMode] = useState<'login' | 'guest' | null>(null);
+ const [checkingOut, setCheckingOut] = useState(false);
+ const [checkoutError, setCheckoutError] = useState Your bag is empty. {item.name} Qty: {item.quantity} How would you like to checkout?
+ Don't have an account?{' '}
+
+ Create one now
+
+
+ {checkoutError}
+ Checkout
+ Checkout
+
+ Order summary
+ Log in
+
+ Guest checkout
+ {checkoutError && (
+