diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..3e3c17e --- /dev/null +++ b/assets/css/custom.css @@ -0,0 +1,34 @@ + +body { + font-family: 'Inter', sans-serif; + background-color: #f8f9fa; +} + +.navbar-brand { + font-weight: 600; +} + +.product-card { + transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out; + border: none; + border-radius: 0.5rem; +} + +.product-card:hover { + transform: translateY(-5px); + box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15); +} + +.card-img-top { + border-top-left-radius: 0.5rem; + border-top-right-radius: 0.5rem; + aspect-ratio: 4 / 3; + object-fit: cover; +} + +.toast-container { + position: fixed; + bottom: 1rem; + right: 1rem; + z-index: 1055; +} diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..ce4063f --- /dev/null +++ b/assets/js/main.js @@ -0,0 +1,11 @@ + +document.addEventListener('DOMContentLoaded', function () { + const toastEl = document.getElementById('cartToast'); + const toast = new bootstrap.Toast(toastEl); + + document.querySelectorAll('.add-to-cart-btn').forEach(button => { + button.addEventListener('click', function () { + toast.show(); + }); + }); +}); diff --git a/db/migrations/001_create_products_table.sql b/db/migrations/001_create_products_table.sql new file mode 100644 index 0000000..313a077 --- /dev/null +++ b/db/migrations/001_create_products_table.sql @@ -0,0 +1,22 @@ + +CREATE TABLE IF NOT EXISTS products ( + id INT AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(255) NOT NULL, + description TEXT, + price DECIMAL(10, 2) NOT NULL, + image_url VARCHAR(255), + stock_quantity INT NOT NULL DEFAULT 0, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +-- Insert sample data +DELETE FROM products; -- Clear existing data to avoid duplicates on re-run +INSERT INTO products (name, description, price, image_url, stock_quantity) VALUES +('Laptop Pro', 'Powerful laptop for professionals with a stunning 16-inch display.', 1499.99, 'assets/images/laptop.jpg', 50), +('Wireless Mouse', 'Ergonomic wireless mouse with a long-lasting battery.', 25.50, 'assets/images/mouse.jpg', 200), +('Mechanical Keyboard', 'RGB backlit mechanical keyboard for the ultimate typing experience.', 120.00, 'assets/images/keyboard.jpg', 75), +('4K Monitor', '27-inch 4K UHD monitor with vibrant colors and crisp details.', 349.99, 'assets/images/monitor.jpg', 100), +('Webcam HD', 'Full HD 1080p webcam for clear video calls and streaming.', 45.00, 'assets/images/webcam.jpg', 150), +('Docking Station', 'Universal docking station to connect all your peripherals with a single cable.', 89.99, 'assets/images/docking.jpg', 60), +('Gaming Headset', 'Immersive surround sound gaming headset with a noise-cancelling microphone.', 75.00, 'assets/images/headset.jpg', 90), +('USB-C Hub', '7-in-1 USB-C hub with HDMI, SD card reader, and multiple USB ports.', 35.25, 'assets/images/hub.jpg', 300); diff --git a/index.php b/index.php index 7205f3d..2dcc2ab 100644 --- a/index.php +++ b/index.php @@ -1,150 +1,107 @@ - - + - - - New Style - - - - - - - - - - - - - - - - - - - + + + <?php echo htmlspecialchars($_SERVER['PROJECT_NAME'] ?? 'My Web Shop'); ?> + + + + + + + + + + + + + + + -
-
-

Analyzing your requirements and generating your website…

-
- Loading… -
-

AI is collecting your requirements and applying the first changes.

-

This page will update automatically as the plan is implemented.

-

Runtime: PHP — UTC

+ + + + + +
+

Our Products

+ + query('SELECT name, description, price, image_url, stock_quantity FROM products ORDER BY created_at DESC'); + $products = $stmt->fetchAll(); + } catch (PDOException $e) { + // In a real application, you would log this error and show a user-friendly message. + error_log('Database error: ' . $e->getMessage()); + $products = []; // Ensure products is an empty array on error + } + ?> + +
+ +
+
+ <?php echo htmlspecialchars($product['name']); ?> +
+
+

$

+ +
+
+
+ +
+
+ + +
+
+

© . All Rights Reserved.

+
+
+ + +
+
-
- + + + + + + - + \ No newline at end of file