Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -135,29 +135,14 @@ def catalog():
|
|
| 135 |
box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
|
| 136 |
}
|
| 137 |
.products-grid {
|
| 138 |
-
display:
|
| 139 |
-
|
| 140 |
-
overflow-x: auto;
|
| 141 |
gap: 10px;
|
| 142 |
-
padding:
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
scrollbar-color: #888 #f5f5f5;
|
| 146 |
-
}
|
| 147 |
-
.products-grid::-webkit-scrollbar {
|
| 148 |
-
height: 8px;
|
| 149 |
-
}
|
| 150 |
-
.products-grid::-webkit-scrollbar-track {
|
| 151 |
-
background: #f5f5f5;
|
| 152 |
-
border-radius: 10px;
|
| 153 |
-
}
|
| 154 |
-
.products-grid::-webkit-scrollbar-thumb {
|
| 155 |
-
background-color: #888;
|
| 156 |
-
border-radius: 10px;
|
| 157 |
-
border: 2px solid #f5f5f5;
|
| 158 |
}
|
| 159 |
.product {
|
| 160 |
-
flex: 0 0 50%;
|
| 161 |
background: #ffffff;
|
| 162 |
border-radius: 10px;
|
| 163 |
padding: 10px;
|
|
@@ -212,12 +197,6 @@ def catalog():
|
|
| 212 |
text-overflow: ellipsis;
|
| 213 |
white-space: nowrap;
|
| 214 |
}
|
| 215 |
-
.product-popularity {
|
| 216 |
-
color: #666;
|
| 217 |
-
font-size: 0.7em;
|
| 218 |
-
text-align: center;
|
| 219 |
-
margin-bottom: 5px;
|
| 220 |
-
}
|
| 221 |
.product-button {
|
| 222 |
background-color: #3498db;
|
| 223 |
color: white;
|
|
@@ -333,11 +312,13 @@ def catalog():
|
|
| 333 |
}
|
| 334 |
@media (min-width: 768px) {
|
| 335 |
.products-grid {
|
| 336 |
-
|
| 337 |
-
|
|
|
|
|
|
|
| 338 |
}
|
| 339 |
.product {
|
| 340 |
-
|
| 341 |
}
|
| 342 |
.product-image {
|
| 343 |
aspect-ratio: 1;
|
|
@@ -381,7 +362,6 @@ def catalog():
|
|
| 381 |
<h2>{{ product['name'] }}</h2>
|
| 382 |
<div class="product-price">{{ product['price'] }}</div>
|
| 383 |
<p class="product-description">{{ product['description'][:50] }}{% if product['description']|length > 50 %}...{% endif %}</p>
|
| 384 |
-
<p class="product-popularity">Продано {{ product.get('sales', '0') }}+ раз</p>
|
| 385 |
<button class="product-button" onclick="openModal({{ loop.index0 }})">Подробнее</button>
|
| 386 |
<button class="product-button add-to-cart" onclick="openQuantityModal({{ loop.index0 }})">В корзину</button>
|
| 387 |
</div>
|
|
@@ -721,8 +701,7 @@ def admin():
|
|
| 721 |
'name': name,
|
| 722 |
'price': price,
|
| 723 |
'description': description,
|
| 724 |
-
'photos': photos_list
|
| 725 |
-
'sales': 0 # Добавляем поле для количества продаж
|
| 726 |
}
|
| 727 |
|
| 728 |
products.append(new_product)
|
|
@@ -890,8 +869,6 @@ def admin():
|
|
| 890 |
<input type="number" id="price" name="price" step="0.01" required>
|
| 891 |
<label for="description">Описание:</label>
|
| 892 |
<textarea id="description" name="description" rows="4" required></textarea>
|
| 893 |
-
<label for="sales">Количество продаж (примерно):</label>
|
| 894 |
-
<input type="number" id="sales" name="sales" value="0" min="0">
|
| 895 |
<label for="photos">Фотографии товара (максимум 2):</label>
|
| 896 |
<input type="file" id="photos" name="photos" accept="image/*" multiple>
|
| 897 |
<button type="submit">Добавить товар</button>
|
|
@@ -912,7 +889,6 @@ def admin():
|
|
| 912 |
<h3>{{ product['name'] }}</h3>
|
| 913 |
<p><strong>Цена:</strong> {{ product['price'] }}</p>
|
| 914 |
<p><strong>Описание:</strong> {{ product['description'] }}</p>
|
| 915 |
-
<p><strong>Продано:</strong> {{ product['sales'] }}+ раз</p>
|
| 916 |
{% if product.get('photos') and product['photos']|length > 0 %}
|
| 917 |
<div style="background-color: #fff; width: 100px; height: 100px; display: flex; justify-content: center; align-items: center;">
|
| 918 |
<img src="https://huggingface.co/datasets/{{ repo_id }}/resolve/main/photos/{{ product['photos'][0] }}"
|
|
@@ -931,8 +907,6 @@ def admin():
|
|
| 931 |
<input type="number" id="price" name="price" step="0.01" value="{{ product['price'] }}" required>
|
| 932 |
<label for="description">Описание:</label>
|
| 933 |
<textarea id="description" name="description" rows="4" required>{{ product['description'] }}</textarea>
|
| 934 |
-
<label for="sales">Количество продаж:</label>
|
| 935 |
-
<input type="number" id="sales" name="sales" value="{{ product['sales'] }}" min="0">
|
| 936 |
<label for="photos">Фотографии товара (максимум 2):</label>
|
| 937 |
<input type="file" id="photos" name="photos" accept="image/*" multiple>
|
| 938 |
<button type="submit">Сохранить изменения</button>
|
|
|
|
| 135 |
box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
|
| 136 |
}
|
| 137 |
.products-grid {
|
| 138 |
+
display: grid;
|
| 139 |
+
grid-template-columns: repeat(2, 1fr);
|
|
|
|
| 140 |
gap: 10px;
|
| 141 |
+
padding: 0 5px;
|
| 142 |
+
overflow-y: auto;
|
| 143 |
+
max-height: calc(100vh - 120px);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
}
|
| 145 |
.product {
|
|
|
|
| 146 |
background: #ffffff;
|
| 147 |
border-radius: 10px;
|
| 148 |
padding: 10px;
|
|
|
|
| 197 |
text-overflow: ellipsis;
|
| 198 |
white-space: nowrap;
|
| 199 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 200 |
.product-button {
|
| 201 |
background-color: #3498db;
|
| 202 |
color: white;
|
|
|
|
| 312 |
}
|
| 313 |
@media (min-width: 768px) {
|
| 314 |
.products-grid {
|
| 315 |
+
grid-template-columns: repeat(2, 1fr);
|
| 316 |
+
gap: 20px;
|
| 317 |
+
padding: 0 15px;
|
| 318 |
+
max-height: none;
|
| 319 |
}
|
| 320 |
.product {
|
| 321 |
+
padding: 15px;
|
| 322 |
}
|
| 323 |
.product-image {
|
| 324 |
aspect-ratio: 1;
|
|
|
|
| 362 |
<h2>{{ product['name'] }}</h2>
|
| 363 |
<div class="product-price">{{ product['price'] }}</div>
|
| 364 |
<p class="product-description">{{ product['description'][:50] }}{% if product['description']|length > 50 %}...{% endif %}</p>
|
|
|
|
| 365 |
<button class="product-button" onclick="openModal({{ loop.index0 }})">Подробнее</button>
|
| 366 |
<button class="product-button add-to-cart" onclick="openQuantityModal({{ loop.index0 }})">В корзину</button>
|
| 367 |
</div>
|
|
|
|
| 701 |
'name': name,
|
| 702 |
'price': price,
|
| 703 |
'description': description,
|
| 704 |
+
'photos': photos_list
|
|
|
|
| 705 |
}
|
| 706 |
|
| 707 |
products.append(new_product)
|
|
|
|
| 869 |
<input type="number" id="price" name="price" step="0.01" required>
|
| 870 |
<label for="description">Описание:</label>
|
| 871 |
<textarea id="description" name="description" rows="4" required></textarea>
|
|
|
|
|
|
|
| 872 |
<label for="photos">Фотографии товара (максимум 2):</label>
|
| 873 |
<input type="file" id="photos" name="photos" accept="image/*" multiple>
|
| 874 |
<button type="submit">Добавить товар</button>
|
|
|
|
| 889 |
<h3>{{ product['name'] }}</h3>
|
| 890 |
<p><strong>Цена:</strong> {{ product['price'] }}</p>
|
| 891 |
<p><strong>Описание:</strong> {{ product['description'] }}</p>
|
|
|
|
| 892 |
{% if product.get('photos') and product['photos']|length > 0 %}
|
| 893 |
<div style="background-color: #fff; width: 100px; height: 100px; display: flex; justify-content: center; align-items: center;">
|
| 894 |
<img src="https://huggingface.co/datasets/{{ repo_id }}/resolve/main/photos/{{ product['photos'][0] }}"
|
|
|
|
| 907 |
<input type="number" id="price" name="price" step="0.01" value="{{ product['price'] }}" required>
|
| 908 |
<label for="description">Описание:</label>
|
| 909 |
<textarea id="description" name="description" rows="4" required>{{ product['description'] }}</textarea>
|
|
|
|
|
|
|
| 910 |
<label for="photos">Фотографии товара (максимум 2):</label>
|
| 911 |
<input type="file" id="photos" name="photos" accept="image/*" multiple>
|
| 912 |
<button type="submit">Сохранить изменения</button>
|