import React, { useState, useEffect } from "react"; import { createRoot } from "react-dom/client"; import { ShoppingCart, Menu, X, Search, MapPin, Phone, Mail, Facebook, Instagram, Cpu, Monitor, Printer, HardDrive, Star, CheckCircle, ArrowRight } from "lucide-react"; // --- Types & Interfaces --- type Category = 'laptop' | 'pc' | 'printer' | 'device'; type Page = 'home' | 'products' | 'about' | 'contact'; interface Product { id: number; name: string; category: Category; price: number; oldPrice?: number; specs: string[]; image: string; rating: number; } interface CartItem extends Product { quantity: number; } // --- Mock Data Generator --- // Tạo 20 sản phẩm cho mỗi danh mục như yêu cầu const generateProducts = (): Product[] => { const products: Product[] = []; let idCounter = 1; const categories: { key: Category; label: string; imagePrefix: string }[] = [ { key: 'laptop', label: 'Laptop', imagePrefix: 'https://images.unsplash.com/photo-1496181133206-80ce9b88a853?auto=format&fit=crop&w=500&q=80' }, { key: 'pc', label: 'PC Đồng Bộ', imagePrefix: 'https://images.unsplash.com/photo-1587831990711-23ca6441447b?auto=format&fit=crop&w=500&q=80' }, { key: 'printer', label: 'Máy in', imagePrefix: 'https://images.unsplash.com/photo-1612815154858-60aa4c59eaa6?auto=format&fit=crop&w=500&q=80' }, { key: 'device', label: 'Thiết bị & Linh kiện', imagePrefix: 'https://images.unsplash.com/photo-1555618568-98e357948b89?auto=format&fit=crop&w=500&q=80' } ]; categories.forEach(cat => { for (let i = 1; i <= 20; i++) { let specs=[]; let name="" ; let price=0; if (cat.key==='laptop' ) { name=`Laptop Vietech ${cat.label} Pro ${i}`; specs=[`Core i${i % 2===0 ? '5' : '7' }`, 'RAM 16GB' , 'SSD 512GB' ]; price=15000000 + (i * 500000); } else if (cat.key==='pc' ) { name=`PC Gaming Vietech G${i}`; specs=['RTX 3060', 'RAM 32GB' , 'Liquid Cool' ]; price=20000000 + (i * 800000); } else if (cat.key==='printer' ) { name=`Máy in Laser Vietech P${i}`; specs=['In 2 mặt', 'Wifi' , 'Tốc độ cao' ]; price=3000000 + (i * 200000); } else { name=`Chuột/Phím Cơ Vietech K${i}`; specs=['RGB Led', 'Wireless' , 'Mechanical' ]; price=500000 + (i * 50000); } products.push({ id: idCounter++, name: name, category: cat.key, price: price, oldPrice: i % 3===0 ? price * 1.2 : undefined, // Giả lập giảm giá specs: specs, image: cat.imagePrefix, rating: 4 + (i % 2) * 0.5 }); } }); return products; }; const ALL_PRODUCTS=generateProducts(); // --- Components --- const Header=({ cartCount, activePage, setPage, toggleCart }: { cartCount: number; activePage: Page; setPage: (p: Page)=> void; toggleCart: () => void }) => { const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false); const navItems: { id: Page; label: string }[] = [ { id: 'home', label: 'Trang Chủ' }, { id: 'products', label: 'Sản Phẩm' }, { id: 'about', label: 'Vietech Green' }, { id: 'contact', label: 'Liên hệ' }, ]; return (
{/* Top Bar */}
Hotline: 1900 xxxx - Email: sales@vietechgreen.vn Công nghệ xanh cho tương lai số
{/* Main Header */}
{/* Logo */}
setPage('home')} >

VIETECH GREEN

CÔNG TY TNHH VIETECH GREEN

