import React, { useState, useEffect, useRef } from 'react';
import { BrowserRouter as Router, Routes, Route, Link, useNavigate } from 'react-router-dom';
import * as THREE from 'three';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
// Main App Component
export default function App() {
const [user, setUser] = useState(null);
const [cart, setCart] = useState([]);
const [isAdmin, setIsAdmin] = useState(false);
// Simulate authentication
const login = (email, password) => {
// In a real app, this would verify credentials with Firebase
setUser({ id: '123', email, name: 'Test User' });
// Check if user is admin (simplified)
if (email === 'admin@example.com') {
setIsAdmin(true);
}
};
const logout = () => {
setUser(null);
setIsAdmin(false);
};
// Cart functions
const addToCart = (product) => {
const existingItem = cart.find(item => item.id === product.id);
if (existingItem) {
setCart(cart.map(item =>
item.id === product.id ? {...item, quantity: item.quantity + 1} : item
));
} else {
setCart([...cart, {...product, quantity: 1}]);
}
};
const removeFromCart = (productId) => {
setCart(cart.filter(item => item.id !== productId));
};
const updateQuantity = (productId, quantity) => {
if (quantity <= 0) {
removeFromCart(productId);
} else {
setCart(cart.map(item =>
item.id === productId ? {...item, quantity} : item
));
}
};
// Calculate cart total
const cartTotal = cart.reduce((total, item) => total + (item.price * item.quantity), 0);
return (
} />
} />
} />
} />
} />
} />
} />
} />
} />
{isAdmin && (
<>
} />
} />
} />
>
)}
);
}
// Navigation Component
function Navbar({ user, logout, cart, isAdmin }) {
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
return (
AR Shop
Products
{user ? (
<>
Profile
{isAdmin && (
Admin
)}
Logout
>
) : (
<>
Login
Register
>
)}
Cart
{cart.length > 0 && (
{cart.reduce((total, item) => total + item.quantity, 0)}
)}
setMobileMenuOpen(!mobileMenuOpen)} className="text-gray-700">
{mobileMenuOpen && (
Products
{user ? (
<>
Profile
{isAdmin && (
Admin
)}
Logout
>
) : (
<>
Login
Register
>
)}
Cart ({cart.reduce((total, item) => total + item.quantity, 0)})
)}
);
}
// Home Page Component
function HomePage() {
return (
Try Before You Buy with AR
Experience our products in augmented reality. See how clothes and accessories look on you before making a purchase.
Shop Now
How It Works
1
Browse Products
Explore our catalog of clothing and accessories.
2
Try On with AR
Use your camera to see how items look on you in real-time.
3
Purchase with Confidence
Buy the items you love, knowing exactly how they'll look.
);
}
// Featured Products Component
function FeaturedProducts() {
// Sample featured products
const featuredProducts = [
{ id: '1', name: 'Classic T-Shirt', price: 29.99, image: 'https://images.unsplash.com/photo-1521572163474-6864f9cf17ab?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80', hasAR: true },
{ id: '2', name: 'Designer Sunglasses', price: 89.99, image: 'https://images.unsplash.com/photo-1511499767150-a48a237f0083?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80', hasAR: true },
{ id: '3', name: 'Leather Jacket', price: 199.99, image: 'https://images.unsplash.com/photo-1551028719-00167b16eac5?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80', hasAR: true },
];
return (
{featuredProducts.map((product) => (
{product.name}
{product.hasAR && (
AR Available
)}
${product.price}
))}
);
}
// Login Page Component
function LoginPage({ login }) {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const navigate = useNavigate();
const handleSubmit = (e) => {
e.preventDefault();
login(email, password);
navigate('/');
};
return (
Login
Don't have an account?{' '}
Register
);
}
// Register Page Component
function RegisterPage() {
const [name, setName] = useState('');
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const [confirmPassword, setConfirmPassword] = useState('');
const navigate = useNavigate();
const handleSubmit = (e) => {
e.preventDefault();
if (password !== confirmPassword) {
alert("Passwords don't match");
return;
}
// In a real app, this would register the user with Firebase
alert('Registration successful! Please login.');
navigate('/login');
};
return (
Register
Already have an account?{' '}
Login
);
}
// Products Page Component
function ProductsPage({ addToCart }) {
const [products, setProducts] = useState([]);
const [categories, setCategories] = useState([]);
const [selectedCategory, setSelectedCategory] = useState('all');
const [loading, setLoading] = useState(true);
useEffect(() => {
// Simulate fetching products from API
setTimeout(() => {
const fetchedProducts = [
{ id: '1', name: 'Classic T-Shirt', price: 29.99, category: 'clothing', image: 'https://images.unsplash.com/photo-1521572163474-6864f9cf17ab?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80', hasAR: true },
{ id: '2', name: 'Designer Sunglasses', price: 89.99, category: 'accessories', image: 'https://images.unsplash.com/photo-1511499767150-a48a237f0083?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80', hasAR: true },
{ id: '3', name: 'Leather Jacket', price: 199.99, category: 'clothing', image: 'https://images.unsplash.com/photo-1551028719-00167b16eac5?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80', hasAR: true },
{ id: '4', name: 'Silver Watch', price: 149.99, category: 'accessories', image: 'https://images.unsplash.com/photo-1524805444758-089113d48a6d?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80', hasAR: true },
{ id: '5', name: 'Denim Jeans', price: 59.99, category: 'clothing', image: 'https://images.unsplash.com/photo-1542272604-787c3835535d?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80', hasAR: true },
{ id: '6', name: 'Beanie Hat', price: 19.99, category: 'accessories', image: 'https://images.unsplash.com/photo-1576871337632-b9aef4c17ab9?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80', hasAR: true },
];
setProducts(fetchedProducts);
// Extract unique categories
const uniqueCategories = [...new Set(fetchedProducts.map(product => product.category))];
setCategories(uniqueCategories);
setLoading(false);
}, 1000);
}, []);
const filteredProducts = selectedCategory === 'all'
? products
: products.filter(product => product.category === selectedCategory);
return (
Products
Filter by Category
setSelectedCategory(e.target.value)}
className="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-teal-500 focus:border-teal-500 sm:text-sm rounded-md"
>
All Categories
{categories.map(category => (
{category.charAt(0).toUpperCase() + category.slice(1)}
))}
{loading ? (
) : (
{filteredProducts.map((product) => (
{product.name}
{product.hasAR && (
AR Available
)}
${product.price}
addToCart(product)}
className="relative w-full bg-gray-100 border border-transparent rounded-md py-2 px-8 flex items-center justify-center text-sm font-medium text-gray-900 hover:bg-gray-200"
>
Add to Cart
))}
)}
);
}
// Product Detail Page Component
function ProductDetailPage({ addToCart }) {
const [product, setProduct] = useState(null);
const [loading, setLoading] = useState(true);
const { id } = useParams();
const navigate = useNavigate();
useEffect(() => {
// Simulate fetching product details from API
setTimeout(() => {
// This would be an API call in a real app
const fetchedProduct = {
id,
name: 'Classic T-Shirt',
price: 29.99,
description: 'A comfortable, casual fit t-shirt made from 100% organic cotton. Perfect for everyday wear.',
category: 'clothing',
image: 'https://images.unsplash.com/photo-1521572163474-6864f9cf17ab?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80',
hasAR: true,
sizes: ['S', 'M', 'L', 'XL'],
colors: ['White', 'Black', 'Gray', 'Blue'],
modelUrl: '/models/tshirt.glb', // This would be a real 3D model URL in a production app
};
setProduct(fetchedProduct);
setLoading(false);
}, 1000);
}, [id]);
const handleTryOn = () => {
navigate(`/try-on/${id}`);
};
if (loading) {
return (
);
}
return (
{/* Image gallery */}
{/* Product info */}
{product.name}
Product information
${product.price}
Description
{product.description}
{product.sizes.map((size) => (
{size}
))}
Color
{product.colors.map((color) => (
{color}
))}
addToCart(product)}
className="max-w-xs flex-1 bg-teal-600 border border-transparent rounded-md py-3 px-8 flex items-center justify-center text-base font-medium text-white hover:bg-teal-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-50 focus:ring-teal-500 sm:w-full"
>
Add to Cart
{product.hasAR && (
Try On with AR
)}
);
}
// AR Try-On Page Component
function ARTryOnPage() {
const [isARSupported, setIsARSupported] = useState(null);
const [isLoading, setIsLoading] = useState(true);
const [isARActive, setIsARActive] = useState(false);
const { id } = useParams();
const navigate = useNavigate();
const sceneRef = useRef(null);
const cameraVideoRef = useRef(null);
useEffect(() => {
// Check if WebXR is supported
if ('xr' in navigator) {
navigator.xr.isSessionSupported('immersive-ar')
.then((supported) => {
setIsARSupported(supported);
setIsLoading(false);
})
.catch(() => {
setIsARSupported(false);
setIsLoading(false);
});
} else {
setIsARSupported(false);
setIsLoading(false);
}
// Simulate fetching product details
// In a real app, you would fetch the 3D model URL here
return () => {
// Clean up AR session if active
if (isARActive) {
stopAR();
}
};
}, []);
const startAR = async () => {
try {
// Request camera access
const stream = await navigator.mediaDevices.getUserMedia({ video: { facingMode: 'user' } });
if (cameraVideoRef.current) {
cameraVideoRef.current.srcObject = stream;
cameraVideoRef.current.play();
}
// Initialize Three.js scene
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer({ alpha: true });
renderer.setSize(window.innerWidth, window.innerHeight);
if (sceneRef.current) {
sceneRef.current.appendChild(renderer.domElement);
}
// Add lighting
const ambientLight = new THREE.AmbientLight(0xffffff, 0.5);
scene.add(ambientLight);
const directionalLight = new THREE.DirectionalLight(0xffffff, 0.8);
directionalLight.position.set(0, 1, 1);
scene.add(directionalLight);
// Position camera
camera.position.z = 5;
// Load 3D model (this would use the actual model URL in a real app)
const loader = new GLTFLoader();
// This is a placeholder - in a real app you would load the actual model
// loader.load('/models/tshirt.glb', (gltf) => {
// scene.add(gltf.scene);
// });
// Create a placeholder model for demo purposes
const geometry = new THREE.BoxGeometry(1, 1, 1);
const material = new THREE.MeshStandardMaterial({ color: 0x5f9ea0 });
const cube = new THREE.Mesh(geometry, material);
scene.add(cube);
// Animation loop
const animate = () => {
requestAnimationFrame(animate);
// Rotate the placeholder model
cube.rotation.x += 0.01;
cube.rotation.y += 0.01;
renderer.render(scene, camera);
};
animate();
setIsARActive(true);
} catch (error) {
console.error('Error starting AR:', error);
alert('Failed to start AR experience. Please check camera permissions.');
}
};
const stopAR = () => {
// Stop camera stream
if (cameraVideoRef.current && cameraVideoRef.current.srcObject) {
const tracks = cameraVideoRef.current.srcObject.getTracks();
tracks.forEach(track => track.stop());
cameraVideoRef.current.srcObject = null;
}
// Clear Three.js scene
if (sceneRef.current) {
while (sceneRef.current.firstChild) {
sceneRef.current.removeChild(sceneRef.current.firstChild);
}
}
setIsARActive(false);
};
if (isLoading) {
return (
);
}
return (
{!isARSupported && (
AR Not Supported
Your device or browser doesn't support Augmented Reality. Please try using a different device or browser.
navigate(`/products/${id}`)}
className="w-full bg-teal-600 text-white py-2 px-4 rounded-md hover:bg-teal-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-teal-500"
>
Back to Product
)}
{isARSupported && !isARActive && (
Try On with AR
Use your camera to see how this product looks on you in real-time. Your camera will be used only for this AR experience.
Start AR Experience
navigate(`/products/${id}`)}
className="w-full bg-white border border-gray-300 text-gray-700 py-2 px-4 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-teal-500"
>
Back to Product
)}
{isARSupported && isARActive && (
<>
Exit AR
>
)}
);
}
// Cart Page Component
function CartPage({ cart, updateQuantity, removeFromCart, total }) {
const navigate = useNavigate();
if (cart.length === 0) {
return (
Your Cart
Your cart is empty
Continue Shopping
);
}
return (
Your Cart
{cart.map((item) => (
{item.name}
${item.price}
Quantity, {item.name}
updateQuantity(item.id, parseInt(e.target.value))}
className="max-w-full rounded-md border border-gray-300 py-1.5 text-base leading-5 font-medium text-gray-700 text-left shadow-sm focus:outline-none focus:ring-1 focus:ring-teal-500 focus:border-teal-500 sm:text-sm"
>
{[...Array(10).keys()].map((i) => (
{i + 1}
))}
removeFromCart(item.id)}
className="-m-2 p-2 inline-flex text-gray-400 hover:text-gray-500"
>
Remove
{item.hasAR && (
Try on with AR
)}
))}
Order summary
Subtotal
${total.toFixed(2)}
Tax estimate
${(total * 0.1).toFixed(2)}
Order total
${(total + 5 + total * 0.1).toFixed(2)}
navigate('/checkout')}
className="w-full bg-teal-600 border border-transparent rounded-md shadow-sm py-3 px-4 text-base font-medium text-white hover:bg-teal-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-50 focus:ring-teal-500"
>
Checkout
);
}
// Checkout Page Component
function CheckoutPage({ cart, total }) {
const [formData, setFormData] = useState({
firstName: '',
lastName: '',
email: '',
address: '',
city: '',
state: '',
postalCode: '',
country: 'US',
cardName: '',
cardNumber: '',
expDate: '',
cvv: '',
});
const [isProcessing, setIsProcessing] = useState(false);
const [isComplete, setIsComplete] = useState(false);
const navigate = useNavigate();
const handleChange = (e) => {
const { name, value } = e.target;
setFormData({
...formData,
[name]: value,
});
};
const handleSubmit = (e) => {
e.preventDefault();
setIsProcessing(true);
// Simulate payment processing
setTimeout(() => {
setIsProcessing(false);
setIsComplete(true);
}, 2000);
};
if (isComplete) {
return (
Order Complete!
Thank you for your purchase. Your order has been processed successfully.
navigate('/')}
className="w-full bg-teal-600 text-white py-2 px-4 rounded-md hover:bg-teal-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-teal-500"
>
Continue Shopping
);
}
return (
Checkout
Order summary
{cart.map((item) => (
{item.name}
Qty {item.quantity}
${(item.price * item.quantity).toFixed(2)}
))}
Subtotal
${total.toFixed(2)}
Taxes
${(total * 0.1).toFixed(2)}
Total
${(total + 5 + total * 0.1).toFixed(2)}
);
}
// Profile Page Component
function ProfilePage({ user }) {
const [orders, setOrders] = useState([]);
const [loading, setLoading] = useState(true);
useEffect(() => {
// Simulate fetching order history
setTimeout(() => {
const sampleOrders = [
{
id: 'ORD-001',
date: '2023-05-15',
total: 129.99,
status: 'Delivered',
items: [
{ id: '1', name: 'Classic T-Shirt', price: 29.99, quantity: 1 },
{ id: '2', name: 'Designer Sunglasses', price: 89.99, quantity: 1 },
],
},
{
id: 'ORD-002',
date: '2023-04-22',
total: 199.99,
status: 'Delivered',
items: [
{ id: '3', name: 'Leather Jacket', price: 199.99, quantity: 1 },
],
},
];
setOrders(sampleOrders);
setLoading(false);
}, 1000);
}, []);
if (!user) {
return (
Access Denied
Please log in to view your profile.
Login
);
}
return (
Your Profile
Order History
{loading ? (
) : orders.length === 0 ? (
You haven't placed any orders yet.
) : (
Order ID
Date
Total
Status
View
{orders.map((order) => (
{order.id}
{order.date}
${order.total.toFixed(2)}
{order.status}
View Details
))}
)}
);
}
// Admin Dashboard Component
function AdminDashboard() {
const [stats, setStats] = useState(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
// Simulate fetching dashboard stats
setTimeout(() => {
const dashboardStats = {
totalSales: 12589.99,
totalOrders: 156,
totalCustomers: 98,
recentOrders: [
{ id: 'ORD-005', customer: 'John Doe', date: '2023-05-18', total: 249.99, status: 'Processing' },
{ id: 'ORD-004', customer: 'Jane Smith', date: '2023-05-17', total: 129.99, status: 'Shipped' },
{ id: 'ORD-003', customer: 'Bob Johnson', date: '2023-05-16', total: 89.99, status: 'Delivered' },
],
};
setStats(dashboardStats);
setLoading(false);
}, 1000);
}, []);
if (loading) {
return (
);
}
return (
Admin Dashboard
Total Sales
${stats.totalSales.toFixed(2)}
Total Orders
{stats.totalOrders}
Total Customers
{stats.totalCustomers}
Recent Orders
View all
Order ID
Customer
Date
Total
Status
Actions
{stats.recentOrders.map((order) => (
{order.id}
{order.customer}
{order.date}
${order.total.toFixed(2)}
{order.status}
View
))}
Quick Links
Manage Products
Manage Orders
Add New Product
View Analytics
System Status
Server Status
Operational
Database Status
Operational
AR Services
Operational
Payment Gateway
Operational
);
}
// Admin Products Component
function AdminProducts() {
const [products, setProducts] = useState([]);
const [loading, setLoading] = useState(true);
const [showAddModal, setShowAddModal] = useState(false);
const [showEditModal, setShowEditModal] = useState(false);
const [currentProduct, setCurrentProduct] = useState(null);
useEffect(() => {
// Simulate fetching products
setTimeout(() => {
const fetchedProducts = [
{ id: '1', name: 'Classic T-Shirt', price: 29.99, category: 'clothing', inventory: 45, hasAR: true },
{ id: '2', name: 'Designer Sunglasses', price: 89.99, category: 'accessories', inventory: 20, hasAR: true },
{ id: '3', name: 'Leather Jacket', price: 199.99, category: 'clothing', inventory: 15, hasAR: true },
{ id: '4', name: 'Silver Watch', price: 149.99, category: 'accessories', inventory: 12, hasAR: true },
{ id: '5', name: 'Denim Jeans', price: 59.99, category: 'clothing', inventory: 30, hasAR: true },
{ id: '6', name: 'Beanie Hat', price: 19.99, category: 'accessories', inventory: 50, hasAR: true },
];
setProducts(fetchedProducts);
setLoading(false);
}, 1000);
}, []);
const handleEdit = (product) => {
setCurrentProduct(product);
setShowEditModal(true);
};
const handleDelete = (productId) => {
if (window.confirm('Are you sure you want to delete this product?')) {
// In a real app, this would make an API call to delete the product
setProducts(products.filter(product => product.id !== productId));
}
};
if (loading) {
return (
);
}
return (
Manage Products
setShowAddModal(true)}
className="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-teal-600 hover:bg-teal-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-teal-500"
>
Add New Product
Product Name
Category
Price
Inventory
AR Available
Actions
{products.map((product) => (
{product.name}
{product.category}
${product.price.toFixed(2)}
{product.inventory}
{product.hasAR ? (
Yes
) : (
No
)}
handleEdit(product)}
className="text-teal-600 hover:text-teal-900 mr-4"
>
Edit
handleDelete(product.id)}
className="text-red-600 hover:text-red-900"
>
Delete
))}
{/* Add Product Modal */}
{showAddModal && (
setShowAddModal(false)}
>
Add Product
setShowAddModal(false)}
>
Cancel
)}
{/* Edit Product Modal */}
{showEditModal && currentProduct && (
Edit Product: {currentProduct.name}
setShowEditModal(false)}
>
Save Changes
setShowEditModal(false)}
>
Cancel
)}
);
}
// Admin Orders Component
function AdminOrders() {
const [orders, setOrders] = useState([]);
const [loading, setLoading] = useState(true);
const [showDetailsModal, setShowDetailsModal] = useState(false);
const [currentOrder, setCurrentOrder] = useState(null);
useEffect(() => {
// Simulate fetching orders
setTimeout(() => {
const fetchedOrders = [
{ id: 'ORD-001', customer: 'John Doe', email: 'john@example.com', date: '2023-05-15', total: 129.99, status: 'Delivered', items: [
{ id: '1', name: 'Classic T-Shirt', price: 29.99, quantity: 1 },
{ id: '2', name: 'Designer Sunglasses', price: 89.99, quantity: 1 },
]},
{ id: 'ORD-002', customer: 'Jane Smith', email: 'jane@example.com', date: '2023-05-14', total: 199.99, status: 'Shipped', items: [
{ id: '3', name: 'Leather Jacket', price: 199.99, quantity: 1 },
]},
{ id: 'ORD-003', customer: 'Bob Johnson', email: 'bob@example.com', date: '2023-05-13', total: 89.99, status: 'Processing', items: [
{ id: '2', name: 'Designer Sunglasses', price: 89.99, quantity: 1 },
]},
{ id: 'ORD-004', customer: 'Alice Brown', email: 'alice@example.com', date: '2023-05-12', total: 149.99, status: 'Delivered', items: [
{ id: '4', name: 'Silver Watch', price: 149.99, quantity: 1 },
]},
{ id: 'ORD-005', customer: 'Charlie Davis', email: 'charlie@example.com', date: '2023-05-11', total: 79.98, status: 'Shipped', items: [
{ id: '5', name: 'Denim Jeans', price: 59.99, quantity: 1 },
{ id: '6', name: 'Beanie Hat', price: 19.99, quantity: 1 },
]},
];
setOrders(fetchedOrders);
setLoading(false);
}, 1000);
}, []);
const handleViewDetails = (order) => {
setCurrentOrder(order);
setShowDetailsModal(true);
};
const handleUpdateStatus = (orderId, newStatus) => {
// In a real app, this would make an API call to update the order status
setOrders(orders.map(order =>
order.id === orderId ? { ...order, status: newStatus } : order
));
if (currentOrder && currentOrder.id === orderId) {
setCurrentOrder({ ...currentOrder, status: newStatus });
}
};
if (loading) {
return (
);
}
return (
Manage Orders
Order ID
Customer
Date
Total
Status
Actions
{orders.map((order) => (
{order.id}
{order.customer}
{order.date}
${order.total.toFixed(2)}
{order.status}
handleViewDetails(order)}
className="text-teal-600 hover:text-teal-900"
>
View Details
))}
{/* Order Details Modal */}
{showDetailsModal && currentOrder && (
Order Details: {currentOrder.id}
Customer
{currentOrder.customer}
Email
{currentOrder.email}
Status
{currentOrder.status}
Items
{currentOrder.items.map((item) => (
{item.name}
Qty: {item.quantity}
${item.price.toFixed(2)}
))}
Total
${currentOrder.total.toFixed(2)}
Update Status
handleUpdateStatus(currentOrder.id, 'Processing')}
className={`inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white ${
currentOrder.status === 'Processing' ? 'bg-yellow-600' : 'bg-yellow-500 hover:bg-yellow-600'
} focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-yellow-500`}
>
Processing
handleUpdateStatus(currentOrder.id, 'Shipped')}
className={`inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white ${
currentOrder.status === 'Shipped' ? 'bg-blue-600' : 'bg-blue-500 hover:bg-blue-600'
} focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500`}
>
Shipped
handleUpdateStatus(currentOrder.id, 'Delivered')}
className={`inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white ${
currentOrder.status === 'Delivered' ? 'bg-green-600' : 'bg-green-500 hover:bg-green-600'
} focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500`}
>
Delivered
setShowDetailsModal(false)}
>
Close
)}
);
}
// Footer Component
function Footer() {
return (
);
}