Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -119,7 +119,7 @@ def catalog():
|
|
| 119 |
}
|
| 120 |
.search-container {
|
| 121 |
text-align: center;
|
| 122 |
-
margin-bottom:
|
| 123 |
}
|
| 124 |
#search-input {
|
| 125 |
width: 80%;
|
|
@@ -143,7 +143,7 @@ def catalog():
|
|
| 143 |
.product {
|
| 144 |
background: #ffffff;
|
| 145 |
border-radius: 12px;
|
| 146 |
-
padding:
|
| 147 |
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
| 148 |
display: flex;
|
| 149 |
flex-direction: column;
|
|
@@ -154,7 +154,8 @@ def catalog():
|
|
| 154 |
box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
|
| 155 |
}
|
| 156 |
.product-image {
|
| 157 |
-
width:
|
|
|
|
| 158 |
height: 200px;
|
| 159 |
background-color: #fff;
|
| 160 |
border-radius: 8px;
|
|
@@ -166,8 +167,8 @@ def catalog():
|
|
| 166 |
align-items: center;
|
| 167 |
}
|
| 168 |
.product-image img {
|
| 169 |
-
max-width:
|
| 170 |
-
max-height:
|
| 171 |
width: auto;
|
| 172 |
height: auto;
|
| 173 |
object-fit: contain;
|
|
@@ -200,7 +201,7 @@ def catalog():
|
|
| 200 |
.product-button {
|
| 201 |
background-color: #3498db;
|
| 202 |
color: white;
|
| 203 |
-
padding:
|
| 204 |
border: none;
|
| 205 |
border-radius: 5px;
|
| 206 |
cursor: pointer;
|
|
@@ -210,6 +211,7 @@ def catalog():
|
|
| 210 |
display: block;
|
| 211 |
margin: 5px auto;
|
| 212 |
font-weight: 500;
|
|
|
|
| 213 |
}
|
| 214 |
.product-button:hover {
|
| 215 |
background-color: #2980b9;
|
|
@@ -222,15 +224,15 @@ def catalog():
|
|
| 222 |
}
|
| 223 |
#cart-button {
|
| 224 |
position: fixed;
|
| 225 |
-
bottom:
|
| 226 |
-
right:
|
| 227 |
background-color: #e74c3c;
|
| 228 |
color: white;
|
| 229 |
border: none;
|
| 230 |
border-radius: 50%;
|
| 231 |
-
width:
|
| 232 |
-
height:
|
| 233 |
-
font-size:
|
| 234 |
cursor: pointer;
|
| 235 |
display: none;
|
| 236 |
box-shadow: 0 2px 10px rgba(0,0,0,0.2);
|
|
@@ -254,9 +256,9 @@ def catalog():
|
|
| 254 |
position: relative;
|
| 255 |
background-color: #fefefe;
|
| 256 |
margin: 10% auto;
|
| 257 |
-
padding:
|
| 258 |
border: 1px solid #888;
|
| 259 |
-
width:
|
| 260 |
max-width: 600px;
|
| 261 |
box-shadow: 0 4px 8px rgba(0,0,0,0.2);
|
| 262 |
animation: animatetop 0.4s;
|
|
@@ -268,7 +270,7 @@ def catalog():
|
|
| 268 |
.close {
|
| 269 |
color: #aaa;
|
| 270 |
float: right;
|
| 271 |
-
font-size:
|
| 272 |
font-weight: bold;
|
| 273 |
cursor: pointer;
|
| 274 |
}
|
|
@@ -283,16 +285,17 @@ def catalog():
|
|
| 283 |
border-bottom: 1px solid #eee;
|
| 284 |
}
|
| 285 |
.cart-item img {
|
| 286 |
-
width:
|
| 287 |
-
height:
|
| 288 |
object-fit: contain;
|
| 289 |
background-color: #fff;
|
| 290 |
margin-right: 10px;
|
| 291 |
}
|
| 292 |
.quantity-input {
|
| 293 |
-
width:
|
| 294 |
padding: 5px;
|
| 295 |
margin: 10px 0;
|
|
|
|
| 296 |
}
|
| 297 |
.clear-cart {
|
| 298 |
background-color: #e74c3c;
|
|
@@ -309,6 +312,75 @@ def catalog():
|
|
| 309 |
.order-button:hover {
|
| 310 |
background-color: #20B956;
|
| 311 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 312 |
</style>
|
| 313 |
</head>
|
| 314 |
<body>
|
|
@@ -360,7 +432,7 @@ def catalog():
|
|
| 360 |
<span class="close" onclick="closeModal('cartModal')">×</span>
|
| 361 |
<h2>Корзина</h2>
|
| 362 |
<div id="cartContent"></div>
|
| 363 |
-
<div style="margin-top:
|
| 364 |
<strong>Итого: <span id="cartTotal">0</span></strong>
|
| 365 |
<button class="product-button clear-cart" onclick="clearCart()">Очистить корзину</button>
|
| 366 |
<button class="product-button order-button" onclick="orderViaWhatsApp()">Заказать</button>
|
|
@@ -402,7 +474,7 @@ def catalog():
|
|
| 402 |
function initializeSwiper() {
|
| 403 |
new Swiper('.swiper-container', {
|
| 404 |
slidesPerView: 1,
|
| 405 |
-
spaceBetween:
|
| 406 |
loop: true,
|
| 407 |
grabCursor: true,
|
| 408 |
pagination: {
|
|
@@ -758,7 +830,7 @@ def admin():
|
|
| 758 |
}
|
| 759 |
form {
|
| 760 |
background-color: #fff;
|
| 761 |
-
padding:
|
| 762 |
border: 1px solid #ddd;
|
| 763 |
border-radius: 5px;
|
| 764 |
max-width: 100%;
|
|
@@ -778,8 +850,8 @@ def admin():
|
|
| 778 |
box-sizing: border-box;
|
| 779 |
}
|
| 780 |
button {
|
| 781 |
-
margin-top:
|
| 782 |
-
padding:
|
| 783 |
background-color: #28a745;
|
| 784 |
color: white;
|
| 785 |
border: none;
|
|
@@ -795,7 +867,7 @@ def admin():
|
|
| 795 |
.product-item {
|
| 796 |
background-color: #fff;
|
| 797 |
border: 1px solid #ddd;
|
| 798 |
-
padding:
|
| 799 |
margin-bottom: 10px;
|
| 800 |
border-radius: 5px;
|
| 801 |
}
|
|
@@ -806,6 +878,24 @@ def admin():
|
|
| 806 |
border-radius: 5px;
|
| 807 |
background-color: #f9f9f9;
|
| 808 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 809 |
</style>
|
| 810 |
</head>
|
| 811 |
<body>
|
|
@@ -893,4 +983,4 @@ if __name__ == '__main__':
|
|
| 893 |
except Exception as e:
|
| 894 |
logging.error(f"Не удалось загрузить базу данных при запуске: {e}")
|
| 895 |
|
| 896 |
-
app.run(debug=True, host='0.0.0.0', port=7860)
|
|
|
|
| 119 |
}
|
| 120 |
.search-container {
|
| 121 |
text-align: center;
|
| 122 |
+
margin-bottom: 30px;
|
| 123 |
}
|
| 124 |
#search-input {
|
| 125 |
width: 80%;
|
|
|
|
| 143 |
.product {
|
| 144 |
background: #ffffff;
|
| 145 |
border-radius: 12px;
|
| 146 |
+
padding: 15px;
|
| 147 |
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
| 148 |
display: flex;
|
| 149 |
flex-direction: column;
|
|
|
|
| 154 |
box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
|
| 155 |
}
|
| 156 |
.product-image {
|
| 157 |
+
width: 100%;
|
| 158 |
+
max-width: 200px;
|
| 159 |
height: 200px;
|
| 160 |
background-color: #fff;
|
| 161 |
border-radius: 8px;
|
|
|
|
| 167 |
align-items: center;
|
| 168 |
}
|
| 169 |
.product-image img {
|
| 170 |
+
max-width: 100%;
|
| 171 |
+
max-height: 100%;
|
| 172 |
width: auto;
|
| 173 |
height: auto;
|
| 174 |
object-fit: contain;
|
|
|
|
| 201 |
.product-button {
|
| 202 |
background-color: #3498db;
|
| 203 |
color: white;
|
| 204 |
+
padding: 8px 15px;
|
| 205 |
border: none;
|
| 206 |
border-radius: 5px;
|
| 207 |
cursor: pointer;
|
|
|
|
| 211 |
display: block;
|
| 212 |
margin: 5px auto;
|
| 213 |
font-weight: 500;
|
| 214 |
+
font-size: 0.9em;
|
| 215 |
}
|
| 216 |
.product-button:hover {
|
| 217 |
background-color: #2980b9;
|
|
|
|
| 224 |
}
|
| 225 |
#cart-button {
|
| 226 |
position: fixed;
|
| 227 |
+
bottom: 15px;
|
| 228 |
+
right: 15px;
|
| 229 |
background-color: #e74c3c;
|
| 230 |
color: white;
|
| 231 |
border: none;
|
| 232 |
border-radius: 50%;
|
| 233 |
+
width: 50px;
|
| 234 |
+
height: 50px;
|
| 235 |
+
font-size: 18px;
|
| 236 |
cursor: pointer;
|
| 237 |
display: none;
|
| 238 |
box-shadow: 0 2px 10px rgba(0,0,0,0.2);
|
|
|
|
| 256 |
position: relative;
|
| 257 |
background-color: #fefefe;
|
| 258 |
margin: 10% auto;
|
| 259 |
+
padding: 15px;
|
| 260 |
border: 1px solid #888;
|
| 261 |
+
width: 90%;
|
| 262 |
max-width: 600px;
|
| 263 |
box-shadow: 0 4px 8px rgba(0,0,0,0.2);
|
| 264 |
animation: animatetop 0.4s;
|
|
|
|
| 270 |
.close {
|
| 271 |
color: #aaa;
|
| 272 |
float: right;
|
| 273 |
+
font-size: 24px;
|
| 274 |
font-weight: bold;
|
| 275 |
cursor: pointer;
|
| 276 |
}
|
|
|
|
| 285 |
border-bottom: 1px solid #eee;
|
| 286 |
}
|
| 287 |
.cart-item img {
|
| 288 |
+
width: 40px;
|
| 289 |
+
height: 40px;
|
| 290 |
object-fit: contain;
|
| 291 |
background-color: #fff;
|
| 292 |
margin-right: 10px;
|
| 293 |
}
|
| 294 |
.quantity-input {
|
| 295 |
+
width: 50px;
|
| 296 |
padding: 5px;
|
| 297 |
margin: 10px 0;
|
| 298 |
+
font-size: 0.9em;
|
| 299 |
}
|
| 300 |
.clear-cart {
|
| 301 |
background-color: #e74c3c;
|
|
|
|
| 312 |
.order-button:hover {
|
| 313 |
background-color: #20B956;
|
| 314 |
}
|
| 315 |
+
@media (max-width: 768px) {
|
| 316 |
+
body {
|
| 317 |
+
padding: 10px;
|
| 318 |
+
}
|
| 319 |
+
.products-grid {
|
| 320 |
+
grid-template-columns: 1fr;
|
| 321 |
+
gap: 15px;
|
| 322 |
+
padding: 0 10px;
|
| 323 |
+
}
|
| 324 |
+
.product {
|
| 325 |
+
padding: 10px;
|
| 326 |
+
}
|
| 327 |
+
.product-image {
|
| 328 |
+
max-width: 150px;
|
| 329 |
+
height: 150px;
|
| 330 |
+
}
|
| 331 |
+
.product h2 {
|
| 332 |
+
font-size: 1em;
|
| 333 |
+
}
|
| 334 |
+
.product-price {
|
| 335 |
+
font-size: 1.1em;
|
| 336 |
+
}
|
| 337 |
+
.product-description {
|
| 338 |
+
font-size: 0.85em;
|
| 339 |
+
}
|
| 340 |
+
.product-button {
|
| 341 |
+
padding: 6px 12px;
|
| 342 |
+
font-size: 0.85em;
|
| 343 |
+
}
|
| 344 |
+
#cart-button {
|
| 345 |
+
width: 40px;
|
| 346 |
+
height: 40px;
|
| 347 |
+
font-size: 16px;
|
| 348 |
+
}
|
| 349 |
+
.modal-content {
|
| 350 |
+
width: 95%;
|
| 351 |
+
padding: 10px;
|
| 352 |
+
}
|
| 353 |
+
.search-container {
|
| 354 |
+
margin-bottom: 20px;
|
| 355 |
+
}
|
| 356 |
+
#search-input {
|
| 357 |
+
width: 90%;
|
| 358 |
+
font-size: 0.9em;
|
| 359 |
+
}
|
| 360 |
+
}
|
| 361 |
+
@media (max-width: 480px) {
|
| 362 |
+
.products-grid {
|
| 363 |
+
gap: 10px;
|
| 364 |
+
padding: 0 5px;
|
| 365 |
+
}
|
| 366 |
+
.product-image {
|
| 367 |
+
max-width: 120px;
|
| 368 |
+
height: 120px;
|
| 369 |
+
}
|
| 370 |
+
.product h2 {
|
| 371 |
+
font-size: 0.9em;
|
| 372 |
+
}
|
| 373 |
+
.product-price {
|
| 374 |
+
font-size: 1em;
|
| 375 |
+
}
|
| 376 |
+
.product-description {
|
| 377 |
+
font-size: 0.8em;
|
| 378 |
+
}
|
| 379 |
+
.product-button {
|
| 380 |
+
padding: 5px 10px;
|
| 381 |
+
font-size: 0.8em;
|
| 382 |
+
}
|
| 383 |
+
}
|
| 384 |
</style>
|
| 385 |
</head>
|
| 386 |
<body>
|
|
|
|
| 432 |
<span class="close" onclick="closeModal('cartModal')">×</span>
|
| 433 |
<h2>Корзина</h2>
|
| 434 |
<div id="cartContent"></div>
|
| 435 |
+
<div style="margin-top: 15px; text-align: right;">
|
| 436 |
<strong>Итого: <span id="cartTotal">0</span></strong>
|
| 437 |
<button class="product-button clear-cart" onclick="clearCart()">Очистить корзину</button>
|
| 438 |
<button class="product-button order-button" onclick="orderViaWhatsApp()">Заказать</button>
|
|
|
|
| 474 |
function initializeSwiper() {
|
| 475 |
new Swiper('.swiper-container', {
|
| 476 |
slidesPerView: 1,
|
| 477 |
+
spaceBetween: 20,
|
| 478 |
loop: true,
|
| 479 |
grabCursor: true,
|
| 480 |
pagination: {
|
|
|
|
| 830 |
}
|
| 831 |
form {
|
| 832 |
background-color: #fff;
|
| 833 |
+
padding: 15px;
|
| 834 |
border: 1px solid #ddd;
|
| 835 |
border-radius: 5px;
|
| 836 |
max-width: 100%;
|
|
|
|
| 850 |
box-sizing: border-box;
|
| 851 |
}
|
| 852 |
button {
|
| 853 |
+
margin-top: 10px;
|
| 854 |
+
padding: 8px 12px;
|
| 855 |
background-color: #28a745;
|
| 856 |
color: white;
|
| 857 |
border: none;
|
|
|
|
| 867 |
.product-item {
|
| 868 |
background-color: #fff;
|
| 869 |
border: 1px solid #ddd;
|
| 870 |
+
padding: 10px;
|
| 871 |
margin-bottom: 10px;
|
| 872 |
border-radius: 5px;
|
| 873 |
}
|
|
|
|
| 878 |
border-radius: 5px;
|
| 879 |
background-color: #f9f9f9;
|
| 880 |
}
|
| 881 |
+
@media (max-width: 768px) {
|
| 882 |
+
body {
|
| 883 |
+
margin: 10px;
|
| 884 |
+
}
|
| 885 |
+
form {
|
| 886 |
+
padding: 10px;
|
| 887 |
+
}
|
| 888 |
+
input, textarea {
|
| 889 |
+
font-size: 0.9em;
|
| 890 |
+
}
|
| 891 |
+
button {
|
| 892 |
+
padding: 6px 10px;
|
| 893 |
+
font-size: 0.9em;
|
| 894 |
+
}
|
| 895 |
+
.product-item {
|
| 896 |
+
padding: 8px;
|
| 897 |
+
}
|
| 898 |
+
}
|
| 899 |
</style>
|
| 900 |
</head>
|
| 901 |
<body>
|
|
|
|
| 983 |
except Exception as e:
|
| 984 |
logging.error(f"Не удалось загрузить базу данных при запуске: {e}")
|
| 985 |
|
| 986 |
+
app.run(debug=True, host='0.0.0.0', port=7860) й
|