{/* Desktop Nav */} {/* Actions */}
{/* Mobile Menu */} {isMobileMenuOpen && (
{navItems.map((item) => ( ))}
)}
); }; const Footer = () => { return ( ); }; const ProductCard: React.FC<{ product: Product; onAddToCart: (p: Product)=> void }> = ({ product, onAddToCart }) => { return (
{product.name} {product.oldPrice && (
GIẢM {Math.round(((product.oldPrice - product.price) / product.oldPrice) * 100)}%
)}
{product.category === 'device' ? 'Thiết bị' : product.category}

{product.name}

{/* Specs summary */}
{product.specs.slice(0, 2).map((spec, idx) => ( {spec} ))}
{[...Array(5)].map((_, i) => ( ))} ({Math.floor(Math.random() * 50) + 1} đánh giá)
{product.price.toLocaleString('vi-VN')}đ {product.oldPrice && ( {product.oldPrice.toLocaleString('vi-VN')}đ )}
); }; // --- Views --- const HomeView = ({ setPage, onAddToCart }: { setPage: (p: Page) => void; onAddToCart: (p: Product) => void }) => { const featuredProducts = ALL_PRODUCTS.filter(p => p.id % 5 === 0).slice(0, 8); // Lấy ngẫu nhiên vài sản phẩm return (
{/* Hero Banner */}
KHUYẾN MÃI MÙA HÈ

Công Nghệ Đỉnh Cao
Nâng Tầm Cuộc Sống

Vietech Green mang đến các giải pháp Laptop, PC, Máy in và Thiết bị văn phòng chính hãng với giá tốt nhất thị trường.

{/* Benefits */}
{[ { icon: CheckCircle, title: "Sản phẩm chính hãng", desc: "Cam kết 100% hàng chính hãng, bảo hành đầy đủ." }, { icon: TruckIcon, title: "Giao hàng toàn quốc", desc: "Vận chuyển nhanh chóng, an toàn đến tận tay bạn." }, { icon: HeadsetIcon, title: "Hỗ trợ 24/7", desc: "Đội ngũ kỹ thuật viên giàu kinh nghiệm luôn sẵn sàng." } ].map((item, idx) => (

{item.title}

{item.desc}

))}
{/* Featured Products */}

Sản Phẩm Nổi Bật

{featuredProducts.map(p => ( ))}
{/* Banner Sales */}

Đối Tác Của Vietech Green

Chúng tôi tự hào là đối tác chiến lược của các thương hiệu công nghệ hàng đầu thế giới.

