Refactor to multi-category catalog with polished light mode
- Restructure from single filament table to multi-category product catalog (filamenti, stampaci, ploce, mlaznice, delovi, oprema) - Add shared layout components (SiteHeader, SiteFooter, CategoryNav, Breadcrumb) - Add reusable UI primitives (Badge, Button, Card, Modal, PriceDisplay, EmptyState) - Add catalog components (CatalogPage, ProductTable, ProductGrid, FilamentCard, ProductCard) - Add admin dashboard with sidebar navigation and category management - Add product API endpoints and database migrations - Add SEO pages (politika-privatnosti, uslovi-koriscenja, robots.txt, sitemap.xml) - Fix light mode: gradient text contrast, category nav accessibility, surface tokens, card shadows, CTA section theming
This commit is contained in:
32
database/migrations/021_create_products_table.sql
Normal file
32
database/migrations/021_create_products_table.sql
Normal file
@@ -0,0 +1,32 @@
|
||||
-- Migration: Create products table for non-filament product categories
|
||||
-- This is purely additive - does not modify existing tables
|
||||
|
||||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
||||
|
||||
CREATE TYPE product_category AS ENUM ('printer', 'build_plate', 'nozzle', 'spare_part', 'accessory');
|
||||
CREATE TYPE product_condition AS ENUM ('new', 'used_like_new', 'used_good', 'used_fair');
|
||||
|
||||
CREATE TABLE products (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
category product_category NOT NULL,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
slug VARCHAR(255) NOT NULL UNIQUE,
|
||||
description TEXT,
|
||||
price INTEGER,
|
||||
condition product_condition DEFAULT 'new',
|
||||
stock INTEGER NOT NULL DEFAULT 0 CHECK (stock >= 0),
|
||||
sale_percentage INTEGER DEFAULT 0,
|
||||
sale_active BOOLEAN DEFAULT FALSE,
|
||||
sale_start_date TIMESTAMP WITH TIME ZONE,
|
||||
sale_end_date TIMESTAMP WITH TIME ZONE,
|
||||
attributes JSONB NOT NULL DEFAULT '{}',
|
||||
image_url VARCHAR(500),
|
||||
is_active BOOLEAN DEFAULT TRUE,
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE INDEX idx_products_category ON products(category);
|
||||
CREATE INDEX idx_products_slug ON products(slug);
|
||||
CREATE INDEX idx_products_is_active ON products(is_active);
|
||||
CREATE INDEX idx_products_category_active ON products(category, is_active);
|
||||
25
database/migrations/022_create_printer_compatibility.sql
Normal file
25
database/migrations/022_create_printer_compatibility.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
-- Migration: Create printer models and product compatibility junction table
|
||||
|
||||
CREATE TABLE printer_models (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
name VARCHAR(100) NOT NULL UNIQUE,
|
||||
series VARCHAR(50) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE product_printer_compatibility (
|
||||
product_id UUID REFERENCES products(id) ON DELETE CASCADE,
|
||||
printer_model_id UUID REFERENCES printer_models(id) ON DELETE CASCADE,
|
||||
PRIMARY KEY (product_id, printer_model_id)
|
||||
);
|
||||
|
||||
-- Seed printer models
|
||||
INSERT INTO printer_models (name, series) VALUES
|
||||
('A1 Mini', 'A'),
|
||||
('A1', 'A'),
|
||||
('P1P', 'P'),
|
||||
('P1S', 'P'),
|
||||
('X1C', 'X'),
|
||||
('X1E', 'X'),
|
||||
('H2D', 'H'),
|
||||
('H2S', 'H'),
|
||||
('P2S', 'P');
|
||||
12
database/migrations/023_create_product_images.sql
Normal file
12
database/migrations/023_create_product_images.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
-- Migration: Multi-image support for products
|
||||
|
||||
CREATE TABLE product_images (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
product_id UUID NOT NULL REFERENCES products(id) ON DELETE CASCADE,
|
||||
url VARCHAR(500) NOT NULL,
|
||||
alt_text VARCHAR(255),
|
||||
sort_order INTEGER DEFAULT 0,
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE INDEX idx_product_images_product_id ON product_images(product_id);
|
||||
Reference in New Issue
Block a user