diff --git "a/app.py" "b/app.py" --- "a/app.py" +++ "b/app.py" @@ -421,8 +421,8 @@ def load_data(): changed = True for product in env_data['products']: - if 'product_id' not in product: product['product_id'] = uuid4().hex; changed = True if 'created_at' not in product: product['created_at'] = '2000-01-01 00:00:00'; changed = True + if 'product_id' not in product: product['product_id'] = uuid4().hex; changed = True if 'pieces_per_box' not in product: product['pieces_per_box'] = ""; changed = True if 'pieces_per_master_box' not in product: product['pieces_per_master_box'] = ""; changed = True if 'box_price' not in product: product['box_price'] = ""; changed = True @@ -461,7 +461,6 @@ def load_data(): if 'category' not in item: item['category'] = 'Без категории'; changed = True if 'wholesale_tiers' not in item: item['wholesale_tiers'] = []; changed = True if 'pieces_per_master_box' not in item: item['pieces_per_master_box'] = 1; changed = True - if 'is_custom' not in item: item['is_custom'] = False; changed = True if changed or not os.path.exists(DATA_FILE): try: @@ -620,7 +619,7 @@ def is_order_fully_assembled(order): def deduct_stock(cart_items, products): for item in cart_items: - if item.get('is_custom'): + if item.get('is_custom', False): continue pid = item.get('product_id') vidx = item.get('variant_idx', -1) @@ -932,7 +931,7 @@ CATALOG_TEMPLATE = ''' } } - .header { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; background: var(--surface); box-shadow: 0 2px 10px rgba(0,0,0,0.03); position: sticky; top: 0; z-index: 100; flex-wrap: wrap; gap: 10px; } + .header { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; background: var(--surface); box-shadow: 0 2px 10px rgba(0,0,0,0.03); position: sticky; top: 0; z-index: 100; } .header h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.5px; } .back-btn { display: none; font-size: 1.2rem; cursor: pointer; color: var(--text); margin-right: 15px; padding: 5px; } @@ -941,54 +940,12 @@ CATALOG_TEMPLATE = ''' .search-container:focus-within { border-color: #dcdde1; background: var(--surface); box-shadow: 0 4px 12px rgba(0,0,0,0.05); } .search-container input { width: 100%; padding: 15px 10px; border: none; background: transparent; outline: none; font-size: 16px; color: var(--text); } - .stories-wrapper { - display: flex; - overflow-x: auto; - -webkit-overflow-scrolling: touch; - scrollbar-width: none; - padding: 15px 20px; - background: var(--surface); - gap: 15px; - border-bottom: 1px solid var(--border); - } + .stories-wrapper { display: flex; gap: 15px; padding: 15px 20px; background: var(--surface); margin-bottom: 1px; border-bottom: 1px solid var(--border); overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; } .stories-wrapper::-webkit-scrollbar { display: none; } - .story-item { - display: flex; - flex-direction: column; - align-items: center; - gap: 6px; - cursor: pointer; - min-width: 76px; - max-width: 76px; - } - .story-img-ring { - width: 72px; - height: 72px; - border-radius: 50%; - background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); - padding: 3px; - display: flex; - align-items: center; - justify-content: center; - } - .story-img-inner { - width: 100%; - height: 100%; - border-radius: 50%; - object-fit: cover; - border: 2px solid var(--surface); - background: var(--bg); - } - .story-title { - font-size: 0.75rem; - font-weight: 600; - text-align: center; - width: 100%; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - color: var(--text); - } + .story-item { display: inline-flex; flex-direction: column; align-items: center; width: 72px; cursor: pointer; text-decoration: none; } + .story-img-wrap { width: 64px; height: 64px; border-radius: 50%; padding: 3px; background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); margin-bottom: 6px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); } + .story-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 2px solid var(--surface); background: var(--bg); } + .story-title { font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; text-align: center; color: var(--text); font-weight: 500; } .categories-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; padding: 20px; } .category-item { background: var(--surface); padding: 20px 15px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; cursor: pointer; box-shadow: 0 4px 15px rgba(0,0,0,0.03); transition: transform 0.2s; text-align: center; } @@ -1063,6 +1020,7 @@ CATALOG_TEMPLATE = ''' .cart-item-delete { color: #ff7675; background: none; border: none; font-size: 1.2rem; cursor: pointer; padding: 10px; touch-action: manipulation; } .confirm-btn { background: var(--accent); color: #fff; width: 100%; padding: 16px; border: none; border-radius: 14px; font-size: 16px; font-weight: 700; cursor: pointer; box-shadow: 0 4px 15px rgba(37,211,102,0.3); min-height: 50px; touch-action: manipulation; } + .confirm-btn:disabled { background: #999; cursor: not-allowed; box-shadow: none; } .gallery-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #000; z-index: 300; justify-content: center; align-items: center; flex-direction: column; } .gallery-close { position: absolute; top: max(20px, env(safe-area-inset-top)); right: 20px; color: #fff; font-size: 2rem; cursor: pointer; background: rgba(0,0,0,0.5); width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: none; z-index: 302; } @@ -1077,7 +1035,7 @@ CATALOG_TEMPLATE = ''' .gallery-text { position: absolute; bottom: 80px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 1.1rem; background: rgba(0,0,0,0.6); padding: 6px 16px; border-radius: 20px; text-align: center; z-index: 301; font-weight: 600; display: none; } .floating-socials { position: fixed; bottom: max(100px, calc(100px + env(safe-area-inset-bottom))); right: 15px; display: flex; flex-direction: column; gap: 12px; z-index: 90; } - .social-btn { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-size: 1.6rem; text-decoration: none; box-shadow: 0 4px 12px rgba(0,0,0,0.25); transition: transform 0.2s; border: none; cursor: pointer;} + .social-btn { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-size: 1.6rem; text-decoration: none; box-shadow: 0 4px 12px rgba(0,0,0,0.25); transition: transform 0.2s; } .social-btn:active { transform: scale(0.9); } .btn-float-wa { background: #25D366; } .btn-float-ig { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%); } @@ -1122,8 +1080,6 @@ CATALOG_TEMPLATE = ''' .pagination button:active { transform: scale(0.95); } .pagination span { color: var(--text-muted); } - .desktop-header-controls { display: none; } - {% if settings.theme in ['dark', 'magma', 'ocean', 'forest', 'cyberpunk'] %} .category-item, .product-card, .header, .search-bar, .cart-bar, .modal-content, .stories-wrapper { box-shadow: 0 4px 15px rgba(0,0,0,0.5); border: 1px solid var(--border); } {% endif %} @@ -1131,14 +1087,9 @@ CATALOG_TEMPLATE = ''' @media (min-width: 768px) { .categories-container { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); } .products-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); } - - .cart-bar, .floating-socials { display: none !important; } - .desktop-header-controls { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; } - .desktop-header-controls .btn { padding: 10px 15px; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: opacity 0.2s; font-size: 15px; min-height: 40px; } - .desktop-header-controls .btn:active { opacity: 0.8; } - .modal-content { max-width: 500px; margin: 0 auto; border-radius: 24px; top: 50%; transform: translateY(-50%) scale(0.9); bottom: auto; position: relative; max-height: 90vh; } .modal-overlay.active .modal-content { transform: translateY(-50%) scale(1); } + .cart-bar { max-width: 500px; left: 50%; transform: translateX(-50%); border-radius: 20px 20px 0 0; } } @@ -1175,29 +1126,11 @@ CATALOG_TEMPLATE = ''' {% endif %} -
-