{['DELL', 'HP', 'ASUS', 'CANON', 'LOGITECH'].map(brand => (
{brand}
))}
); }; const ProductsView = ({ onAddToCart }: { onAddToCart: (p: Product) => void }) => { const [filter, setFilter] = useState('all'); const categories = [ { id: 'all', label: 'Tất cả', icon: Monitor }, // Generic icon for all { id: 'laptop', label: 'Laptop', icon: LaptopIcon }, { id: 'pc', label: 'PC Đồng Bộ', icon: Monitor }, { id: 'printer', label: 'Máy in', icon: Printer }, { id: 'device', label: 'Thiết bị', icon: HardDrive }, ]; const filteredProducts = filter === 'all' ? ALL_PRODUCTS : ALL_PRODUCTS.filter(p => p.category === filter); return (
{/* Page Title */}

Danh Mục Sản Phẩm

Lựa chọn thiết bị phù hợp nhất với nhu cầu của bạn

{/* Filters */}
{categories.map((cat) => ( ))}
{/* Product Grid */}
Hiển thị {filteredProducts.length} sản phẩm
{filteredProducts.map(p => ( ))}
); }; const AboutView = () => { return (
{/* Intro Header */}

Về Vietech Green

Công ty TNHH Vietech Green - Tiên phong trong lĩnh vực cung cấp giải pháp công nghệ xanh và bền vững.

{/* Main Content */}

Câu chuyện của chúng tôi

Thành lập với sứ mệnh mang công nghệ đến gần hơn với mọi người, Vietech Green không chỉ bán sản phẩm, chúng tôi cung cấp giải pháp. Chúng tôi tin rằng công nghệ là chìa khóa để tối ưu hóa hiệu suất làm việc và nâng cao chất lượng cuộc sống.

Với đội ngũ kỹ sư và tư vấn viên giàu kinh nghiệm, chúng tôi cam kết mang đến những sản phẩm chất lượng cao nhất từ các thương hiệu hàng đầu thế giới như Dell, HP, Asus, Canon...

10+
Năm kinh nghiệm
5000+
Khách hàng hài lòng
Team
{/* Vision/Mission */}

Tầm Nhìn

Trở thành nhà cung cấp giải pháp IT hàng đầu Việt Nam với hệ sinh thái xanh.

Sứ Mệnh

Tối ưu hóa quy trình làm việc của doanh nghiệp thông qua công nghệ hiện đại.

Giá Trị Cốt Lõi

Uy tín - Tận tâm - Chuyên nghiệp - Sáng tạo.

); }; const ContactView = () => { return (

Liên Hệ Với Chúng Tôi

{/* Contact Info */}

Thông tin liên lạc

Hãy liên hệ với Vietech Green để được tư vấn miễn phí về các giải pháp công nghệ cho doanh nghiệp và cá nhân.

Địa chỉ

Số 123, Đường Công Nghệ, Quận Cầu Giấy, Thành phố Hà Nội, Việt Nam.

Điện thoại

Hotline: 1900 xxxx

Kinh doanh: 0912 xxx xxx

Email

contact@vietechgreen.vn

support@vietechgreen.vn

{/* Contact Form */}

Gửi tin nhắn

e.preventDefault()}>
); }; const CartModal = ({ isOpen, onClose, items, onRemove }: { isOpen: boolean; onClose: () => void; items: CartItem[]; onRemove: (id: number) => void }) => { if (!isOpen) return null; const total = items.reduce((sum, item) => sum + (item.price * item.quantity), 0); return (

Giỏ hàng của bạn

{items.length === 0 ? (

Giỏ hàng đang trống

) : ( items.map(item => (
{item.name}

{item.name}

{item.price.toLocaleString('vi-VN')}đ
SL: {item.quantity}
)) )}
Tổng tiền: {total.toLocaleString('vi-VN')}đ
); }; // Helper components for Icons used only in JSX logic above const LaptopIcon = ({ className }: {className?: string}) => ; const TruckIcon = ({ className }: {className?: string}) => ; const HeadsetIcon = ({ className }: {className?: string}) => ; const HeartIcon = ({ className }: {className?: string}) => ; const ShieldCheckIcon = ({ className }: {className?: string}) => ; // --- Main App --- const App = () => { const [activePage, setActivePage] = useState('home'); const [cart, setCart] = useState([]); const [isCartOpen, setIsCartOpen] = useState(false); // Load cart from local storage simulation useEffect(() => { // In a real app, load from localStorage here }, []); const addToCart = (product: Product) => { setCart(prev => { const existing = prev.find(item => item.id === product.id); if (existing) { return prev.map(item => item.id === product.id ? { ...item, quantity: item.quantity + 1 } : item ); } return [...prev, { ...product, quantity: 1 }]; }); setIsCartOpen(true); // Open cart to confirm }; const removeFromCart = (id: number) => { setCart(prev => prev.filter(item => item.id !== id)); }; const cartCount = cart.reduce((acc, item) => acc + item.quantity, 0); return (
{ window.scrollTo(0,0); setActivePage(p); }} toggleCart={() => setIsCartOpen(true)} />
{activePage === 'home' && { window.scrollTo(0,0); setActivePage(p); }} onAddToCart={addToCart} />} {activePage === 'products' && } {activePage === 'about' && } {activePage === 'contact' && }
setIsCartOpen(false)} items={cart} onRemove={removeFromCart} />
); }; const root = createRoot(document.getElementById("root")!); root.render( );