Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,7 +18,7 @@ HF_TOKEN_WRITE = os.getenv("HF_TOKEN")
|
|
| 18 |
HF_TOKEN_READ = os.getenv("HF_TOKEN_READ")
|
| 19 |
|
| 20 |
# Ссылка на логотип
|
| 21 |
-
LOGO_URL = "https://cdn-avatars.huggingface.co/v1/production/uploads/67b22aaeae9b6a59f1cfb849/
|
| 22 |
|
| 23 |
# Настройка логирования
|
| 24 |
logging.basicConfig(level=logging.DEBUG)
|
|
@@ -117,17 +117,17 @@ def catalog():
|
|
| 117 |
}
|
| 118 |
body {
|
| 119 |
font-family: 'Poppins', sans-serif;
|
| 120 |
-
background: #
|
| 121 |
-
color: #
|
| 122 |
line-height: 1.6;
|
| 123 |
transition: background 0.3s, color 0.3s;
|
| 124 |
}
|
| 125 |
body.dark-mode {
|
| 126 |
-
background: #1a202c;
|
| 127 |
color: #e2e8f0;
|
| 128 |
}
|
| 129 |
.container {
|
| 130 |
-
max-width:
|
| 131 |
margin: 0 auto;
|
| 132 |
padding: 20px;
|
| 133 |
}
|
|
@@ -211,32 +211,31 @@ def catalog():
|
|
| 211 |
}
|
| 212 |
.products-grid {
|
| 213 |
display: grid;
|
| 214 |
-
grid-template-columns: repeat(auto-fill, minmax(
|
| 215 |
-
gap:
|
| 216 |
padding: 10px;
|
| 217 |
}
|
| 218 |
.product {
|
| 219 |
background: #fff;
|
| 220 |
-
border-radius:
|
| 221 |
-
padding:
|
| 222 |
-
box-shadow: 0
|
| 223 |
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
|
| 224 |
overflow: hidden;
|
| 225 |
-
position: relative;
|
| 226 |
}
|
| 227 |
body.dark-mode .product {
|
| 228 |
background: #2d3748;
|
| 229 |
color: #fff;
|
| 230 |
}
|
| 231 |
.product:hover {
|
| 232 |
-
transform: translateY(-5px);
|
| 233 |
-
box-shadow: 0
|
| 234 |
}
|
| 235 |
.product-image {
|
| 236 |
width: 100%;
|
| 237 |
aspect-ratio: 1;
|
| 238 |
background-color: #fff;
|
| 239 |
-
border-radius:
|
| 240 |
overflow: hidden;
|
| 241 |
display: flex;
|
| 242 |
justify-content: center;
|
|
@@ -251,57 +250,67 @@ def catalog():
|
|
| 251 |
.product-image img:hover {
|
| 252 |
transform: scale(1.1);
|
| 253 |
}
|
| 254 |
-
.product
|
| 255 |
-
|
| 256 |
-
justify-content: space-between;
|
| 257 |
-
align-items: center;
|
| 258 |
-
margin-top: 5px;
|
| 259 |
-
}
|
| 260 |
-
.product-title {
|
| 261 |
-
font-size: 1rem;
|
| 262 |
font-weight: 600;
|
| 263 |
-
margin:
|
| 264 |
-
|
| 265 |
-
text-align: left;
|
| 266 |
white-space: nowrap;
|
| 267 |
overflow: hidden;
|
| 268 |
text-overflow: ellipsis;
|
| 269 |
}
|
| 270 |
-
body.dark-mode .product-title {
|
| 271 |
-
color: #e2e8f0;
|
| 272 |
-
}
|
| 273 |
.product-price {
|
| 274 |
-
font-size: 1.
|
| 275 |
-
color: #
|
| 276 |
font-weight: 700;
|
| 277 |
-
text-align:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
}
|
| 279 |
.product-button {
|
| 280 |
display: block;
|
| 281 |
width: 100%;
|
| 282 |
-
padding:
|
| 283 |
border: none;
|
| 284 |
-
border-radius:
|
| 285 |
-
background-color: #
|
| 286 |
color: white;
|
| 287 |
font-size: 0.9rem;
|
| 288 |
font-weight: 500;
|
| 289 |
cursor: pointer;
|
| 290 |
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
| 291 |
-
margin
|
| 292 |
text-align: center;
|
| 293 |
text-decoration: none;
|
| 294 |
}
|
| 295 |
.product-button:hover {
|
| 296 |
-
background-color: #
|
| 297 |
-
box-shadow: 0
|
| 298 |
transform: translateY(-2px);
|
| 299 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 300 |
#cart-button {
|
| 301 |
position: fixed;
|
| 302 |
bottom: 20px;
|
| 303 |
right: 20px;
|
| 304 |
-
background-color: #
|
| 305 |
color: white;
|
| 306 |
border: none;
|
| 307 |
border-radius: 50%;
|
|
@@ -404,17 +413,20 @@ def catalog():
|
|
| 404 |
@media (max-width: 768px) {
|
| 405 |
.products-grid {
|
| 406 |
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
| 407 |
-
gap:
|
| 408 |
}
|
| 409 |
-
.product
|
| 410 |
-
font-size:
|
| 411 |
}
|
| 412 |
.product-price {
|
| 413 |
-
font-size: 1rem;
|
|
|
|
|
|
|
|
|
|
| 414 |
}
|
| 415 |
.product-button {
|
| 416 |
font-size: 0.8rem;
|
| 417 |
-
padding:
|
| 418 |
}
|
| 419 |
.header-logo {
|
| 420 |
width: 50px;
|
|
@@ -459,11 +471,11 @@ def catalog():
|
|
| 459 |
loading="lazy">
|
| 460 |
</div>
|
| 461 |
{% endif %}
|
| 462 |
-
<
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
<button class="product-button" onclick="openQuantityModal({{ loop.index0 }})">В корзину</button>
|
| 467 |
</div>
|
| 468 |
{% endfor %}
|
| 469 |
</div>
|
|
@@ -632,7 +644,7 @@ def catalog():
|
|
| 632 |
orderText += `${index + 1}. ${item.name} - ${item.price} с × ${item.quantity}%0A`;
|
| 633 |
});
|
| 634 |
orderText += `Итого: ${total} с`;
|
| 635 |
-
window.open(`https://api.whatsapp.com/send?phone=
|
| 636 |
}
|
| 637 |
|
| 638 |
function clearCart() {
|
|
|
|
| 18 |
HF_TOKEN_READ = os.getenv("HF_TOKEN_READ")
|
| 19 |
|
| 20 |
# Ссылка на логотип
|
| 21 |
+
LOGO_URL = "https://cdn-avatars.huggingface.co/v1/production/uploads/67b22aaeae9b6a59f1cfb849/JrKb3It_r7IqEEikB9mZV.jpeg"
|
| 22 |
|
| 23 |
# Настройка логирования
|
| 24 |
logging.basicConfig(level=logging.DEBUG)
|
|
|
|
| 117 |
}
|
| 118 |
body {
|
| 119 |
font-family: 'Poppins', sans-serif;
|
| 120 |
+
background: linear-gradient(135deg, #f0f2f5, #e9ecef);
|
| 121 |
+
color: #2d3748;
|
| 122 |
line-height: 1.6;
|
| 123 |
transition: background 0.3s, color 0.3s;
|
| 124 |
}
|
| 125 |
body.dark-mode {
|
| 126 |
+
background: linear-gradient(135deg, #1a202c, #2d3748);
|
| 127 |
color: #e2e8f0;
|
| 128 |
}
|
| 129 |
.container {
|
| 130 |
+
max-width: 1300px;
|
| 131 |
margin: 0 auto;
|
| 132 |
padding: 20px;
|
| 133 |
}
|
|
|
|
| 211 |
}
|
| 212 |
.products-grid {
|
| 213 |
display: grid;
|
| 214 |
+
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
| 215 |
+
gap: 20px;
|
| 216 |
padding: 10px;
|
| 217 |
}
|
| 218 |
.product {
|
| 219 |
background: #fff;
|
| 220 |
+
border-radius: 15px;
|
| 221 |
+
padding: 15px;
|
| 222 |
+
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
|
| 223 |
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
|
| 224 |
overflow: hidden;
|
|
|
|
| 225 |
}
|
| 226 |
body.dark-mode .product {
|
| 227 |
background: #2d3748;
|
| 228 |
color: #fff;
|
| 229 |
}
|
| 230 |
.product:hover {
|
| 231 |
+
transform: translateY(-5px) scale(1.02);
|
| 232 |
+
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
|
| 233 |
}
|
| 234 |
.product-image {
|
| 235 |
width: 100%;
|
| 236 |
aspect-ratio: 1;
|
| 237 |
background-color: #fff;
|
| 238 |
+
border-radius: 10px;
|
| 239 |
overflow: hidden;
|
| 240 |
display: flex;
|
| 241 |
justify-content: center;
|
|
|
|
| 250 |
.product-image img:hover {
|
| 251 |
transform: scale(1.1);
|
| 252 |
}
|
| 253 |
+
.product h2 {
|
| 254 |
+
font-size: 1.2rem;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 255 |
font-weight: 600;
|
| 256 |
+
margin: 10px 0;
|
| 257 |
+
text-align: center;
|
|
|
|
| 258 |
white-space: nowrap;
|
| 259 |
overflow: hidden;
|
| 260 |
text-overflow: ellipsis;
|
| 261 |
}
|
|
|
|
|
|
|
|
|
|
| 262 |
.product-price {
|
| 263 |
+
font-size: 1.3rem;
|
| 264 |
+
color: #ef4444;
|
| 265 |
font-weight: 700;
|
| 266 |
+
text-align: center;
|
| 267 |
+
margin: 5px 0;
|
| 268 |
+
}
|
| 269 |
+
.product-description {
|
| 270 |
+
font-size: 0.9rem;
|
| 271 |
+
color: #718096;
|
| 272 |
+
text-align: center;
|
| 273 |
+
margin-bottom: 15px;
|
| 274 |
+
overflow: hidden;
|
| 275 |
+
text-overflow: ellipsis;
|
| 276 |
+
white-space: nowrap;
|
| 277 |
+
}
|
| 278 |
+
body.dark-mode .product-description {
|
| 279 |
+
color: #a0aec0;
|
| 280 |
}
|
| 281 |
.product-button {
|
| 282 |
display: block;
|
| 283 |
width: 100%;
|
| 284 |
+
padding: 10px;
|
| 285 |
border: none;
|
| 286 |
+
border-radius: 8px;
|
| 287 |
+
background-color: #3b82f6;
|
| 288 |
color: white;
|
| 289 |
font-size: 0.9rem;
|
| 290 |
font-weight: 500;
|
| 291 |
cursor: pointer;
|
| 292 |
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
| 293 |
+
margin: 5px 0;
|
| 294 |
text-align: center;
|
| 295 |
text-decoration: none;
|
| 296 |
}
|
| 297 |
.product-button:hover {
|
| 298 |
+
background-color: #2563eb;
|
| 299 |
+
box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
|
| 300 |
transform: translateY(-2px);
|
| 301 |
}
|
| 302 |
+
.add-to-cart {
|
| 303 |
+
background-color: #10b981;
|
| 304 |
+
}
|
| 305 |
+
.add-to-cart:hover {
|
| 306 |
+
background-color: #059669;
|
| 307 |
+
box-shadow: 0 4px 15px rgba(5, 150, 105, 0.4);
|
| 308 |
+
}
|
| 309 |
#cart-button {
|
| 310 |
position: fixed;
|
| 311 |
bottom: 20px;
|
| 312 |
right: 20px;
|
| 313 |
+
background-color: #ef4444;
|
| 314 |
color: white;
|
| 315 |
border: none;
|
| 316 |
border-radius: 50%;
|
|
|
|
| 413 |
@media (max-width: 768px) {
|
| 414 |
.products-grid {
|
| 415 |
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
| 416 |
+
gap: 15px;
|
| 417 |
}
|
| 418 |
+
.product h2 {
|
| 419 |
+
font-size: 1rem;
|
| 420 |
}
|
| 421 |
.product-price {
|
| 422 |
+
font-size: 1.1rem;
|
| 423 |
+
}
|
| 424 |
+
.product-description {
|
| 425 |
+
font-size: 0.8rem;
|
| 426 |
}
|
| 427 |
.product-button {
|
| 428 |
font-size: 0.8rem;
|
| 429 |
+
padding: 8px;
|
| 430 |
}
|
| 431 |
.header-logo {
|
| 432 |
width: 50px;
|
|
|
|
| 471 |
loading="lazy">
|
| 472 |
</div>
|
| 473 |
{% endif %}
|
| 474 |
+
<h2>{{ product['name'] }}</h2>
|
| 475 |
+
<div class="product-price">{{ product['price'] }} с</div>
|
| 476 |
+
<p class="product-description">{{ product['description'][:50] }}{% if product['description']|length > 50 %}...{% endif %}</p>
|
| 477 |
+
<button class="product-button" onclick="openModal({{ loop.index0 }})">Подробнее</button>
|
| 478 |
+
<button class="product-button add-to-cart" onclick="openQuantityModal({{ loop.index0 }})">В корзину</button>
|
| 479 |
</div>
|
| 480 |
{% endfor %}
|
| 481 |
</div>
|
|
|
|
| 644 |
orderText += `${index + 1}. ${item.name} - ${item.price} с × ${item.quantity}%0A`;
|
| 645 |
});
|
| 646 |
orderText += `Итого: ${total} с`;
|
| 647 |
+
window.open(`https://api.whatsapp.com/send?phone=996709513331&text=${orderText}`, '_blank');
|
| 648 |
}
|
| 649 |
|
| 650 |
function clearCart() {
|